Skip to content

privy-io/session-keys-example

Repository files navigation

Privy account abstraction example with session keys

This is a example using Privy to create an signer for an account abstraction (AA) account and provision server-side access to the AA wallet using session keys.

Please follow this guide to access wallets from your backend for a deep dive into this integration.

Installation

# Clone repo
git clone git@github.com:privy-io/session-keys-example.git
cd session-keys-example

# Create .env.local file from example, filling in your Privy App ID and other environment variables.
cp .env.example.local .env.local

# Install dependencies
npm i

# Start the demo
npm run dev

Setup

Account abstraction provider

To run this example, you will need to set up a project with an Account Abstraction provider. This example uses Zerodev.

See the Zerodev docs to configure your project and environment.

Server-side storage provider

To run this example, you will need to set up server-side storage. This example uses Supabase.

See the Supabase docs to configure your database and credentials.

By default, this example expects a database table called SessionKeyApprovals with two columns:

  • privy_did: The Privy user ID for all users who approved session keys. This is the table's primary key
  • session_key_approval: The session key approvals associated with each user. This approval grants your server permissioned access to the user's AA account, via a session key that your server has access to.

About

Privy account abstraction example with session keys

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published