Skip to content

Instantly share code, notes, and snippets.

@tdcolvin
Created February 3, 2023 18:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tdcolvin/f03d18c33cef6fa2cfd0f74924db6611 to your computer and use it in GitHub Desktop.
Save tdcolvin/f03d18c33cef6fa2cfd0f74924db6611 to your computer and use it in GitHub Desktop.
private val encryptedFile by lazy {
//This is the app's internal storage folder
val baseDir = getApplication<Application>().filesDir
//The encrypted file within the app's internal storage folder
val fileToWrite = File(baseDir, "encrypted-file.txt")
//Create the encrypted file
EncryptedFile.Builder(
fileToWrite,
getApplication(),
mainKeyAlias,
EncryptedFile.FileEncryptionScheme.AES256_GCM_HKDF_4KB
).build()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment