Skip to content

Refactor authenticator options to include WebAuthn Level 3 features#101

Open
shilgapira wants to merge 3 commits intomainfrom
authenticator-refactor
Open

Refactor authenticator options to include WebAuthn Level 3 features#101
shilgapira wants to merge 3 commits intomainfrom
authenticator-refactor

Conversation

@shilgapira
Copy link
Member

@shilgapira shilgapira commented Feb 25, 2026

Related Issues

Resolves https://github.com/descope/etc/issues/11944

Related PRs

#80

Description

  • The new settings added in #80 are now part of the AuthenticatorOptions struct, keeping the library's public API unchanged compared to before.
  • Authenticators are now created with a default internal transport.

Must

  • Tests
  • Documentation (if applicable)

@shilgapira shilgapira self-assigned this Feb 25, 2026
Copilot AI review requested due to automatic review settings February 25, 2026 23:51
@shuni-bot-dev
Copy link

shuni-bot-dev bot commented Feb 25, 2026

✅ Code review completed successfully

#101

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors WebAuthn Level 3 response customization by moving clientExtensionResults and transports configuration into AuthenticatorOptions, and updates defaults/documentation accordingly.

Changes:

  • Add Transports and ClientExtensionResults to AuthenticatorOptions and use them when generating attestation/assertion responses.
  • Change transport name translation to use an internal transport-name map.
  • Replace/adjust tests and update dependencies + README to reflect new behavior.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
utils.go Updates transport translation logic to use the new transport name map.
transport.go Renames the transport-name map used for encoding transports.
authenticator.go Extends AuthenticatorOptions with transports + client extension results configuration.
attestation.go Uses authenticator options to populate transports and clientExtensionResults in attestation JSON.
assertion.go Uses authenticator options to populate clientExtensionResults in assertion JSON.
test/extensions.go Adds new tests intended to validate default/custom extension results and transports behavior.
test/client_extension_results_test.go Removes prior extension-results-focused tests.
README.md Documents Level 3 support for clientExtensionResults and transports, plus new options usage.
go.mod Updates toolchain version and bumps go-webauthn dependencies.
go.sum Updates dependency checksums to match go.mod changes.
Comments suppressed due to low confidence (3)

utils.go:74

  • translateTransports now starts with result := []string{} which may reallocate as it grows. Since the maximum size is known, consider make([]string, 0, len(transports)) to avoid extra allocations (even if some entries are filtered out).
func translateTransports(transports []Transport) []string {
	result := []string{}
	for _, t := range transports {
		if name, ok := transportNames[t]; ok {
			result = append(result, name)
		}

transport.go:14

  • Renaming the exported Transports map to unexported transportNames is a breaking public API change for any external callers referencing virtualwebauthn.Transports. If the intent is to keep the public API unchanged, keep Transports exported (or provide an exported alias like var Transports = transportNames).
    attestation.go:139
  • The defaulting logic if len(transports) == 0 { transports = []Transport{TransportInternal} } prevents callers from intentionally requesting an explicit empty transports array (valid in WebAuthn L3). Consider defaulting only when auth.Options.Transports == nil, so an empty but non-nil slice results in an empty JSON array.
	transports := auth.Options.Transports
	if len(transports) == 0 {
		transports = []Transport{TransportInternal}
	}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@shuni-bot-dev shuni-bot-dev bot left a comment

Choose a reason for hiding this comment

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

🐕 Shuni's Review

Consolidates WebAuthn Level 3 features (clientExtensionResults, transports) from separate *WithExtensions functions into AuthenticatorOptions, cleanly simplifying the public API back to its pre-#80 surface. Default transport narrowed to [internal], translateTransports now safely skips unknown values, and the exported Transports map (added in #80) is correctly unexported.

LGTM — no issues found. Good bones! Woof!

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@ninjapanzer
Copy link
Contributor

@shilgapira refactor makes sense, should be easy to integrate this change, thanks!

@shilgapira shilgapira force-pushed the authenticator-refactor branch from 3a98d53 to 51ad84b Compare February 27, 2026 03:39
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