Sign In/Out

These are the functions you would use in your dApp to interact with Ramper. Import each from @ramper/ethereum

Sign in

const signIn: (clientAPIKey?: string) => Promise<SignInResult>

The sign in options such as which SSO providers to allow and which Web3 wallets to allow can be customized through the init function. It is recommend to call this function when the user clicks the Sign In Button on your web app. The clientAPIKey is optional. You can obtain it from Ramper Developer Console (coming soon)

Sign out

const signOut: () => Promise<void>

Response Types

type SignInResult = {
  method: 'ramper' | 'wallet' | 'none'
  user?: User
  apiGatingToken?: string

The method value is 'ramper' if the user logged in using SSO or email and a Ramper managed wallet is created for them. The method value is 'wallet' if the user used a Web3 wallet such as Metamask to log in. Lastly, the method returns 'none' if the user cancels the log in process. The user value contains information regarding the user that logged in. The apiGatingToken is generated based on the clientAPIKey if that value was provided on signIn. The apiGatingToken is an JWT idToken that can be decoded with the clientAPIKey. This key can be used to verify that the user has logged in properly. Example Response:


Related Data Types:

export type User = {
  wallets: Record<string, Wallet>
} & UserModel

export type UserModel = {
  UID: string
  signupSource: string
  notificationPreference?: string
  email?: string
  preferredCommunicationMethod?: string
  region?: string

export type WalletModel = {
  blockchain: string
  walletId: string
  publicKey: string
  creationDate: number // UTC Epoch
  provider?: string

export type Wallet = {
  getAddress: () => string
} & WalletModel

Last updated