class WebAuthn::ClientDataJSON

Attributes

challenge[RW]
origin[RW]
raw[RW]
type[RW]

Public Class Methods

decode(encoded_client_data_json) click to toggle source
# File lib/web_authn/client_data_json.rb, line 13
def decode(encoded_client_data_json)
  raw = Base64.urlsafe_decode64 encoded_client_data_json
  json = JSON.parse(raw).with_indifferent_access
  new(
    type: json[:type],
    origin: json[:origin],
    challenge: Base64.urlsafe_decode64(json[:challenge]),
    raw: raw
  )
end
new(type:, origin:, challenge:, raw: nil) click to toggle source
# File lib/web_authn/client_data_json.rb, line 5
def initialize(type:, origin:, challenge:, raw: nil)
  self.type = type
  self.origin = origin
  self.challenge = challenge
  self.raw = raw
end