Server SDK Reference
This page documents the full server-side API for the Persona Relay SDK.
Installation
Node.js
Go
Python
Available on npm as @persona/sdk-node.
Available as a Go module at github.com/persona-id/relay-sdk-go. Public release versions available on GitHub.
Available on PyPI as persona-id.
Constructor
Node.js
Go
Python
Arguments — PersonaOptions
The environment is inferred from your API key: a sandbox key runs against sandbox, a production key against production.
Arguments — persona.Options
The environment is inferred from your API key: a sandbox key runs against sandbox, a production key against production.
Arguments — keyword-only
The environment is inferred from your API key: a sandbox key runs against sandbox, a production key against production.
Persona holds an HTTP connection pool. Call persona.close() when you’re done with it, or use it as a context manager (with Persona(api_key=...) as persona:).
Methods
Node.js
Go
Python
Relay methods are available on the persona.relays namespace.
Relay methods are available on the client.Relays namespace.
Relay methods are available on the persona.relays namespace. All arguments are keyword-only.
create
Creates a Persona relay session. No API key required.
Node.js
Go
Python
Arguments — CreateRelayParams
Always pass encryptionKeyJwk: a JWK, or null to opt out of encryption. A key that doesn’t meet the encryption key requirements is rejected with a 400 and the relay is not created.
Returns — CreateRelayResponse
Signature — Create(ctx context.Context, claimType string, encryptionKeyJWK *persona.EncryptionJWK, opts ...persona.RequestOption) (*persona.Relay, error)
Returns — *persona.Relay
Arguments
Always pass encryption_key_jwk: a JWK, or None to opt out of encryption. A key that doesn’t meet the encryption key requirements is rejected with a 400 and the relay is not created.
Returns — CreateRelayResponse
issuePrivacyPass
Runs the full blind RSA issuance flow and returns a Privacy Pass token. The SDK handles all cryptography internally.
Curious how the Privacy Pass protocol works under the hood? See Privacy Pass Protocol for a full walkthrough — relevant if you’re implementing this yourself without the SDK.
Issuance depends only on the claim type — it is not tied to a relay, so it can run at any time, including before the relay is created.
The signing key the SDK fetches is determined by the claim type you pass, so each Privacy Pass is bound to that claim type. A pass can only redeem a relay created with the same claim type — if they don’t match, the pass won’t be able to redeem the claim.
Node.js
Go
Python
Arguments — IssuePrivacyPassParams
Returns — IssuePrivacyPassResponse
Signature — IssuePrivacyPass(ctx context.Context, claimType string, opts ...persona.RequestOption) (*persona.IssuePrivacyPassResponse, error)
Returns — *persona.IssuePrivacyPassResponse
Arguments
Returns — IssuePrivacyPassResponse
generateClaim
Redeems the Privacy Pass token against Persona and returns the claim payload.
Node.js
Go
Python
If you created the relay session with an encryptionKeyJwk, claimPayload is a compact JWE. Decrypt it with your private key — see Parsing the claim payload.
Arguments — GenerateClaimParams
Returns — GenerateClaimResponse
If you created the relay session with an encryption key, ClaimPayload is a compact JWE. Decrypt it with your private key — see Parsing the claim payload.
Signature — GenerateClaim(ctx context.Context, privacyPassToken, relayToken, relaySecret string, opts ...persona.RequestOption) (*persona.GenerateClaimResponse, error)
Returns — *persona.GenerateClaimResponse
If you created the relay session with an encryption_key_jwk, claim_payload is a compact JWE. Decrypt it with your private key — see Parsing the claim payload.
Arguments
Returns — GenerateClaimResponse
Error handling
Node.js
Go
Python
All Persona API errors and network failures throw a PersonaError.
All Persona API errors and network failures return a *persona.PersonaError.
All Persona API errors and network failures raise a PersonaError. Network failures raise its subclass PersonaTransportError (no response was received, so the request may have been processed), or PersonaConnectionError when the request was never sent.
See Error responses for the raw JSON error shape returned by the API.

