fix: KDB opening

This commit is contained in:
J-Jamet
2022-07-05 17:55:12 +02:00
parent 647e3f9383
commit 99e9a92953

View File

@@ -150,10 +150,15 @@ class DatabaseKDB : DatabaseVersioned<Int, UUID, GroupKDB, EntryKDB>() {
) else null
// Build master key
this.masterKey = HashManager.hashSha256(
passwordBytes,
keyFileBytes
)
if (passwordBytes != null
&& keyFileBytes != null) {
this.masterKey = HashManager.hashSha256(
passwordBytes,
keyFileBytes
)
} else {
this.masterKey = passwordBytes ?: keyFileBytes ?: byteArrayOf(0)
}
}
override fun createGroup(): GroupKDB {