diff --git a/CHANGELOG.md b/CHANGELOG.md index d1300886..d3821ba1 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] - Add support for the `hints` option in `WebAuthn::Credential.options_for_create` and `WebAuthn::Credential.options_for_get`. [#513](https://github.com/cedarcode/webauthn-ruby/pull/513) [@santiagorodriguez96] ### Changed 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 7a5eb2c9..68c8911f 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"], hints: ["security-key", "hybrid"], extensions: { whatever: "whatever" }, ) @@ -127,6 +128,7 @@ authenticatorAttachment: "cross-platform", residentKey: "required", userVerification: "required" ) expect(hash[:attestation]).to eq("direct") + expect(hash[:attestationFormats]).to eq(["packed", "tpm"]) expect(hash[:hints]).to eq(["security-key", "hybrid"]) expect(hash[:extensions]).to eq(whatever: "whatever") expect(hash[:challenge]).to be_truthy @@ -155,6 +157,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) expect(hash).not_to have_key(:hints) end