Specialize

This commit is contained in:
Manav Rathi
2025-06-05 17:58:42 +05:30
parent 4a3d503992
commit ac9cee8fa3
2 changed files with 7 additions and 7 deletions

View File

@@ -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) {

View File

@@ -21,7 +21,7 @@ export interface AuthCodesAndTimeOffset {
}
export const getAuthCodesAndTimeOffset = async (
masterKey: Uint8Array,
masterKeyBytes: Uint8Array,
): Promise<AuthCodesAndTimeOffset> => {
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,
);