Specialize
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user