Class: WebAuthn::AuthenticatorData::AttestedCredentialData

Inherits:
BinData::Record
  • Object
show all
Defined in:
lib/webauthn/authenticator_data/attested_credential_data.rb

Defined Under Namespace

Classes: Credential

Constant Summary collapse

AAGUID_LENGTH =
16
ZEROED_AAGUID =
0.chr * AAGUID_LENGTH
ID_LENGTH_LENGTH =
2

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.deserialize(data) ⇒ Object


33
34
35
36
37
# File 'lib/webauthn/authenticator_data/attested_credential_data.rb', line 33

def self.deserialize(data)
  read(data)
rescue EOFError
  raise AttestedCredentialDataFormatError
end

Instance Method Details

#aaguidObject


43
44
45
# File 'lib/webauthn/authenticator_data/attested_credential_data.rb', line 43

def aaguid
  raw_aaguid.unpack("H8H4H4H4H12").join("-")
end

#credentialObject


47
48
49
50
51
52
# File 'lib/webauthn/authenticator_data/attested_credential_data.rb', line 47

def credential
  @credential ||=
    if valid?
      Credential.new(id, public_key)
    end
end

#lengthObject


54
55
56
57
58
# File 'lib/webauthn/authenticator_data/attested_credential_data.rb', line 54

def length
  if valid?
    AAGUID_LENGTH + ID_LENGTH_LENGTH + id_length + public_key_length
  end
end

#valid?Boolean

Returns:

  • (Boolean)

39
40
41
# File 'lib/webauthn/authenticator_data/attested_credential_data.rb', line 39

def valid?
  valid_credential_public_key?
end