Skip to content

feat(passkeys): add auth server passkey configs#20133

Merged
MagentaManifold merged 1 commit intomainfrom
FXA-13057
Mar 9, 2026
Merged

feat(passkeys): add auth server passkey configs#20133
MagentaManifold merged 1 commit intomainfrom
FXA-13057

Conversation

@MagentaManifold
Copy link
Copy Markdown
Contributor

Because

  • we need to load passkey configs into auth server

This pull request

  • defines convict passkey configs

Issue that this pull request solves

Closes: FXA-13057

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).

Screenshots (Optional)

Please attach the screenshots of the changes made in case of change in user interface.

Other information (Optional)

Any other information that is important to this pull request.

@MagentaManifold MagentaManifold requested a review from a team as a code owner March 3, 2026 17:50
Copy link
Copy Markdown
Contributor Author

@MagentaManifold MagentaManifold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I didn't feel the need to add a new section in README.md, with inline documentation being sufficiently detailed.)

format: ['required', 'preferred', 'discouraged'],
},
authenticatorAttachment: {
default: null,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure it default should be null or undefined. Passkey config service uses undefined, but null seems more idiomatic for convict.

Copy link
Copy Markdown
Contributor

@dschom dschom Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason the passkey config is using undefined instead of null?

Comment thread packages/fxa-auth-server/config/index.ts Outdated
Comment thread packages/fxa-auth-server/config/index.ts Outdated
Comment thread packages/fxa-auth-server/config/index.ts Outdated
Comment thread packages/fxa-auth-server/config/index.ts Outdated
);
Container.set(RecoveryPhoneService, recoveryPhoneService);

const passkeyConfig = buildPasskeyConfig(config.passkeys, log);
Copy link
Copy Markdown
Contributor Author

@MagentaManifold MagentaManifold Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added these just to demonstrate how it will be used in auth-server. Remove before merging

@IsIn(['platform', 'cross-platform'])
public authenticatorAttachment?: AuthenticatorAttachment;
@IsIn(['platform', 'cross-platform', undefined])
public authenticatorAttachment?: AuthenticatorAttachment | undefined;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the | undefined here for convict compatibility?

Sometimes side stepping the optional vs null vs undefined issue and just using an empty string or explicit value ends up being simpler. eg @IsIn(['platform', 'cross-platform', '']) or @IsIn(['platform', 'cross-platform', 'none']).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AuthenticatorAttachment | undefined is the type that simplewebauthn/server (the webauthn lib we depend on) takes.

Container.set(RecoveryPhoneService, recoveryPhoneService);

const passkeyConfig = buildPasskeyConfig(config.passkeys, log);
if (passkeyConfig) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I said I would to remove this change before merging, but since it's now conditionally loaded, there's no runtime cost after startup, with passkeys disabled by default. Should we just keep this?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could leave it, but commented out for now perhaps?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good

authenticatorSelection: {
residentKey: config.residentKey,
userVerification: config.userVerification,
authenticatorAttachment: config.authenticatorAttachment,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Piggy-backing on Dan's suggestion - if authenticatorAttachment defaults to an empty string (instead of null and manually converting in the config builder), we could use the following to handle the undefined case:
authenticatorAttachment: config.authenticatorAttachment || undefined

@MagentaManifold MagentaManifold force-pushed the FXA-13057 branch 2 times, most recently from 560dc55 to 47da024 Compare March 9, 2026 18:16
Because:

* we need to load passkey configs to auth server

This commit:

* defines convict passkey configs

Closes FXA-13057
@MagentaManifold MagentaManifold merged commit f85a47b into main Mar 9, 2026
21 checks passed
@MagentaManifold MagentaManifold deleted the FXA-13057 branch March 9, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants