Class: WebAuthn::AttestationObject
- Inherits:
-
Object
- Object
- WebAuthn::AttestationObject
- Extended by:
- Forwardable
- Defined in:
- lib/webauthn/attestation_object.rb
Instance Attribute Summary collapse
-
#attestation_statement ⇒ Object
readonly
Returns the value of attribute attestation_statement.
-
#authenticator_data ⇒ Object
readonly
Returns the value of attribute authenticator_data.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(authenticator_data:, attestation_statement:) ⇒ AttestationObject
constructor
A new instance of AttestationObject.
- #valid_attestation_statement?(client_data_hash) ⇒ Boolean
- #valid_attested_credential? ⇒ Boolean
Constructor Details
#initialize(authenticator_data:, attestation_statement:) ⇒ AttestationObject
Returns a new instance of AttestationObject.
24 25 26 27 |
# File 'lib/webauthn/attestation_object.rb', line 24 def initialize(authenticator_data:, attestation_statement:) @authenticator_data = authenticator_data @attestation_statement = attestation_statement end |
Instance Attribute Details
#attestation_statement ⇒ Object (readonly)
Returns the value of attribute attestation_statement.
22 23 24 |
# File 'lib/webauthn/attestation_object.rb', line 22 def attestation_statement @attestation_statement end |
#authenticator_data ⇒ Object (readonly)
Returns the value of attribute authenticator_data.
22 23 24 |
# File 'lib/webauthn/attestation_object.rb', line 22 def authenticator_data @authenticator_data end |
Class Method Details
.deserialize(attestation_object) ⇒ Object
11 12 13 |
# File 'lib/webauthn/attestation_object.rb', line 11 def self.deserialize(attestation_object) from_map(CBOR.decode(attestation_object)) end |
.from_map(map) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/webauthn/attestation_object.rb', line 15 def self.from_map(map) new( authenticator_data: WebAuthn::AuthenticatorData.deserialize(map["authData"]), attestation_statement: WebAuthn::AttestationStatement.from(map["fmt"], map["attStmt"]) ) end |
Instance Method Details
#valid_attestation_statement?(client_data_hash) ⇒ Boolean
34 35 36 |
# File 'lib/webauthn/attestation_object.rb', line 34 def valid_attestation_statement?(client_data_hash) attestation_statement.valid?(authenticator_data, client_data_hash) end |
#valid_attested_credential? ⇒ Boolean
29 30 31 32 |
# File 'lib/webauthn/attestation_object.rb', line 29 def valid_attested_credential? authenticator_data.attested_credential_data_included? && authenticator_data.attested_credential_data.valid? end |