Skip to content

Commit

Permalink
fix add account issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Sneezry committed Aug 21, 2024
1 parent 4adadda commit c6088f9
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/models/otp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,21 @@ export class OTPEntry implements OTPEntryInterface {
hash: string;
index: number;
},
encryption?: EncryptionInterface
encryption?: EncryptionInterface | Map<string, EncryptionInterface>
) {
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) {
Expand Down

0 comments on commit c6088f9

Please sign in to comment.