From ac9cee8fa390c07477ef7fe9edb6688f6246aaaf Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Thu, 5 Jun 2025 17:58:42 +0530 Subject: [PATCH] Specialize --- web/apps/auth/src/pages/auth.tsx | 6 +++--- web/apps/auth/src/services/remote.ts | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/web/apps/auth/src/pages/auth.tsx b/web/apps/auth/src/pages/auth.tsx index a187d5f568..7984cf946a 100644 --- a/web/apps/auth/src/pages/auth.tsx +++ b/web/apps/auth/src/pages/auth.tsx @@ -41,8 +41,8 @@ const Page: React.FC = () => { useEffect(() => { const fetchCodes = async () => { - const masterKey = await masterKeyBytesFromSessionIfLoggedIn(); - if (!masterKey) { + const masterKeyBytes = await masterKeyBytesFromSessionIfLoggedIn(); + if (!masterKeyBytes) { stashRedirect("/auth"); void router.push("/"); return; @@ -50,7 +50,7 @@ const Page: React.FC = () => { try { const { codes, timeOffset } = - await getAuthCodesAndTimeOffset(masterKey); + await getAuthCodesAndTimeOffset(masterKeyBytes); setCodes(codes); setTimeOffset(timeOffset ?? 0); } catch (e) { diff --git a/web/apps/auth/src/services/remote.ts b/web/apps/auth/src/services/remote.ts index 13e192b96a..a29632cd26 100644 --- a/web/apps/auth/src/services/remote.ts +++ b/web/apps/auth/src/services/remote.ts @@ -21,7 +21,7 @@ export interface AuthCodesAndTimeOffset { } export const getAuthCodesAndTimeOffset = async ( - masterKey: Uint8Array, + masterKeyBytes: Uint8Array, ): Promise => { const authenticatorEntityKey = await getAuthenticatorEntityKey(); if (!authenticatorEntityKey) { @@ -31,7 +31,7 @@ export const getAuthCodesAndTimeOffset = async ( const authenticatorKey = await decryptAuthenticatorKey( authenticatorEntityKey, - masterKey, + masterKeyBytes, ); const { entities, timeOffset } = @@ -263,7 +263,7 @@ export const getAuthenticatorEntityKey = async (): Promise< */ const decryptAuthenticatorKey = async ( remote: AuthenticatorEntityKey, - masterKey: Uint8Array, + masterKeyBytes: Uint8Array, ) => decryptBox( { @@ -271,5 +271,5 @@ const decryptAuthenticatorKey = async ( // Remote calls it the header, but it really is the nonce. nonce: remote.header, }, - masterKey, + masterKeyBytes, );