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.
-
#relying_party ⇒ Object
readonly
Returns the value of attribute relying_party.
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.
30 31 32 33 |
# File 'lib/webauthn/attestation_object.rb', line 30 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.
28 29 30 |
# File 'lib/webauthn/attestation_object.rb', line 28 def attestation_statement @attestation_statement end |
#authenticator_data ⇒ Object (readonly)
Returns the value of attribute authenticator_data.
28 29 30 |
# File 'lib/webauthn/attestation_object.rb', line 28 def authenticator_data @authenticator_data end |
#relying_party ⇒ Object (readonly)
Returns the value of attribute relying_party.
28 29 30 |
# File 'lib/webauthn/attestation_object.rb', line 28 def @relying_party end |
Class Method Details
.deserialize(attestation_object, relying_party) ⇒ Object
13 14 15 |
# File 'lib/webauthn/attestation_object.rb', line 13 def self.deserialize(attestation_object, ) from_map(CBOR.decode(attestation_object), ) end |
.from_map(map, relying_party) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/webauthn/attestation_object.rb', line 17 def self.from_map(map, ) new( authenticator_data: WebAuthn::AuthenticatorData.deserialize(map["authData"]), attestation_statement: WebAuthn::AttestationStatement.from( map["fmt"], map["attStmt"], relying_party: ) ) end |
Instance Method Details
#valid_attestation_statement?(client_data_hash) ⇒ Boolean
40 41 42 |
# File 'lib/webauthn/attestation_object.rb', line 40 def valid_attestation_statement?(client_data_hash) attestation_statement.valid?(authenticator_data, client_data_hash) end |
#valid_attested_credential? ⇒ Boolean
35 36 37 38 |
# File 'lib/webauthn/attestation_object.rb', line 35 def valid_attested_credential? authenticator_data.attested_credential_data_included? && authenticator_data.attested_credential_data.valid? end |