Skip to content

Conversation

@AlfioEmanueleFresta
Copy link
Member

@AlfioEmanueleFresta AlfioEmanueleFresta commented Dec 26, 2025

This PR migrates JSON request parsing to use libwebauthn's WebAuthnIDL::from_json() trait instead of our custom parsing code. This removes ~700 lines of manual parsing in favour of the shared implementation.

Changes

  • Use MakeCredentialRequest::from_json() and GetAssertionRequest::from_json() from libwebauthn
  • Remove intermediate parsing structs (MakeCredentialOptions, GetCredentialOptions, CredentialDescriptor, etc.)
  • Pin libwebauthn to commit d97c80d25bdb974472c40de5e5031db5946ad532 (from Web IDL support 2/N: response JSON serialization libwebauthn#155)

Behavioral changes

Default timeout

The default timeout when not specified by the relying party changes from 300s to 60s:

Allow list transports

Previously we cleared transports from credentials in the allow list as a workaround. This is no longer done - transports now pass through as-is. These are just UI hints and shouldn't affect functionality.

Follow-up

Copy link
Collaborator

@msirringhaus msirringhaus left a comment

Choose a reason for hiding this comment

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

Left some questions inline

Ok(Some(hid_device)) => Ok(NfcStateInternal::Connected(hid_device)),
Ok(Some(nfc_device)) => Ok(NfcStateInternal::Connected(nfc_device)),
Ok(None) => {
let state = NfcStateInternal::Waiting;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't understand the change made here

.unwrap_or_else(|| {
// Default to effective domain from origin
origin
.rsplit_once('/')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is rsplit_once() really correct here? Can't there be multiple /?

MakeCredentialRequest {
hash: client_data_hash,
origin,
String::from_utf8(make_cred_request.client_data_json()).map_err(|_| {
Copy link
Collaborator

Choose a reason for hiding this comment

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

See my comment here linux-credentials/libwebauthn#155 (comment) I think it would be sensible for make_cred_request.client_data_json() to return a String.


// Get the client data JSON from the request for response serialization
let client_data_json =
String::from_utf8(get_assertion_request.client_data_json()).map_err(|_| {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above

.unwrap_or_else(|| {
// Default to effective domain from origin
origin
.rsplit_once('/')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above

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