Skip to main content
If you are unable to use Privy’s SDKs for signing, you can implement request signing directly in your service.
Implementing request signing directly is an advanced integration. Wherever possible, we suggest using Privy’s SDKs to handle request signing.

Steps

At a high-level, directly implementing request signing requires the following steps:
1

Build signature payload

Generate a JSON payload containing the following fields. All fields are required unless otherwise specified.
FieldTypeDescription
version1Authorization signature version. Currently, 1 is the only version.
method'POST' | 'PUT' | 'PATCH' | 'DELETE'HTTP method for the request. Signatures are not required on 'GET' requests.
urlstringThe full URL for the request. Should not include a trailing slash.
bodyJSONJSON body for the request.
headersJSONJSON object containing any Privy-specific headers, e.g. those that are prefixed with 'privy-'. This should not include any other headers, such as authentication headers, content-type, or trace headers.
headers['privy-app-id']stringPrivy app ID header (required).
headers['privy-idempotency-key']stringPrivy idempotency key header (optional). If the request does not contain an idempotency key, leave this field out of the payload.
2

Canonicalize signature payload

Next, canonicalize the payload per RFC 8785 and serialize it to a string. This GitHub repository links to various libraries for JSON canonicalization in different languages.
3

Sign signature payload

Sign the serialized JSON with ECDSA P-256 using the private key of your user key or authorization key and serialize it to a base64-encoded string.
4

Include the signature in request headers

Lastly, include the base64-encoded signature over the payload in the privy-authorization-signature header of your request to the Privy API.

Code examples

View code examples for signing requests in various languages below.
If the desired resource requires a user owner or user signer, make sure to request the user key before signing requests with it.