Sha256: a38e06360afcfbcdd29ffa0a01905c6802d8fa1ab6aadd809df4755f3ce4e64e

Contents?: true

Size: 1.54 KB

Versions: 14

Compression:

Stored size: 1.54 KB

Contents

# frozen_string_literal: true

require_relative 'request_helper'

module Stytch
  class CryptoWallets
    include Stytch::RequestHelper

    PATH = '/v1/crypto_wallets'

    def initialize(connection)
      @connection = connection
    end

    def authenticate_start(
      crypto_wallet_address:,
      crypto_wallet_type:,
      user_id: nil,
      session_token: nil,
      session_jwt: nil
    )
      request = {
        crypto_wallet_address: crypto_wallet_address,
        crypto_wallet_type: crypto_wallet_type
      }

      request[:user_id] = user_id unless user_id.nil?
      request[:session_token] = session_token unless session_token.nil?
      request[:session_jwt] = session_jwt unless session_jwt.nil?

      post_request("#{PATH}/authenticate/start", request)
    end

    def authenticate(
      crypto_wallet_address:,
      crypto_wallet_type:,
      signature:,
      session_token: nil,
      session_jwt: nil,
      session_duration_minutes: nil,
      session_custom_claims: nil
    )
      request = {
        crypto_wallet_address: crypto_wallet_address,
        crypto_wallet_type: crypto_wallet_type,
        signature: signature
      }

      request[:session_token] = session_token unless session_token.nil?
      request[:session_jwt] = session_jwt unless session_jwt.nil?
      request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil?
      request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?

      post_request("#{PATH}/authenticate", request)
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
stytch-5.0.2 lib/stytch/crypto_wallets.rb
stytch-5.0.1 lib/stytch/crypto_wallets.rb
stytch-5.0.0 lib/stytch/crypto_wallets.rb
stytch-4.5.1 lib/stytch/crypto_wallets.rb
stytch-4.5.0 lib/stytch/crypto_wallets.rb
stytch-4.4.0 lib/stytch/crypto_wallets.rb
stytch-4.3.1 lib/stytch/crypto_wallets.rb
stytch-4.3.0 lib/stytch/crypto_wallets.rb
stytch-4.2.0 lib/stytch/crypto_wallets.rb
stytch-4.1.0 lib/stytch/crypto_wallets.rb
stytch-4.0.0 lib/stytch/crypto_wallets.rb
stytch-3.15.0 lib/stytch/crypto_wallets.rb
stytch-3.14.0 lib/stytch/crypto_wallets.rb
stytch-3.13.1 lib/stytch/crypto_wallets.rb