Sealite Key
The key a SealiteDriver opens databases with.
There are two kinds, and they are not interchangeable: a raw key is the 256-bit database key itself and skips key derivation, a passphrase key is stretched by SQLCipher's PBKDF2. The same bytes given to both forms open different keys, so a file written with one is never readable with the other.
Every factory copies its input: the caller keeps, and wipes, its own array. close wipes the copy held here; a closed key can not be used again. There is deliberately no String overload: a String can not be wiped.
val key = SealiteKey.raw(keyFromKeystore)
keyFromKeystore.fill(0)
val driver = SealiteDriver(key) // copies the key
key.close()Content copied to clipboard