Setup
To create user wallets that integrate directly with your JWT-based authentication system, first configure your app’s JWT-based authentication settings in the dashboard. The User Signer API uses this configuration to verify the legitimacy of user JWTs.
Create a wallet with a user signer
Once you have configured your custom JWT authentication in the dashboard, your application can create a user wallet by calling the /v1/wallets_with_recovery
endpoint with your user’s JWT subject ID. This endpoint will create a wallet that can be accessed using the associated user JWT.
Request
The request to /v1/wallets_with_recovery
contains the following parameters.
The JWT subject ID of the user.
chain_type
ethereum | solana | cosmos | stellar | sui
required
Chain type of the wallet. “ethereum” supports any EVM-compatible network.
List of policy IDs for policies that should be enforced on the wallet. Currently, only one policy is supported per wallet.
The accounts to associate with the newly created user. Must be of length 1-2.
Response
The response from the endpoint will contain the following fields.
The wallet that was created.
The ID of the created user.
Example
An example request to /v1/wallets_with_recovery
may have the following parameters.
curl -X POST https://api.privy.io/v1/wallets_with_recovery \
-u "<your-privy-app-id>:<your-privy-app-secret>" \
-H "privy-app-id: <your-privy-app-id>" \
-H "Content-Type: application/json" \
-d '{
"primary_signer": {
"subject_id": "<jwt-subject-id>"
},
"wallets": [{
"chain_type": "<chain-type>"
}],
"recovery_user": {
// Must include at least one of these or one of each.
"linked_accounts": [
{
"type": "<email>",
"address": "<recovery-account-address>"
},
{
"type": "<custom-auth>",
"custom_user_id": "<custom-user-id>"
}
]
}
}'
A successful response will look like the following.
{
"wallets": [
{
"id": "<wallet-id>",
"chain_type": "ethereum",
"address": "<wallet-address>",
"owner_id": "<owner-id>"
}
],
"recovery_user_id": "<recovery-user-id>"
}