Class: WebAuthn::AuthenticatorData::Flags

Inherits:
Object
  • Object
show all
Defined in:
lib/web_authn/authenticator_data/flags.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(up:, uv:, at:, ex:) ⇒ Flags

Returns a new instance of Flags.



10
11
12
13
14
15
# File 'lib/web_authn/authenticator_data/flags.rb', line 10

def initialize(up:, uv:, at:, ex:)
  self.up = up
  self.uv = uv
  self.at = at
  self.ex = ex
end

Class Method Details

.decode(input) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/web_authn/authenticator_data/flags.rb', line 25

def decode(input)
  bit_array = input.getbyte(0)
  new(
    up: bit_array[0] == 1,
    uv: bit_array[2] == 1,
    at: bit_array[6] == 1,
    ex: bit_array[7] == 1
  )
end

Instance Method Details

#==(target) ⇒ Object



17
18
19
20
21
22
# File 'lib/web_authn/authenticator_data/flags.rb', line 17

def ==(target)
  up == target.up &&
  uv == target.uv &&
  at == target.at &&
  ex == target.ex
end