Secure Storage Testing
The app uses an encrypted Realm.io database to store sensitive location information. For debug builds, we can add log statements to each platform that can print out the hex encoded encryption key.
Get Encryption Key
Android
// RealmSecureStorage.kt getEncryptionKey()
// find where the key is generated and add the last line below.
val newKey = ByteArray(64)
SecureRandom().nextBytes(newKey)
Log.d("EncryptionKey", newKey.asUByteArray().joinToString("") { it.toString(16).padStart(2, '0') })
iOS
// RealmSecureStorage.swift getEncryptionKey()
// find where the key is generated and add the last line below.
let keyData = NSMutableData(length: 64)!
let result = SecRandomCopyBytes(kSecRandomDefault, 64, keyData.mutableBytes.bindMemory(to: UInt8.self, capacity: 64))
assert(result == 0, "Failed to get random bytes")
if (result != 0) {
return nil
}
print (keyData.map {String (format: "% .2hhx", $0)}.joined())
Download Database From Device
Android
Enable USB debugging
Open the Device File Explorer in Android Studio
Navigate to data/data/org.pathcheck.covidsafepaths/files
Right click on safepaths.realm and save as to your preferred location
Open your safepaths.realm file in Realm Studio https://realm.io/products/realm-studio/
When asked, paste in the encryption key captured from earlier
iOS
Open Xcode -> Window - Devices and Simulators
Select your device on the left hand side
In the middle of the screen, you should see the Safe Paths app under the "Installed Apps" heading
Click on the gear beneath and click
Download Container
Right click on the download
<filename>.xcappdata
folder and show package contentsOpen default.realm found in
AppData/Documents
using Realm Studio https://realm.io/products/realm-studio/