supertokens-node/recipe/webauthn/types
References documentation for the supertokens-node/recipe/webauthn/types package
Type Aliases
APIInterface
type APIInterface = object;
Defined in: recipe/webauthn/types.ts
Properties
| Property | Type | Defined in |
|---|---|---|
emailExistsGET |
| undefined | (input) => Promise< | { exists: boolean; status: "OK"; } | GeneralErrorResponse> |
recipe/webauthn/types.ts |
generateRecoverAccountTokenPOST |
| undefined | (input) => Promise< | { status: "OK"; } | GeneralErrorResponse | GenerateRecoverAccountTokenPOSTErrorResponse> |
recipe/webauthn/types.ts |
listCredentialsGET |
| undefined | (input) => Promise< | { credentials: object[]; status: "OK"; } | GeneralErrorResponse> |
recipe/webauthn/types.ts |
recoverAccountPOST |
| undefined | (input) => Promise< | { email: string; status: "OK"; user: User; } | GeneralErrorResponse | RecoverAccountPOSTErrorResponse> |
recipe/webauthn/types.ts |
registerCredentialPOST |
| undefined | (input) => Promise< | { status: "OK"; } | GeneralErrorResponse | RegisterCredentialPOSTErrorResponse> |
recipe/webauthn/types.ts |
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 |
removeCredentialPOST |
| undefined | (input) => Promise< | { status: "OK"; } | GeneralErrorResponse | RemoveCredentialPOSTErrorResponse> |
recipe/webauthn/types.ts |
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 |
signInPOST |
| undefined | (input) => Promise< | { session: SessionContainerInterface; status: "OK"; user: User; } | GeneralErrorResponse | SignInPOSTErrorResponse> |
recipe/webauthn/types.ts |
signUpPOST |
| undefined | (input) => Promise< | { session: SessionContainerInterface; status: "OK"; user: User; } | GeneralErrorResponse | SignUpPOSTErrorResponse> |
recipe/webauthn/types.ts |
APIOptions
type APIOptions = object;
Defined in: recipe/webauthn/types.ts
Properties
| Property | Type | Defined in |
|---|---|---|
appInfo |
NormalisedAppinfo |
recipe/webauthn/types.ts |
config |
TypeNormalisedInput |
recipe/webauthn/types.ts |
emailDelivery |
EmailDeliveryIngredient<TypeWebauthnEmailDeliveryInput> |
recipe/webauthn/types.ts |
isInServerlessEnv |
boolean |
recipe/webauthn/types.ts |
recipeId |
string |
recipe/webauthn/types.ts |
recipeImplementation |
RecipeInterface |
recipe/webauthn/types.ts |
req |
BaseRequest |
recipe/webauthn/types.ts |
res |
BaseResponse |
recipe/webauthn/types.ts |
Attestation
type Attestation = "none" | "indirect" | "direct" | "enterprise";
Defined in: recipe/webauthn/types.ts
AuthenticationPayload
type AuthenticationPayload = CredentialPayloadBase & object;
Defined in: recipe/webauthn/types.ts
Type Declaration
| Name | Type | Defined in |
|---|---|---|
response |
AuthenticatorAssertionResponseJSON |
recipe/webauthn/types.ts |
AuthenticatorAssertionResponseJSON
type AuthenticatorAssertionResponseJSON = object;
Defined in: recipe/webauthn/types.ts
Properties
| Property | Type | Defined in |
|---|---|---|
authenticatorData |
Base64URLString |
recipe/webauthn/types.ts |
clientDataJSON |
Base64URLString |
recipe/webauthn/types.ts |
signature |
Base64URLString |
recipe/webauthn/types.ts |
userHandle? |
Base64URLString |
recipe/webauthn/types.ts |
AuthenticatorAttestationResponseJSON
type AuthenticatorAttestationResponseJSON = object;
Defined in: recipe/webauthn/types.ts
Properties
| Property | Type | Defined in |
|---|---|---|
attestationObject |
Base64URLString |
recipe/webauthn/types.ts |
authenticatorData? |
Base64URLString |
recipe/webauthn/types.ts |
clientDataJSON |
Base64URLString |
recipe/webauthn/types.ts |
publicKey? |
Base64URLString |
recipe/webauthn/types.ts |
publicKeyAlgorithm? |
COSEAlgorithmIdentifier |
recipe/webauthn/types.ts |
transports? |
("ble" | "cable" | "hybrid" | "internal" | "nfc" | "smart-card" | "usb")[] |
recipe/webauthn/types.ts |
CredentialPayload
type CredentialPayload = CredentialPayloadBase & object;
Defined in: recipe/webauthn/types.ts
Type Declaration
| Name | Type | Defined in |
|---|---|---|
response |
object |
recipe/webauthn/types.ts |
response.attestationObject |
string |
recipe/webauthn/types.ts |
response.clientDataJSON |
string |
recipe/webauthn/types.ts |
response.transports? |
("ble" | "cable" | "hybrid" | "internal" | "nfc" | "smart-card" | "usb")[] |
recipe/webauthn/types.ts |
response.userHandle |
string |
recipe/webauthn/types.ts |
CredentialPayloadBase
type CredentialPayloadBase = object;
Defined in: recipe/webauthn/types.ts
Properties
| Property | Type | Defined in |
|---|---|---|
authenticatorAttachment? |
"platform" | "cross-platform" |
recipe/webauthn/types.ts |
clientExtensionResults |
Record<string, unknown> |
recipe/webauthn/types.ts |
id |
string |
recipe/webauthn/types.ts |
rawId |
string |
recipe/webauthn/types.ts |
type |
"public-key" |
recipe/webauthn/types.ts |
RecipeInterface
type RecipeInterface = object;
Defined in: recipe/webauthn/types.ts
Methods
consumeRecoverAccountToken()
consumeRecoverAccountToken(input): Promise<
| {
email: string;
status: "OK";
userId: string;
}
| ConsumeRecoverAccountTokenErrorResponse>;
Defined in: recipe/webauthn/types.ts
Parameters
| Parameter | Type |
|---|---|
input |
{ tenantId: string; token: string; userContext: UserContext; } |
input.tenantId |
string |
input.token |
string |
input.userContext |
UserContext |
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
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
| Parameter | Type |
|---|---|
input |
{ credential: RegistrationPayload; tenantId: string; userContext: UserContext; webauthnGeneratedOptionsId: string; } |
input.credential |
RegistrationPayload |
input.tenantId |
string |
input.userContext |
UserContext |
input.webauthnGeneratedOptionsId |
string |
Returns
Promise<
| CreateNewRecipeUserErrorResponse
| {
recipeUserId: RecipeUserId;
status: "OK";
user: User;
}>
generateRecoverAccountToken()
generateRecoverAccountToken(input): Promise<
| {
status: "OK";
token: string;
}
| GenerateRecoverAccountTokenErrorResponse>;
Defined in: recipe/webauthn/types.ts
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
| Parameter | Type |
|---|---|
input |
{ email: string; tenantId: string; userContext: UserContext; userId: string; } |
input.email |
string |
input.tenantId |
string |
input.userContext |
UserContext |
input.userId |
string |
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
Parameters
| Parameter | Type |
|---|---|
input |
{ recipeUserId: string; userContext: UserContext; webauthnCredentialId: string; } |
input.recipeUserId |
string |
input.userContext |
UserContext |
input.webauthnCredentialId |
string |
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
Parameters
| Parameter | Type |
|---|---|
input |
{ tenantId: string; userContext: UserContext; webauthnGeneratedOptionsId: string; } |
input.tenantId |
string |
input.userContext |
UserContext |
input.webauthnGeneratedOptionsId |
string |
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
Parameters
| Parameter | Type |
|---|---|
input |
{ tenantId: string; token: string; userContext: UserContext; } |
input.tenantId |
string |
input.token |
string |
input.userContext |
UserContext |
Returns
Promise<
| {
recipeUserId?: RecipeUserId;
status: "OK";
user: User;
}
| GetUserFromRecoverAccountTokenErrorResponse>
listCredentials()
listCredentials(input): Promise<{
credentials: object[];
status: "OK";
}>;
Defined in: recipe/webauthn/types.ts
Parameters
| Parameter | Type |
|---|---|
input |
{ recipeUserId: string; userContext: UserContext; } |
input.recipeUserId |
string |
input.userContext |
UserContext |
Returns
Promise<{
credentials: object[];
status: "OK";
}>
registerCredential()
registerCredential(input): Promise<
| {
status: "OK";
}
| RegisterCredentialErrorResponse>;
Defined in: recipe/webauthn/types.ts
Parameters
| Parameter | Type |
|---|---|
input |
{ credential: RegistrationPayload; recipeUserId: string; userContext: UserContext; webauthnGeneratedOptionsId: string; } |
input.credential |
RegistrationPayload |
input.recipeUserId |
string |
input.userContext |
UserContext |
input.webauthnGeneratedOptionsId |
string |
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
Parameters
| Parameter | Type |
|---|---|
input |
object & | { 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
Parameters
| Parameter | Type |
|---|---|
input |
{ recipeUserId: string; userContext: UserContext; webauthnCredentialId: string; } |
input.recipeUserId |
string |
input.userContext |
UserContext |
input.webauthnCredentialId |
string |
Returns
Promise<
| {
status: "OK";
}
| RemoveCredentialErrorResponse>
removeGeneratedOptions()
removeGeneratedOptions(input): Promise<
| {
status: "OK";
}
| RemoveGeneratedOptionsErrorResponse>;
Defined in: recipe/webauthn/types.ts
Parameters
| Parameter | Type |
|---|---|
input |
{ tenantId: string; userContext: UserContext; webauthnGeneratedOptionsId: string; } |
input.tenantId |
string |
input.userContext |
UserContext |
input.webauthnGeneratedOptionsId |
string |
Returns
Promise<
| {
status: "OK";
}
| RemoveGeneratedOptionsErrorResponse>
signIn()
signIn(input): Promise<
| {
recipeUserId: RecipeUserId;
status: "OK";
user: User;
}
| SignInErrorResponse>;
Defined in: recipe/webauthn/types.ts
Parameters
| Parameter | Type |
|---|---|
input |
{ credential: AuthenticationPayload; session: SessionContainerInterface | undefined; shouldTryLinkingWithSessionUser: boolean | undefined; tenantId: string; userContext: UserContext; webauthnGeneratedOptionsId: string; } |
input.credential |
AuthenticationPayload |
input.session |
SessionContainerInterface | undefined |
input.shouldTryLinkingWithSessionUser |
boolean | undefined |
input.tenantId |
string |
input.userContext |
UserContext |
input.webauthnGeneratedOptionsId |
string |
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
Parameters
| Parameter | Type |
|---|---|
input |
{ origin: string; relyingPartyId: string; relyingPartyName: string; tenantId: string; timeout: number | undefined; userContext: UserContext; userPresence: boolean | undefined; userVerification: UserVerification | undefined; } |
input.origin |
string |
input.relyingPartyId |
string |
input.relyingPartyName |
string |
input.tenantId |
string |
input.timeout |
number | undefined |
input.userContext |
UserContext |
input.userPresence |
boolean | undefined |
input.userVerification |
UserVerification | 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
Parameters
| Parameter | Type |
|---|---|
input |
{ credential: RegistrationPayload; session: SessionContainerInterface | undefined; shouldTryLinkingWithSessionUser: boolean | undefined; tenantId: string; userContext: UserContext; webauthnGeneratedOptionsId: string; } |
input.credential |
RegistrationPayload |
input.session |
SessionContainerInterface | undefined |
input.shouldTryLinkingWithSessionUser |
boolean | undefined |
input.tenantId |
string |
input.userContext |
UserContext |
input.webauthnGeneratedOptionsId |
string |
Returns
Promise<
| {
recipeUserId: RecipeUserId;
status: "OK";
user: User;
}
| SignUpErrorResponse>
updateUserEmail()
updateUserEmail(input): Promise<
| {
status: "OK";
}
| UpdateUserEmailErrorResponse>;
Defined in: recipe/webauthn/types.ts
Parameters
| Parameter | Type |
|---|---|
input |
{ email: string; recipeUserId: string; tenantId: string; userContext: UserContext; } |
input.email |
string |
input.recipeUserId |
string |
input.tenantId |
string |
input.userContext |
UserContext |
Returns
Promise<
| {
status: "OK";
}
| UpdateUserEmailErrorResponse>
verifyCredentials()
verifyCredentials(input): Promise<
| VerifyCredentialsErrorResponse
| {
recipeUserId: RecipeUserId;
status: "OK";
user: User;
}>;
Defined in: recipe/webauthn/types.ts
Parameters
| Parameter | Type |
|---|---|
input |
{ credential: AuthenticationPayload; tenantId: string; userContext: UserContext; webauthnGeneratedOptionsId: string; } |
input.credential |
AuthenticationPayload |
input.tenantId |
string |
input.userContext |
UserContext |
input.webauthnGeneratedOptionsId |
string |
Returns
Promise<
| VerifyCredentialsErrorResponse
| {
recipeUserId: RecipeUserId;
status: "OK";
user: User;
}>
RegistrationPayload
type RegistrationPayload = CredentialPayloadBase & object;
Defined in: recipe/webauthn/types.ts
Type Declaration
| Name | Type | Defined in |
|---|---|---|
response |
AuthenticatorAttestationResponseJSON |
recipe/webauthn/types.ts |
ResidentKey
type ResidentKey = "required" | "preferred" | "discouraged";
Defined in: recipe/webauthn/types.ts
TypeInput
type TypeInput = object;
Defined in: recipe/webauthn/types.ts
Properties
| Property | Type | Defined in |
|---|---|---|
emailDelivery? |
EmailDeliveryTypeInput<TypeWebauthnEmailDeliveryInput> |
recipe/webauthn/types.ts |
getOrigin? |
TypeInputGetOrigin |
recipe/webauthn/types.ts |
getRelyingPartyId? |
TypeInputRelyingPartyId |
recipe/webauthn/types.ts |
getRelyingPartyName? |
TypeInputRelyingPartyName |
recipe/webauthn/types.ts |
override? |
object |
recipe/webauthn/types.ts |
override.apis? |
(originalImplementation, builder) => APIInterface |
recipe/webauthn/types.ts |
override.functions? |
(originalImplementation, builder) => RecipeInterface |
recipe/webauthn/types.ts |
validateEmailAddress? |
TypeInputValidateEmailAddress |
recipe/webauthn/types.ts |
TypeInputGetOrigin()
type TypeInputGetOrigin = (input) => Promise<string>;
Defined in: recipe/webauthn/types.ts
Parameters
| Parameter | Type |
|---|---|
input |
{ request: BaseRequest; tenantId: string; userContext: UserContext; } |
input.request |
BaseRequest |
input.tenantId |
string |
input.userContext |
UserContext |
Returns
Promise<string>
TypeInputRelyingPartyId
type TypeInputRelyingPartyId = string | (input) => Promise<string>;
Defined in: recipe/webauthn/types.ts
TypeInputRelyingPartyName
type TypeInputRelyingPartyName = string | (input) => Promise<string>;
Defined in: recipe/webauthn/types.ts
TypeInputValidateEmailAddress()
type TypeInputValidateEmailAddress = (email, tenantId, userContext) => Promise<string | undefined> | string | undefined;
Defined in: recipe/webauthn/types.ts
Parameters
| Parameter | Type |
|---|---|
email |
string |
tenantId |
string |
userContext |
UserContext |
Returns
Promise<string | undefined> | string | undefined
TypeNormalisedInput
type TypeNormalisedInput = object;
Defined in: recipe/webauthn/types.ts
Properties
| Property | Type | Defined in |
|---|---|---|
getEmailDeliveryConfig |
(isInServerlessEnv) => EmailDeliveryTypeInputWithService<TypeWebauthnEmailDeliveryInput> |
recipe/webauthn/types.ts |
getOrigin |
TypeNormalisedInputGetOrigin |
recipe/webauthn/types.ts |
getRelyingPartyId |
TypeNormalisedInputRelyingPartyId |
recipe/webauthn/types.ts |
getRelyingPartyName |
TypeNormalisedInputRelyingPartyName |
recipe/webauthn/types.ts |
override |
object |
recipe/webauthn/types.ts |
override.apis |
(originalImplementation, builder) => APIInterface |
recipe/webauthn/types.ts |
override.functions |
(originalImplementation, builder) => RecipeInterface |
recipe/webauthn/types.ts |
validateEmailAddress |
TypeNormalisedInputValidateEmailAddress |
recipe/webauthn/types.ts |
TypeNormalisedInputGetOrigin()
type TypeNormalisedInputGetOrigin = (input) => Promise<string>;
Defined in: recipe/webauthn/types.ts
Parameters
| Parameter | Type |
|---|---|
input |
{ request: BaseRequest; tenantId: string; userContext: UserContext; } |
input.request |
BaseRequest |
input.tenantId |
string |
input.userContext |
UserContext |
Returns
Promise<string>
TypeNormalisedInputRelyingPartyId()
type TypeNormalisedInputRelyingPartyId = (input) => Promise<string>;
Defined in: recipe/webauthn/types.ts
Parameters
| Parameter | Type |
|---|---|
input |
{ request: BaseRequest | undefined; tenantId: string; userContext: UserContext; } |
input.request |
BaseRequest | undefined |
input.tenantId |
string |
input.userContext |
UserContext |
Returns
Promise<string>
TypeNormalisedInputRelyingPartyName()
type TypeNormalisedInputRelyingPartyName = (input) => Promise<string>;
Defined in: recipe/webauthn/types.ts
Parameters
| Parameter | Type |
|---|---|
input |
{ request: BaseRequest | undefined; tenantId: string; userContext: UserContext; } |
input.request |
BaseRequest | undefined |
input.tenantId |
string |
input.userContext |
UserContext |
Returns
Promise<string>
TypeNormalisedInputValidateEmailAddress()
type TypeNormalisedInputValidateEmailAddress = (email, tenantId, userContext) => Promise<string | undefined> | string | undefined;
Defined in: recipe/webauthn/types.ts
Parameters
| Parameter | Type |
|---|---|
email |
string |
tenantId |
string |
userContext |
UserContext |
Returns
Promise<string | undefined> | string | undefined
TypeWebauthnEmailDeliveryInput
type TypeWebauthnEmailDeliveryInput = TypeWebauthnRecoverAccountEmailDeliveryInput;
Defined in: recipe/webauthn/types.ts
TypeWebauthnRecoverAccountEmailDeliveryInput
type TypeWebauthnRecoverAccountEmailDeliveryInput = object;
Defined in: recipe/webauthn/types.ts
Properties
| Property | Type | Defined in |
|---|---|---|
recoverAccountLink |
string |
recipe/webauthn/types.ts |
tenantId |
string |
recipe/webauthn/types.ts |
type |
"RECOVER_ACCOUNT" |
recipe/webauthn/types.ts |
user |
object |
recipe/webauthn/types.ts |
user.email |
string |
recipe/webauthn/types.ts |
user.id |
string |
recipe/webauthn/types.ts |
user.recipeUserId |
RecipeUserId | undefined |
recipe/webauthn/types.ts |
UserVerification
type UserVerification = "required" | "preferred" | "discouraged";
Defined in: recipe/webauthn/types.ts