Overview
At a high-level, the instructions for creating and signing a JWT in the Privy format are:- Generate your signing & verification keys for tests. Privy uses an asymmetric ECDSA P256 keypair, but you can choose any key setup you like.
- Construct a JWT with the Privy claims. For tests, you can use any arbitrary Privy DID for the
subclaim and any arbitrary session ID for thesidclaim. - Sign your JWT with your signing key. Privy uses the ES256 algorithm to sign & verify JWTs for your app, but you can choose any signing algorithm you like, as long as it is compatible with your key setup from Step 1.
jose.
Generating signing & verification keys for tests
Generate a keypair usingjose’s generateKeyPair method, specifying the ‘ES256’ algorithm as a parameter.
privateKey to sign JWTs and the publicKey to verify JWTs in your tests.
Creating and signing test JWTs
First, define the values you will use to populate your test JWT’s claims.privateKey using jose’s SignJWT class.
Verifying test JWTs
Usejose’s jwtVerify method to verify your test JWT against your test publicKey

