From aa1a1ad0cd77e28888c09f32bba9ff270c44ba77 Mon Sep 17 00:00:00 2001 From: MallardsAreCool Date: Thu, 25 Jun 2026 23:00:23 +0100 Subject: [PATCH] Fix: normalize Base32 secret from QR import before TOTP generation --- src/background.ts | 3 +++ src/import.ts | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/background.ts b/src/background.ts index bb59a2f9d..dc697f902 100644 --- a/src/background.ts +++ b/src/background.ts @@ -203,6 +203,9 @@ async function getTotp(text: string, silent = false) { ) { type = "hhex"; } + if (secret.length % 8) { + secret += "=".repeat(8 - (secret.length % 8)); + } const entryData: { [hash: string]: RawOTPStorage } = {}; entryData[hash] = { account, diff --git a/src/import.ts b/src/import.ts index 21bebdabb..f534c43c0 100644 --- a/src/import.ts +++ b/src/import.ts @@ -292,7 +292,10 @@ export async function getEntryDataFromOTPAuthPerLine(importCode: string) { ) { type = "hhex"; } - + if (secret.length % 8) { + secret += "=".repeat(8 - (secret.length % 8)); + } + exportData[hash] = { account, hash,