From c6088f9ef7aff10d824fae58634cead85ffc6338 Mon Sep 17 00:00:00 2001 From: Zhe Li Date: Wed, 21 Aug 2024 20:08:46 +0800 Subject: [PATCH] fix add account issue --- src/models/otp.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/models/otp.ts b/src/models/otp.ts index cdfa38db..40f48af4 100644 --- a/src/models/otp.ts +++ b/src/models/otp.ts @@ -88,9 +88,21 @@ export class OTPEntry implements OTPEntryInterface { hash: string; index: number; }, - encryption?: EncryptionInterface + encryption?: EncryptionInterface | Map ) { - this.encryption = encryption; + if (encryption instanceof Map) { + for (const key in encryption) { + if ( + /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test( + key + ) + ) { + this.encryption = encryption.get(key); + } + } + } else { + this.encryption = encryption; + } this.index = entry.index; if ("keyId" in entry) {