Skip to content

Commit c6088f9

Browse files
committed
fix add account issue
1 parent 4adadda commit c6088f9

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/models/otp.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,21 @@ export class OTPEntry implements OTPEntryInterface {
8888
hash: string;
8989
index: number;
9090
},
91-
encryption?: EncryptionInterface
91+
encryption?: EncryptionInterface | Map<string, EncryptionInterface>
9292
) {
93-
this.encryption = encryption;
93+
if (encryption instanceof Map) {
94+
for (const key in encryption) {
95+
if (
96+
/^[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(
97+
key
98+
)
99+
) {
100+
this.encryption = encryption.get(key);
101+
}
102+
}
103+
} else {
104+
this.encryption = encryption;
105+
}
94106
this.index = entry.index;
95107

96108
if ("keyId" in entry) {

0 commit comments

Comments
 (0)