Skip to content

Commit ebdc52c

Browse files
fix: WebAuthn type fixes to align with CDI (#1002)
* fix: handle optional recipeUserId in getUserFromRecoverAccountToken response * rebuilt code * fix: update WebAuthn types to use number for createdAt, expiresAt and timout fields and made email optional in for register options * changelog updates --------- Co-authored-by: Victor Bojica <[email protected]>
1 parent d69a80a commit ebdc52c

File tree

6 files changed

+35
-31
lines changed

6 files changed

+35
-31
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
- Fixes broken workflows (Example Tests, AWS Edge function compatibility)
1515
- Sets up workflow to run auth-react tests
1616
- Updates test-servers to work with updated tests
17+
- Fixes wrong types types from `string` to `number` on `createdAt`, `expiresAt` and `timeout` from the WebAuthn recipe
18+
- Fixed `email` property by making it optional on `getGeneratedOptions` recipe implementation method
1719

1820
## [23.0.0] - 2025-06-10
1921

lib/build/recipe/webauthn/index.d.ts

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/build/recipe/webauthn/recipeImplementation.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/build/recipe/webauthn/types.d.ts

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/ts/recipe/webauthn/recipeImplementation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ export default function getRecipeInterface(
328328
return {
329329
...resp,
330330
user: new User(resp.user),
331-
recipeUserId: new RecipeUserId(resp.recipeUserId),
331+
recipeUserId: resp.recipeUserId ? new RecipeUserId(resp.recipeUserId) : undefined,
332332
};
333333
}
334334

lib/ts/recipe/webauthn/types.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ export type RecipeInterface = {
199199
| {
200200
status: "OK";
201201
webauthnGeneratedOptionsId: string;
202-
createdAt: string;
203-
expiresAt: string;
202+
createdAt: number;
203+
expiresAt: number;
204204
// 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
205205
rp: {
206206
id: string;
@@ -246,8 +246,8 @@ export type RecipeInterface = {
246246
| {
247247
status: "OK";
248248
webauthnGeneratedOptionsId: string;
249-
createdAt: string;
250-
expiresAt: string;
249+
createdAt: number;
250+
expiresAt: number;
251251
challenge: string;
252252
timeout: number;
253253
userVerification: UserVerification;
@@ -344,7 +344,9 @@ export type RecipeInterface = {
344344
token: string;
345345
tenantId: string;
346346
userContext: UserContext;
347-
}): Promise<{ status: "OK"; user: User; recipeUserId: RecipeUserId } | GetUserFromRecoverAccountTokenErrorResponse>;
347+
}): Promise<
348+
{ status: "OK"; user: User; recipeUserId?: RecipeUserId } | GetUserFromRecoverAccountTokenErrorResponse
349+
>;
348350

349351
removeCredential(input: { webauthnCredentialId: string; recipeUserId: string; userContext: UserContext }): Promise<
350352
| {
@@ -393,8 +395,8 @@ export type RecipeInterface = {
393395
userVerification: UserVerification;
394396
userPresence: boolean;
395397
origin: string;
396-
email: string;
397-
timeout: string;
398+
email?: string;
399+
timeout: number;
398400
challenge: string;
399401
createdAt: number;
400402
expiresAt: number;
@@ -483,8 +485,8 @@ export type APIInterface = {
483485
| {
484486
status: "OK";
485487
webauthnGeneratedOptionsId: string;
486-
createdAt: string;
487-
expiresAt: string;
488+
createdAt: number;
489+
expiresAt: number;
488490
rp: {
489491
id: string;
490492
name: string;
@@ -522,8 +524,8 @@ export type APIInterface = {
522524
| {
523525
status: "OK";
524526
webauthnGeneratedOptionsId: string;
525-
createdAt: string;
526-
expiresAt: string;
527+
createdAt: number;
528+
expiresAt: number;
527529
rpId: string;
528530
challenge: string;
529531
timeout: number;

0 commit comments

Comments
 (0)