diff --git a/CHANGELOG.md b/CHANGELOG.md index e42223201..d27884e3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixes broken workflows (Example Tests, AWS Edge function compatibility) - Sets up workflow to run auth-react tests - Updates test-servers to work with updated tests +- Fixes wrong types types from `string` to `number` on `createdAt`, `expiresAt` and `timeout` from the WebAuthn recipe +- Fixed `email` property by making it optional on `getGeneratedOptions` recipe implementation method ## [22.1.0] - 2025-04-04 diff --git a/lib/build/recipe/webauthn/index.d.ts b/lib/build/recipe/webauthn/index.d.ts index c4e28c46d..e36df4af2 100644 --- a/lib/build/recipe/webauthn/index.d.ts +++ b/lib/build/recipe/webauthn/index.d.ts @@ -52,8 +52,8 @@ export default class Wrapper { | { status: "OK"; webauthnGeneratedOptionsId: string; - createdAt: string; - expiresAt: string; + createdAt: number; + expiresAt: number; rp: { id: string; name: string; @@ -98,8 +98,8 @@ export default class Wrapper { | { status: "OK"; webauthnGeneratedOptionsId: string; - createdAt: string; - expiresAt: string; + createdAt: number; + expiresAt: number; challenge: string; timeout: number; userVerification: UserVerification; @@ -121,8 +121,8 @@ export default class Wrapper { userVerification: UserVerification; userPresence: boolean; origin: string; - email: string; - timeout: string; + email?: string | undefined; + timeout: number; challenge: string; createdAt: number; expiresAt: number; @@ -382,7 +382,7 @@ export default class Wrapper { | { status: "OK"; user: import("../../types").User; - recipeUserId: import("../..").RecipeUserId; + recipeUserId?: import("../..").RecipeUserId | undefined; } >; static removeGeneratedOptions(input: { diff --git a/lib/build/recipe/webauthn/recipeImplementation.js b/lib/build/recipe/webauthn/recipeImplementation.js index 9b192bb8c..2d7a90151 100644 --- a/lib/build/recipe/webauthn/recipeImplementation.js +++ b/lib/build/recipe/webauthn/recipeImplementation.js @@ -333,7 +333,7 @@ function getRecipeInterface(querier, getWebauthnConfig) { if (resp.status === "OK") { return Object.assign(Object.assign({}, resp), { user: new user_1.User(resp.user), - recipeUserId: new recipeUserId_1.default(resp.recipeUserId), + recipeUserId: resp.recipeUserId ? new recipeUserId_1.default(resp.recipeUserId) : undefined, }); } return resp; diff --git a/lib/build/recipe/webauthn/types.d.ts b/lib/build/recipe/webauthn/types.d.ts index 30fc60c1c..c98c76e30 100644 --- a/lib/build/recipe/webauthn/types.d.ts +++ b/lib/build/recipe/webauthn/types.d.ts @@ -218,8 +218,8 @@ export declare type RecipeInterface = { | { status: "OK"; webauthnGeneratedOptionsId: string; - createdAt: string; - expiresAt: string; + createdAt: number; + expiresAt: number; rp: { id: string; name: string; @@ -262,8 +262,8 @@ export declare type RecipeInterface = { | { status: "OK"; webauthnGeneratedOptionsId: string; - createdAt: string; - expiresAt: string; + createdAt: number; + expiresAt: number; challenge: string; timeout: number; userVerification: UserVerification; @@ -380,7 +380,7 @@ export declare type RecipeInterface = { | { status: "OK"; user: User; - recipeUserId: RecipeUserId; + recipeUserId?: RecipeUserId; } | GetUserFromRecoverAccountTokenErrorResponse >; @@ -443,8 +443,8 @@ export declare type RecipeInterface = { userVerification: UserVerification; userPresence: boolean; origin: string; - email: string; - timeout: string; + email?: string; + timeout: number; challenge: string; createdAt: number; expiresAt: number; @@ -564,8 +564,8 @@ export declare type APIInterface = { | { status: "OK"; webauthnGeneratedOptionsId: string; - createdAt: string; - expiresAt: string; + createdAt: number; + expiresAt: number; rp: { id: string; name: string; @@ -606,8 +606,8 @@ export declare type APIInterface = { | { status: "OK"; webauthnGeneratedOptionsId: string; - createdAt: string; - expiresAt: string; + createdAt: number; + expiresAt: number; rpId: string; challenge: string; timeout: number; diff --git a/lib/ts/recipe/webauthn/recipeImplementation.ts b/lib/ts/recipe/webauthn/recipeImplementation.ts index 796be8130..870e414c9 100644 --- a/lib/ts/recipe/webauthn/recipeImplementation.ts +++ b/lib/ts/recipe/webauthn/recipeImplementation.ts @@ -311,7 +311,7 @@ export default function getRecipeInterface( return { ...resp, user: new User(resp.user), - recipeUserId: new RecipeUserId(resp.recipeUserId), + recipeUserId: resp.recipeUserId ? new RecipeUserId(resp.recipeUserId) : undefined, }; } diff --git a/lib/ts/recipe/webauthn/types.ts b/lib/ts/recipe/webauthn/types.ts index a25c86070..11dd5bd5d 100644 --- a/lib/ts/recipe/webauthn/types.ts +++ b/lib/ts/recipe/webauthn/types.ts @@ -199,8 +199,8 @@ export type RecipeInterface = { | { status: "OK"; webauthnGeneratedOptionsId: string; - createdAt: string; - expiresAt: string; + createdAt: number; + expiresAt: number; // for understanding the response, see https://www.w3.org/TR/webauthn-3/#sctn-registering-a-new-credential and https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredential rp: { id: string; @@ -246,8 +246,8 @@ export type RecipeInterface = { | { status: "OK"; webauthnGeneratedOptionsId: string; - createdAt: string; - expiresAt: string; + createdAt: number; + expiresAt: number; challenge: string; timeout: number; userVerification: UserVerification; @@ -348,7 +348,9 @@ export type RecipeInterface = { token: string; tenantId: string; userContext: UserContext; - }): Promise<{ status: "OK"; user: User; recipeUserId: RecipeUserId } | GetUserFromRecoverAccountTokenErrorResponse>; + }): Promise< + { status: "OK"; user: User; recipeUserId?: RecipeUserId } | GetUserFromRecoverAccountTokenErrorResponse + >; removeCredential(input: { webauthnCredentialId: string; @@ -408,8 +410,8 @@ export type RecipeInterface = { userVerification: UserVerification; userPresence: boolean; origin: string; - email: string; - timeout: string; + email?: string; + timeout: number; challenge: string; createdAt: number; expiresAt: number; @@ -498,8 +500,8 @@ export type APIInterface = { | { status: "OK"; webauthnGeneratedOptionsId: string; - createdAt: string; - expiresAt: string; + createdAt: number; + expiresAt: number; rp: { id: string; name: string; @@ -541,8 +543,8 @@ export type APIInterface = { | { status: "OK"; webauthnGeneratedOptionsId: string; - createdAt: string; - expiresAt: string; + createdAt: number; + expiresAt: number; rpId: string; challenge: string; timeout: number;