fix: Fixes an issue where importing an encrypted backup file may not successfully complete in some cases

This commit is contained in:
moughxyz
2024-04-12 11:40:33 -05:00
parent 241a973880
commit 7f1baf52c1

View File

@@ -67,6 +67,14 @@ export class DetermineKeyToUse implements SyncUseCaseInterface<AnyKey | undefine
let itemsKey: ItemsKeyInterface | RootKeyInterface | KeySystemItemsKeyInterface | undefined
itemsKey = dto.recentlyDecryptedKeys.filter(isItemsKey).find((itemsKeyPayload) => {
return dto.payload.items_key_id === itemsKeyPayload.uuid
})
if (itemsKey) {
return Result.ok(itemsKey)
}
if (dto.payload.items_key_id) {
itemsKey = this.encryption.itemsKeyForEncryptedPayload(dto.payload)
if (itemsKey) {
@@ -74,10 +82,6 @@ export class DetermineKeyToUse implements SyncUseCaseInterface<AnyKey | undefine
}
}
itemsKey = dto.recentlyDecryptedKeys.filter(isItemsKey).find((itemsKeyPayload) => {
return Result.ok(dto.payload.items_key_id === itemsKeyPayload.uuid)
})
if (itemsKey) {
return Result.ok(itemsKey)
}