@kya-os/checkpoint-shared 1.5.1 → 1.6.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.
Files changed (161) hide show
  1. package/CHANGELOG.md +217 -0
  2. package/dist/beacon-nonce/index.d.mts +36 -0
  3. package/dist/beacon-nonce/index.d.mts.map +1 -0
  4. package/dist/beacon-nonce/index.d.ts +36 -0
  5. package/dist/beacon-nonce/index.d.ts.map +1 -0
  6. package/dist/beacon-nonce/index.js +305 -0
  7. package/dist/beacon-nonce/index.mjs +294 -0
  8. package/dist/beacon-nonce/index.mjs.map +1 -0
  9. package/dist/beacon-types/index.d.mts +40 -0
  10. package/dist/beacon-types/index.d.mts.map +1 -1
  11. package/dist/beacon-types/index.d.ts +40 -0
  12. package/dist/beacon-types/index.d.ts.map +1 -1
  13. package/dist/beacon-types/index.js +53 -5
  14. package/dist/beacon-types/index.mjs +49 -6
  15. package/dist/beacon-types/index.mjs.map +1 -1
  16. package/dist/browser-posture-BuChqmH5.d.mts +169 -0
  17. package/dist/browser-posture-BuChqmH5.d.mts.map +1 -0
  18. package/dist/browser-posture-DIaVLuW3.d.ts +169 -0
  19. package/dist/browser-posture-DIaVLuW3.d.ts.map +1 -0
  20. package/dist/browser-posture-cookie.d.mts +4 -2
  21. package/dist/browser-posture-cookie.d.mts.map +1 -0
  22. package/dist/browser-posture-cookie.d.ts +4 -2
  23. package/dist/browser-posture-cookie.d.ts.map +1 -0
  24. package/dist/browser-posture-cookie.mjs.map +1 -1
  25. package/dist/browser-posture-proof.d.mts +18 -0
  26. package/dist/browser-posture-proof.d.mts.map +1 -0
  27. package/dist/browser-posture-proof.d.ts +18 -0
  28. package/dist/browser-posture-proof.d.ts.map +1 -0
  29. package/dist/browser-posture-proof.js +66 -0
  30. package/dist/browser-posture-proof.mjs +63 -0
  31. package/dist/browser-posture-proof.mjs.map +1 -0
  32. package/dist/browser-posture-report.d.mts +59 -2
  33. package/dist/browser-posture-report.d.mts.map +1 -1
  34. package/dist/browser-posture-report.d.ts +59 -2
  35. package/dist/browser-posture-report.d.ts.map +1 -1
  36. package/dist/browser-posture-report.js +1 -1
  37. package/dist/browser-posture-report.mjs +1 -1
  38. package/dist/browser-posture-report.mjs.map +1 -1
  39. package/dist/browser-posture.d.mts +2 -85
  40. package/dist/browser-posture.d.ts +2 -85
  41. package/dist/browser-posture.js +207 -45
  42. package/dist/browser-posture.mjs +195 -45
  43. package/dist/browser-posture.mjs.map +1 -1
  44. package/dist/browser.d.mts +0 -8
  45. package/dist/browser.d.mts.map +1 -1
  46. package/dist/browser.d.ts +0 -8
  47. package/dist/browser.d.ts.map +1 -1
  48. package/dist/browser.js +1 -1
  49. package/dist/browser.mjs +1 -1
  50. package/dist/browser.mjs.map +1 -1
  51. package/dist/clearance.d.mts +1 -1
  52. package/dist/clearance.d.ts +1 -1
  53. package/dist/clearance.js +2 -2
  54. package/dist/clearance.mjs +2 -2
  55. package/dist/{client-ip-HOfe6ucV.mjs → client-ip-B2Xeo-GK.mjs} +2 -2
  56. package/dist/{client-ip-HOfe6ucV.mjs.map → client-ip-B2Xeo-GK.mjs.map} +1 -1
  57. package/dist/{client-ip-1y2iXAYW.js → client-ip-CW6pRyLf.js} +1 -1
  58. package/dist/consent-handoff.d.mts +41 -0
  59. package/dist/consent-handoff.d.mts.map +1 -0
  60. package/dist/consent-handoff.d.ts +41 -0
  61. package/dist/consent-handoff.d.ts.map +1 -0
  62. package/dist/consent-handoff.js +1 -0
  63. package/dist/consent-handoff.mjs +2 -0
  64. package/dist/consent-handoff.mjs.map +1 -0
  65. package/dist/errors/index.d.mts +155 -0
  66. package/dist/errors/index.d.mts.map +1 -1
  67. package/dist/errors/index.d.ts +155 -0
  68. package/dist/errors/index.d.ts.map +1 -1
  69. package/dist/errors/index.js +513 -9
  70. package/dist/errors/index.mjs +513 -10
  71. package/dist/errors/index.mjs.map +1 -1
  72. package/dist/{external-jr_S4iSS.d.ts → external-B7WI9FyQ.d.mts} +2 -2
  73. package/dist/{external-jr_S4iSS.d.mts.map → external-B7WI9FyQ.d.mts.map} +1 -1
  74. package/dist/{external-jr_S4iSS.d.mts → external-B7WI9FyQ.d.ts} +2 -2
  75. package/dist/{external-jr_S4iSS.d.ts.map → external-B7WI9FyQ.d.ts.map} +1 -1
  76. package/dist/gateway-client-ip.d.mts +1 -1
  77. package/dist/gateway-client-ip.d.ts +1 -1
  78. package/dist/gateway-client-ip.js +2 -2
  79. package/dist/gateway-client-ip.mjs +2 -2
  80. package/dist/index.d.mts +6375 -1532
  81. package/dist/index.d.mts.map +1 -1
  82. package/dist/index.d.ts +6375 -1532
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +5629 -697
  85. package/dist/index.mjs +5341 -683
  86. package/dist/index.mjs.map +1 -1
  87. package/dist/mcpi/approval-grant/index.d.mts +1 -1
  88. package/dist/mcpi/approval-grant/index.d.mts.map +1 -1
  89. package/dist/mcpi/approval-grant/index.d.ts +1 -1
  90. package/dist/mcpi/approval-grant/index.d.ts.map +1 -1
  91. package/dist/mcpi/approval-grant/index.js +58 -49
  92. package/dist/mcpi/approval-grant/index.mjs +58 -49
  93. package/dist/mcpi/approval-grant/index.mjs.map +1 -1
  94. package/dist/mcpi/dashboard-config/index.d.mts +3 -2
  95. package/dist/mcpi/dashboard-config/index.d.mts.map +1 -1
  96. package/dist/mcpi/dashboard-config/index.d.ts +3 -2
  97. package/dist/mcpi/dashboard-config/index.d.ts.map +1 -1
  98. package/dist/posture-origins/index.d.mts +41 -0
  99. package/dist/posture-origins/index.d.mts.map +1 -0
  100. package/dist/posture-origins/index.d.ts +41 -0
  101. package/dist/posture-origins/index.d.ts.map +1 -0
  102. package/dist/posture-origins/index.js +441 -0
  103. package/dist/posture-origins/index.mjs +430 -0
  104. package/dist/posture-origins/index.mjs.map +1 -0
  105. package/dist/posture-origins-LFkX80oF.js +627 -0
  106. package/dist/posture-origins-Pn-ii-Pp.mjs +533 -0
  107. package/dist/posture-origins-Pn-ii-Pp.mjs.map +1 -0
  108. package/dist/{project-verification-key-CgSVX9_m.mjs → project-verification-key-66N4edKn.mjs} +2 -2
  109. package/dist/{project-verification-key-CgSVX9_m.mjs.map → project-verification-key-66N4edKn.mjs.map} +1 -1
  110. package/dist/{project-verification-key-C3L5rd8a.js → project-verification-key-BccT12tQ.js} +1 -1
  111. package/dist/rules.json +0 -1
  112. package/dist/{schemas-DxY-dk9y.mjs → schemas-7qodsG-Z.mjs} +49 -2
  113. package/dist/schemas-7qodsG-Z.mjs.map +1 -0
  114. package/dist/{schemas-BmjNLAE7.js → schemas-YhagYDx_.js} +59 -0
  115. package/dist/signals/index.d.mts +75 -55
  116. package/dist/signals/index.d.mts.map +1 -1
  117. package/dist/signals/index.d.ts +75 -55
  118. package/dist/signals/index.d.ts.map +1 -1
  119. package/dist/signals/index.js +246 -2
  120. package/dist/signals/index.mjs +236 -3
  121. package/dist/signals/index.mjs.map +1 -1
  122. package/fixtures/browser-integrity/captured-java-0.2.1-missing-score.json +10 -0
  123. package/fixtures/browser-integrity/null-score.json +11 -0
  124. package/fixtures/browser-integrity/numeric-score.json +11 -0
  125. package/fixtures/browser-posture-claims.json +168 -0
  126. package/fixtures/browser-posture-headers.json +6 -0
  127. package/fixtures/cli-registration.v2.json +115 -0
  128. package/fixtures/detection/reason-codes.json +1 -1
  129. package/fixtures/kya-http/README.md +34 -25
  130. package/fixtures/kya-http/consent-handoff.codes.json +34 -0
  131. package/fixtures/kya-http/protected-resource-metadata.full.json +14 -5
  132. package/fixtures/kya-http/protected-resource-metadata.invalid-issuer.json +51 -0
  133. package/fixtures/kya-http/protected-resource-metadata.no-issuer.json +32 -0
  134. package/fixtures/reviewer-grant-revocation.v1.json +285 -0
  135. package/fixtures/workbench/a2a-signed-request.v1.json +255 -0
  136. package/fixtures/workbench/artifact-bindings.v1.json +1003 -0
  137. package/fixtures/workbench/delegation-management.v1.json +507 -0
  138. package/fixtures/workbench/didcomm-task-source.v1.json +191 -0
  139. package/fixtures/workbench/graph-interfaces.v1.json +1887 -0
  140. package/fixtures/workbench/identity-provisioning.v1.json +643 -0
  141. package/fixtures/workbench/linear-installation.v1.json +484 -0
  142. package/fixtures/workbench/management-session.v1.json +716 -0
  143. package/fixtures/workbench/model-credentials.v1.json +630 -0
  144. package/fixtures/workbench/source-claim-pooled.v1.json +50 -0
  145. package/fixtures/workbench/task-grant.v1.json +695 -0
  146. package/fixtures/workbench/task-status-projection.v1.json +591 -0
  147. package/fixtures/workbench/workload-enrollment.v1.json +580 -0
  148. package/package.json +24 -5
  149. package/src/data/compiled/merged-rules.json +2 -9
  150. package/src/data/default-rules.json +0 -1
  151. package/dist/browser-posture-cookie-Dmq9Brf_.d.mts +0 -5
  152. package/dist/browser-posture-cookie-Dmq9Brf_.d.mts.map +0 -1
  153. package/dist/browser-posture-cookie-Dmq9Brf_.d.ts +0 -5
  154. package/dist/browser-posture-cookie-Dmq9Brf_.d.ts.map +0 -1
  155. package/dist/browser-posture.d.mts.map +0 -1
  156. package/dist/browser-posture.d.ts.map +0 -1
  157. package/dist/patterns-CkRVOdtV.js +0 -243
  158. package/dist/patterns-DzkGy_qk.mjs +0 -173
  159. package/dist/patterns-DzkGy_qk.mjs.map +0 -1
  160. package/dist/schemas-DxY-dk9y.mjs.map +0 -1
  161. package/fixtures/kya-http/protected-resource-metadata.global.json +0 -28
@@ -1,5 +1,6 @@
1
1
  import { JWK } from "jose";
2
2
  //#region src/mcpi/approval-grant/nonce.d.ts
3
+ export declare const APPROVAL_GRANT_MAX_LIFETIME_SEC = 300;
3
4
  interface ApprovalNonceStore {
4
5
  issue(requestHash: string, ttlSec?: number): string;
5
6
  current(requestHash: string): string | null;
@@ -14,7 +15,6 @@ export declare class InMemoryApprovalNonceStore implements ApprovalNonceStore {
14
15
  //#endregion
15
16
  //#region src/mcpi/approval-grant/grant.d.ts
16
17
  export declare const APPROVAL_GRANT_TYP = "approval-grant+jwt";
17
- export declare const APPROVAL_GRANT_MAX_LIFETIME_SEC = 300;
18
18
  interface Ed25519PublicJWK {
19
19
  kty: 'OKP';
20
20
  crv: 'Ed25519';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/mcpi/approval-grant/nonce.ts","../../../src/mcpi/approval-grant/grant.ts"],"mappings":";;UAmBiB;EAOf,MAAM,qBAAqB;EAE3B,QAAQ;EAWR,WAAW;;qBAQA,sCAAsC;mBAChC;EAKjB,MAAM,qBAAqB;EAc3B,QAAQ;EAMR,WAAW;;;;qBCtCA;qBACA;UAEI;EACf;EACA;EACA;;UAIe;EACf;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA,MAAM;;UAGS;EACf;EACA;EACA;EACA;EACA;EACA;;KAGU,uBAAuB,gBAAgB,QAAQ;UAE1C;EACf;EACA;EACA;;wBAIoB,kBACpB,MAAM,mBACN,eAAe,MACd,QAAQ;wBAsCW,oBAAoB;EACxC,OAAO;EACP,UAAU;EACV,YAAY;IACV,QAAQ;UAsEK;EACf;EACA;;wBASoB,2BAA2B;EAC/C,QAAQ;EACR;IAAY;IAAqB;IAAkB;IAAkB;;EACrE;IAAU;IAAW;;EACrB,YAAY;EACZ,YAAY;IACV,QAAQ"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/mcpi/approval-grant/nonce.ts","../../../src/mcpi/approval-grant/grant.ts"],"mappings":";;qBAiBa;UAEI;EAOf,MAAM,qBAAqB;EAE3B,QAAQ;EAWR,WAAW;;qBAQA,sCAAsC;mBAChC;EAKjB,MAAM,qBAAqB;EAc3B,QAAQ;EAMR,WAAW;;;;qBCtCA;UAEI;EACf;EACA;EACA;;UAIe;EACf;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA,MAAM;;UAGS;EACf;EACA;EACA;EACA;EACA;EACA;;KAGU,uBAAuB,gBAAgB,QAAQ;UAE1C;EACf;EACA;EACA;;wBAIoB,kBACpB,MAAM,mBACN,eAAe,MACd,QAAQ;wBA6CW,oBAAoB;EACxC,OAAO;EACP,UAAU;EACV,YAAY;IACV,QAAQ;UAsEK;EACf;EACA;;wBASoB,2BAA2B;EAC/C,QAAQ;EACR;IAAY;IAAqB;IAAkB;IAAkB;;EACrE;IAAU;IAAW;;EACrB,YAAY;EACZ,YAAY;IACV,QAAQ"}
@@ -1,5 +1,6 @@
1
1
  import { JWK } from "jose";
2
2
  //#region src/mcpi/approval-grant/nonce.d.ts
3
+ export declare const APPROVAL_GRANT_MAX_LIFETIME_SEC = 300;
3
4
  interface ApprovalNonceStore {
4
5
  issue(requestHash: string, ttlSec?: number): string;
5
6
  current(requestHash: string): string | null;
@@ -14,7 +15,6 @@ export declare class InMemoryApprovalNonceStore implements ApprovalNonceStore {
14
15
  //#endregion
15
16
  //#region src/mcpi/approval-grant/grant.d.ts
16
17
  export declare const APPROVAL_GRANT_TYP = "approval-grant+jwt";
17
- export declare const APPROVAL_GRANT_MAX_LIFETIME_SEC = 300;
18
18
  interface Ed25519PublicJWK {
19
19
  kty: 'OKP';
20
20
  crv: 'Ed25519';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/mcpi/approval-grant/nonce.ts","../../../src/mcpi/approval-grant/grant.ts"],"mappings":";;UAmBiB;EAOf,MAAM,qBAAqB;EAE3B,QAAQ;EAWR,WAAW;;qBAQA,sCAAsC;mBAChC;EAKjB,MAAM,qBAAqB;EAc3B,QAAQ;EAMR,WAAW;;;;qBCtCA;qBACA;UAEI;EACf;EACA;EACA;;UAIe;EACf;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA,MAAM;;UAGS;EACf;EACA;EACA;EACA;EACA;EACA;;KAGU,uBAAuB,gBAAgB,QAAQ;UAE1C;EACf;EACA;EACA;;wBAIoB,kBACpB,MAAM,mBACN,eAAe,MACd,QAAQ;wBAsCW,oBAAoB;EACxC,OAAO;EACP,UAAU;EACV,YAAY;IACV,QAAQ;UAsEK;EACf;EACA;;wBASoB,2BAA2B;EAC/C,QAAQ;EACR;IAAY;IAAqB;IAAkB;IAAkB;;EACrE;IAAU;IAAW;;EACrB,YAAY;EACZ,YAAY;IACV,QAAQ"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/mcpi/approval-grant/nonce.ts","../../../src/mcpi/approval-grant/grant.ts"],"mappings":";;qBAiBa;UAEI;EAOf,MAAM,qBAAqB;EAE3B,QAAQ;EAWR,WAAW;;qBAQA,sCAAsC;mBAChC;EAKjB,MAAM,qBAAqB;EAc3B,QAAQ;EAMR,WAAW;;;;qBCtCA;UAEI;EACf;EACA;EACA;;UAIe;EACf;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA,MAAM;;UAGS;EACf;EACA;EACA;EACA;EACA;EACA;;KAGU,uBAAuB,gBAAgB,QAAQ;UAE1C;EACf;EACA;EACA;;wBAIoB,kBACpB,MAAM,mBACN,eAAe,MACd,QAAQ;wBA6CW,oBAAoB;EACxC,OAAO;EACP,UAAU;EACV,YAAY;IACV,QAAQ;UAsEK;EACf;EACA;;wBASoB,2BAA2B;EAC/C,QAAQ;EACR;IAAY;IAAqB;IAAkB;IAAkB;;EACrE;IAAU;IAAW;;EACrB,YAAY;EACZ,YAAY;IACV,QAAQ"}
@@ -1,6 +1,54 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  let jose = require("jose");
3
3
 
4
+ //#region src/mcpi/approval-grant/nonce.ts
5
+ /**
6
+ * Server-issued, single-use nonce store for step-up approval grants.
7
+ *
8
+ * Issues one nonce per suspended action (`requestHash`) and consumes it when the
9
+ * quorum is satisfied. A resubmission of the same grants finds the nonce gone →
10
+ * rejected. This is what makes the grant single-use (closes replay across
11
+ * connections). In production this is shared state (Redis/DO); in-memory here.
12
+ *
13
+ * Edge-safe: nonce bytes come from `globalThis.crypto.getRandomValues` (Web
14
+ * Crypto — present on Node 18+, Cloudflare Workers, and Vercel Edge), encoded
15
+ * with `jose`'s isomorphic `base64url`. No `node:crypto`, no `Buffer`.
16
+ *
17
+ * @module @kya-os/checkpoint-shared/mcpi/approval-grant
18
+ */
19
+ const APPROVAL_GRANT_MAX_LIFETIME_SEC = 300;
20
+ /** 32 cryptographically-random bytes, base64url-encoded. Edge-safe. */
21
+ function generateNonce() {
22
+ return jose.base64url.encode(globalThis.crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(32)));
23
+ }
24
+ var InMemoryApprovalNonceStore = class {
25
+ issued = /* @__PURE__ */ new Map();
26
+ issue(requestHash, ttlSec = 300) {
27
+ const now = Math.floor(Date.now() / 1e3);
28
+ const existing = this.issued.get(requestHash);
29
+ if (existing && !existing.consumed && existing.expiresAt >= now) return existing.nonce;
30
+ const nonce = generateNonce();
31
+ this.issued.set(requestHash, {
32
+ nonce,
33
+ consumed: false,
34
+ expiresAt: now + ttlSec
35
+ });
36
+ return nonce;
37
+ }
38
+ current(requestHash) {
39
+ const e = this.issued.get(requestHash);
40
+ if (!e || e.consumed || e.expiresAt < Math.floor(Date.now() / 1e3)) return null;
41
+ return e.nonce;
42
+ }
43
+ tryConsume(requestHash) {
44
+ const e = this.issued.get(requestHash);
45
+ if (!e || e.consumed || e.expiresAt < Math.floor(Date.now() / 1e3)) return false;
46
+ e.consumed = true;
47
+ return true;
48
+ }
49
+ };
50
+
51
+ //#endregion
4
52
  //#region src/mcpi/approval-grant/grant.ts
5
53
  /**
6
54
  * Step-up approval grants — portable, edge-safe reference implementation.
@@ -33,7 +81,6 @@ let jose = require("jose");
33
81
  * @module @kya-os/checkpoint-shared/mcpi/approval-grant
34
82
  */
35
83
  const APPROVAL_GRANT_TYP = "approval-grant+jwt";
36
- const APPROVAL_GRANT_MAX_LIFETIME_SEC = 300;
37
84
  /** Produce a signed grant (runs in the approver's client, with their key). */
38
85
  async function signApprovalGrant(meta, privateKeyJwk) {
39
86
  if (!Number.isInteger(meta.created) || !Number.isInteger(meta.expires)) throw new Error("approval grant: created/expires must be integer unix seconds");
@@ -56,7 +103,14 @@ async function signApprovalGrant(meta, privateKeyJwk) {
56
103
  meta
57
104
  };
58
105
  }
59
- /** Verify a single grant against the gateway's expectation. Fail-closed. */
106
+ /**
107
+ * Verify a single grant against the gateway's expectation. Fail-closed.
108
+ *
109
+ * This resolves `grant.meta.approverDid` through `resolveKey` without checking
110
+ * it against any allowlist, and that DID is request-supplied. Callers that hold
111
+ * an approver allowlist must check it first, as {@link verifySignedApprovalQuorum}
112
+ * does, so an arbitrary DID never reaches the resolver.
113
+ */
60
114
  async function verifyApprovalGrant(opts) {
61
115
  const { grant, expected, resolveKey } = opts;
62
116
  const approverDid = grant?.meta?.approverDid;
@@ -153,6 +207,8 @@ async function verifySignedApprovalQuorum(opts) {
153
207
  };
154
208
  const approvers = /* @__PURE__ */ new Set();
155
209
  for (const grant of grants) {
210
+ const claimedApproverDid = grant?.meta?.approverDid;
211
+ if (typeof claimedApproverDid !== "string" || !quorum.approvers.includes(claimedApproverDid)) continue;
156
212
  const v = await verifyApprovalGrant({
157
213
  grant,
158
214
  expected: {
@@ -181,53 +237,6 @@ async function verifySignedApprovalQuorum(opts) {
181
237
  };
182
238
  }
183
239
 
184
- //#endregion
185
- //#region src/mcpi/approval-grant/nonce.ts
186
- /**
187
- * Server-issued, single-use nonce store for step-up approval grants.
188
- *
189
- * Issues one nonce per suspended action (`requestHash`) and consumes it when the
190
- * quorum is satisfied. A resubmission of the same grants finds the nonce gone →
191
- * rejected. This is what makes the grant single-use (closes replay across
192
- * connections). In production this is shared state (Redis/DO); in-memory here.
193
- *
194
- * Edge-safe: nonce bytes come from `globalThis.crypto.getRandomValues` (Web
195
- * Crypto — present on Node 18+, Cloudflare Workers, and Vercel Edge), encoded
196
- * with `jose`'s isomorphic `base64url`. No `node:crypto`, no `Buffer`.
197
- *
198
- * @module @kya-os/checkpoint-shared/mcpi/approval-grant
199
- */
200
- /** 32 cryptographically-random bytes, base64url-encoded. Edge-safe. */
201
- function generateNonce() {
202
- return jose.base64url.encode(globalThis.crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(32)));
203
- }
204
- var InMemoryApprovalNonceStore = class {
205
- issued = /* @__PURE__ */ new Map();
206
- issue(requestHash, ttlSec = 300) {
207
- const now = Math.floor(Date.now() / 1e3);
208
- const existing = this.issued.get(requestHash);
209
- if (existing && !existing.consumed && existing.expiresAt >= now) return existing.nonce;
210
- const nonce = generateNonce();
211
- this.issued.set(requestHash, {
212
- nonce,
213
- consumed: false,
214
- expiresAt: now + ttlSec
215
- });
216
- return nonce;
217
- }
218
- current(requestHash) {
219
- const e = this.issued.get(requestHash);
220
- if (!e || e.consumed || e.expiresAt < Math.floor(Date.now() / 1e3)) return null;
221
- return e.nonce;
222
- }
223
- tryConsume(requestHash) {
224
- const e = this.issued.get(requestHash);
225
- if (!e || e.consumed || e.expiresAt < Math.floor(Date.now() / 1e3)) return false;
226
- e.consumed = true;
227
- return true;
228
- }
229
- };
230
-
231
240
  //#endregion
232
241
  exports.APPROVAL_GRANT_MAX_LIFETIME_SEC = APPROVAL_GRANT_MAX_LIFETIME_SEC;
233
242
  exports.APPROVAL_GRANT_TYP = APPROVAL_GRANT_TYP;
@@ -1,5 +1,53 @@
1
1
  import { SignJWT, base64url, importJWK, jwtVerify } from "jose";
2
2
 
3
+ //#region src/mcpi/approval-grant/nonce.ts
4
+ /**
5
+ * Server-issued, single-use nonce store for step-up approval grants.
6
+ *
7
+ * Issues one nonce per suspended action (`requestHash`) and consumes it when the
8
+ * quorum is satisfied. A resubmission of the same grants finds the nonce gone →
9
+ * rejected. This is what makes the grant single-use (closes replay across
10
+ * connections). In production this is shared state (Redis/DO); in-memory here.
11
+ *
12
+ * Edge-safe: nonce bytes come from `globalThis.crypto.getRandomValues` (Web
13
+ * Crypto — present on Node 18+, Cloudflare Workers, and Vercel Edge), encoded
14
+ * with `jose`'s isomorphic `base64url`. No `node:crypto`, no `Buffer`.
15
+ *
16
+ * @module @kya-os/checkpoint-shared/mcpi/approval-grant
17
+ */
18
+ const APPROVAL_GRANT_MAX_LIFETIME_SEC = 300;
19
+ /** 32 cryptographically-random bytes, base64url-encoded. Edge-safe. */
20
+ function generateNonce() {
21
+ return base64url.encode(globalThis.crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(32)));
22
+ }
23
+ var InMemoryApprovalNonceStore = class {
24
+ issued = /* @__PURE__ */ new Map();
25
+ issue(requestHash, ttlSec = 300) {
26
+ const now = Math.floor(Date.now() / 1e3);
27
+ const existing = this.issued.get(requestHash);
28
+ if (existing && !existing.consumed && existing.expiresAt >= now) return existing.nonce;
29
+ const nonce = generateNonce();
30
+ this.issued.set(requestHash, {
31
+ nonce,
32
+ consumed: false,
33
+ expiresAt: now + ttlSec
34
+ });
35
+ return nonce;
36
+ }
37
+ current(requestHash) {
38
+ const e = this.issued.get(requestHash);
39
+ if (!e || e.consumed || e.expiresAt < Math.floor(Date.now() / 1e3)) return null;
40
+ return e.nonce;
41
+ }
42
+ tryConsume(requestHash) {
43
+ const e = this.issued.get(requestHash);
44
+ if (!e || e.consumed || e.expiresAt < Math.floor(Date.now() / 1e3)) return false;
45
+ e.consumed = true;
46
+ return true;
47
+ }
48
+ };
49
+
50
+ //#endregion
3
51
  //#region src/mcpi/approval-grant/grant.ts
4
52
  /**
5
53
  * Step-up approval grants — portable, edge-safe reference implementation.
@@ -32,7 +80,6 @@ import { SignJWT, base64url, importJWK, jwtVerify } from "jose";
32
80
  * @module @kya-os/checkpoint-shared/mcpi/approval-grant
33
81
  */
34
82
  const APPROVAL_GRANT_TYP = "approval-grant+jwt";
35
- const APPROVAL_GRANT_MAX_LIFETIME_SEC = 300;
36
83
  /** Produce a signed grant (runs in the approver's client, with their key). */
37
84
  async function signApprovalGrant(meta, privateKeyJwk) {
38
85
  if (!Number.isInteger(meta.created) || !Number.isInteger(meta.expires)) throw new Error("approval grant: created/expires must be integer unix seconds");
@@ -55,7 +102,14 @@ async function signApprovalGrant(meta, privateKeyJwk) {
55
102
  meta
56
103
  };
57
104
  }
58
- /** Verify a single grant against the gateway's expectation. Fail-closed. */
105
+ /**
106
+ * Verify a single grant against the gateway's expectation. Fail-closed.
107
+ *
108
+ * This resolves `grant.meta.approverDid` through `resolveKey` without checking
109
+ * it against any allowlist, and that DID is request-supplied. Callers that hold
110
+ * an approver allowlist must check it first, as {@link verifySignedApprovalQuorum}
111
+ * does, so an arbitrary DID never reaches the resolver.
112
+ */
59
113
  async function verifyApprovalGrant(opts) {
60
114
  const { grant, expected, resolveKey } = opts;
61
115
  const approverDid = grant?.meta?.approverDid;
@@ -152,6 +206,8 @@ async function verifySignedApprovalQuorum(opts) {
152
206
  };
153
207
  const approvers = /* @__PURE__ */ new Set();
154
208
  for (const grant of grants) {
209
+ const claimedApproverDid = grant?.meta?.approverDid;
210
+ if (typeof claimedApproverDid !== "string" || !quorum.approvers.includes(claimedApproverDid)) continue;
155
211
  const v = await verifyApprovalGrant({
156
212
  grant,
157
213
  expected: {
@@ -180,53 +236,6 @@ async function verifySignedApprovalQuorum(opts) {
180
236
  };
181
237
  }
182
238
 
183
- //#endregion
184
- //#region src/mcpi/approval-grant/nonce.ts
185
- /**
186
- * Server-issued, single-use nonce store for step-up approval grants.
187
- *
188
- * Issues one nonce per suspended action (`requestHash`) and consumes it when the
189
- * quorum is satisfied. A resubmission of the same grants finds the nonce gone →
190
- * rejected. This is what makes the grant single-use (closes replay across
191
- * connections). In production this is shared state (Redis/DO); in-memory here.
192
- *
193
- * Edge-safe: nonce bytes come from `globalThis.crypto.getRandomValues` (Web
194
- * Crypto — present on Node 18+, Cloudflare Workers, and Vercel Edge), encoded
195
- * with `jose`'s isomorphic `base64url`. No `node:crypto`, no `Buffer`.
196
- *
197
- * @module @kya-os/checkpoint-shared/mcpi/approval-grant
198
- */
199
- /** 32 cryptographically-random bytes, base64url-encoded. Edge-safe. */
200
- function generateNonce() {
201
- return base64url.encode(globalThis.crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(32)));
202
- }
203
- var InMemoryApprovalNonceStore = class {
204
- issued = /* @__PURE__ */ new Map();
205
- issue(requestHash, ttlSec = 300) {
206
- const now = Math.floor(Date.now() / 1e3);
207
- const existing = this.issued.get(requestHash);
208
- if (existing && !existing.consumed && existing.expiresAt >= now) return existing.nonce;
209
- const nonce = generateNonce();
210
- this.issued.set(requestHash, {
211
- nonce,
212
- consumed: false,
213
- expiresAt: now + ttlSec
214
- });
215
- return nonce;
216
- }
217
- current(requestHash) {
218
- const e = this.issued.get(requestHash);
219
- if (!e || e.consumed || e.expiresAt < Math.floor(Date.now() / 1e3)) return null;
220
- return e.nonce;
221
- }
222
- tryConsume(requestHash) {
223
- const e = this.issued.get(requestHash);
224
- if (!e || e.consumed || e.expiresAt < Math.floor(Date.now() / 1e3)) return false;
225
- e.consumed = true;
226
- return true;
227
- }
228
- };
229
-
230
239
  //#endregion
231
240
  export { APPROVAL_GRANT_MAX_LIFETIME_SEC, APPROVAL_GRANT_TYP, InMemoryApprovalNonceStore, signApprovalGrant, verifyApprovalGrant, verifySignedApprovalQuorum };
232
241
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/mcpi/approval-grant/grant.ts","../../../src/mcpi/approval-grant/nonce.ts"],"sourcesContent":["/**\n * Step-up approval grants — portable, edge-safe reference implementation.\n *\n * The signed approval-grant scheme the step-up gate verifies. Lives in\n * `@kya-os/checkpoint-shared` (the runtime-neutral home) so every runtime that\n * enforces N-of-M step-up at the edge — the central gateway AND the SDK\n * middleware adapters (Express / Next.js / Cloudflare-worker / .NET-port) —\n * injects the SAME verifier into the step-up core\n * (`@kya-os/checkpoint-wasm-runtime/step-up`) instead of re-implementing it.\n *\n * A grant is a compact EdDSA JWS (one crypto path with the delegation proof)\n * binding five independent dimensions so a captured grant can't be replayed or\n * repurposed past any one of them:\n * - `requestHash` — the exact suspended action (TOCTOU)\n * - `aud` — the resource/gateway it's valid for\n * - `sub` — the AGENT being approved (`agentDid`; an approval for X must\n * not satisfy Y's byte-identical call)\n * - `iat`/`exp` — freshness (lifetime <= 300s; jose enforces exp)\n * - `nonce` — server-issued + single-use; consumed on quorum satisfaction\n * so a resubmission of the same grants is rejected\n *\n * The approver holds their own key and signs client-side; verification resolves\n * the approver DID (via the host-injected {@link ApproverKeyResolver}) and is\n * fail-closed.\n *\n * Edge-safe: `jose` is isomorphic (Web Crypto `SubtleCrypto`); nonce generation\n * uses `globalThis.crypto.getRandomValues` (see `./nonce`). No `node:*` import.\n *\n * @module @kya-os/checkpoint-shared/mcpi/approval-grant\n */\n\nimport { SignJWT, jwtVerify, importJWK, type JWK, type JWTPayload } from 'jose';\n\nimport type { ApprovalNonceStore } from './nonce';\n\nexport const APPROVAL_GRANT_TYP = 'approval-grant+jwt';\nexport const APPROVAL_GRANT_MAX_LIFETIME_SEC = 300;\n\nexport interface Ed25519PublicJWK {\n kty: 'OKP';\n crv: 'Ed25519';\n x: string;\n}\n\n/** What an approver attests — canonicalised into the JWS payload. */\nexport interface ApprovalGrantMeta {\n approvalRequestId: string;\n approverDid: string;\n /** The agent being approved (`sub`). Aligns with the engine/Cedar agent identity. */\n agentDid: string;\n requestHash: string;\n audience: string;\n decision: 'approve' | 'deny';\n nonce: string;\n created: number;\n expires: number;\n amr?: string[];\n delegationRef?: string;\n}\n\nexport interface SignedApprovalGrant {\n jws: string;\n meta: ApprovalGrantMeta;\n}\n\nexport interface ApprovalGrantExpectation {\n requestHash: string;\n audience: string;\n nonce: string;\n agentDid: string;\n now?: number;\n maxLifetimeSec?: number;\n}\n\nexport type ApproverKeyResolver = (did: string) => Promise<Ed25519PublicJWK | null>;\n\nexport interface ApprovalGrantVerification {\n valid: boolean;\n reason?: string;\n approverDid?: string;\n}\n\n/** Produce a signed grant (runs in the approver's client, with their key). */\nexport async function signApprovalGrant(\n meta: ApprovalGrantMeta,\n privateKeyJwk: JWK\n): Promise<SignedApprovalGrant> {\n if (!Number.isInteger(meta.created) || !Number.isInteger(meta.expires)) {\n throw new Error('approval grant: created/expires must be integer unix seconds');\n }\n if (meta.expires <= meta.created) {\n throw new Error('approval grant: expires must be after created');\n }\n if (meta.expires - meta.created > APPROVAL_GRANT_MAX_LIFETIME_SEC) {\n throw new Error(`approval grant: lifetime exceeds ${APPROVAL_GRANT_MAX_LIFETIME_SEC}s ceiling`);\n }\n\n const key = await importJWK(privateKeyJwk, 'EdDSA');\n const claims: JWTPayload = {\n requestHash: meta.requestHash,\n decision: meta.decision,\n nonce: meta.nonce,\n };\n if (meta.amr) claims.amr = meta.amr;\n if (meta.delegationRef) claims.delegationRef = meta.delegationRef;\n\n const jws = await new SignJWT(claims)\n .setProtectedHeader({\n alg: 'EdDSA',\n kid: `${meta.approverDid}#key-1`,\n typ: APPROVAL_GRANT_TYP,\n })\n .setIssuer(meta.approverDid)\n .setSubject(meta.agentDid)\n .setAudience(meta.audience)\n .setJti(meta.approvalRequestId)\n .setIssuedAt(new Date(meta.created * 1000))\n .setExpirationTime(new Date(meta.expires * 1000))\n .sign(key);\n\n return { jws, meta };\n}\n\n/** Verify a single grant against the gateway's expectation. Fail-closed. */\nexport async function verifyApprovalGrant(opts: {\n grant: SignedApprovalGrant;\n expected: ApprovalGrantExpectation;\n resolveKey: ApproverKeyResolver;\n}): Promise<ApprovalGrantVerification> {\n const { grant, expected, resolveKey } = opts;\n\n const approverDid = grant?.meta?.approverDid;\n if (typeof approverDid !== 'string' || approverDid.length === 0) {\n return { valid: false, reason: 'missing_approver_did' };\n }\n\n let publicKeyJwk: Ed25519PublicJWK | null = null;\n try {\n publicKeyJwk = await resolveKey(approverDid);\n } catch {\n return { valid: false, reason: 'approver_key_unresolved' };\n }\n if (!publicKeyJwk) {\n return { valid: false, reason: 'approver_key_unresolved' };\n }\n\n try {\n const key = await importJWK(publicKeyJwk, 'EdDSA');\n const { payload, protectedHeader } = await jwtVerify(grant.jws, key, {\n algorithms: ['EdDSA'],\n issuer: approverDid,\n audience: expected.audience,\n ...(expected.now !== undefined ? { currentDate: new Date(expected.now * 1000) } : {}),\n });\n\n if (protectedHeader.typ !== APPROVAL_GRANT_TYP) {\n return { valid: false, reason: 'bad_typ' };\n }\n if (payload.requestHash !== expected.requestHash) {\n return { valid: false, reason: 'request_hash_mismatch' };\n }\n if (payload.nonce !== expected.nonce) {\n return { valid: false, reason: 'nonce_mismatch' };\n }\n if (payload.sub !== expected.agentDid) {\n return { valid: false, reason: 'agent_mismatch' };\n }\n if (payload.decision !== 'approve') {\n return { valid: false, reason: 'not_approved' };\n }\n\n const iat = payload.iat;\n const exp = payload.exp;\n if (typeof iat !== 'number' || typeof exp !== 'number') {\n return { valid: false, reason: 'missing_times' };\n }\n if (exp - iat > (expected.maxLifetimeSec ?? APPROVAL_GRANT_MAX_LIFETIME_SEC)) {\n return { valid: false, reason: 'lifetime_exceeded' };\n }\n if (\n grant.meta.requestHash !== payload.requestHash ||\n grant.meta.nonce !== payload.nonce ||\n grant.meta.agentDid !== payload.sub ||\n grant.meta.audience !== payload.aud ||\n grant.meta.decision !== payload.decision ||\n grant.meta.approverDid !== payload.iss\n ) {\n return { valid: false, reason: 'meta_mismatch' };\n }\n\n return { valid: true, approverDid };\n } catch {\n return { valid: false, reason: 'verify_failed' };\n }\n}\n\n// ── Quorum over signed grants ───────────────────────────────────────────────\n\nexport interface SignedQuorumResult {\n satisfied: boolean;\n reason?: string;\n}\n\n/**\n * Quorum is satisfied iff >= `quorum.n` DISTINCT allow-listed approvers each\n * signed a valid grant bound to the suspended action's outstanding nonce. On\n * satisfaction the nonce is consumed — a replay of the same grants then finds no\n * outstanding nonce and is rejected. Reuses {@link verifyApprovalGrant} per grant.\n */\nexport async function verifySignedApprovalQuorum(opts: {\n grants: SignedApprovalGrant[];\n expected: { requestHash: string; audience: string; agentDid: string; now?: number };\n quorum: { n: number; approvers: string[] };\n resolveKey: ApproverKeyResolver;\n nonceStore: ApprovalNonceStore;\n}): Promise<SignedQuorumResult> {\n const { grants, expected, quorum, resolveKey, nonceStore } = opts;\n\n if (!Number.isInteger(quorum.n) || quorum.n < 1) {\n return { satisfied: false, reason: 'invalid_quorum' };\n }\n if (!Array.isArray(quorum.approvers) || quorum.approvers.length === 0) {\n // Fail-closed: an empty allowlist means \"anyone who signs\" = not authorization.\n return { satisfied: false, reason: 'no_approvers' };\n }\n\n const nonce = nonceStore.current(expected.requestHash);\n if (!nonce) {\n // No outstanding challenge — covers a replay after a prior satisfaction.\n return { satisfied: false, reason: 'no_outstanding_challenge' };\n }\n\n const approvers = new Set<string>();\n for (const grant of grants) {\n const v = await verifyApprovalGrant({\n grant,\n expected: {\n requestHash: expected.requestHash,\n audience: expected.audience,\n agentDid: expected.agentDid,\n nonce,\n ...(expected.now !== undefined ? { now: expected.now } : {}),\n },\n resolveKey,\n });\n if (!v.valid || !v.approverDid) continue;\n if (!quorum.approvers.includes(v.approverDid)) continue;\n approvers.add(v.approverDid);\n }\n\n if (approvers.size >= quorum.n) {\n // ATOMIC single-use: only the first concurrent satisfier claims the nonce and\n // proceeds. A request that verified the same grants against the same nonce but\n // lost the race is re-challenged rather than double-admitted (closes the\n // read-verify-consume TOCTOU on the shared nonce).\n if (!nonceStore.tryConsume(expected.requestHash)) {\n return { satisfied: false, reason: 'nonce_already_consumed' };\n }\n return { satisfied: true };\n }\n return { satisfied: false, reason: `quorum_not_met:${approvers.size}/${quorum.n}` };\n}\n","/**\n * Server-issued, single-use nonce store for step-up approval grants.\n *\n * Issues one nonce per suspended action (`requestHash`) and consumes it when the\n * quorum is satisfied. A resubmission of the same grants finds the nonce gone →\n * rejected. This is what makes the grant single-use (closes replay across\n * connections). In production this is shared state (Redis/DO); in-memory here.\n *\n * Edge-safe: nonce bytes come from `globalThis.crypto.getRandomValues` (Web\n * Crypto — present on Node 18+, Cloudflare Workers, and Vercel Edge), encoded\n * with `jose`'s isomorphic `base64url`. No `node:crypto`, no `Buffer`.\n *\n * @module @kya-os/checkpoint-shared/mcpi/approval-grant\n */\n\nimport { base64url } from 'jose';\n\nimport { APPROVAL_GRANT_MAX_LIFETIME_SEC } from './grant';\n\nexport interface ApprovalNonceStore {\n /**\n * The action's nonce — minted once on the first `step_up`, then REUSED on every\n * resubmit (so grants already signed for it stay valid across partial resumes).\n * A fresh nonce is minted only for a NEW action instance — after the prior was\n * consumed (the action proceeded) or expired. Idempotent per `requestHash`.\n */\n issue(requestHash: string, ttlSec?: number): string;\n /** The outstanding, unconsumed, unexpired nonce for this action — else null. */\n current(requestHash: string): string | null;\n /**\n * ATOMICALLY claim + consume the action's outstanding nonce. Returns `true` for\n * the FIRST caller to claim it, `false` for every subsequent call (already\n * consumed, expired, or never issued). This is the single-use guarantee under\n * CONCURRENCY: two overlapping requests can both verify their grants against the\n * same outstanding nonce, but only the winner of `tryConsume` proceeds — the\n * loser is re-challenged, not double-admitted. The in-memory impl is atomic by\n * virtue of the synchronous event loop; a shared (Redis/DO) impl MUST back this\n * with an atomic compare-and-delete, not a read-then-write.\n */\n tryConsume(requestHash: string): boolean;\n}\n\n/** 32 cryptographically-random bytes, base64url-encoded. Edge-safe. */\nfunction generateNonce(): string {\n return base64url.encode(globalThis.crypto.getRandomValues(new Uint8Array(32)));\n}\n\nexport class InMemoryApprovalNonceStore implements ApprovalNonceStore {\n private readonly issued = new Map<\n string,\n { nonce: string; consumed: boolean; expiresAt: number }\n >();\n\n issue(requestHash: string, ttlSec = APPROVAL_GRANT_MAX_LIFETIME_SEC): string {\n const now = Math.floor(Date.now() / 1000);\n const existing = this.issued.get(requestHash);\n // Idempotent per action: a resubmitted step_up reuses the outstanding nonce\n // rather than rotating it (which would invalidate grants already signed for\n // it). Mint fresh only for a new action instance — after consume or expiry.\n if (existing && !existing.consumed && existing.expiresAt >= now) {\n return existing.nonce;\n }\n const nonce = generateNonce();\n this.issued.set(requestHash, { nonce, consumed: false, expiresAt: now + ttlSec });\n return nonce;\n }\n\n current(requestHash: string): string | null {\n const e = this.issued.get(requestHash);\n if (!e || e.consumed || e.expiresAt < Math.floor(Date.now() / 1000)) return null;\n return e.nonce;\n }\n\n tryConsume(requestHash: string): boolean {\n const e = this.issued.get(requestHash);\n if (!e || e.consumed || e.expiresAt < Math.floor(Date.now() / 1000)) return false;\n e.consumed = true; // synchronous compare-and-set — the event loop serializes concurrent claims\n return true;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,qBAAqB;AAClC,MAAa,kCAAkC;;AA+C/C,eAAsB,kBACpB,MACA,eAC8B;CAC9B,IAAI,CAAC,OAAO,UAAU,KAAK,OAAO,KAAK,CAAC,OAAO,UAAU,KAAK,OAAO,GACnE,MAAM,IAAI,MAAM,8DAA8D;CAEhF,IAAI,KAAK,WAAW,KAAK,SACvB,MAAM,IAAI,MAAM,+CAA+C;CAEjE,IAAI,KAAK,UAAU,KAAK,eACtB,MAAM,IAAI,MAAM,wCAAoE,UAAU;CAGhG,MAAM,MAAM,MAAM,UAAU,eAAe,OAAO;CAClD,MAAM,SAAqB;EACzB,aAAa,KAAK;EAClB,UAAU,KAAK;EACf,OAAO,KAAK;CACd;CACA,IAAI,KAAK,KAAK,OAAO,MAAM,KAAK;CAChC,IAAI,KAAK,eAAe,OAAO,gBAAgB,KAAK;CAgBpD,OAAO;EAAE,WAdS,IAAI,QAAQ,MAAM,CAAC,CAClC,mBAAmB;GAClB,KAAK;GACL,KAAK,GAAG,KAAK,YAAY;GACzB,KAAK;EACP,CAAC,CAAC,CACD,UAAU,KAAK,WAAW,CAAC,CAC3B,WAAW,KAAK,QAAQ,CAAC,CACzB,YAAY,KAAK,QAAQ,CAAC,CAC1B,OAAO,KAAK,iBAAiB,CAAC,CAC9B,4BAAY,IAAI,KAAK,KAAK,UAAU,GAAI,CAAC,CAAC,CAC1C,kCAAkB,IAAI,KAAK,KAAK,UAAU,GAAI,CAAC,CAAC,CAChD,KAAK,GAAG;EAEG;CAAK;AACrB;;AAGA,eAAsB,oBAAoB,MAIH;CACrC,MAAM,EAAE,OAAO,UAAU,eAAe;CAExC,MAAM,cAAc,OAAO,M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AAK;CAC3B;CACA,OAAO;EAAE,WAAW;EAAO,QAAQ,kBAAkB,UAAU,KAAK,GAAG,OAAO;CAAI;AACpF;;;;;;;;;;;;;;;;;;;AC1NA,SAAS,gBAAwB;CAC/B,OAAO,UAAU,OAAO,WAAW,OAAO,gCAAgB,IAAI,WAAW,EAAE,CAAC,CAAC;AAC/E;AAEA,IAAa,6BAAb,MAAsE;CACpE,AAAiB,yBAAS,IAAI,IAG5B;CAEF,MAAM,aAAqB,cAAkD;EAC3E,MAAM,MAAM,KAAK,MAAM,KAAK,IAAI,IAAI,GAAI;EACxC,MAAM,WAAW,KAAK,OAAO,IAAI,WAAW;EAI5C,IAAI,YAAY,CAAC,SAAS,YAAY,SAAS,aAAa,KAC1D,OAAO,SAAS;EAElB,MAAM,QAAQ,cAAc;EAC5B,KAAK,OAAO,IAAI,aAAa;GAAE;GAAO,UAAU;GAAO,WAAW,MAAM;EAAO,CAAC;EAChF,OAAO;CACT;CAEA,QAAQ,aAAoC;EAC1C,MAAM,IAAI,KAAK,OAAO,IAAI,WAAW;EACrC,IAAI,CAAC,KAAK,EAAE,YAAY,EAAE,YAAY,KAAK,MAAM,KAAK,IAAI,IAAI,GAAI,GAAG,OAAO;EAC5E,OAAO,EAAE;CACX;CAEA,WAAW,aAA8B;EACvC,MAAM,IAAI,KAAK,OAAO,IAAI,WAAW;EACrC,IAAI,CAAC,KAAK,EAAE,YAAY,EAAE,YAAY,KAAK,MAAM,KAAK,IAAI,IAAI,GAAI,GAAG,OAAO;EAC5E,EAAE,WAAW;EACb,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/mcpi/approval-grant/nonce.ts","../../../src/mcpi/approval-grant/grant.ts"],"sourcesContent":["/**\n * Server-issued, single-use nonce store for step-up approval grants.\n *\n * Issues one nonce per suspended action (`requestHash`) and consumes it when the\n * quorum is satisfied. A resubmission of the same grants finds the nonce gone →\n * rejected. This is what makes the grant single-use (closes replay across\n * connections). In production this is shared state (Redis/DO); in-memory here.\n *\n * Edge-safe: nonce bytes come from `globalThis.crypto.getRandomValues` (Web\n * Crypto — present on Node 18+, Cloudflare Workers, and Vercel Edge), encoded\n * with `jose`'s isomorphic `base64url`. No `node:crypto`, no `Buffer`.\n *\n * @module @kya-os/checkpoint-shared/mcpi/approval-grant\n */\n\nimport { base64url } from 'jose';\n\nexport const APPROVAL_GRANT_MAX_LIFETIME_SEC = 300;\n\nexport interface ApprovalNonceStore {\n /**\n * The action's nonce — minted once on the first `step_up`, then REUSED on every\n * resubmit (so grants already signed for it stay valid across partial resumes).\n * A fresh nonce is minted only for a NEW action instance — after the prior was\n * consumed (the action proceeded) or expired. Idempotent per `requestHash`.\n */\n issue(requestHash: string, ttlSec?: number): string;\n /** The outstanding, unconsumed, unexpired nonce for this action — else null. */\n current(requestHash: string): string | null;\n /**\n * ATOMICALLY claim + consume the action's outstanding nonce. Returns `true` for\n * the FIRST caller to claim it, `false` for every subsequent call (already\n * consumed, expired, or never issued). This is the single-use guarantee under\n * CONCURRENCY: two overlapping requests can both verify their grants against the\n * same outstanding nonce, but only the winner of `tryConsume` proceeds — the\n * loser is re-challenged, not double-admitted. The in-memory impl is atomic by\n * virtue of the synchronous event loop; a shared (Redis/DO) impl MUST back this\n * with an atomic compare-and-delete, not a read-then-write.\n */\n tryConsume(requestHash: string): boolean;\n}\n\n/** 32 cryptographically-random bytes, base64url-encoded. Edge-safe. */\nfunction generateNonce(): string {\n return base64url.encode(globalThis.crypto.getRandomValues(new Uint8Array(32)));\n}\n\nexport class InMemoryApprovalNonceStore implements ApprovalNonceStore {\n private readonly issued = new Map<\n string,\n { nonce: string; consumed: boolean; expiresAt: number }\n >();\n\n issue(requestHash: string, ttlSec = APPROVAL_GRANT_MAX_LIFETIME_SEC): string {\n const now = Math.floor(Date.now() / 1000);\n const existing = this.issued.get(requestHash);\n // Idempotent per action: a resubmitted step_up reuses the outstanding nonce\n // rather than rotating it (which would invalidate grants already signed for\n // it). Mint fresh only for a new action instance — after consume or expiry.\n if (existing && !existing.consumed && existing.expiresAt >= now) {\n return existing.nonce;\n }\n const nonce = generateNonce();\n this.issued.set(requestHash, { nonce, consumed: false, expiresAt: now + ttlSec });\n return nonce;\n }\n\n current(requestHash: string): string | null {\n const e = this.issued.get(requestHash);\n if (!e || e.consumed || e.expiresAt < Math.floor(Date.now() / 1000)) return null;\n return e.nonce;\n }\n\n tryConsume(requestHash: string): boolean {\n const e = this.issued.get(requestHash);\n if (!e || e.consumed || e.expiresAt < Math.floor(Date.now() / 1000)) return false;\n e.consumed = true; // synchronous compare-and-set — the event loop serializes concurrent claims\n return true;\n }\n}\n","/**\n * Step-up approval grants — portable, edge-safe reference implementation.\n *\n * The signed approval-grant scheme the step-up gate verifies. Lives in\n * `@kya-os/checkpoint-shared` (the runtime-neutral home) so every runtime that\n * enforces N-of-M step-up at the edge — the central gateway AND the SDK\n * middleware adapters (Express / Next.js / Cloudflare-worker / .NET-port) —\n * injects the SAME verifier into the step-up core\n * (`@kya-os/checkpoint-wasm-runtime/step-up`) instead of re-implementing it.\n *\n * A grant is a compact EdDSA JWS (one crypto path with the delegation proof)\n * binding five independent dimensions so a captured grant can't be replayed or\n * repurposed past any one of them:\n * - `requestHash` — the exact suspended action (TOCTOU)\n * - `aud` — the resource/gateway it's valid for\n * - `sub` — the AGENT being approved (`agentDid`; an approval for X must\n * not satisfy Y's byte-identical call)\n * - `iat`/`exp` — freshness (lifetime <= 300s; jose enforces exp)\n * - `nonce` — server-issued + single-use; consumed on quorum satisfaction\n * so a resubmission of the same grants is rejected\n *\n * The approver holds their own key and signs client-side; verification resolves\n * the approver DID (via the host-injected {@link ApproverKeyResolver}) and is\n * fail-closed.\n *\n * Edge-safe: `jose` is isomorphic (Web Crypto `SubtleCrypto`); nonce generation\n * uses `globalThis.crypto.getRandomValues` (see `./nonce`). No `node:*` import.\n *\n * @module @kya-os/checkpoint-shared/mcpi/approval-grant\n */\n\nimport { SignJWT, jwtVerify, importJWK, type JWK, type JWTPayload } from 'jose';\n\nimport { APPROVAL_GRANT_MAX_LIFETIME_SEC, type ApprovalNonceStore } from './nonce';\n\nexport const APPROVAL_GRANT_TYP = 'approval-grant+jwt';\n\nexport interface Ed25519PublicJWK {\n kty: 'OKP';\n crv: 'Ed25519';\n x: string;\n}\n\n/** What an approver attests — canonicalised into the JWS payload. */\nexport interface ApprovalGrantMeta {\n approvalRequestId: string;\n approverDid: string;\n /** The agent being approved (`sub`). Aligns with the engine/Cedar agent identity. */\n agentDid: string;\n requestHash: string;\n audience: string;\n decision: 'approve' | 'deny';\n nonce: string;\n created: number;\n expires: number;\n amr?: string[];\n delegationRef?: string;\n}\n\nexport interface SignedApprovalGrant {\n jws: string;\n meta: ApprovalGrantMeta;\n}\n\nexport interface ApprovalGrantExpectation {\n requestHash: string;\n audience: string;\n nonce: string;\n agentDid: string;\n now?: number;\n maxLifetimeSec?: number;\n}\n\nexport type ApproverKeyResolver = (did: string) => Promise<Ed25519PublicJWK | null>;\n\nexport interface ApprovalGrantVerification {\n valid: boolean;\n reason?: string;\n approverDid?: string;\n}\n\n/** Produce a signed grant (runs in the approver's client, with their key). */\nexport async function signApprovalGrant(\n meta: ApprovalGrantMeta,\n privateKeyJwk: JWK\n): Promise<SignedApprovalGrant> {\n if (!Number.isInteger(meta.created) || !Number.isInteger(meta.expires)) {\n throw new Error('approval grant: created/expires must be integer unix seconds');\n }\n if (meta.expires <= meta.created) {\n throw new Error('approval grant: expires must be after created');\n }\n if (meta.expires - meta.created > APPROVAL_GRANT_MAX_LIFETIME_SEC) {\n throw new Error(`approval grant: lifetime exceeds ${APPROVAL_GRANT_MAX_LIFETIME_SEC}s ceiling`);\n }\n\n const key = await importJWK(privateKeyJwk, 'EdDSA');\n const claims: JWTPayload = {\n requestHash: meta.requestHash,\n decision: meta.decision,\n nonce: meta.nonce,\n };\n if (meta.amr) claims.amr = meta.amr;\n if (meta.delegationRef) claims.delegationRef = meta.delegationRef;\n\n const jws = await new SignJWT(claims)\n .setProtectedHeader({\n alg: 'EdDSA',\n kid: `${meta.approverDid}#key-1`,\n typ: APPROVAL_GRANT_TYP,\n })\n .setIssuer(meta.approverDid)\n .setSubject(meta.agentDid)\n .setAudience(meta.audience)\n .setJti(meta.approvalRequestId)\n .setIssuedAt(new Date(meta.created * 1000))\n .setExpirationTime(new Date(meta.expires * 1000))\n .sign(key);\n\n return { jws, meta };\n}\n\n/**\n * Verify a single grant against the gateway's expectation. Fail-closed.\n *\n * This resolves `grant.meta.approverDid` through `resolveKey` without checking\n * it against any allowlist, and that DID is request-supplied. Callers that hold\n * an approver allowlist must check it first, as {@link verifySignedApprovalQuorum}\n * does, so an arbitrary DID never reaches the resolver.\n */\nexport async function verifyApprovalGrant(opts: {\n grant: SignedApprovalGrant;\n expected: ApprovalGrantExpectation;\n resolveKey: ApproverKeyResolver;\n}): Promise<ApprovalGrantVerification> {\n const { grant, expected, resolveKey } = opts;\n\n const approverDid = grant?.meta?.approverDid;\n if (typeof approverDid !== 'string' || approverDid.length === 0) {\n return { valid: false, reason: 'missing_approver_did' };\n }\n\n let publicKeyJwk: Ed25519PublicJWK | null = null;\n try {\n publicKeyJwk = await resolveKey(approverDid);\n } catch {\n return { valid: false, reason: 'approver_key_unresolved' };\n }\n if (!publicKeyJwk) {\n return { valid: false, reason: 'approver_key_unresolved' };\n }\n\n try {\n const key = await importJWK(publicKeyJwk, 'EdDSA');\n const { payload, protectedHeader } = await jwtVerify(grant.jws, key, {\n algorithms: ['EdDSA'],\n issuer: approverDid,\n audience: expected.audience,\n ...(expected.now !== undefined ? { currentDate: new Date(expected.now * 1000) } : {}),\n });\n\n if (protectedHeader.typ !== APPROVAL_GRANT_TYP) {\n return { valid: false, reason: 'bad_typ' };\n }\n if (payload.requestHash !== expected.requestHash) {\n return { valid: false, reason: 'request_hash_mismatch' };\n }\n if (payload.nonce !== expected.nonce) {\n return { valid: false, reason: 'nonce_mismatch' };\n }\n if (payload.sub !== expected.agentDid) {\n return { valid: false, reason: 'agent_mismatch' };\n }\n if (payload.decision !== 'approve') {\n return { valid: false, reason: 'not_approved' };\n }\n\n const iat = payload.iat;\n const exp = payload.exp;\n if (typeof iat !== 'number' || typeof exp !== 'number') {\n return { valid: false, reason: 'missing_times' };\n }\n if (exp - iat > (expected.maxLifetimeSec ?? APPROVAL_GRANT_MAX_LIFETIME_SEC)) {\n return { valid: false, reason: 'lifetime_exceeded' };\n }\n if (\n grant.meta.requestHash !== payload.requestHash ||\n grant.meta.nonce !== payload.nonce ||\n grant.meta.agentDid !== payload.sub ||\n grant.meta.audience !== payload.aud ||\n grant.meta.decision !== payload.decision ||\n grant.meta.approverDid !== payload.iss\n ) {\n return { valid: false, reason: 'meta_mismatch' };\n }\n\n return { valid: true, approverDid };\n } catch {\n return { valid: false, reason: 'verify_failed' };\n }\n}\n\n// ── Quorum over signed grants ───────────────────────────────────────────────\n\nexport interface SignedQuorumResult {\n satisfied: boolean;\n reason?: string;\n}\n\n/**\n * Quorum is satisfied iff >= `quorum.n` DISTINCT allow-listed approvers each\n * signed a valid grant bound to the suspended action's outstanding nonce. On\n * satisfaction the nonce is consumed — a replay of the same grants then finds no\n * outstanding nonce and is rejected. Reuses {@link verifyApprovalGrant} per grant.\n */\nexport async function verifySignedApprovalQuorum(opts: {\n grants: SignedApprovalGrant[];\n expected: { requestHash: string; audience: string; agentDid: string; now?: number };\n quorum: { n: number; approvers: string[] };\n resolveKey: ApproverKeyResolver;\n nonceStore: ApprovalNonceStore;\n}): Promise<SignedQuorumResult> {\n const { grants, expected, quorum, resolveKey, nonceStore } = opts;\n\n if (!Number.isInteger(quorum.n) || quorum.n < 1) {\n return { satisfied: false, reason: 'invalid_quorum' };\n }\n if (!Array.isArray(quorum.approvers) || quorum.approvers.length === 0) {\n // Fail-closed: an empty allowlist means \"anyone who signs\" = not authorization.\n return { satisfied: false, reason: 'no_approvers' };\n }\n\n const nonce = nonceStore.current(expected.requestHash);\n if (!nonce) {\n // No outstanding challenge — covers a replay after a prior satisfaction.\n return { satisfied: false, reason: 'no_outstanding_challenge' };\n }\n\n const approvers = new Set<string>();\n for (const grant of grants) {\n // Check the allowlist BEFORE verifyApprovalGrant resolves the approver's\n // key. `approverDid` is whatever the caller put in the grant, and resolving\n // a did:web is an outbound fetch to the host and port it names. A grant\n // from an approver outside the list is dropped exactly as the post-verify\n // check below drops it, so the result (`quorum_not_met:k/n`) is unchanged.\n const claimedApproverDid = grant?.meta?.approverDid;\n if (typeof claimedApproverDid !== 'string' || !quorum.approvers.includes(claimedApproverDid)) {\n continue;\n }\n\n const v = await verifyApprovalGrant({\n grant,\n expected: {\n requestHash: expected.requestHash,\n audience: expected.audience,\n agentDid: expected.agentDid,\n nonce,\n ...(expected.now !== undefined ? { now: expected.now } : {}),\n },\n resolveKey,\n });\n if (!v.valid || !v.approverDid) continue;\n // Kept as a second check on the verified issuer, in case verification ever\n // returns a DID other than the one the grant claimed.\n if (!quorum.approvers.includes(v.approverDid)) continue;\n approvers.add(v.approverDid);\n }\n\n if (approvers.size >= quorum.n) {\n // ATOMIC single-use: only the first concurrent satisfier claims the nonce and\n // proceeds. A request that verified the same grants against the same nonce but\n // lost the race is re-challenged rather than double-admitted (closes the\n // read-verify-consume TOCTOU on the shared nonce).\n if (!nonceStore.tryConsume(expected.requestHash)) {\n return { satisfied: false, reason: 'nonce_already_consumed' };\n }\n return { satisfied: true };\n }\n return { satisfied: false, reason: `quorum_not_met:${approvers.size}/${quorum.n}` };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,MAAa,kCAAkC;;AA0B/C,SAAS,gBAAwB;CAC/B,OAAO,UAAU,OAAO,WAAW,OAAO,gCAAgB,IAAI,WAAW,EAAE,CAAC,CAAC;AAC/E;AAEA,IAAa,6BAAb,MAAsE;CACpE,AAAiB,yBAAS,IAAI,IAG5B;CAEF,MAAM,aAAqB,cAAkD;EAC3E,MAAM,MAAM,KAAK,MAAM,KAAK,IAAI,IAAI,GAAI;EACxC,MAAM,WAAW,KAAK,OAAO,IAAI,WAAW;EAI5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B,GACzF;EAGF,MAAM,IAAI,MAAM,oBAAoB;GAClC;GACA,UAAU;IACR,aAAa,SAAS;IACtB,UAAU,SAAS;IACnB,UAAU,SAAS;IACnB;IACA,GAAI,SAAS,QAAQ,SAAY,EAAE,KAAK,SAAS,IAAI,IAAI,CAAC;GAC5D;GACA;EACF,CAAC;EACD,IAAI,CAAC,EAAE,SAAS,CAAC,EAAE,aAAa;EAGhC,IAAI,CAAC,OAAO,UAAU,SAAS,EAAE,WAAW,GAAG;EAC/C,UAAU,IAAI,EAAE,WAAW;CAC7B;CAEA,IAAI,UAAU,QAAQ,OAAO,GAAG;EAK9B,IAAI,CAAC,WAAW,WAAW,SAAS,WAAW,GAC7C,OAAO;GAAE,WAAW;GAAO,QAAQ;EAAyB;EAE9D,OAAO,EAAE,WAAW,KAAK;CAC3B;CACA,OAAO;EAAE,WAAW;EAAO,QAAQ,kBAAkB,UAAU,KAAK,GAAG,OAAO;CAAI;AACpF"}
@@ -119,11 +119,11 @@ declare const PolicyConfigSchema: z.ZodObject<{
119
119
  agentDid: "agentDid";
120
120
  riskLevel: "riskLevel";
121
121
  path: "path";
122
- confidence: "confidence";
123
- clientDid: "clientDid";
124
122
  agentType: "agentType";
125
123
  agentName: "agentName";
126
124
  agentVendor: "agentVendor";
125
+ clientDid: "clientDid";
126
+ confidence: "confidence";
127
127
  reputationScore: "reputationScore";
128
128
  method: "method";
129
129
  origin: "origin";
@@ -180,6 +180,7 @@ declare const PolicyConfigSchema: z.ZodObject<{
180
180
  policySourceHash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
181
181
  engineEnforcementEnabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
182
182
  trustedDelegationRoots: z.ZodOptional<z.ZodArray<z.ZodString>>;
183
+ authorizationServerIssuer: z.ZodOptional<z.ZodString>;
183
184
  }, z.core.$strip>;
184
185
  type PolicyConfig = z.infer<typeof PolicyConfigSchema>;
185
186
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/tool-protection/index.ts","../../../src/policy/schemas.ts","../../../src/mcpi/dashboard-config/types.ts","../../../src/mcpi/dashboard-config/schemas.ts","../../../src/mcpi/dashboard-config/default-config.ts"],"mappings":";;KAwCY;EAKN;EACA;EACA;;EAIA;EACA;EACA;;EAGA;EACA;;EAGA;EACA;EACA;;EAGA;EACA;EACA;;EAIA;EACA;EACA;;EAOA;EACA;EACA;;EAIA;EACA;EACA;;EAIA;EACA;EACA;;EAIA;EACA;EACA,eAAe;;EAGf;;UA8BW;EAIf;EAMA;EAMA;EASA;EAMA,gBAAgB;;KASN,oBAAoB,eAAe;;;cC+PlC,oBAAkB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6E7B,EAAA,KAAA;KAoEU,eAAe,EAAE,aAAa;;;KCniB9B;UAqBK;EAIf;IAME;IAOA;IAMA;IAMA;;EAMF;IAIE;IAMA,cAAc;MACZ;MACA;MACA;;IAMF;MACE;MACA;MACA;;;EAOJ;IAIE;IAOA;IAKA;MACE,MAAM;MACN;MACA;;IAMF;MACE;MACA;MACA;MACA;;;EAOJ;IAOE;IAKA;MACE;MACA;;IAQF,WAAW;;EAMb;IAIE;IAKA;IAMA;;EAMF;IAKE;IAMA;IAMA;;EAMF;IAIE;IAKA;MAIE;QACE;QACA;;MAOF,cAAc;QACZ;QACA;;MAMF,sBAAsB;QACpB;QACA;QACA;;;IAOJ;MAIE;QACE;QACA;QACA;QACA;;MAMF;QACE;QACA;UACE;UACA;UACA;;;;IAQN;MAIE,sBAAsB;QACpB;QACA;QACA;;MAMF;QACE;QACA;;;;EAaN,SAAS;EAKT;IAIE;IAKA;IAQA;IAKA;IAKA;;;UASa,+BAA+B;EAC9C,gBAAgB;IAEd,OAAO,eAAe;;EAGxB,QAAQ;;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;;;;;;;;;;GAG5C,EAAA,KAAA;qBAKW,oCAAkC,EAAA;;;;;;;;;;;;;;;;;;GA4B7C,EAAA,KAAA;;;qBCrMW,eAAe;wBA8DZ,4BACd,6CACC;wBAoDa,kBAAkB,SAAS,QAAQ,oBAAoB"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/tool-protection/index.ts","../../../src/policy/schemas.ts","../../../src/mcpi/dashboard-config/types.ts","../../../src/mcpi/dashboard-config/schemas.ts","../../../src/mcpi/dashboard-config/default-config.ts"],"mappings":";;KAwCY;EAKN;EACA;EACA;;EAIA;EACA;EACA;;EAGA;EACA;;EAGA;EACA;EACA;;EAGA;EACA;EACA;;EAIA;EACA;EACA;;EAOA;EACA;EACA;;EAIA;EACA;EACA;;EAIA;EACA;EACA;;EAIA;EACA;EACA,eAAe;;EAGf;;UA8BW;EAIf;EAMA;EAMA;EASA;EAMA,gBAAgB;;KASN,oBAAoB,eAAe;;;cC+PlC,oBAAkB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsF7B,EAAA,KAAA;KAoEU,eAAe,EAAE,aAAa;;;KC5iB9B;UAqBK;EAIf;IAME;IAOA;IAMA;IAMA;;EAMF;IAIE;IAMA,cAAc;MACZ;MACA;MACA;;IAMF;MACE;MACA;MACA;;;EAOJ;IAIE;IAOA;IAKA;MACE,MAAM;MACN;MACA;;IAMF;MACE;MACA;MACA;MACA;;;EAOJ;IAOE;IAKA;MACE;MACA;;IAQF,WAAW;;EAMb;IAIE;IAKA;IAMA;;EAMF;IAKE;IAMA;IAMA;;EAMF;IAIE;IAKA;MAIE;QACE;QACA;;MAOF,cAAc;QACZ;QACA;;MAMF,sBAAsB;QACpB;QACA;QACA;;;IAOJ;MAIE;QACE;QACA;QACA;QACA;;MAMF;QACE;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAG5C,EAAA,KAAA;qBAKW,oCAAkC,EAAA;;;;;;;;;;;;;;;;;;GA4B7C,EAAA,KAAA;;;qBCrMW,eAAe;wBA8DZ,4BACd,6CACC;wBAoDa,kBAAkB,SAAS,QAAQ,oBAAoB"}
@@ -119,11 +119,11 @@ declare const PolicyConfigSchema: z.ZodObject<{
119
119
  agentDid: "agentDid";
120
120
  riskLevel: "riskLevel";
121
121
  path: "path";
122
- confidence: "confidence";
123
- clientDid: "clientDid";
124
122
  agentType: "agentType";
125
123
  agentName: "agentName";
126
124
  agentVendor: "agentVendor";
125
+ clientDid: "clientDid";
126
+ confidence: "confidence";
127
127
  reputationScore: "reputationScore";
128
128
  method: "method";
129
129
  origin: "origin";
@@ -180,6 +180,7 @@ declare const PolicyConfigSchema: z.ZodObject<{
180
180
  policySourceHash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
181
181
  engineEnforcementEnabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
182
182
  trustedDelegationRoots: z.ZodOptional<z.ZodArray<z.ZodString>>;
183
+ authorizationServerIssuer: z.ZodOptional<z.ZodString>;
183
184
  }, z.core.$strip>;
184
185
  type PolicyConfig = z.infer<typeof PolicyConfigSchema>;
185
186
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/tool-protection/index.ts","../../../src/policy/schemas.ts","../../../src/mcpi/dashboard-config/types.ts","../../../src/mcpi/dashboard-config/schemas.ts","../../../src/mcpi/dashboard-config/default-config.ts"],"mappings":";;KAwCY;EAKN;EACA;EACA;;EAIA;EACA;EACA;;EAGA;EACA;;EAGA;EACA;EACA;;EAGA;EAC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","../../../src/policy/schemas.ts","../../../src/mcpi/dashboard-config/types.ts","../../../src/mcpi/dashboard-config/schemas.ts","../../../src/mcpi/dashboard-config/default-config.ts"],"mappings":";;KAwCY;EAKN;EACA;EACA;;EAIA;EACA;EACA;;EAGA;EACA;;EAGA;EACA;EACA;;EAGA;EACA;EACA;;EAIA;EACA;EACA;;EAOA;EACA;EACA;;EAIA;EACA;EACA;;EAIA;EACA;EACA;;EAIA;EACA;EACA,eAAe;;EAGf;;UA8BW;EAIf;EAMA;EAMA;EASA;EAMA,gBAAgB;;KASN,oBAAoB,eAAe;;;cC+PlC,oBAAkB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsF7B,EAAA,KAAA;KAoEU,eAAe,EAAE,aAAa;;;KC5iB9B;UAqBK;EAIf;IAME;IAOA;IAMA;IAMA;;EAMF;IAIE;IAMA,cAAc;MACZ;MACA;MACA;;IAMF;MACE;MACA;MACA;;;EAOJ;IAIE;IAOA;IAKA;MACE,MAAM;MACN;MACA;;IAMF;MACE;MACA;MACA;MACA;;;EAOJ;IAOE;IAKA;MACE;MACA;;IAQF,WAAW;;EAMb;IAIE;IAKA;IAMA;;EAMF;IAKE;IAMA;IAMA;;EAMF;IAIE;IAKA;MAIE;QACE;QACA;;MAOF,cAAc;QACZ;QACA;;MAMF,sBAAsB;QACpB;QACA;QACA;;;IAOJ;MAIE;QACE;QACA;QACA;QACA;;MAMF;QACE;QACA;UACE;UACA;UACA;;;;IAQN;MAIE,sBAAsB;QACpB;QACA;QACA;;MAMF;QACE;QACA;;;;EAaN,SAAS;EAKT;IAIE;IAKA;IAQA;IAKA;IAKA;;;UASa,+BAA+B;EAC9C,gBAAgB;IAEd,OAAO,eAAe;;EAGxB,QAAQ;;UAWO;EACf;;UAMe;EACf;EACA;IACE,Q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AKW,oCAAkC,EAAA;;;;;;;;;;;;;;;;;;GA4B7C,EAAA,KAAA;;;qBCrMW,eAAe;wBA8DZ,4BACd,6CACC;wBAoDa,kBAAkB,SAAS,QAAQ,oBAAoB"}
@@ -0,0 +1,41 @@
1
+ //#region src/posture-origins/index.d.ts
2
+ export declare const MAX_POSTURE_ORIGINS = 20;
3
+ export declare const MAX_POSTURE_ORIGIN_LENGTH = 300;
4
+ export declare const MULTI_TENANT_SUFFIXES: ReadonlySet<string>;
5
+ export interface ParsedOriginPattern {
6
+ pattern: string;
7
+ wildcard: boolean;
8
+ host: string;
9
+ port: string;
10
+ }
11
+ export type OriginPatternResult = {
12
+ ok: true;
13
+ value: ParsedOriginPattern;
14
+ } | {
15
+ ok: false;
16
+ error: string;
17
+ };
18
+ export declare function isPublicSuffixLike(host: string): boolean;
19
+ export declare function parseOriginPattern(input: string): OriginPatternResult;
20
+ export type PostureOriginsValidation = {
21
+ ok: true;
22
+ origins: string[];
23
+ } | {
24
+ ok: false;
25
+ errors: Array<{
26
+ index: number;
27
+ message: string;
28
+ }>;
29
+ };
30
+ export declare function validatePostureOrigins(input: unknown): PostureOriginsValidation;
31
+ export declare function primaryPostureOrigin(domain: string | null | undefined): string | undefined;
32
+ export declare function postureKeysUrl(base: string, projectId: string): string;
33
+ export declare function readPostureOriginsSetting(settings: unknown): string[];
34
+ export declare function resolveProjectAllowedOrigins(project: {
35
+ domain: string | null | undefined;
36
+ settings?: unknown;
37
+ }): string[];
38
+ export declare function matchAllowedOrigin(pageOrigin: string | null | undefined, allowed: readonly string[]): string | undefined;
39
+ export declare function pageOriginFromHeaders(origin: string | null | undefined, referer: string | null | undefined): string | null;
40
+ //#endregion
41
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/posture-origins/index.ts"],"mappings":";qBA2Ca;qBAEA;qBAcA,uBAAuB;iBA2InB;EAEf;EACA;EAEA;EAEA;;YAGU;EACN;EAAU,OAAO;;EACjB;EAAW;;wBASD,mBAAmB;wBAqBnB,mBAAmB,gBAAgB;YAoDvC;EACN;EAAU;;EACV;EAAW,QAAQ;IAAQ;IAAe;;;wBAOhC,uBAAuB,iBAAiB;wBAgCxC,qBAAqB;wBAwBrB,eAAe,cAAc;wBAI7B,0BAA0B;wBAkB1B,6BAA6B;EAC3C;EACA;;wBAkBc,mBACd,uCACA;wBAqCc,sBACd,mCACA"}
@@ -0,0 +1,41 @@
1
+ //#region src/posture-origins/index.d.ts
2
+ export declare const MAX_POSTURE_ORIGINS = 20;
3
+ export declare const MAX_POSTURE_ORIGIN_LENGTH = 300;
4
+ export declare const MULTI_TENANT_SUFFIXES: ReadonlySet<string>;
5
+ export interface ParsedOriginPattern {
6
+ pattern: string;
7
+ wildcard: boolean;
8
+ host: string;
9
+ port: string;
10
+ }
11
+ export type OriginPatternResult = {
12
+ ok: true;
13
+ value: ParsedOriginPattern;
14
+ } | {
15
+ ok: false;
16
+ error: string;
17
+ };
18
+ export declare function isPublicSuffixLike(host: string): boolean;
19
+ export declare function parseOriginPattern(input: string): OriginPatternResult;
20
+ export type PostureOriginsValidation = {
21
+ ok: true;
22
+ origins: string[];
23
+ } | {
24
+ ok: false;
25
+ errors: Array<{
26
+ index: number;
27
+ message: string;
28
+ }>;
29
+ };
30
+ export declare function validatePostureOrigins(input: unknown): PostureOriginsValidation;
31
+ export declare function primaryPostureOrigin(domain: string | null | undefined): string | undefined;
32
+ export declare function postureKeysUrl(base: string, projectId: string): string;
33
+ export declare function readPostureOriginsSetting(settings: unknown): string[];
34
+ export declare function resolveProjectAllowedOrigins(project: {
35
+ domain: string | null | undefined;
36
+ settings?: unknown;
37
+ }): string[];
38
+ export declare function matchAllowedOrigin(pageOrigin: string | null | undefined, allowed: readonly string[]): string | undefined;
39
+ export declare function pageOriginFromHeaders(origin: string | null | undefined, referer: string | null | undefined): string | null;
40
+ //#endregion
41
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/posture-origins/index.ts"],"mappings":";qBA2Ca;qBAEA;qBAcA,uBAAuB;iBA2InB;EAEf;EACA;EAEA;EAEA;;YAGU;EACN;EAAU,OAAO;;EACjB;EAAW;;wBASD,mBAAmB;wBAqBnB,mBAAmB,gBAAgB;YAoDvC;EACN;EAAU;;EACV;EAAW,QAAQ;IAAQ;IAAe;;;wBAOhC,uBAAuB,iBAAiB;wBAgCxC,qBAAqB;wBAwBrB,eAAe,cAAc;wBAI7B,0BAA0B;wBAkB1B,6BAA6B;EAC3C;EACA;;wBAkBc,mBACd,uCACA;wBAqCc,sBACd,mCACA"}