Class: Warden::WebAuthn::ErrorKeyFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/warden/webauthn/error_key_finder.rb

Overview

Helper method for generating a symbol based on the WebAuthn::Error

Class Method Summary collapse

Class Method Details

.webauthn_error_key(exception:) ⇒ Object

rubocop:disable Metrics/CyclomaticComplexity rubocop:disable Metrics/MethodLength



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/warden/webauthn/error_key_finder.rb', line 9

def self.webauthn_error_key(exception:)
  case exception
  when ::WebAuthn::AttestationStatement::FormatNotSupportedError
    :webauthn_attestation_statement_format_not_supported
  when ::WebAuthn::PublicKey::UnsupportedAlgorithm
    :webauthn_public_key_unsupported_algorithm
  when ::WebAuthn::AttestationStatement::UnsupportedAlgorithm
    :webauthn_attestation_statement_unsupported_algorithm
  when ::WebAuthn::UserVerifiedVerificationError
    :webauthn_user_verified_verification_error
  when ::WebAuthn::OriginVerificationError
    :webauthn_origin_verification_error
  when ::WebAuthn::ChallengeVerificationError
    :webauthn_challenge_verification_error
  when ::WebAuthn::SignCountVerificationError
    :webauthn_sign_count_verification_error
  when ::WebAuthn::VerificationError
    :webauthn_verification_error
  when ::WebAuthn::ClientDataMissingError
    :webauthn_client_data_missing
  when ::WebAuthn::AuthenticatorDataFormatError
    :webauthn_authenticator_data_format
  when ::WebAuthn::AttestedCredentialDataFormatError
    :webauthn_attested_credential_data_format
  when ::WebAuthn::RootCertificateFinderNotSupportedError
    :webauthn_root_certificate_finder_not_supported
  when ::WebAuthn::Error
    :webauthn_generic_error
  else
    raise RuntimeError
  end
end