From c372d9e387b563e61bd68c268bc9c6204ece7fcc Mon Sep 17 00:00:00 2001 From: Enzo Caceres Date: Fri, 15 Aug 2025 11:02:45 -0700 Subject: [PATCH 1/3] fix(storage): parse algorithm properly --- src/models/storage.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/models/storage.ts b/src/models/storage.ts index 4b3699fb..ccb24343 100644 --- a/src/models/storage.ts +++ b/src/models/storage.ts @@ -487,9 +487,7 @@ export class EntryStorage { counter: data[hash].counter || 0, period: data[hash].period || 30, digits: data[hash].digits || 6, - algorithm: rawAlgorithm - ? (parseInt(rawAlgorithm) as OTPAlgorithm) - : OTPAlgorithm.SHA1, + algorithm: OTPAlgorithm[rawAlgorithm] || OTPAlgorithm.SHA1, pinned: data[hash].pinned || false, hash: data[hash].hash || hash, }; From e195933497551f50328470d1496a7947eda4727b Mon Sep 17 00:00:00 2001 From: Enzo Caceres Date: Fri, 15 Aug 2025 11:07:40 -0700 Subject: [PATCH 2/3] fix(storage): parse type properly --- src/models/storage.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/models/storage.ts b/src/models/storage.ts index ccb24343..56cee15b 100644 --- a/src/models/storage.ts +++ b/src/models/storage.ts @@ -463,7 +463,9 @@ export class EntryStorage { continue; } + const rawType = data[hash].type; const rawAlgorithm = data[hash].algorithm; + const entryData: { account: string; encrypted: false; @@ -478,7 +480,7 @@ export class EntryStorage { algorithm: OTPAlgorithm; pinned: boolean; } = { - type: (parseInt(data[hash].type) as OTPType) || OTPType[OTPType.totp], + type: OTPType[rawType] || OTPType[OTPType.totp], index: data[hash].index || 0, issuer: data[hash].issuer || "", account: data[hash].account || "", From 1fc616bad4d99f19ce9708d35c1e3563f583db36 Mon Sep 17 00:00:00 2001 From: Enzo Caceres Date: Fri, 15 Aug 2025 11:09:31 -0700 Subject: [PATCH 3/3] fix(storage): keep algorithm undefined if invalid --- src/models/storage.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/models/storage.ts b/src/models/storage.ts index 56cee15b..b22c0eeb 100644 --- a/src/models/storage.ts +++ b/src/models/storage.ts @@ -489,7 +489,9 @@ export class EntryStorage { counter: data[hash].counter || 0, period: data[hash].period || 30, digits: data[hash].digits || 6, - algorithm: OTPAlgorithm[rawAlgorithm] || OTPAlgorithm.SHA1, + algorithm: rawAlgorithm + ? OTPAlgorithm[rawAlgorithm] + : OTPAlgorithm.SHA1, pinned: data[hash].pinned || false, hash: data[hash].hash || hash, };