From 2ed21bf36c6b66c55cc29bcb29706531c18cf168 Mon Sep 17 00:00:00 2001 From: Santiago Rodriguez <46354312+santiagorodriguez96@users.noreply.github.com> Date: Thu, 22 Oct 2026 11:02:27 -0300 Subject: [PATCH 1/2] feat: add support for `attestationFormats` in creation options --- lib/webauthn/public_key_credential/creation_options.rb | 8 +++++++- .../public_key_credential/creation_options_spec.rb | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/webauthn/public_key_credential/creation_options.rb b/lib/webauthn/public_key_credential/creation_options.rb index 32e346bf..5786a161 100644 --- a/lib/webauthn/public_key_credential/creation_options.rb +++ b/lib/webauthn/public_key_credential/creation_options.rb @@ -10,6 +10,7 @@ class PublicKeyCredential class CreationOptions < Options attr_accessor( :attestation, + :attestation_formats, :authenticator_selection, :exclude, :algs, @@ -19,6 +20,7 @@ class CreationOptions < Options def initialize( attestation: nil, + attestation_formats: nil, authenticator_selection: nil, exclude_credentials: nil, exclude: nil, @@ -31,6 +33,7 @@ def initialize( super(**keyword_arguments) @attestation = attestation + @attestation_formats = attestation_formats @authenticator_selection = authenticator_selection @exclude_credentials = exclude_credentials @exclude = exclude @@ -67,7 +70,10 @@ def pub_key_cred_params private def attributes - super.concat([:rp, :user, :pub_key_cred_params, :attestation, :authenticator_selection, :exclude_credentials]) + super.concat( + [:rp, :user, :pub_key_cred_params, :attestation, :attestation_formats, :authenticator_selection, + :exclude_credentials] + ) end def exclude_credentials_from_exclude diff --git a/spec/webauthn/public_key_credential/creation_options_spec.rb b/spec/webauthn/public_key_credential/creation_options_spec.rb index 9c5ab71b..97be232c 100644 --- a/spec/webauthn/public_key_credential/creation_options_spec.rb +++ b/spec/webauthn/public_key_credential/creation_options_spec.rb @@ -110,6 +110,7 @@ user_verification: "required" }, attestation: "direct", + attestation_formats: ["packed", "tpm"], extensions: { whatever: "whatever" }, ) @@ -126,6 +127,7 @@ authenticatorAttachment: "cross-platform", residentKey: "required", userVerification: "required" ) expect(hash[:attestation]).to eq("direct") + expect(hash[:attestationFormats]).to eq(["packed", "tpm"]) expect(hash[:extensions]).to eq(whatever: "whatever") expect(hash[:challenge]).to be_truthy end @@ -153,6 +155,7 @@ expect(hash).not_to have_key(:excludeCredentials) expect(hash).not_to have_key(:authenticatorSelection) expect(hash).not_to have_key(:attestation) + expect(hash).not_to have_key(:attestationFormats) end it "accepts shorthand for exclude_credentials" do From 816b61f6b6794ecff43e9a15634b493adfc2b2cf Mon Sep 17 00:00:00 2001 From: Santiago Rodriguez <46354312+santiagorodriguez96@users.noreply.github.com> Date: Thu, 22 Oct 2026 12:36:55 -0300 Subject: [PATCH 2/2] docs: add CHANGELOG entry for `attestationFormats` support --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 127d5532..c73adad8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Added - Add support for crossOrigin/topOrigin verification during credential registration and authentication. [#486](https://github.com/cedarcode/webauthn-ruby/pull/486) [@nicolastemciuc] +- Add support for the `attestation_formats` option in `WebAuthn::Credential.options_for_create`. [#514](https://github.com/cedarcode/webauthn-ruby/pull/514) [@santiagorodriguez96] ## [v3.4.3](https://github.com/cedarcode/webauthn-ruby/compare/v3.4.2...v3.4.3/) - 2025-10-23