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.
# Clone repo
git clone [email protected]: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
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.
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 keysession_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.