Class: WebAuthn::AuthenticatorAttestationResponse
- Inherits:
-
AuthenticatorResponse
- Object
- AuthenticatorResponse
- WebAuthn::AuthenticatorAttestationResponse
- Extended by:
- Forwardable
- Defined in:
- lib/webauthn/authenticator_attestation_response.rb
Instance Attribute Summary collapse
-
#attestation_trust_path ⇒ Object
readonly
Returns the value of attribute attestation_trust_path.
-
#attestation_type ⇒ Object
readonly
Returns the value of attribute attestation_type.
-
#transports ⇒ Object
readonly
Returns the value of attribute transports.
Class Method Summary collapse
Instance Method Summary collapse
- #attestation_object ⇒ Object
-
#initialize(attestation_object:, transports: [], **options) ⇒ AuthenticatorAttestationResponse
constructor
A new instance of AuthenticatorAttestationResponse.
- #verify(expected_challenge, expected_origin = nil, user_presence: nil, user_verification: nil, rp_id: nil) ⇒ Object
Methods inherited from AuthenticatorResponse
Constructor Details
#initialize(attestation_object:, transports: [], **options) ⇒ AuthenticatorAttestationResponse
Returns a new instance of AuthenticatorAttestationResponse.
33 34 35 36 37 38 39 |
# File 'lib/webauthn/authenticator_attestation_response.rb', line 33 def initialize(attestation_object:, transports: [], **) super(**) @attestation_object_bytes = attestation_object @transports = transports @relying_party = end |
Instance Attribute Details
#attestation_trust_path ⇒ Object (readonly)
Returns the value of attribute attestation_trust_path.
31 32 33 |
# File 'lib/webauthn/authenticator_attestation_response.rb', line 31 def attestation_trust_path @attestation_trust_path end |
#attestation_type ⇒ Object (readonly)
Returns the value of attribute attestation_type.
31 32 33 |
# File 'lib/webauthn/authenticator_attestation_response.rb', line 31 def attestation_type @attestation_type end |
#transports ⇒ Object (readonly)
Returns the value of attribute transports.
31 32 33 |
# File 'lib/webauthn/authenticator_attestation_response.rb', line 31 def transports @transports end |
Class Method Details
.from_client(response, relying_party: WebAuthn.configuration.relying_party) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/webauthn/authenticator_attestation_response.rb', line 20 def self.from_client(response, relying_party: WebAuthn.configuration.) encoder = .encoder new( attestation_object: encoder.decode(response["attestationObject"]), transports: response["transports"], client_data_json: encoder.decode(response["clientDataJSON"]), relying_party: ) end |
Instance Method Details
#attestation_object ⇒ Object
52 53 54 |
# File 'lib/webauthn/authenticator_attestation_response.rb', line 52 def attestation_object @attestation_object ||= WebAuthn::AttestationObject.deserialize(attestation_object_bytes, ) end |
#verify(expected_challenge, expected_origin = nil, user_presence: nil, user_verification: nil, rp_id: nil) ⇒ Object
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/webauthn/authenticator_attestation_response.rb', line 41 def verify(expected_challenge, expected_origin = nil, user_presence: nil, user_verification: nil, rp_id: nil) super verify_item(:attested_credential) if .verify_attestation_statement verify_item(:attestation_statement) end true end |