Class: WebAuthn::PublicKeyCredential
- Inherits:
-
Object
- Object
- WebAuthn::PublicKeyCredential
- Defined in:
- lib/webauthn/public_key_credential.rb,
lib/webauthn/public_key_credential/entity.rb,
lib/webauthn/public_key_credential/options.rb,
lib/webauthn/public_key_credential/rp_entity.rb,
lib/webauthn/public_key_credential/user_entity.rb,
lib/webauthn/public_key_credential/request_options.rb,
lib/webauthn/public_key_credential/creation_options.rb
Direct Known Subclasses
PublicKeyCredentialWithAssertion, PublicKeyCredentialWithAttestation
Defined Under Namespace
Classes: CreationOptions, Entity, Options, RPEntity, RequestOptions, UserEntity
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#raw_id ⇒ Object
readonly
Returns the value of attribute raw_id.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(type:, id:, raw_id:, response:) ⇒ PublicKeyCredential
constructor
A new instance of PublicKeyCredential.
- #sign_count ⇒ Object
- #verify(*_args) ⇒ Object
Constructor Details
#initialize(type:, id:, raw_id:, response:) ⇒ PublicKeyCredential
Returns a new instance of PublicKeyCredential.
18 19 20 21 22 23 |
# File 'lib/webauthn/public_key_credential.rb', line 18 def initialize(type:, id:, raw_id:, response:) @type = type @id = id @raw_id = raw_id @response = response end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/webauthn/public_key_credential.rb', line 7 def id @id end |
#raw_id ⇒ Object (readonly)
Returns the value of attribute raw_id.
7 8 9 |
# File 'lib/webauthn/public_key_credential.rb', line 7 def raw_id @raw_id end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
7 8 9 |
# File 'lib/webauthn/public_key_credential.rb', line 7 def response @response end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
7 8 9 |
# File 'lib/webauthn/public_key_credential.rb', line 7 def type @type end |
Class Method Details
.from_client(credential) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/webauthn/public_key_credential.rb', line 9 def self.from_client(credential) new( type: credential["type"], id: credential["id"], raw_id: WebAuthn.configuration.encoder.decode(credential["rawId"]), response: response_class.from_client(credential["response"]) ) end |
Instance Method Details
#sign_count ⇒ Object
32 33 34 |
# File 'lib/webauthn/public_key_credential.rb', line 32 def sign_count response&.authenticator_data&.sign_count end |
#verify(*_args) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/webauthn/public_key_credential.rb', line 25 def verify(*_args) valid_type? || raise("invalid type") valid_id? || raise("invalid id") true end |