databaseKey

internal fun <T : Any> databaseKey(databasePath: String, existingKey: () -> T?, newKey: () -> T): T

The key of the Apple database at databasePath.

Apple databases were never encrypted before, so there is no legacy key to migrate from: a database that doesn't exist yet gets newKey, the stored key or a new one, which the Keychain keeps consistent across the processes sharing it. Every process stores the key, on iOS with its salt, before it creates the database, so an existing database has one, and existingKey has to return it: a new key couldn't open the database, so it fails instead of storing one.