How it works
- User taps “Grant wallet access” in your app — calls
initDelegationProcess()in the Dynamic SDK. - Dynamic encrypts the user’s signing credentials with your server’s public key and POSTs them to your webhook endpoint.
- Your server decrypts and stores the credentials.
- On each agent request, your server fetches those credentials and signs on behalf of the user.
- If the user revokes, Dynamic fires another webhook and you delete the credentials.
Step 1: Generate a key pair
Your server needs an RSA key pair. Dynamic encrypts the credentials with your public key; your server decrypts them with the private key..env, escaping newlines as \n:
Step 2: Register the webhook in the Dynamic dashboard
- Go to app.dynamic.xyz → your environment → Integrations > Webhooks.
- Click Add endpoint and set the URL to your server’s webhook route.
- Paste the contents of
delegation_public.peminto the Public key field. - Enable
wallet.delegation.createdandwallet.delegation.revoked. - Save and copy the webhook secret.
Step 3: Verify the webhook signature
Every request from Dynamic includes anx-dynamic-signature-256 header. Verify it before processing:
Step 4: Decrypt and store
Dynamic encrypts the credentials with your public key before sending them. Decrypt and store per user:userId (the Dynamic user ID). Use ON CONFLICT (user_id, chain) DO UPDATE so re-delegation updates rather than duplicates.
Step 5: Handle revocation
When the user revokes in the Dynamic SDK, Dynamic fireswallet.delegation.revoked:
403 to the user until they re-delegate.
Step 6: Use the credentials
Before each agent action, fetch the credentials for the requesting user:Webhook events
| Event | Trigger | Action |
|---|---|---|
ping | Webhook registration or test | No side effects |
wallet.delegation.created | User approves delegation | Decrypt + store credentials |
wallet.delegation.revoked | User revokes delegation | Delete credentials |
Environment variables
| Variable | Where to get it |
|---|---|
DYNAMIC_WEBHOOK_SECRET | Dynamic dashboard → Integrations → Webhooks |
DYNAMIC_DELEGATION_PRIVATE_KEY | Your generated RSA private key |
DYNAMIC_ENVIRONMENT_ID | Dynamic dashboard → Overview |
DYNAMIC_API_KEY | Dynamic dashboard → Overview |