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:, be:, bs:, at:, ex:) ⇒ Flags

Returns a new instance of Flags.



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

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

Class Method Details

.decode(input) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/web_authn/authenticator_data/flags.rb', line 29

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

Instance Method Details

#==(target) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/web_authn/authenticator_data/flags.rb', line 19

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