Skip to content

Commit

Permalink
chore(managers): add necessary type annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasduteil committed Sep 19, 2024
1 parent a1cb88e commit be03264
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/managers/webauthn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import {
} from "@simplewebauthn/server";
import type {
AuthenticationResponseJSON,
PublicKeyCredentialCreationOptionsJSON,
PublicKeyCredentialRequestOptionsJSON,
RegistrationResponseJSON,
} from "@simplewebauthn/types";
import { isEmpty } from "lodash-es";
Expand Down Expand Up @@ -115,7 +117,10 @@ export const deleteUserAuthenticator = async (
return true;
};

export const getRegistrationOptions = async (email: string) => {
export const getRegistrationOptions: (email: string) => Promise<{
updatedUser: User;
registrationOptions: PublicKeyCredentialCreationOptionsJSON;
}> = async (email) => {
const user = await findUserByEmail(email);

if (isEmpty(user)) {
Expand Down Expand Up @@ -232,10 +237,13 @@ export const verifyRegistration = async ({
return { userVerified: user_verified, user: await enableForce2fa(user.id) };
};

export const getAuthenticationOptions = async (
export const getAuthenticationOptions: (
email: string | undefined,
isSecondFactorAuthentication: boolean,
) => {
) => Promise<{
updatedUser: User;
authenticationOptions: PublicKeyCredentialRequestOptionsJSON;
}> = async (email, isSecondFactorAuthentication) => {
if (!email) {
throw new NotFoundError();
}
Expand Down

0 comments on commit be03264

Please sign in to comment.