Skip to content

Commit cb3522f

Browse files
Merge remote-tracking branch 'thibault/upgrade-privacypass-ts' into arbitrary_batched_toknes
2 parents c632a40 + b262e17 commit cb3522f

6 files changed

+79
-123
lines changed

package-lock.json

+35-77
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@
3434
}
3535
},
3636
"devDependencies": {
37-
"@cloudflare/blindrsa-ts": "0.3.2",
37+
"@cloudflare/blindrsa-ts": "file:./vendor/cloudflare-blindrsa-ts-0.4.2.tgz",
3838
"@cloudflare/workers-types": "4.20240605.0",
3939
"@types/jest": "29.5.11",
4040
"@typescript-eslint/eslint-plugin": "6.21.0",
4141
"@typescript-eslint/parser": "6.21.0",
4242
"commander": "12.1.0",
4343
"dotenv": "16.4.0",
4444
"esbuild": "0.25.0",
45-
"eslint": "8.56.0",
45+
"eslint": "8.57.0",
4646
"eslint-config-prettier": "9.1.0",
4747
"eslint-config-typescript": "3.0.0",
4848
"git-rev-sync": "3.0.2",
@@ -63,5 +63,8 @@
6363
"promjs": "0.4.2",
6464
"toucan-js": "3.3.1",
6565
"typescript": "5.3.3"
66+
},
67+
"overrides": {
68+
"@cloudflare/blindrsa-ts": "file:./vendor/cloudflare-blindrsa-ts-0.4.2.tgz"
6669
}
6770
}

test/e2e/issuer.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,19 @@ export async function testTokenRequest(client, origin, issuerName: string, mTLS?
149149
});
150150

151151
if (!response.ok) {
152-
throw new Error(`Issuer request failed: ${response.status} ${response.statusText}`);
152+
throw new Error(
153+
`Issuer request failed: ${response.status} ${response.statusText}\n${await response.text()}`
154+
);
153155
}
154156

155157
const tokenResponse = publicVerif.TokenResponse.deserialize(
156158
new Uint8Array(await response.arrayBuffer())
157159
);
158160
const token = await client.finalize(tokenResponse);
159161

162+
const origin = new Origin(BlindRSAMode.PSS);
160163
return (
164+
(await origin.verify(token, issuerPublicKey)) &&
161165
(await origin.verify(token, issuerPublicKey)) &&
162166
response.headers.get('Content-Type') === MediaType.PRIVATE_TOKEN_RESPONSE
163167
);

test/index.test.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
MediaType,
2222
PRIVATE_TOKEN_ISSUER_DIRECTORY,
2323
publicVerif,
24+
TOKEN_TYPES,
2425
util,
2526
} from '@cloudflare/privacypass-ts';
2627
import { getDirectoryCache } from '../src/cache';
@@ -77,7 +78,7 @@ describe('challenge handlers', () => {
7778
const tokenKeyId = await keyToTokenKeyID(new TextEncoder().encode(publicKeyEnc));
7879

7980
// note that blindedMsg should be the payload and not the message directly
80-
const tokenRequest = new TokenRequest(tokenKeyId, blindedMsg, BLIND_RSA);
81+
const tokenRequest = new TokenRequest(tokenKeyId, blindedMsg, TOKEN_TYPES.BLIND_RSA);
8182

8283
const request = new Request(tokenRequestURL, {
8384
method: 'POST',

0 commit comments

Comments
 (0)