Class: Aptible::CLI::Helpers::SecurityKey::AuthenticatorParameters

Inherits:
Object
  • Object
show all
Defined in:
lib/aptible/cli/helpers/security_key.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(origin, challenge, app_id, device, device_location) ⇒ AuthenticatorParameters

Returns a new instance of AuthenticatorParameters.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/aptible/cli/helpers/security_key.rb', line 17

def initialize(origin, challenge, app_id, device, device_location)
  @origin = origin
  @challenge = challenge
  @app_id = app_id
  @version = device.version
  @key_handle = device.key_handle
  @rp_id = device.rp_id
  @version = device.version
  @device_location = device_location
  @client_data = {
    type: 'webauthn.get',
    challenge: challenge,
    origin: origin,
    crossOrigin: false
  }.to_json
  key_handle = Base64.strict_encode64(
    Base64.urlsafe_decode64(device.key_handle)
  )
  client_data_hash = Digest::SHA256.base64digest(@client_data)
  in_str = "#{client_data_hash}\n" \
    "#{device.rp_id}\n" \
    "#{key_handle}"
  @assert_str = in_str
end

Instance Attribute Details

#app_idObject (readonly)

Returns the value of attribute app_id.



13
14
15
# File 'lib/aptible/cli/helpers/security_key.rb', line 13

def app_id
  @app_id
end

#assert_strObject (readonly)

Returns the value of attribute assert_str.



15
16
17
# File 'lib/aptible/cli/helpers/security_key.rb', line 15

def assert_str
  @assert_str
end

#challengeObject (readonly)

Returns the value of attribute challenge.



13
14
15
# File 'lib/aptible/cli/helpers/security_key.rb', line 13

def challenge
  @challenge
end

#client_dataObject (readonly)

Returns the value of attribute client_data.



15
16
17
# File 'lib/aptible/cli/helpers/security_key.rb', line 15

def client_data
  @client_data
end

#device_locationObject (readonly)

Returns the value of attribute device_location.



14
15
16
# File 'lib/aptible/cli/helpers/security_key.rb', line 14

def device_location
  @device_location
end

#key_handleObject (readonly)

Returns the value of attribute key_handle.



13
14
15
# File 'lib/aptible/cli/helpers/security_key.rb', line 13

def key_handle
  @key_handle
end

#originObject (readonly)

Returns the value of attribute origin.



13
14
15
# File 'lib/aptible/cli/helpers/security_key.rb', line 13

def origin
  @origin
end

#requestObject (readonly)

Returns the value of attribute request.



14
15
16
# File 'lib/aptible/cli/helpers/security_key.rb', line 14

def request
  @request
end

#rp_idObject (readonly)

Returns the value of attribute rp_id.



14
15
16
# File 'lib/aptible/cli/helpers/security_key.rb', line 14

def rp_id
  @rp_id
end

#versionObject (readonly)

Returns the value of attribute version.



13
14
15
# File 'lib/aptible/cli/helpers/security_key.rb', line 13

def version
  @version
end