Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion lib/webauthn/public_key_credential/creation_options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class PublicKeyCredential
class CreationOptions < Options
attr_accessor(
:attestation,
:attestation_formats,
:authenticator_selection,
:exclude,
:algs,
Expand All @@ -19,6 +20,7 @@ class CreationOptions < Options

def initialize(
attestation: nil,
attestation_formats: nil,
authenticator_selection: nil,
exclude_credentials: nil,
exclude: nil,
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions spec/webauthn/public_key_credential/creation_options_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
user_verification: "required"
},
attestation: "direct",
attestation_formats: ["packed", "tpm"],
hints: ["security-key", "hybrid"],
extensions: { whatever: "whatever" },
)
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down
Loading