Class: WebAuthn::AuthenticatorData
- Inherits:
-
BinData::Record
- Object
- BinData::Record
- WebAuthn::AuthenticatorData
show all
- Defined in:
- lib/webauthn/authenticator_data.rb,
lib/webauthn/authenticator_data/attested_credential_data.rb
Defined Under Namespace
Classes: AttestedCredentialData
Constant Summary
collapse
- RP_ID_HASH_LENGTH =
32
- FLAGS_LENGTH =
1
- SIGN_COUNT_LENGTH =
4
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.deserialize(data) ⇒ Object
33
34
35
36
37
|
# File 'lib/webauthn/authenticator_data.rb', line 33
def self.deserialize(data)
read(data)
rescue EOFError
raise AuthenticatorDataFormatError
end
|
Instance Method Details
#attested_credential_data ⇒ Object
#attested_credential_data_included? ⇒ Boolean
69
70
71
|
# File 'lib/webauthn/authenticator_data.rb', line 69
def attested_credential_data_included?
flags.attested_credential_data_included == 1
end
|
#credential ⇒ Object
77
78
79
80
81
|
# File 'lib/webauthn/authenticator_data.rb', line 77
def credential
if attested_credential_data_included?
attested_credential_data.credential
end
end
|
#credential_backed_up? ⇒ Boolean
65
66
67
|
# File 'lib/webauthn/authenticator_data.rb', line 65
def credential_backed_up?
flags.backup_state == 1
end
|
#credential_backup_eligible? ⇒ Boolean
61
62
63
|
# File 'lib/webauthn/authenticator_data.rb', line 61
def credential_backup_eligible?
flags.backup_eligibility == 1
end
|
#data ⇒ Object
39
40
41
|
# File 'lib/webauthn/authenticator_data.rb', line 39
def data
to_binary_s
end
|
#extension_data ⇒ Object
90
91
92
|
# File 'lib/webauthn/authenticator_data.rb', line 90
def extension_data
@extension_data ||= CBOR.decode(raw_extension_data)
end
|
#extension_data_included? ⇒ Boolean
73
74
75
|
# File 'lib/webauthn/authenticator_data.rb', line 73
def extension_data_included?
flags.extension_data_included == 1
end
|
#user_flagged? ⇒ Boolean
49
50
51
|
# File 'lib/webauthn/authenticator_data.rb', line 49
def user_flagged?
user_present? || user_verified?
end
|
#user_present? ⇒ Boolean
53
54
55
|
# File 'lib/webauthn/authenticator_data.rb', line 53
def user_present?
flags.user_present == 1
end
|
#user_verified? ⇒ Boolean
57
58
59
|
# File 'lib/webauthn/authenticator_data.rb', line 57
def user_verified?
flags.user_verified == 1
end
|
#valid? ⇒ Boolean
43
44
45
46
47
|
# File 'lib/webauthn/authenticator_data.rb', line 43
def valid?
(!attested_credential_data_included? || attested_credential_data.valid?) &&
(!extension_data_included? || extension_data) &&
valid_length?
end
|