Class: WebAuthn::AttestationStatement::AndroidSafetynet
- Inherits:
-
WebAuthn::AttestationStatement
- Object
- WebAuthn::AttestationStatement
- WebAuthn::AttestationStatement::AndroidSafetynet
- Defined in:
- lib/web_authn/attestation_statement/android_safetynet.rb
Instance Attribute Summary collapse
-
#certs ⇒ Object
Returns the value of attribute certs.
-
#response ⇒ Object
Returns the value of attribute response.
-
#ver ⇒ Object
Returns the value of attribute ver.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(ver:, response:) ⇒ AndroidSafetynet
constructor
A new instance of AndroidSafetynet.
- #verify!(authenticator_data, client_data_json) ⇒ Object
Constructor Details
#initialize(ver:, response:) ⇒ AndroidSafetynet
Returns a new instance of AndroidSafetynet.
6 7 8 9 10 11 12 13 14 |
# File 'lib/web_authn/attestation_statement/android_safetynet.rb', line 6 def initialize(ver:, response:) self.ver = ver self.response = response self.certs = response.x5c.collect do |x5c| OpenSSL::X509::Certificate.new( Base64.decode64 x5c ) end end |
Instance Attribute Details
#certs ⇒ Object
Returns the value of attribute certs.
4 5 6 |
# File 'lib/web_authn/attestation_statement/android_safetynet.rb', line 4 def certs @certs end |
#response ⇒ Object
Returns the value of attribute response.
4 5 6 |
# File 'lib/web_authn/attestation_statement/android_safetynet.rb', line 4 def response @response end |
#ver ⇒ Object
Returns the value of attribute ver.
4 5 6 |
# File 'lib/web_authn/attestation_statement/android_safetynet.rb', line 4 def ver @ver end |
Class Method Details
.decode(att_stmt) ⇒ Object
71 72 73 74 75 76 |
# File 'lib/web_authn/attestation_statement/android_safetynet.rb', line 71 def decode(att_stmt) new( ver: att_stmt[:ver], response: JSON::JWT.decode(att_stmt[:response], :skip_verification) ) end |
Instance Method Details
#verify!(authenticator_data, client_data_json) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/web_authn/attestation_statement/android_safetynet.rb', line 16 def verify!(authenticator_data, client_data_json) verify_nonce! authenticator_data, client_data_json verify_signature! verify_certificate! unless response[:ctsProfileMatch] raise InvalidAttestation, 'Invalid Android Safetynet Response: ctsProfileMatch' end end |