From b3ff2f1aea03abc803cfecf99eb59739122cb067 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 9 Oct 2023 16:39:05 +0100 Subject: [PATCH] Decode base64url --- src/useE2eeConfig.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/useE2eeConfig.ts b/src/useE2eeConfig.ts index d136c9b4..c2fb3bf0 100644 --- a/src/useE2eeConfig.ts +++ b/src/useE2eeConfig.ts @@ -32,7 +32,10 @@ export const useE2eeConfig = ( // as such. Otherwise, we assume it's an old-style password and use it as a string. try { const itFunc = function* () { - const decoded = atob(passwordString); + const decoded = atob( + // built-in atob doesn't support base64url, so convert + passwordString.replace("-", "+").replace("_", "/") + ); for (let i = 0; i < decoded.length; ++i) { yield decoded.charCodeAt(i); }