Sha256: f53bfdd5411d0a2866e0745215cf44aa9300c92595a27cf646764f8d1c8b9fc8
Contents?: true
Size: 1.49 KB
Versions: 6
Compression:
Stored size: 1.49 KB
Contents
# frozen_string_literal: true require_relative 'request_helper' module Stytch class WebAuthn include Stytch::RequestHelper PATH = '/v1/webauthn' def initialize(connection) @connection = connection end def register_start( user_id:, domain:, user_agent: nil, authenticator_type: nil ) request = { user_id: user_id, domain: domain } request[:user_agent] = user_agent unless user_agent.nil? request[:authenticator_type] = authenticator_type unless authenticator_type.nil? post_request("#{PATH}/register/start", request) end def register( user_id:, public_key_credential: ) request = { user_id: user_id, public_key_credential: public_key_credential } post_request("#{PATH}/register", request) end def authenticate_start( user_id:, domain: ) request = { user_id: user_id, domain: domain } post_request("#{PATH}/authenticate/start", request) end def authenticate( public_key_credential:, session_token: nil, session_duration_minutes: nil ) request = { public_key_credential: public_key_credential } request[:session_token] = session_token unless session_token.nil? request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil? post_request("#{PATH}/authenticate", request) end end end
Version data entries
6 entries across 6 versions & 1 rubygems