Skip to content

Instantly share code, notes, and snippets.

@shafty023
Created June 9, 2020 22: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 shafty023/3c0e30789ca438abefe5635b6ba70aa3 to your computer and use it in GitHub Desktop.
Save shafty023/3c0e30789ca438abefe5635b6ba70aa3 to your computer and use it in GitHub Desktop.
Wrapper function to create a new key
private lateinit var rawByteKey: ByteArray
private lateinit var dbCharKey: CharArray
/**
* Generates a new database key.
*/
fun createNewKey() {
// This is the raw key that we'll be encrypting + storing
rawByteKey = generateRandomKey()
// This is the key that will be used by Room
dbCharKey = rawByteKey.toHex()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment