Skip to main content
Session keys allow the TapRails SDK to execute payments from the user’s wallet without prompting them to sign every transaction. The user signs a single approval once; subsequent payments are instant and gasless.

How It Works

  1. SDK detects no session key → shows the setup UI
  2. User reviews the daily limit → approves in your wallet
  3. SDK generates a keypair on-device, stores private key in Keychain
  4. SDK registers the public key with the TapRails backend
  5. Future payments are signed by the session key — no user interaction

Automatic Setup with TapRailsThemeProvider

The simplest setup — wrap your app with TapRailsThemeProvider and configure sessionKey in initialize(). The SDK handles detection and UI automatically.
App.tsx
TapRailsThemeProvider checks for a valid session key on mount. If none is found (or the key has expired and autoRenew: true), it automatically shows the SessionKeySetupFlow screen.

Manual Setup with SessionKeySetupFlow

For more control over when the setup flow is shown:
WalletScreen.tsx

useSessionKey Hook

For programmatic session key management:

Checking key status

Revoking a session key



Security Notes

  • Session key private keys never leave the device — they’re stored in the OS Keychain
  • The daily limit is enforced on-chain by the ERC-20 approval
  • Keys are automatically invalidated on the backend if revoked
  • Each device generates its own keypair — a key from one device cannot be used on another