Skip to main content
References

WebAuthn Types

Type Aliases

APIInterface

type APIInterface = object;

Defined in: recipe/webauthn/types.ts:477

Properties

PropertyTypeDefined in
emailExistsGET| undefined | (input) => Promise< | { exists: boolean; status: "OK"; } | GeneralErrorResponse>recipe/webauthn/types.ts:655
generateRecoverAccountTokenPOST| undefined | (input) => Promise< | { status: "OK"; } | GeneralErrorResponse | GenerateRecoverAccountTokenPOSTErrorResponse>recipe/webauthn/types.ts:580
listCredentialsGET| undefined | (input) => Promise< | { credentials: object[]; status: "OK"; } | GeneralErrorResponse>recipe/webauthn/types.ts:609
recoverAccountPOST| undefined | (input) => Promise< | { email: string; status: "OK"; user: User; } | GeneralErrorResponse | RecoverAccountPOSTErrorResponse>recipe/webauthn/types.ts:590
registerCredentialPOST| undefined | (input) => Promise< | { status: "OK"; } | GeneralErrorResponse | RegisterCredentialPOSTErrorResponse>recipe/webauthn/types.ts:623
registerOptionsPOST| undefined | (input) => Promise< | { attestation: "none" | "indirect" | "direct" | "enterprise"; authenticatorSelection: { requireResidentKey: boolean; residentKey: ResidentKey; userVerification: UserVerification; }; challenge: string; createdAt: number; excludeCredentials: object[]; expiresAt: number; pubKeyCredParams: object[]; rp: { id: string; name: string; }; status: "OK"; timeout: number; user: { displayName: string; id: string; name: string; }; webauthnGeneratedOptionsId: string; } | GeneralErrorResponse | RegisterOptionsPOSTErrorResponse>recipe/webauthn/types.ts:478
removeCredentialPOST| undefined | (input) => Promise< | { status: "OK"; } | GeneralErrorResponse | RemoveCredentialPOSTErrorResponse>recipe/webauthn/types.ts:640
signInOptionsPOST| undefined | (input) => Promise< | { challenge: string; createdAt: number; expiresAt: number; rpId: string; status: "OK"; timeout: number; userVerification: UserVerification; webauthnGeneratedOptionsId: string; } | GeneralErrorResponse | SignInOptionsPOSTErrorResponse>recipe/webauthn/types.ts:523
signInPOST| undefined | (input) => Promise< | { session: SessionContainerInterface; status: "OK"; user: User; } | GeneralErrorResponse | SignInPOSTErrorResponse>recipe/webauthn/types.ts:560
signUpPOST| undefined | (input) => Promise< | { session: SessionContainerInterface; status: "OK"; user: User; } | GeneralErrorResponse | SignUpPOSTErrorResponse>recipe/webauthn/types.ts:540

APIOptions

type APIOptions = object;

Defined in: recipe/webauthn/types.ts:420

Properties

Attestation

type Attestation = "none" | "indirect" | "direct" | "enterprise";

Defined in: recipe/webauthn/types.ts:173

AuthenticationPayload

type AuthenticationPayload = CredentialPayloadBase & object;

Defined in: recipe/webauthn/types.ts:703

Type Declaration

AuthenticatorAssertionResponseJSON

type AuthenticatorAssertionResponseJSON = object;

Defined in: recipe/webauthn/types.ts:687

Properties

PropertyTypeDefined in
authenticatorDataBase64URLStringrecipe/webauthn/types.ts:689
clientDataJSONBase64URLStringrecipe/webauthn/types.ts:688
signatureBase64URLStringrecipe/webauthn/types.ts:690
userHandle?Base64URLStringrecipe/webauthn/types.ts:691

AuthenticatorAttestationResponseJSON

type AuthenticatorAttestationResponseJSON = object;

Defined in: recipe/webauthn/types.ts:694

Properties

PropertyTypeDefined in
attestationObjectBase64URLStringrecipe/webauthn/types.ts:696
authenticatorData?Base64URLStringrecipe/webauthn/types.ts:697
clientDataJSONBase64URLStringrecipe/webauthn/types.ts:695
publicKey?Base64URLStringrecipe/webauthn/types.ts:700
publicKeyAlgorithm?COSEAlgorithmIdentifierrecipe/webauthn/types.ts:699
transports?("ble" | "cable" | "hybrid" | "internal" | "nfc" | "smart-card" | "usb")[]recipe/webauthn/types.ts:698

CredentialPayload

type CredentialPayload = CredentialPayloadBase & object;

Defined in: recipe/webauthn/types.ts:711

Type Declaration

NameTypeDefined in
responseobjectrecipe/webauthn/types.ts:712
response.attestationObjectstringrecipe/webauthn/types.ts:714
response.clientDataJSONstringrecipe/webauthn/types.ts:713
response.transports?("ble" | "cable" | "hybrid" | "internal" | "nfc" | "smart-card" | "usb")[]recipe/webauthn/types.ts:715
response.userHandlestringrecipe/webauthn/types.ts:716

CredentialPayloadBase

type CredentialPayloadBase = object;

Defined in: recipe/webauthn/types.ts:679

Properties

PropertyTypeDefined in
authenticatorAttachment?"platform" | "cross-platform"recipe/webauthn/types.ts:682
clientExtensionResultsRecord<string, unknown>recipe/webauthn/types.ts:683
idstringrecipe/webauthn/types.ts:680
rawIdstringrecipe/webauthn/types.ts:681
type"public-key"recipe/webauthn/types.ts:684

RecipeInterface

type RecipeInterface = object;

Defined in: recipe/webauthn/types.ts:175

Methods

consumeRecoverAccountToken()​
consumeRecoverAccountToken(input): Promise<
| {
email: string;
status: "OK";
userId: string;
}
| ConsumeRecoverAccountTokenErrorResponse>;

Defined in: recipe/webauthn/types.ts:322

Parameters​
ParameterType
input{ tenantId: string; token: string; userContext: UserContext; }
input.tenantIdstring
input.tokenstring
input.userContextUserContext
Returns​

Promise< | { email: string; status: "OK"; userId: string; } | ConsumeRecoverAccountTokenErrorResponse>

createNewRecipeUser()​
createNewRecipeUser(input): Promise<
| CreateNewRecipeUserErrorResponse
| {
recipeUserId: RecipeUserId;
status: "OK";
user: User;
}>;

Defined in: recipe/webauthn/types.ts:296

This function is meant only for creating the recipe in the core and nothing else. We added this even though signUp exists cause devs may override signup expecting it to be called just during sign up. But we also need a version of signing up which can be called during operations like creating a user during account recovery flow.

Parameters​
ParameterType
input{ credential: RegistrationPayload; tenantId: string; userContext: UserContext; webauthnGeneratedOptionsId: string; }
input.credentialRegistrationPayload
input.tenantIdstring
input.userContextUserContext
input.webauthnGeneratedOptionsIdstring
Returns​

Promise< | CreateNewRecipeUserErrorResponse | { recipeUserId: RecipeUserId; status: "OK"; user: User; }>

generateRecoverAccountToken()​
generateRecoverAccountToken(input): Promise<
| {
status: "OK";
token: string;
}
| GenerateRecoverAccountTokenErrorResponse>;

Defined in: recipe/webauthn/types.ts:315

We pass in the email as well to this function cause the input userId may not be associated with an webauthn account. In this case, we need to know which email to use to create an webauthn account later on.

Parameters​
ParameterType
input{ email: string; tenantId: string; userContext: UserContext; userId: string; }
input.emailstring
input.tenantIdstring
input.userContextUserContext
input.userIdstring
Returns​

Promise< | { status: "OK"; token: string; } | GenerateRecoverAccountTokenErrorResponse>

getCredential()​
getCredential(input): Promise<
| {
createdAt: number;
recipeUserId: RecipeUserId;
relyingPartyId: string;
status: "OK";
webauthnCredentialId: string;
}
| GetCredentialErrorResponse>;

Defined in: recipe/webauthn/types.ts:358

Parameters​
ParameterType
input{ recipeUserId: string; userContext: UserContext; webauthnCredentialId: string; }
input.recipeUserIdstring
input.userContextUserContext
input.webauthnCredentialIdstring
Returns​

Promise< | { createdAt: number; recipeUserId: RecipeUserId; relyingPartyId: string; status: "OK"; webauthnCredentialId: string; } | GetCredentialErrorResponse>

getGeneratedOptions()​
getGeneratedOptions(input): Promise<
| {
challenge: string;
createdAt: number;
email?: string;
expiresAt: number;
origin: string;
relyingPartyId: string;
relyingPartyName: string;
status: "OK";
timeout: number;
userPresence: boolean;
userVerification: UserVerification;
webauthnGeneratedOptionsId: string;
}
| GetGeneratedOptionsErrorResponse>;

Defined in: recipe/webauthn/types.ts:385

Parameters​
ParameterType
input{ tenantId: string; userContext: UserContext; webauthnGeneratedOptionsId: string; }
input.tenantIdstring
input.userContextUserContext
input.webauthnGeneratedOptionsIdstring
Returns​

Promise< | { challenge: string; createdAt: number; email?: string; expiresAt: number; origin: string; relyingPartyId: string; relyingPartyName: string; status: "OK"; timeout: number; userPresence: boolean; userVerification: UserVerification; webauthnGeneratedOptionsId: string; } | GetGeneratedOptionsErrorResponse>

getUserFromRecoverAccountToken()​
getUserFromRecoverAccountToken(input): Promise<
| {
recipeUserId?: RecipeUserId;
status: "OK";
user: User;
}
| GetUserFromRecoverAccountTokenErrorResponse>;

Defined in: recipe/webauthn/types.ts:343

Parameters​
ParameterType
input{ tenantId: string; token: string; userContext: UserContext; }
input.tenantIdstring
input.tokenstring
input.userContextUserContext
Returns​

Promise< | { recipeUserId?: RecipeUserId; status: "OK"; user: User; } | GetUserFromRecoverAccountTokenErrorResponse>

listCredentials()​
listCredentials(input): Promise<{
credentials: object[];
status: "OK";
}>;

Defined in: recipe/webauthn/types.ts:369

Parameters​
ParameterType
input{ recipeUserId: string; userContext: UserContext; }
input.recipeUserIdstring
input.userContextUserContext
Returns​

Promise<{ credentials: object[]; status: "OK"; }>

registerCredential()​
registerCredential(input): Promise<
| {
status: "OK";
}
| RegisterCredentialErrorResponse>;

Defined in: recipe/webauthn/types.ts:331

Parameters​
ParameterType
input{ credential: RegistrationPayload; recipeUserId: string; userContext: UserContext; webauthnGeneratedOptionsId: string; }
input.credentialRegistrationPayload
input.recipeUserIdstring
input.userContextUserContext
input.webauthnGeneratedOptionsIdstring
Returns​

Promise< | { status: "OK"; } | RegisterCredentialErrorResponse>

registerOptions()​
registerOptions(input): Promise<
| {
attestation: Attestation;
authenticatorSelection: {
requireResidentKey: boolean;
residentKey: ResidentKey;
userVerification: UserVerification;
};
challenge: string;
createdAt: number;
excludeCredentials: object[];
expiresAt: number;
pubKeyCredParams: object[];
rp: {
id: string;
name: string;
};
status: "OK";
timeout: number;
user: {
displayName: string;
id: string;
name: string;
};
webauthnGeneratedOptionsId: string;
}
| RegisterOptionsErrorResponse>;

Defined in: recipe/webauthn/types.ts:176

Parameters​
ParameterType
inputobject & | { recoverAccountToken: string; } | { displayName: string | undefined; email: string; }
Returns​

Promise< | { attestation: Attestation; authenticatorSelection: { requireResidentKey: boolean; residentKey: ResidentKey; userVerification: UserVerification; }; challenge: string; createdAt: number; excludeCredentials: object[]; expiresAt: number; pubKeyCredParams: object[]; rp: { id: string; name: string; }; status: "OK"; timeout: number; user: { displayName: string; id: string; name: string; }; webauthnGeneratedOptionsId: string; } | RegisterOptionsErrorResponse>

removeCredential()​
removeCredential(input): Promise<
| {
status: "OK";
}
| RemoveCredentialErrorResponse>;

Defined in: recipe/webauthn/types.ts:351

Parameters​
ParameterType
input{ recipeUserId: string; userContext: UserContext; webauthnCredentialId: string; }
input.recipeUserIdstring
input.userContextUserContext
input.webauthnCredentialIdstring
Returns​

Promise< | { status: "OK"; } | RemoveCredentialErrorResponse>

removeGeneratedOptions()​
removeGeneratedOptions(input): Promise<
| {
status: "OK";
}
| RemoveGeneratedOptionsErrorResponse>;

Defined in: recipe/webauthn/types.ts:379

Parameters​
ParameterType
input{ tenantId: string; userContext: UserContext; webauthnGeneratedOptionsId: string; }
input.tenantIdstring
input.userContextUserContext
input.webauthnGeneratedOptionsIdstring
Returns​

Promise< | { status: "OK"; } | RemoveGeneratedOptionsErrorResponse>

signIn()​
signIn(input): Promise<
| {
recipeUserId: RecipeUserId;
status: "OK";
user: User;
}
| SignInErrorResponse>;

Defined in: recipe/webauthn/types.ts:274

Parameters​
ParameterType
input{ credential: AuthenticationPayload; session: SessionContainerInterface | undefined; shouldTryLinkingWithSessionUser: boolean | undefined; tenantId: string; userContext: UserContext; webauthnGeneratedOptionsId: string; }
input.credentialAuthenticationPayload
input.sessionSessionContainerInterface | undefined
input.shouldTryLinkingWithSessionUserboolean | undefined
input.tenantIdstring
input.userContextUserContext
input.webauthnGeneratedOptionsIdstring
Returns​

Promise< | { recipeUserId: RecipeUserId; status: "OK"; user: User; } | SignInErrorResponse>

signInOptions()​
signInOptions(input): Promise<
| {
challenge: string;
createdAt: number;
expiresAt: number;
status: "OK";
timeout: number;
userVerification: UserVerification;
webauthnGeneratedOptionsId: string;
}
| SignInOptionsErrorResponse>;

Defined in: recipe/webauthn/types.ts:236

Parameters​
ParameterType
input{ origin: string; relyingPartyId: string; relyingPartyName: string; tenantId: string; timeout: number | undefined; userContext: UserContext; userPresence: boolean | undefined; userVerification: UserVerification | undefined; }
input.originstring
input.relyingPartyIdstring
input.relyingPartyNamestring
input.tenantIdstring
input.timeoutnumber | undefined
input.userContextUserContext
input.userPresenceboolean | undefined
input.userVerificationUserVerification | undefined
Returns​

Promise< | { challenge: string; createdAt: number; expiresAt: number; status: "OK"; timeout: number; userVerification: UserVerification; webauthnGeneratedOptionsId: string; } | SignInOptionsErrorResponse>

signUp()​
signUp(input): Promise<
| {
recipeUserId: RecipeUserId;
status: "OK";
user: User;
}
| SignUpErrorResponse>;

Defined in: recipe/webauthn/types.ts:258

Parameters​
ParameterType
input{ credential: RegistrationPayload; session: SessionContainerInterface | undefined; shouldTryLinkingWithSessionUser: boolean | undefined; tenantId: string; userContext: UserContext; webauthnGeneratedOptionsId: string; }
input.credentialRegistrationPayload
input.sessionSessionContainerInterface | undefined
input.shouldTryLinkingWithSessionUserboolean | undefined
input.tenantIdstring
input.userContextUserContext
input.webauthnGeneratedOptionsIdstring
Returns​

Promise< | { recipeUserId: RecipeUserId; status: "OK"; user: User; } | SignUpErrorResponse>

updateUserEmail()​
updateUserEmail(input): Promise<
| {
status: "OK";
}
| UpdateUserEmailErrorResponse>;

Defined in: recipe/webauthn/types.ts:407

Parameters​
ParameterType
input{ email: string; recipeUserId: string; tenantId: string; userContext: UserContext; }
input.emailstring
input.recipeUserIdstring
input.tenantIdstring
input.userContextUserContext
Returns​

Promise< | { status: "OK"; } | UpdateUserEmailErrorResponse>

verifyCredentials()​
verifyCredentials(input): Promise<
| VerifyCredentialsErrorResponse
| {
recipeUserId: RecipeUserId;
status: "OK";
user: User;
}>;

Defined in: recipe/webauthn/types.ts:283

Parameters​
ParameterType
input{ credential: AuthenticationPayload; tenantId: string; userContext: UserContext; webauthnGeneratedOptionsId: string; }
input.credentialAuthenticationPayload
input.tenantIdstring
input.userContextUserContext
input.webauthnGeneratedOptionsIdstring
Returns​

Promise< | VerifyCredentialsErrorResponse | { recipeUserId: RecipeUserId; status: "OK"; user: User; }>

RegistrationPayload

type RegistrationPayload = CredentialPayloadBase & object;

Defined in: recipe/webauthn/types.ts:707

Type Declaration

ResidentKey

type ResidentKey = "required" | "preferred" | "discouraged";

Defined in: recipe/webauthn/types.ts:171

TypeInput

type TypeInput = object;

Defined in: recipe/webauthn/types.ts:68

Properties

PropertyTypeDefined in
emailDelivery?EmailDeliveryTypeInput<TypeWebauthnEmailDeliveryInput>recipe/webauthn/types.ts:69
getOrigin?TypeInputGetOriginrecipe/webauthn/types.ts:73
getRelyingPartyId?TypeInputRelyingPartyIdrecipe/webauthn/types.ts:70
getRelyingPartyName?TypeInputRelyingPartyNamerecipe/webauthn/types.ts:71
override?objectrecipe/webauthn/types.ts:74
override.apis?(originalImplementation, builder) => APIInterfacerecipe/webauthn/types.ts:79
override.functions?(originalImplementation, builder) => RecipeInterfacerecipe/webauthn/types.ts:75
validateEmailAddress?TypeInputValidateEmailAddressrecipe/webauthn/types.ts:72

TypeInputGetOrigin()

type TypeInputGetOrigin = (input) => Promise<string>;

Defined in: recipe/webauthn/types.ts:91

Parameters

ParameterType
input{ request: BaseRequest; tenantId: string; userContext: UserContext; }
input.requestBaseRequest
input.tenantIdstring
input.userContextUserContext

Returns

Promise<string>

TypeInputRelyingPartyId

type TypeInputRelyingPartyId = string | (input) => Promise<string>;

Defined in: recipe/webauthn/types.ts:83

TypeInputRelyingPartyName

type TypeInputRelyingPartyName = string | (input) => Promise<string>;

Defined in: recipe/webauthn/types.ts:87

TypeInputValidateEmailAddress()

type TypeInputValidateEmailAddress = (email, tenantId, userContext) => Promise<string | undefined> | string | undefined;

Defined in: recipe/webauthn/types.ts:97

Parameters

ParameterType
emailstring
tenantIdstring
userContextUserContext

Returns

Promise<string | undefined> | string | undefined

TypeNormalisedInput

type TypeNormalisedInput = object;

Defined in: recipe/webauthn/types.ts:27

Properties

PropertyTypeDefined in
getEmailDeliveryConfig(isInServerlessEnv) => EmailDeliveryTypeInputWithService<TypeWebauthnEmailDeliveryInput>recipe/webauthn/types.ts:31
getOriginTypeNormalisedInputGetOriginrecipe/webauthn/types.ts:30
getRelyingPartyIdTypeNormalisedInputRelyingPartyIdrecipe/webauthn/types.ts:28
getRelyingPartyNameTypeNormalisedInputRelyingPartyNamerecipe/webauthn/types.ts:29
overrideobjectrecipe/webauthn/types.ts:35
override.apis(originalImplementation, builder) => APIInterfacerecipe/webauthn/types.ts:40
override.functions(originalImplementation, builder) => RecipeInterfacerecipe/webauthn/types.ts:36
validateEmailAddressTypeNormalisedInputValidateEmailAddressrecipe/webauthn/types.ts:34

TypeNormalisedInputGetOrigin()

type TypeNormalisedInputGetOrigin = (input) => Promise<string>;

Defined in: recipe/webauthn/types.ts:56

Parameters

ParameterType
input{ request: BaseRequest; tenantId: string; userContext: UserContext; }
input.requestBaseRequest
input.tenantIdstring
input.userContextUserContext

Returns

Promise<string>

TypeNormalisedInputRelyingPartyId()

type TypeNormalisedInputRelyingPartyId = (input) => Promise<string>;

Defined in: recipe/webauthn/types.ts:44

Parameters

ParameterType
input{ request: BaseRequest | undefined; tenantId: string; userContext: UserContext; }
input.requestBaseRequest | undefined
input.tenantIdstring
input.userContextUserContext

Returns

Promise<string>

TypeNormalisedInputRelyingPartyName()

type TypeNormalisedInputRelyingPartyName = (input) => Promise<string>;

Defined in: recipe/webauthn/types.ts:50

Parameters

ParameterType
input{ request: BaseRequest | undefined; tenantId: string; userContext: UserContext; }
input.requestBaseRequest | undefined
input.tenantIdstring
input.userContextUserContext

Returns

Promise<string>

TypeNormalisedInputValidateEmailAddress()

type TypeNormalisedInputValidateEmailAddress = (email, tenantId, userContext) => Promise<string | undefined> | string | undefined;

Defined in: recipe/webauthn/types.ts:62

Parameters

ParameterType
emailstring
tenantIdstring
userContextUserContext

Returns

Promise<string | undefined> | string | undefined

TypeWebauthnEmailDeliveryInput

type TypeWebauthnEmailDeliveryInput = TypeWebauthnRecoverAccountEmailDeliveryInput;

Defined in: recipe/webauthn/types.ts:677

TypeWebauthnRecoverAccountEmailDeliveryInput

type TypeWebauthnRecoverAccountEmailDeliveryInput = object;

Defined in: recipe/webauthn/types.ts:666

Properties

PropertyTypeDefined in
recoverAccountLinkstringrecipe/webauthn/types.ts:673
tenantIdstringrecipe/webauthn/types.ts:674
type"RECOVER_ACCOUNT"recipe/webauthn/types.ts:667
userobjectrecipe/webauthn/types.ts:668
user.emailstringrecipe/webauthn/types.ts:671
user.idstringrecipe/webauthn/types.ts:669
user.recipeUserIdRecipeUserId | undefinedrecipe/webauthn/types.ts:670

UserVerification

type UserVerification = "required" | "preferred" | "discouraged";

Defined in: recipe/webauthn/types.ts:172