Class: WebAuthn::Context::Authentication
- Inherits:
-
WebAuthn::Context
- Object
- WebAuthn::Context
- WebAuthn::Context::Authentication
- Defined in:
- lib/web_authn/context/authentication.rb
Instance Attribute Summary collapse
-
#authenticator_data ⇒ Object
Returns the value of attribute authenticator_data.
Attributes inherited from WebAuthn::Context
Instance Method Summary collapse
- #authentication? ⇒ Boolean
- #verify!(encoded_authenticator_data, sign_count:, signature:, public_key: nil, public_cose_key: nil, digest: OpenSSL::Digest::SHA256.new) ⇒ Object
Methods inherited from WebAuthn::Context
for, #initialize, #registration?, #verify_session!
Constructor Details
This class inherits a constructor from WebAuthn::Context
Instance Attribute Details
#authenticator_data ⇒ Object
Returns the value of attribute authenticator_data.
4 5 6 |
# File 'lib/web_authn/context/authentication.rb', line 4 def authenticator_data @authenticator_data end |
Instance Method Details
#authentication? ⇒ Boolean
11 12 13 |
# File 'lib/web_authn/context/authentication.rb', line 11 def authentication? true end |
#verify!(encoded_authenticator_data, sign_count:, signature:, public_key: nil, public_cose_key: nil, digest: OpenSSL::Digest::SHA256.new) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/web_authn/context/authentication.rb', line 15 def verify!(encoded_authenticator_data, sign_count:, signature:, public_key: nil, public_cose_key: nil, digest: OpenSSL::Digest::SHA256.new) unless public_key || public_cose_key raise ArgumentError, 'missing keyword: public_key or public_cose_key' end self.authenticator_data = AuthenticatorData.decode( Base64.urlsafe_decode64 encoded_authenticator_data ) verify_flags! verify_sign_count!(sign_count) verify_signature!(public_key, public_cose_key, signature, digest) self end |