Getting started
There are two self-serve ways to see Privacy Pass in action:
- Get a real token with the demo tool: the fastest way to obtain a real, issuer-signed token, using a browser tool and a Cloudflare-provided demo issuer.
- See a local example: run the complete issuance and redemption flow on your own machine in a few minutes, using real Blind RSA cryptography.
To understand the protocol itself, refer to Privacy Pass Protocol. When you are ready to validate a real, Cloudflare-operated deployment, refer to Production Deployment Testing and contact us to begin setting up the necessary infrastructure.
Get a real token with the demo tool
The quickest way to see what an issuer-signed token looks like is with Cloudflare's Privacy Pass Demo Tool. Pointed at an issuer, it runs the full issuance flow in your browser and returns a verified token.
Prerequisites
- Our demo issuer directory URL, provided here: https://demo-pat.issuer.cloudflare.com/.well-known/private-token-issuer-directory.
How to get a token
- Open the Privacy Pass demo tool.
- In Fetch from issuer URL, paste the demo issuer directory URL and submit. The tool displays the issuer directory—a list of
token-keyswith token type2(Blind RSA)—and automatically fills in the fields for the following steps. - In Create challenge, submit the prefilled form. The tool builds a
WWW-Authenticatetoken challenge from the issuer's key. - In Send Token Request, submit the prefilled form. The tool blinds the request, sends it to the issuer, unblinds the response, and verifies the result.
A successful run shows:
Draft 16 Valid: true
PrivateToken token=...
Draft 16 Valid: true means the issuer returned a real token that verifies against its public key. The PrivateToken token=... value is the finalized token a client would send to an Origin in an Authorization header.
:::note The demo tool routes its requests through its own backend to work around browser cross-origin (CORS) limits. It needs no attester or client certificate here because the demo issuer is open for testing. Production issuers accept requests only from an authenticated Attester, so they cannot be exercised this way — refer to Production Deployment Testing. :::
See a local example
You can run the issuance and redemption flow on your machine in a few minutes, with no Cloudflare setup. It uses real Blind RSA cryptography, but everything happens in one process: the issuer key is generated locally and attestation is stubbed out. It is a quick way to see the protocol in action.
Prerequisites
Run the example
The @cloudflare/privacypass-ts library ships runnable examples. Clone the repository and install dependencies:
git clone https://github.com/cloudflare/privacypass-ts.git
cd privacypass-ts
npm ci
The publicly-verifiable example (pub_verif.example.ts) only exports its functions, so add a small runner that calls just that one. Create examples/run-pub-verif.ts:
import { publicVerifiableTokensPSS } from "./pub_verif.example.js";
await publicVerifiableTokensPSS();
Compile the examples and run your runner:
npx tsc -b examples
node ./lib/examples/run-pub-verif.js
It prints:
Public-Verifiable tokens
Suite: ...
Valid token: true
Valid token: true means a token was issued, unblinded, and verified successfully.
How the example maps to the four roles
The example creates an Issuer, a Client, and an Origin in a single process (the Issuer key pair is generated up front in setup() with Issuer.generateKey), then runs them through the protocol.
The example follows the flow described in the diagram, and only exercises the Origin, Client, and Issuer. The Attester is stubbed and left out of the diagram since no real attestation runs here.
┌────────┐ ┌────────┐ ┌────────┐
│ Origin │ │ Client │ │ Issuer │
└────────┘ └────────┘ └────────┘
│ │ │
│<────── Request ───────│ │
│─── TokenChallenge ───>│ │
│ │ │
│ │───── TokenRequest ─────>│
│ │<──── TokenResponse ─────│
│ │ │
│<─── Request+Token ────│ │
Each call in the example maps to one step in that flow:
const redemptionContext = crypto.getRandomValues(new Uint8Array(32));
const tokChl = origin.createTokenChallenge(issuer.name, redemptionContext); // Origin issues a token challenge
const tokReq = await client.createTokenRequest(tokChl, pkIssuer); // Client sends blinded request
const tokRes = await issuer.issue(tokReq); // Issuer signs the blinded request
const token = await client.finalize(tokRes); // Client finalizes token and resends request with it
const isValid = await origin.verify(token, issuer.publicKey); // Origin verifies against the issuer key
:::note This demonstrates the protocol and the cryptography. It does not reflect a real deployment: in production the roles are operated by separate parties, attestation is real, and the issuer is run by Cloudflare. To validate a real, Cloudflare-operated deployment, refer to Production Deployment Testing. :::
Next steps
- Production Deployment Testing — when you are ready to go beyond these self-serve demos, this is the in-depth guide to validating a real, Cloudflare-operated deployment, with your Attester, Issuer, and Origin working together.
- Privacy Pass Protocol — the four roles, the issuance and redemption flow, and the blinded signatures that produce tokens.
- Deployment Models — who operates each role and the deployment models.
谢谢你的反馈!