Sha256: d3dd5b6f3a2b8d09754e6e452df4748b593cc51224699f9f315ed90b727df97a

Contents?: true

Size: 1.23 KB

Versions: 8

Compression:

Stored size: 1.23 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
    )
      request = {
        crypto_wallet_address: crypto_wallet_address,
        crypto_wallet_type: crypto_wallet_type
      }

      request[:user_id] = user_id unless user_id.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
    )
      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?

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
stytch-3.4.0 lib/stytch/crypto_wallets.rb
stytch-3.3.0 lib/stytch/crypto_wallets.rb
stytch-3.2.1 lib/stytch/crypto_wallets.rb
stytch-3.2.0 lib/stytch/crypto_wallets.rb
stytch-3.1.1 lib/stytch/crypto_wallets.rb
stytch-3.1.0 lib/stytch/crypto_wallets.rb
stytch-3.0.0 lib/stytch/crypto_wallets.rb
stytch-2.12.0 lib/stytch/crypto_wallets.rb