Wallets created through Privy can either be used directly from a user’s device or from a server. To allow your server to transact on users wallets follow the guide below.

This guide assumes your application has already configured session signers in the Dashboard.

To provision server-side access for user’s wallets, use the addSessionSigners method from the useSessionSigners hook:

addSessionSigners: async ({address: string, signers: {signerId: string, overridePolicyIds: string[]}[]}) => Promise<{user: User}>

Usage

import {useSessionSigners} from '@privy-io/react-auth';
const {addSessionSigners} = useSessionSigners();

Parameters

The addSessionSigners method accepts a params object with the following fields:

address
string
required

Address of the embedded wallet to add a session signer to.

signers
object[]
required
signerId
string
required

The key quorum ID that will be allowed to transact on the wallet. This is the same key quorum ID you generated in the Generate an authorization key step.

overridePolicyIds
string[]

An ID for a policy that any transaction from the session signer must satisfy to be signed. This is an optional field, if not provided, no policies will apply to the signers requests. Note that at this time, each signer can only have one override policy.

Some wallets require the signers array to be empty, in which case the signer added to the wallet will automatically be the key created when “Require signed requests” is turned on in the dashboard.

If the interface does not take any specified signers and the “Require signed requests” setting is not turned on in the dashboard, no signature will be required to make request on the wallet. If your wallets do not support setting signers via this interface, then we highly recommend toggling on “Require signed requests” for enhanced security.