class WebAuthn::AuthenticatorData
def self.deserialize(data)
def self.deserialize(data) read(data) rescue EOFError raise AuthenticatorDataFormatError end
def aaguid
def aaguid raw_aaguid = attested_credential_data.raw_aaguid unless raw_aaguid == WebAuthn::AuthenticatorData::AttestedCredentialData::ZEROED_AAGUID attested_credential_data.aaguid end end
def attested_credential_data
def attested_credential_data @attested_credential_data ||= AttestedCredentialData.deserialize(trailing_bytes) rescue AttestedCredentialDataFormatError raise AuthenticatorDataFormatError end
def attested_credential_data_included?
def attested_credential_data_included? flags.attested_credential_data_included == 1 end
def attested_credential_data_length
def attested_credential_data_length if attested_credential_data_included? attested_credential_data.length else 0 end end
def base_length
def base_length RP_ID_HASH_LENGTH + FLAGS_LENGTH + SIGN_COUNT_LENGTH end
def credential
def credential if attested_credential_data_included? attested_credential_data.credential end end
def credential_backed_up?
def credential_backed_up? flags.backup_state == 1 end
def credential_backup_eligible?
def credential_backup_eligible? flags.backup_eligibility == 1 end
def data
def data to_binary_s end
def extension_data
def extension_data @extension_data ||= CBOR.decode(raw_extension_data) end
def extension_data_included?
def extension_data_included? flags.extension_data_included == 1 end
def extension_data_length
def extension_data_length if extension_data_included? raw_extension_data.length else 0 end end
def raw_extension_data
def raw_extension_data if extension_data_included? if attested_credential_data_included? trailing_bytes[attested_credential_data.length..-1] else trailing_bytes.snapshot end end end
def user_flagged?
def user_flagged? user_present? || user_verified? end
def user_present?
def user_present? flags.user_present == 1 end
def user_verified?
def user_verified? flags.user_verified == 1 end
def valid?
def valid? (!attested_credential_data_included? || attested_credential_data.valid?) && (!extension_data_included? || extension_data) && valid_length? end
def valid_length?
def valid_length? data_length == base_length + attested_credential_data_length + extension_data_length end