To execute actions on server session provisioned wallets directly from your server, you can use Privy’s NodeJS Server SDK or by making requests to Privy’s REST API directly. Follow the instructions below to configure your desired integration.

If your server is a NodeJS environment, you can integrate the @privy-io/server-auth library to use server session provisioned actions.

To use @privy-io/server-auth, first install the library:

npm install @privy-io/server-auth@latest

Then, import the PrivyClient class and create an instance of it. As parameters to the PrivyClient’s constructor, pass your Privy app ID and app secret as a string.

import { PrivyClient } from '@privy-io/server-auth';

...

const privy = new PrivyClient('insert-your-app-id', 'insert-your-app-secret', {
  walletApi: {
    authorizationPrivateKey: 'wallet-auth:insert-your-authorization-key-from-the-dashboard'
  }
});

If you have enabled an authorization key for your wallets in the Dashboard, pass the key to the constructor as illustrated above.

When an authorization private key is provided, the Privy client will automatically sign all requests with this key and include the signature as the required privy-authorization-signature header in API calls, ensuring your server-side wallet actions are properly authenticated.

Was this page helpful?