@kya-os/checkpoint-shared 1.7.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +159 -9
- package/README.md +24 -7
- package/dist/agent-catalog.d.mts +12 -0
- package/dist/agent-catalog.d.mts.map +1 -0
- package/dist/agent-catalog.d.ts +12 -0
- package/dist/agent-catalog.d.ts.map +1 -0
- package/dist/agent-catalog.js +105 -0
- package/dist/agent-catalog.mjs +105 -0
- package/dist/agent-catalog.mjs.map +1 -0
- package/dist/beacon-nonce/index.d.mts +1 -0
- package/dist/beacon-nonce/index.d.mts.map +1 -1
- package/dist/beacon-nonce/index.d.ts +1 -0
- package/dist/beacon-nonce/index.d.ts.map +1 -1
- package/dist/beacon-nonce/index.js +9 -3
- package/dist/beacon-nonce/index.mjs +9 -4
- package/dist/beacon-nonce/index.mjs.map +1 -1
- package/dist/beacon-types/index.d.mts +41 -1
- package/dist/beacon-types/index.d.mts.map +1 -1
- package/dist/beacon-types/index.d.ts +41 -1
- package/dist/beacon-types/index.d.ts.map +1 -1
- package/dist/beacon-types/index.js +153 -4
- package/dist/beacon-types/index.mjs +139 -4
- package/dist/beacon-types/index.mjs.map +1 -1
- package/dist/{browser-posture-BLhw-MON.d.mts → browser-posture-5fPrsxx7.d.mts} +6 -6
- package/dist/{browser-posture-BLhw-MON.d.mts.map → browser-posture-5fPrsxx7.d.mts.map} +1 -1
- package/dist/{browser-posture-B8YiPa5c.d.ts → browser-posture-CCR1kh5e.d.ts} +6 -6
- package/dist/{browser-posture-B8YiPa5c.d.ts.map → browser-posture-CCR1kh5e.d.ts.map} +1 -1
- package/dist/browser-posture-cookie.js +1 -1
- package/dist/browser-posture-cookie.mjs +1 -1
- package/dist/browser-posture-cookie.mjs.map +1 -1
- package/dist/browser-posture-proof-verifier-DvsOmFrM.js +202 -0
- package/dist/browser-posture-proof-verifier-I0HP2Ics.mjs +180 -0
- package/dist/browser-posture-proof-verifier-I0HP2Ics.mjs.map +1 -0
- package/dist/browser-posture-proof-verifier.d.mts +25 -0
- package/dist/browser-posture-proof-verifier.d.mts.map +1 -0
- package/dist/browser-posture-proof-verifier.d.ts +25 -0
- package/dist/browser-posture-proof-verifier.d.ts.map +1 -0
- package/dist/browser-posture-proof-verifier.js +7 -0
- package/dist/browser-posture-proof-verifier.mjs +3 -0
- package/dist/browser-posture-proof.d.mts +4 -5
- package/dist/browser-posture-proof.d.mts.map +1 -1
- package/dist/browser-posture-proof.d.ts +4 -5
- package/dist/browser-posture-proof.d.ts.map +1 -1
- package/dist/browser-posture-proof.js +10 -79
- package/dist/browser-posture-proof.mjs +6 -77
- package/dist/browser-posture-proof.mjs.map +1 -1
- package/dist/browser-posture.d.mts +1 -1
- package/dist/browser-posture.d.ts +1 -1
- package/dist/browser-posture.js +6 -5
- package/dist/browser-posture.mjs +4 -3
- package/dist/browser-posture.mjs.map +1 -1
- package/dist/browser.d.mts +25 -286
- package/dist/browser.d.mts.map +1 -1
- package/dist/browser.d.ts +25 -286
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +1 -1
- package/dist/browser.mjs +1 -1
- package/dist/browser.mjs.map +1 -1
- package/dist/canonical-signer/index.js +30 -28
- package/dist/canonical-signer/index.mjs +31 -1
- package/dist/canonical-signer/index.mjs.map +1 -1
- package/dist/clearance.d.mts +1 -1
- package/dist/clearance.d.ts +1 -1
- package/dist/clearance.js +2 -2
- package/dist/clearance.mjs +2 -2
- package/dist/client-ip-B7w-uHfS.d.mts +55 -0
- package/dist/client-ip-B7w-uHfS.d.mts.map +1 -0
- package/dist/client-ip-B7w-uHfS.d.ts +55 -0
- package/dist/client-ip-B7w-uHfS.d.ts.map +1 -0
- package/dist/{client-ip-CW6pRyLf.js → client-ip-B8wFzJ5f.js} +117 -7
- package/dist/{client-ip-B2Xeo-GK.mjs → client-ip-DIJyr6px.mjs} +113 -9
- package/dist/client-ip-DIJyr6px.mjs.map +1 -0
- package/dist/client-ip.d.mts +2 -2
- package/dist/client-ip.d.ts +2 -2
- package/dist/client-ip.js +3 -2
- package/dist/client-ip.mjs +2 -2
- package/dist/consent-handoff.d.mts +0 -3
- package/dist/consent-handoff.d.mts.map +1 -1
- package/dist/consent-handoff.d.ts +0 -3
- package/dist/consent-handoff.d.ts.map +1 -1
- package/dist/consent-handoff.mjs.map +1 -1
- package/dist/default-sign-in-host.d.mts +10 -0
- package/dist/default-sign-in-host.d.mts.map +1 -0
- package/dist/default-sign-in-host.d.ts +10 -0
- package/dist/default-sign-in-host.d.ts.map +1 -0
- package/dist/default-sign-in-host.js +72 -0
- package/dist/default-sign-in-host.mjs +66 -0
- package/dist/default-sign-in-host.mjs.map +1 -0
- package/dist/detection-reason-mapping-B9RSkOs8.js +277 -0
- package/dist/detection-reason-mapping-BGymWIPl.mjs +249 -0
- package/dist/detection-reason-mapping-BGymWIPl.mjs.map +1 -0
- package/dist/detection-reason-mapping-CQexNvR7.d.mts +52 -0
- package/dist/detection-reason-mapping-CQexNvR7.d.mts.map +1 -0
- package/dist/detection-reason-mapping-CQexNvR7.d.ts +52 -0
- package/dist/detection-reason-mapping-CQexNvR7.d.ts.map +1 -0
- package/dist/engine-enforcing-AYEcgNsb.js +39 -0
- package/dist/engine-enforcing-B5eNfCpG.mjs +29 -0
- package/dist/engine-enforcing-B5eNfCpG.mjs.map +1 -0
- package/dist/engine-enforcing-DiOclGqf.d.mts +11 -0
- package/dist/engine-enforcing-DiOclGqf.d.mts.map +1 -0
- package/dist/engine-enforcing-DiOclGqf.d.ts +11 -0
- package/dist/engine-enforcing-DiOclGqf.d.ts.map +1 -0
- package/dist/engine-info.d.mts +2 -0
- package/dist/engine-info.d.ts +2 -0
- package/dist/engine-info.js +4 -0
- package/dist/engine-info.mjs +3 -0
- package/dist/errors/index.d.mts +6 -0
- package/dist/errors/index.d.mts.map +1 -1
- package/dist/errors/index.d.ts +6 -0
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +28 -6
- package/dist/errors/index.mjs +28 -6
- package/dist/errors/index.mjs.map +1 -1
- package/dist/{external-B7WI9FyQ.d.ts → external-m3Kmafwj.d.mts} +2 -2
- package/dist/{external-B7WI9FyQ.d.mts.map → external-m3Kmafwj.d.mts.map} +1 -1
- package/dist/{external-B7WI9FyQ.d.mts → external-m3Kmafwj.d.ts} +2 -2
- package/dist/{external-B7WI9FyQ.d.ts.map → external-m3Kmafwj.d.ts.map} +1 -1
- package/dist/fetcher-C8qvwdnA.d.ts +44 -0
- package/dist/fetcher-C8qvwdnA.d.ts.map +1 -0
- package/dist/fetcher-D2vjr7jB.d.mts +44 -0
- package/dist/fetcher-D2vjr7jB.d.mts.map +1 -0
- package/dist/gateway-client-ip.d.mts +1 -3
- package/dist/gateway-client-ip.d.mts.map +1 -1
- package/dist/gateway-client-ip.d.ts +1 -3
- package/dist/gateway-client-ip.d.ts.map +1 -1
- package/dist/gateway-client-ip.js +2 -2
- package/dist/gateway-client-ip.mjs +2 -2
- package/dist/gateway-client-ip.mjs.map +1 -1
- package/dist/host-adapter/index.d.mts +2 -2
- package/dist/host-adapter/index.d.ts +2 -2
- package/dist/host-adapter/index.js +2 -1
- package/dist/host-adapter/index.mjs +2 -2
- package/dist/{host-adapter-C-4IxmqM.mjs → host-adapter-BKdQHwbi.mjs} +56 -3
- package/dist/{host-adapter-C-4IxmqM.mjs.map → host-adapter-BKdQHwbi.mjs.map} +1 -1
- package/dist/{host-adapter-CwW9YB0U.js → host-adapter-bWftXA9T.js} +60 -1
- package/dist/index-DnFsmr_o.d.ts +156 -0
- package/dist/index-DnFsmr_o.d.ts.map +1 -0
- package/dist/index-rvw5Bz-r.d.mts +156 -0
- package/dist/index-rvw5Bz-r.d.mts.map +1 -0
- package/dist/index.d.mts +6681 -11335
- package/dist/index.d.mts.map +1 -1
- package/dist/index.d.ts +6681 -11335
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2322 -6900
- package/dist/index.mjs +2236 -6574
- package/dist/index.mjs.map +1 -1
- package/dist/{kya-http-error-codes-UYb1zpGM.js → kya-http-error-codes-B4rUmUEI.js} +2 -0
- package/dist/{kya-http-error-codes-7ewV5RuK.d.ts → kya-http-error-codes-C14E4gi3.d.mts} +2 -1
- package/dist/kya-http-error-codes-C14E4gi3.d.mts.map +1 -0
- package/dist/{kya-http-error-codes-7ewV5RuK.d.mts → kya-http-error-codes-C14E4gi3.d.ts} +2 -1
- package/dist/kya-http-error-codes-C14E4gi3.d.ts.map +1 -0
- package/dist/{kya-http-error-codes-C2JiWPsi.mjs → kya-http-error-codes-DSBrxNry.mjs} +3 -1
- package/dist/kya-http-error-codes-DSBrxNry.mjs.map +1 -0
- package/dist/kya-http.d.mts +3 -3
- package/dist/kya-http.d.ts +3 -3
- package/dist/kya-http.js +10 -2
- package/dist/kya-http.mjs +4 -3
- package/dist/mcpi/dashboard-config/index.d.mts.map +1 -1
- package/dist/mcpi/dashboard-config/index.d.ts.map +1 -1
- package/dist/mcpi/dashboard-config/index.mjs.map +1 -1
- package/dist/mcpi/status-list/index.d.mts +72 -0
- package/dist/mcpi/status-list/index.d.mts.map +1 -0
- package/dist/mcpi/status-list/index.d.ts +72 -0
- package/dist/mcpi/status-list/index.d.ts.map +1 -0
- package/dist/mcpi/status-list/index.js +703 -0
- package/dist/mcpi/status-list/index.mjs +684 -0
- package/dist/mcpi/status-list/index.mjs.map +1 -0
- package/dist/patterns-Bp40cwh2.d.mts +110 -0
- package/dist/patterns-Bp40cwh2.d.mts.map +1 -0
- package/dist/patterns-Bp40cwh2.d.ts +110 -0
- package/dist/patterns-Bp40cwh2.d.ts.map +1 -0
- package/dist/patterns-CiMpbdAF.js +243 -0
- package/dist/patterns-D4OAsNQY.mjs +173 -0
- package/dist/patterns-D4OAsNQY.mjs.map +1 -0
- package/dist/patterns.d.mts +2 -0
- package/dist/patterns.d.ts +2 -0
- package/dist/patterns.js +15 -0
- package/dist/patterns.mjs +3 -0
- package/dist/policy/enforcement.d.mts +3 -2
- package/dist/policy/enforcement.d.ts +3 -2
- package/dist/policy/enforcement.js +8 -2
- package/dist/policy/enforcement.mjs +3 -2
- package/dist/policy/fetcher.d.mts +2 -0
- package/dist/policy/fetcher.d.ts +2 -0
- package/dist/policy/fetcher.js +240 -0
- package/dist/policy/fetcher.mjs +238 -0
- package/dist/policy/fetcher.mjs.map +1 -0
- package/dist/policy/schemas.d.mts +3 -0
- package/dist/policy/schemas.d.ts +3 -0
- package/dist/policy/schemas.js +27 -0
- package/dist/policy/schemas.mjs +4 -0
- package/dist/{posture-origins-Ba83O0cD.mjs → posture-origins-Ci6k4Zh1.js} +24 -173
- package/dist/{posture-origins-CdVOdiMT.js → posture-origins-DGyS4Vuk.mjs} +2 -267
- package/dist/posture-origins-DGyS4Vuk.mjs.map +1 -0
- package/dist/{project-verification-key-BccT12tQ.js → project-verification-key-B-L3D2nC.js} +1 -1
- package/dist/{project-verification-key-66N4edKn.mjs → project-verification-key-CWXdu3-n.mjs} +2 -2
- package/dist/{project-verification-key-66N4edKn.mjs.map → project-verification-key-CWXdu3-n.mjs.map} +1 -1
- package/dist/provider-registry.d.mts +2 -0
- package/dist/provider-registry.d.ts +2 -0
- package/dist/provider-registry.js +51 -0
- package/dist/provider-registry.mjs +3 -0
- package/dist/reason-codes.d.mts +2 -0
- package/dist/reason-codes.d.ts +2 -0
- package/dist/reason-codes.js +8 -0
- package/dist/reason-codes.mjs +3 -0
- package/dist/{registered-sid-hUl-bvM5.mjs → registered-sid-26hNxp6t.mjs} +11 -2
- package/dist/registered-sid-26hNxp6t.mjs.map +1 -0
- package/dist/registered-sid-D6KCaT1E.d.mts +33 -0
- package/dist/registered-sid-D6KCaT1E.d.mts.map +1 -0
- package/dist/registered-sid-D6KCaT1E.d.ts +33 -0
- package/dist/registered-sid-D6KCaT1E.d.ts.map +1 -0
- package/dist/{registered-sid-eLCNZvIF.js → registered-sid-DVGTSH0L.js} +15 -0
- package/dist/ruleset-hash-Cmv8MSO5.js +34 -0
- package/dist/ruleset-hash-IRN5eI9H.d.mts +5 -0
- package/dist/ruleset-hash-IRN5eI9H.d.mts.map +1 -0
- package/dist/ruleset-hash-IRN5eI9H.d.ts +5 -0
- package/dist/ruleset-hash-IRN5eI9H.d.ts.map +1 -0
- package/dist/ruleset-hash-QQIaLuPi.mjs +30 -0
- package/dist/ruleset-hash-QQIaLuPi.mjs.map +1 -0
- package/dist/{schemas-YhagYDx_.js → schemas-BlScS1it.js} +0 -20
- package/dist/{index-HaqfPtaL.d.ts → schemas-CGKHzcMV.d.ts} +23 -195
- package/dist/schemas-CGKHzcMV.d.ts.map +1 -0
- package/dist/schemas-Cm4C4Z5G.js +703 -0
- package/dist/schemas-DPIT8usF.mjs +525 -0
- package/dist/schemas-DPIT8usF.mjs.map +1 -0
- package/dist/{schemas-7qodsG-Z.mjs → schemas-IHAhH3gV.mjs} +2 -16
- package/dist/schemas-IHAhH3gV.mjs.map +1 -0
- package/dist/{index-B7rTovHa.d.mts → schemas-m-GqyfyO.d.mts} +23 -195
- package/dist/schemas-m-GqyfyO.d.mts.map +1 -0
- package/dist/{step-up-COlmWJN8.mjs → step-up-BK0oBi11.mjs} +91 -41
- package/dist/step-up-BK0oBi11.mjs.map +1 -0
- package/dist/{step-up-C2d8C20x.js → step-up-Bp8RAQwv.js} +117 -55
- package/dist/{step-up-BjP--hG-.d.mts → step-up-Bz12gYKT.d.mts} +28 -12
- package/dist/step-up-Bz12gYKT.d.mts.map +1 -0
- package/dist/{step-up-BjP--hG-.d.ts → step-up-Bz12gYKT.d.ts} +28 -12
- package/dist/step-up-Bz12gYKT.d.ts.map +1 -0
- package/dist/test-fixtures/index.d.mts +4 -4
- package/dist/test-fixtures/index.d.mts.map +1 -1
- package/dist/test-fixtures/index.d.ts +4 -4
- package/dist/test-fixtures/index.d.ts.map +1 -1
- package/dist/test-fixtures/index.js +4 -4
- package/dist/test-fixtures/index.mjs +4 -4
- package/dist/test-fixtures/index.mjs.map +1 -1
- package/dist/tool-protection/index.d.mts +12 -0
- package/dist/tool-protection/index.d.mts.map +1 -1
- package/dist/tool-protection/index.d.ts +12 -0
- package/dist/tool-protection/index.d.ts.map +1 -1
- package/dist/tool-protection/index.js +46 -0
- package/dist/tool-protection/index.mjs +44 -1
- package/dist/tool-protection/index.mjs.map +1 -1
- package/dist/verification-BAw9N8Pt.js +181 -0
- package/dist/verification-Cvvv86TT.mjs +123 -0
- package/dist/verification-Cvvv86TT.mjs.map +1 -0
- package/fixtures/client-ip-resolution.n01.json +101 -0
- package/fixtures/kya-http/error-codes.json +2 -1
- package/fixtures/reviewer-grant-revocation.v1.json +53 -81
- package/package.json +55 -4
- package/dist/client-ip-B2Xeo-GK.mjs.map +0 -1
- package/dist/client-ip-DFamiNoz.d.mts +0 -34
- package/dist/client-ip-DFamiNoz.d.mts.map +0 -1
- package/dist/client-ip-DFamiNoz.d.ts +0 -34
- package/dist/client-ip-DFamiNoz.d.ts.map +0 -1
- package/dist/index-B7rTovHa.d.mts.map +0 -1
- package/dist/index-HaqfPtaL.d.ts.map +0 -1
- package/dist/kya-http-error-codes-7ewV5RuK.d.mts.map +0 -1
- package/dist/kya-http-error-codes-7ewV5RuK.d.ts.map +0 -1
- package/dist/kya-http-error-codes-C2JiWPsi.mjs.map +0 -1
- package/dist/posture-origins-Ba83O0cD.mjs.map +0 -1
- package/dist/registered-sid-D3g-gZQF.d.mts +0 -11
- package/dist/registered-sid-D3g-gZQF.d.mts.map +0 -1
- package/dist/registered-sid-D3g-gZQF.d.ts +0 -11
- package/dist/registered-sid-D3g-gZQF.d.ts.map +0 -1
- package/dist/registered-sid-hUl-bvM5.mjs.map +0 -1
- package/dist/schemas-7qodsG-Z.mjs.map +0 -1
- package/dist/step-up-BjP--hG-.d.mts.map +0 -1
- package/dist/step-up-BjP--hG-.d.ts.map +0 -1
- package/dist/step-up-COlmWJN8.mjs.map +0 -1
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { A as ZodString, B as $strip, T as ZodObject, t as external_d_exports, w as ZodNumber } from "./external-m3Kmafwj.js";
|
|
2
|
+
import { BrowserPostureProof, BrowserPostureProofFailure, BrowserPostureProofResult, DEFAULT_POSTURE_PROOF_MAX_AGE_SECONDS, POSTURE_PROOF_TYPE, browserPostureKeyThumbprint, verifyBrowserPostureProofKey } from "./browser-posture-proof-verifier.js";
|
|
3
|
+
import { N as BrowserPosture } from "./browser-posture-CCR1kh5e.js";
|
|
3
4
|
//#region src/browser-posture-proof.d.ts
|
|
4
|
-
export declare const POSTURE_PROOF_TYPE = "dpop+jwt";
|
|
5
|
-
export declare const DEFAULT_POSTURE_PROOF_MAX_AGE_SECONDS = 60;
|
|
6
5
|
export declare const BrowserPostureProofSchema: ZodObject<{
|
|
7
6
|
jti: ZodString;
|
|
8
7
|
htm: ZodString;
|
|
9
8
|
htu: ZodString;
|
|
10
9
|
iat: ZodNumber;
|
|
11
10
|
}, $strip>;
|
|
12
|
-
export type BrowserPostureProof = output<typeof BrowserPostureProofSchema>;
|
|
13
11
|
export declare function verifyBrowserPostureProof(proofJws: string | undefined, posture: BrowserPosture, request: {
|
|
14
12
|
method: string;
|
|
15
13
|
url: string;
|
|
16
14
|
}, now?: number, maxAgeSeconds?: number): Promise<BrowserPostureProof | undefined>;
|
|
17
15
|
//#endregion
|
|
16
|
+
export { type BrowserPostureProof, type BrowserPostureProofFailure, type BrowserPostureProofResult, DEFAULT_POSTURE_PROOF_MAX_AGE_SECONDS, POSTURE_PROOF_TYPE, browserPostureKeyThumbprint, verifyBrowserPostureProofKey };
|
|
18
17
|
//# sourceMappingURL=browser-posture-proof.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-posture-proof.d.ts","names":[],"sources":["../src/browser-posture-proof.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"browser-posture-proof.d.ts","names":[],"sources":["../src/browser-posture-proof.ts"],"mappings":";;;;qBAoBa,2BAAyB;;;;;GAKK;wBAgBrB,0BACpB,8BACA,SAAS,gBACT;EAAW;EAAgB;GAC3B,cACA,yBACC,QAAQ"}
|
|
@@ -1,63 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_schemas = require('./schemas-
|
|
3
|
-
|
|
2
|
+
const require_schemas = require('./schemas-BlScS1it.js');
|
|
3
|
+
const require_browser_posture_proof_verifier = require('./browser-posture-proof-verifier-DvsOmFrM.js');
|
|
4
4
|
|
|
5
|
-
//#region src/utils/base64url.ts
|
|
6
|
-
/**
|
|
7
|
-
* Base64url (RFC 4648 § 5) built on `atob` and `btoa` rather than Node's
|
|
8
|
-
* buffer API, so it runs on every runtime the SDKs support, Cloudflare Workers
|
|
9
|
-
* without `nodejs_compat` included.
|
|
10
|
-
*/
|
|
11
|
-
const BASE64URL_UNPADDED = /^[A-Za-z0-9_-]*$/;
|
|
12
|
-
const PADDING = 61;
|
|
13
|
-
/**
|
|
14
|
-
* `text` without its trailing `=` padding. A backward scan, not
|
|
15
|
-
* `replace(/=+$/, '')`: that regex retries from every `=` in a long run that
|
|
16
|
-
* does not reach the end, which is quadratic on hostile input.
|
|
17
|
-
*/
|
|
18
|
-
function withoutPadding(text) {
|
|
19
|
-
let end = text.length;
|
|
20
|
-
while (end > 0 && text.charCodeAt(end - 1) === PADDING) end -= 1;
|
|
21
|
-
return text.slice(0, end);
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Decode base64url, with or without `=` padding.
|
|
25
|
-
*
|
|
26
|
-
* Strict where Node's buffer decoder is lenient: a character outside the
|
|
27
|
-
* alphabet, or a length no encoder produces (one character past a multiple of
|
|
28
|
-
* four), throws a `TypeError` instead of being skipped or truncated. This
|
|
29
|
-
* matches the engine's decoder.
|
|
30
|
-
*/
|
|
31
|
-
function base64UrlToBytes(text) {
|
|
32
|
-
const unpadded = withoutPadding(text);
|
|
33
|
-
if (!BASE64URL_UNPADDED.test(unpadded) || unpadded.length % 4 === 1) throw new TypeError("not valid base64url (RFC 4648 § 5)");
|
|
34
|
-
const base64 = unpadded.replace(/-/g, "+").replace(/_/g, "/");
|
|
35
|
-
const binary = atob(base64 + "=".repeat((4 - base64.length % 4) % 4));
|
|
36
|
-
const bytes = new Uint8Array(binary.length);
|
|
37
|
-
for (let index = 0; index < binary.length; index += 1) bytes[index] = binary.charCodeAt(index);
|
|
38
|
-
return bytes;
|
|
39
|
-
}
|
|
40
|
-
/** Decode base64url to a string as UTF-8, replacing invalid sequences with U+FFFD. */
|
|
41
|
-
function base64UrlToString(text) {
|
|
42
|
-
return new TextDecoder().decode(base64UrlToBytes(text));
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
//#endregion
|
|
46
5
|
//#region src/browser-posture-proof.ts
|
|
47
|
-
/**
|
|
48
|
-
* RFC 9449 DPoP-shaped proof verification (P37): binds a browser-posture
|
|
49
|
-
* token to a non-extractable key the page holds, so the posture token's
|
|
50
|
-
* TTL stops being the whole replay window. The literal RFC 9449 `typ`
|
|
51
|
-
* value, not a project-specific string like the posture token's own
|
|
52
|
-
* `checkpoint-posture+jwt` - adopting the registered value buys real
|
|
53
|
-
* interoperability with any existing DPoP-aware tooling for no cost.
|
|
54
|
-
*/
|
|
55
|
-
const POSTURE_PROOF_TYPE = "dpop+jwt";
|
|
56
|
-
/** Half the posture TTL: a per-request, single-use artifact needs a much
|
|
57
|
-
* tighter freshness window than a session-scoped token. A caller-supplied
|
|
58
|
-
* parameter, not a private constant - this must never repeat
|
|
59
|
-
* `POSTURE_TTL_SECONDS`'s own hardcoding mistake. */
|
|
60
|
-
const DEFAULT_POSTURE_PROOF_MAX_AGE_SECONDS = 60;
|
|
61
6
|
const BrowserPostureProofSchema = require_schemas.object({
|
|
62
7
|
jti: require_schemas.string().min(1).max(255),
|
|
63
8
|
htm: require_schemas.string().min(1).max(16),
|
|
@@ -79,29 +24,15 @@ const BrowserPostureProofSchema = require_schemas.object({
|
|
|
79
24
|
* replay store as the final step before trusting the request.
|
|
80
25
|
*/
|
|
81
26
|
async function verifyBrowserPostureProof(proofJws, posture, request, now = Math.floor(Date.now() / 1e3), maxAgeSeconds = 60) {
|
|
82
|
-
if (!
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (decoded.typ !== "dpop+jwt" || decoded.alg !== "ES256" || !decoded.jwk || decoded.jwk.kty !== "EC" || decoded.jwk.crv !== "P-256" || decoded.jwk.d) return void 0;
|
|
86
|
-
if (await (0, jose.calculateJwkThumbprint)(decoded.jwk, "sha256") !== posture.cnf.jkt) return void 0;
|
|
87
|
-
const key = await (0, jose.importJWK)(decoded.jwk, "ES256");
|
|
88
|
-
const { payload } = await (0, jose.jwtVerify)(proofJws, key, {
|
|
89
|
-
algorithms: ["ES256"],
|
|
90
|
-
typ: POSTURE_PROOF_TYPE,
|
|
91
|
-
currentDate: /* @__PURE__ */ new Date(now * 1e3)
|
|
92
|
-
});
|
|
93
|
-
const parsed = BrowserPostureProofSchema.safeParse(payload);
|
|
94
|
-
if (!parsed.success) return void 0;
|
|
95
|
-
const claims = parsed.data;
|
|
96
|
-
if (claims.htm.toUpperCase() !== request.method.toUpperCase() || claims.htu !== request.url || Math.abs(now - claims.iat) > maxAgeSeconds) return void 0;
|
|
97
|
-
return claims;
|
|
98
|
-
} catch {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
27
|
+
if (!posture.cnf) return void 0;
|
|
28
|
+
const result = await require_browser_posture_proof_verifier.verifyBrowserPostureProofKey(proofJws, request, posture.cnf.jkt, now, maxAgeSeconds);
|
|
29
|
+
return result.verified ? result.claims : void 0;
|
|
101
30
|
}
|
|
102
31
|
|
|
103
32
|
//#endregion
|
|
104
33
|
exports.BrowserPostureProofSchema = BrowserPostureProofSchema;
|
|
105
|
-
exports.DEFAULT_POSTURE_PROOF_MAX_AGE_SECONDS = DEFAULT_POSTURE_PROOF_MAX_AGE_SECONDS;
|
|
106
|
-
exports.POSTURE_PROOF_TYPE = POSTURE_PROOF_TYPE;
|
|
107
|
-
exports.
|
|
34
|
+
exports.DEFAULT_POSTURE_PROOF_MAX_AGE_SECONDS = require_browser_posture_proof_verifier.DEFAULT_POSTURE_PROOF_MAX_AGE_SECONDS;
|
|
35
|
+
exports.POSTURE_PROOF_TYPE = require_browser_posture_proof_verifier.POSTURE_PROOF_TYPE;
|
|
36
|
+
exports.browserPostureKeyThumbprint = require_browser_posture_proof_verifier.browserPostureKeyThumbprint;
|
|
37
|
+
exports.verifyBrowserPostureProof = verifyBrowserPostureProof;
|
|
38
|
+
exports.verifyBrowserPostureProofKey = require_browser_posture_proof_verifier.verifyBrowserPostureProofKey;
|
|
@@ -1,62 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { S as string, _ as number, v as object } from "./schemas-IHAhH3gV.mjs";
|
|
2
|
+
import { i as verifyBrowserPostureProofKey, n as POSTURE_PROOF_TYPE, r as browserPostureKeyThumbprint, t as DEFAULT_POSTURE_PROOF_MAX_AGE_SECONDS } from "./browser-posture-proof-verifier-I0HP2Ics.mjs";
|
|
3
3
|
|
|
4
|
-
//#region src/utils/base64url.ts
|
|
5
|
-
/**
|
|
6
|
-
* Base64url (RFC 4648 § 5) built on `atob` and `btoa` rather than Node's
|
|
7
|
-
* buffer API, so it runs on every runtime the SDKs support, Cloudflare Workers
|
|
8
|
-
* without `nodejs_compat` included.
|
|
9
|
-
*/
|
|
10
|
-
const BASE64URL_UNPADDED = /^[A-Za-z0-9_-]*$/;
|
|
11
|
-
const PADDING = 61;
|
|
12
|
-
/**
|
|
13
|
-
* `text` without its trailing `=` padding. A backward scan, not
|
|
14
|
-
* `replace(/=+$/, '')`: that regex retries from every `=` in a long run that
|
|
15
|
-
* does not reach the end, which is quadratic on hostile input.
|
|
16
|
-
*/
|
|
17
|
-
function withoutPadding(text) {
|
|
18
|
-
let end = text.length;
|
|
19
|
-
while (end > 0 && text.charCodeAt(end - 1) === PADDING) end -= 1;
|
|
20
|
-
return text.slice(0, end);
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Decode base64url, with or without `=` padding.
|
|
24
|
-
*
|
|
25
|
-
* Strict where Node's buffer decoder is lenient: a character outside the
|
|
26
|
-
* alphabet, or a length no encoder produces (one character past a multiple of
|
|
27
|
-
* four), throws a `TypeError` instead of being skipped or truncated. This
|
|
28
|
-
* matches the engine's decoder.
|
|
29
|
-
*/
|
|
30
|
-
function base64UrlToBytes(text) {
|
|
31
|
-
const unpadded = withoutPadding(text);
|
|
32
|
-
if (!BASE64URL_UNPADDED.test(unpadded) || unpadded.length % 4 === 1) throw new TypeError("not valid base64url (RFC 4648 § 5)");
|
|
33
|
-
const base64 = unpadded.replace(/-/g, "+").replace(/_/g, "/");
|
|
34
|
-
const binary = atob(base64 + "=".repeat((4 - base64.length % 4) % 4));
|
|
35
|
-
const bytes = new Uint8Array(binary.length);
|
|
36
|
-
for (let index = 0; index < binary.length; index += 1) bytes[index] = binary.charCodeAt(index);
|
|
37
|
-
return bytes;
|
|
38
|
-
}
|
|
39
|
-
/** Decode base64url to a string as UTF-8, replacing invalid sequences with U+FFFD. */
|
|
40
|
-
function base64UrlToString(text) {
|
|
41
|
-
return new TextDecoder().decode(base64UrlToBytes(text));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
//#endregion
|
|
45
4
|
//#region src/browser-posture-proof.ts
|
|
46
|
-
/**
|
|
47
|
-
* RFC 9449 DPoP-shaped proof verification (P37): binds a browser-posture
|
|
48
|
-
* token to a non-extractable key the page holds, so the posture token's
|
|
49
|
-
* TTL stops being the whole replay window. The literal RFC 9449 `typ`
|
|
50
|
-
* value, not a project-specific string like the posture token's own
|
|
51
|
-
* `checkpoint-posture+jwt` - adopting the registered value buys real
|
|
52
|
-
* interoperability with any existing DPoP-aware tooling for no cost.
|
|
53
|
-
*/
|
|
54
|
-
const POSTURE_PROOF_TYPE = "dpop+jwt";
|
|
55
|
-
/** Half the posture TTL: a per-request, single-use artifact needs a much
|
|
56
|
-
* tighter freshness window than a session-scoped token. A caller-supplied
|
|
57
|
-
* parameter, not a private constant - this must never repeat
|
|
58
|
-
* `POSTURE_TTL_SECONDS`'s own hardcoding mistake. */
|
|
59
|
-
const DEFAULT_POSTURE_PROOF_MAX_AGE_SECONDS = 60;
|
|
60
5
|
const BrowserPostureProofSchema = object({
|
|
61
6
|
jti: string().min(1).max(255),
|
|
62
7
|
htm: string().min(1).max(16),
|
|
@@ -78,27 +23,11 @@ const BrowserPostureProofSchema = object({
|
|
|
78
23
|
* replay store as the final step before trusting the request.
|
|
79
24
|
*/
|
|
80
25
|
async function verifyBrowserPostureProof(proofJws, posture, request, now = Math.floor(Date.now() / 1e3), maxAgeSeconds = 60) {
|
|
81
|
-
if (!
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (decoded.typ !== "dpop+jwt" || decoded.alg !== "ES256" || !decoded.jwk || decoded.jwk.kty !== "EC" || decoded.jwk.crv !== "P-256" || decoded.jwk.d) return void 0;
|
|
85
|
-
if (await calculateJwkThumbprint(decoded.jwk, "sha256") !== posture.cnf.jkt) return void 0;
|
|
86
|
-
const key = await importJWK(decoded.jwk, "ES256");
|
|
87
|
-
const { payload } = await jwtVerify(proofJws, key, {
|
|
88
|
-
algorithms: ["ES256"],
|
|
89
|
-
typ: POSTURE_PROOF_TYPE,
|
|
90
|
-
currentDate: /* @__PURE__ */ new Date(now * 1e3)
|
|
91
|
-
});
|
|
92
|
-
const parsed = BrowserPostureProofSchema.safeParse(payload);
|
|
93
|
-
if (!parsed.success) return void 0;
|
|
94
|
-
const claims = parsed.data;
|
|
95
|
-
if (claims.htm.toUpperCase() !== request.method.toUpperCase() || claims.htu !== request.url || Math.abs(now - claims.iat) > maxAgeSeconds) return void 0;
|
|
96
|
-
return claims;
|
|
97
|
-
} catch {
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
26
|
+
if (!posture.cnf) return void 0;
|
|
27
|
+
const result = await verifyBrowserPostureProofKey(proofJws, request, posture.cnf.jkt, now, maxAgeSeconds);
|
|
28
|
+
return result.verified ? result.claims : void 0;
|
|
100
29
|
}
|
|
101
30
|
|
|
102
31
|
//#endregion
|
|
103
|
-
export { BrowserPostureProofSchema, DEFAULT_POSTURE_PROOF_MAX_AGE_SECONDS, POSTURE_PROOF_TYPE, verifyBrowserPostureProof };
|
|
32
|
+
export { BrowserPostureProofSchema, DEFAULT_POSTURE_PROOF_MAX_AGE_SECONDS, POSTURE_PROOF_TYPE, browserPostureKeyThumbprint, verifyBrowserPostureProof, verifyBrowserPostureProofKey };
|
|
104
33
|
//# sourceMappingURL=browser-posture-proof.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-posture-proof.mjs","names":["z.object","z.string","z.number"],"sources":["../src/
|
|
1
|
+
{"version":3,"file":"browser-posture-proof.mjs","names":["z.object","z.string","z.number"],"sources":["../src/browser-posture-proof.ts"],"sourcesContent":["import { z } from 'zod';\nimport type { BrowserPosture } from './browser-posture';\nimport {\n DEFAULT_POSTURE_PROOF_MAX_AGE_SECONDS,\n verifyBrowserPostureProofKey,\n type BrowserPostureProof,\n} from './browser-posture-proof-verifier';\n\nexport {\n browserPostureKeyThumbprint,\n DEFAULT_POSTURE_PROOF_MAX_AGE_SECONDS,\n POSTURE_PROOF_TYPE,\n verifyBrowserPostureProofKey,\n} from './browser-posture-proof-verifier';\nexport type {\n BrowserPostureProof,\n BrowserPostureProofFailure,\n BrowserPostureProofResult,\n} from './browser-posture-proof-verifier';\n\nexport const BrowserPostureProofSchema = z.object({\n jti: z.string().min(1).max(255),\n htm: z.string().min(1).max(16),\n htu: z.string().url(),\n iat: z.number().int().nonnegative(),\n}) satisfies z.ZodType<BrowserPostureProof>;\n\n/**\n * Verifies a DPoP-shaped proof (RFC 9449) against an ALREADY-VERIFIED\n * `BrowserPosture` (call `verifyBrowserPosture` first). Checks, in order:\n * the proof's own header shape (`typ`, `alg`, embedded `jwk`); that the\n * embedded key's RFC 7638 thumbprint matches `posture.cnf.jkt`; the\n * proof's ES256 signature against that same embedded key; `htm`/`htu`\n * against the real request; `iat` freshness. Returns `undefined` on ANY\n * failure, including when `posture.cnf` is absent (no binding to check\n * against), never throws.\n *\n * Does NOT check `jti` replay: that needs a store this library does not\n * own. The caller checks the returned proof's `jti` against their own\n * replay store as the final step before trusting the request.\n */\nexport async function verifyBrowserPostureProof(\n proofJws: string | undefined,\n posture: BrowserPosture,\n request: { method: string; url: string },\n now = Math.floor(Date.now() / 1000),\n maxAgeSeconds = DEFAULT_POSTURE_PROOF_MAX_AGE_SECONDS\n): Promise<BrowserPostureProof | undefined> {\n if (!posture.cnf) return undefined;\n const result = await verifyBrowserPostureProofKey(\n proofJws,\n request,\n posture.cnf.jkt,\n now,\n maxAgeSeconds\n );\n return result.verified ? result.claims : undefined;\n}\n"],"mappings":";;;;AAoBA,MAAa,4BAA4BA,OAAS;CAChD,KAAKC,OAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG;CAC9B,KAAKA,OAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE;CAC7B,KAAKA,OAAS,CAAC,CAAC,IAAI;CACpB,KAAKC,OAAS,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY;AACpC,CAAC;;;;;;;;;;;;;;;AAgBD,eAAsB,0BACpB,UACA,SACA,SACA,MAAM,KAAK,MAAM,KAAK,IAAI,IAAI,GAAI,GAClC,oBAC0C;CAC1C,IAAI,CAAC,QAAQ,KAAK,OAAO;CACzB,MAAM,SAAS,MAAM,6BACnB,UACA,SACA,QAAQ,IAAI,KACZ,KACA,aACF;CACA,OAAO,OAAO,WAAW,OAAO,SAAS;AAC3C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as POSTURE_VERIFICATION_STATUSES, C as verifyBrowserPosture, D as BrowserPostureRejectionReason, E as BrowserPostureOutcomeSchema, F as POSTURE_TTL_SECONDS, I as postureCookieName, M as browserPostureReport, N as BrowserPosture, O as BrowserPostureReportIngestSchema, P as BrowserPostureSchema, S as validateBrowserPostureConfig, T as BrowserPostureOutcome, _ as postureRequiredScopes, a as POSTURE_SESSION_HEADER, b as readPostureCookie, c as PostureVerification, d as inspectBrowserPosture, f as postureFromCookies, g as postureRequestFromHeaders, h as postureOutcomeReport, i as POSTURE_ISSUER, j as PostureVerificationStatus, k as BrowserPostureReportSchema, l as UNSIGNED_BROWSER_AGENT, m as postureOutcomeFromRequest, n as JWK, o as POSTURE_TYPE, p as postureFromRequest, r as POSTURE_HEADER, s as PostureRequest, t as BrowserPostureConfig, u as behavioralConfidence, v as postureSessionBinding, w as BROWSER_POSTURE_REJECTION_REASONS, x as signBrowserPosture, y as postureUpgrade } from "./browser-posture-
|
|
1
|
+
import { A as POSTURE_VERIFICATION_STATUSES, C as verifyBrowserPosture, D as BrowserPostureRejectionReason, E as BrowserPostureOutcomeSchema, F as POSTURE_TTL_SECONDS, I as postureCookieName, M as browserPostureReport, N as BrowserPosture, O as BrowserPostureReportIngestSchema, P as BrowserPostureSchema, S as validateBrowserPostureConfig, T as BrowserPostureOutcome, _ as postureRequiredScopes, a as POSTURE_SESSION_HEADER, b as readPostureCookie, c as PostureVerification, d as inspectBrowserPosture, f as postureFromCookies, g as postureRequestFromHeaders, h as postureOutcomeReport, i as POSTURE_ISSUER, j as PostureVerificationStatus, k as BrowserPostureReportSchema, l as UNSIGNED_BROWSER_AGENT, m as postureOutcomeFromRequest, n as JWK, o as POSTURE_TYPE, p as postureFromRequest, r as POSTURE_HEADER, s as PostureRequest, t as BrowserPostureConfig, u as behavioralConfidence, v as postureSessionBinding, w as BROWSER_POSTURE_REJECTION_REASONS, x as signBrowserPosture, y as postureUpgrade } from "./browser-posture-5fPrsxx7.mjs";
|
|
2
2
|
export { BROWSER_POSTURE_REJECTION_REASONS, type BrowserPosture, BrowserPostureConfig, type BrowserPostureOutcome, BrowserPostureOutcomeSchema, type BrowserPostureRejectionReason, BrowserPostureReportIngestSchema, BrowserPostureReportSchema, BrowserPostureSchema, type JWK, POSTURE_HEADER, POSTURE_ISSUER, POSTURE_SESSION_HEADER, POSTURE_TTL_SECONDS, POSTURE_TYPE, POSTURE_VERIFICATION_STATUSES, PostureRequest, PostureVerification, type PostureVerificationStatus, UNSIGNED_BROWSER_AGENT, behavioralConfidence, browserPostureReport, inspectBrowserPosture, postureCookieName, postureFromCookies, postureFromRequest, postureOutcomeFromRequest, postureOutcomeReport, postureRequestFromHeaders, postureRequiredScopes, postureSessionBinding, postureUpgrade, readPostureCookie, signBrowserPosture, validateBrowserPostureConfig, verifyBrowserPosture };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as POSTURE_VERIFICATION_STATUSES, C as verifyBrowserPosture, D as BrowserPostureRejectionReason, E as BrowserPostureOutcomeSchema, F as POSTURE_TTL_SECONDS, I as postureCookieName, M as browserPostureReport, N as BrowserPosture, O as BrowserPostureReportIngestSchema, P as BrowserPostureSchema, S as validateBrowserPostureConfig, T as BrowserPostureOutcome, _ as postureRequiredScopes, a as POSTURE_SESSION_HEADER, b as readPostureCookie, c as PostureVerification, d as inspectBrowserPosture, f as postureFromCookies, g as postureRequestFromHeaders, h as postureOutcomeReport, i as POSTURE_ISSUER, j as PostureVerificationStatus, k as BrowserPostureReportSchema, l as UNSIGNED_BROWSER_AGENT, m as postureOutcomeFromRequest, n as JWK, o as POSTURE_TYPE, p as postureFromRequest, r as POSTURE_HEADER, s as PostureRequest, t as BrowserPostureConfig, u as behavioralConfidence, v as postureSessionBinding, w as BROWSER_POSTURE_REJECTION_REASONS, x as signBrowserPosture, y as postureUpgrade } from "./browser-posture-
|
|
1
|
+
import { A as POSTURE_VERIFICATION_STATUSES, C as verifyBrowserPosture, D as BrowserPostureRejectionReason, E as BrowserPostureOutcomeSchema, F as POSTURE_TTL_SECONDS, I as postureCookieName, M as browserPostureReport, N as BrowserPosture, O as BrowserPostureReportIngestSchema, P as BrowserPostureSchema, S as validateBrowserPostureConfig, T as BrowserPostureOutcome, _ as postureRequiredScopes, a as POSTURE_SESSION_HEADER, b as readPostureCookie, c as PostureVerification, d as inspectBrowserPosture, f as postureFromCookies, g as postureRequestFromHeaders, h as postureOutcomeReport, i as POSTURE_ISSUER, j as PostureVerificationStatus, k as BrowserPostureReportSchema, l as UNSIGNED_BROWSER_AGENT, m as postureOutcomeFromRequest, n as JWK, o as POSTURE_TYPE, p as postureFromRequest, r as POSTURE_HEADER, s as PostureRequest, t as BrowserPostureConfig, u as behavioralConfidence, v as postureSessionBinding, w as BROWSER_POSTURE_REJECTION_REASONS, x as signBrowserPosture, y as postureUpgrade } from "./browser-posture-CCR1kh5e.js";
|
|
2
2
|
export { BROWSER_POSTURE_REJECTION_REASONS, type BrowserPosture, BrowserPostureConfig, type BrowserPostureOutcome, BrowserPostureOutcomeSchema, type BrowserPostureRejectionReason, BrowserPostureReportIngestSchema, BrowserPostureReportSchema, BrowserPostureSchema, type JWK, POSTURE_HEADER, POSTURE_ISSUER, POSTURE_SESSION_HEADER, POSTURE_TTL_SECONDS, POSTURE_TYPE, POSTURE_VERIFICATION_STATUSES, PostureRequest, PostureVerification, type PostureVerificationStatus, UNSIGNED_BROWSER_AGENT, behavioralConfidence, browserPostureReport, inspectBrowserPosture, postureCookieName, postureFromCookies, postureFromRequest, postureOutcomeFromRequest, postureOutcomeReport, postureRequestFromHeaders, postureRequiredScopes, postureSessionBinding, postureUpgrade, readPostureCookie, signBrowserPosture, validateBrowserPostureConfig, verifyBrowserPosture };
|
package/dist/browser-posture.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_schemas = require('./schemas-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
2
|
+
const require_schemas = require('./schemas-BlScS1it.js');
|
|
3
|
+
const require_patterns = require('./patterns-CiMpbdAF.js');
|
|
4
|
+
const require_posture_origins = require('./posture-origins-Ci6k4Zh1.js');
|
|
5
|
+
const require_project_verification_key = require('./project-verification-key-B-L3D2nC.js');
|
|
5
6
|
let jose = require("jose");
|
|
6
7
|
|
|
7
8
|
//#region src/browser-posture-cookie.ts
|
|
@@ -17,7 +18,7 @@ let jose = require("jose");
|
|
|
17
18
|
* reader will look for.
|
|
18
19
|
*/
|
|
19
20
|
function postureCookieName(projectId) {
|
|
20
|
-
if (!
|
|
21
|
+
if (!require_patterns.UUID_PATTERN.test(projectId) || projectId !== projectId.toLowerCase()) throw new Error("Invalid posture project id");
|
|
21
22
|
return `__Host-checkpoint_posture_${projectId}`;
|
|
22
23
|
}
|
|
23
24
|
|
|
@@ -302,7 +303,7 @@ function postureRequiredScopes(config, path) {
|
|
|
302
303
|
}
|
|
303
304
|
/** Validate operator configuration at startup, before any request can depend on it. */
|
|
304
305
|
function validateBrowserPostureConfig(config, projectId) {
|
|
305
|
-
if (!projectId || !
|
|
306
|
+
if (!projectId || !require_patterns.VALIDATION_PATTERNS.UUID.test(projectId) || projectId !== projectId.toLowerCase()) throw new Error("Browser posture requires projectId to be the lowercase project UUID (the friendly id is not accepted)");
|
|
306
307
|
if (!validOrigin(config.origin) || !config.keyId || config.publicKey.kty !== "EC" || config.publicKey.crv !== "P-256" || !config.publicKey.x || !config.publicKey.y || config.publicKey.d) throw new Error("Browser posture requires projectId, an exact HTTPS origin, and a public ES256 key");
|
|
307
308
|
const origins = config.origins ?? [];
|
|
308
309
|
if (origins.length > 20) throw new Error(`Browser posture accepts at most ${20} additional origins`);
|
package/dist/browser-posture.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { S as string, _ as number, b as record, c as array, f as guid, h as literal, i as _enum, l as boolean, v as object, w as unknown } from "./schemas-IHAhH3gV.mjs";
|
|
2
|
+
import { c as VALIDATION_PATTERNS, s as UUID_PATTERN } from "./patterns-D4OAsNQY.mjs";
|
|
3
|
+
import { n as matchAllowedOrigin, r as parseOriginPattern } from "./posture-origins-DGyS4Vuk.mjs";
|
|
4
|
+
import { t as projectVerificationKey } from "./project-verification-key-CWXdu3-n.mjs";
|
|
4
5
|
import { SignJWT, compactVerify, decodeProtectedHeader, importJWK } from "jose";
|
|
5
6
|
|
|
6
7
|
//#region src/browser-posture-cookie.ts
|