Class: WebAuthn::PublicKeyCredentialWithAttestation

Inherits:
PublicKeyCredential show all
Defined in:
lib/webauthn/public_key_credential_with_attestation.rb

Instance Attribute Summary

Attributes inherited from PublicKeyCredential

#authenticator_attachment, #client_extension_outputs, #id, #raw_id, #response, #type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from PublicKeyCredential

#authenticator_extension_outputs, #backed_up?, #backup_eligible?, from_client, #initialize, #sign_count

Constructor Details

This class inherits a constructor from WebAuthn::PublicKeyCredential

Class Method Details

.response_classObject



8
9
10
# File 'lib/webauthn/public_key_credential_with_attestation.rb', line 8

def self.response_class
  WebAuthn::AuthenticatorAttestationResponse
end

Instance Method Details

#public_keyObject



20
21
22
23
24
# File 'lib/webauthn/public_key_credential_with_attestation.rb', line 20

def public_key
  if raw_public_key
    encoder.encode(raw_public_key)
  end
end

#raw_public_keyObject



26
27
28
# File 'lib/webauthn/public_key_credential_with_attestation.rb', line 26

def raw_public_key
  response&.authenticator_data&.credential&.public_key
end

#verify(challenge, user_presence: nil, user_verification: nil) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/webauthn/public_key_credential_with_attestation.rb', line 12

def verify(challenge, user_presence: nil, user_verification: nil)
  super

  response.verify(encoder.decode(challenge), user_presence: user_presence, user_verification: user_verification)

  true
end