@kya-os/mcp 1.3.2 → 1.5.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 (92) hide show
  1. package/CHANGELOG.md +222 -1
  2. package/dist/delegation/index.d.ts +2 -1
  3. package/dist/delegation/index.d.ts.map +1 -1
  4. package/dist/delegation/index.js +2 -1
  5. package/dist/delegation/index.js.map +1 -1
  6. package/dist/delegation/scope-matcher.d.ts +35 -0
  7. package/dist/delegation/scope-matcher.d.ts.map +1 -0
  8. package/dist/delegation/scope-matcher.js +83 -0
  9. package/dist/delegation/scope-matcher.js.map +1 -0
  10. package/dist/delegation/vc-verifier.d.ts +1 -11
  11. package/dist/delegation/vc-verifier.d.ts.map +1 -1
  12. package/dist/delegation/vc-verifier.js +5 -19
  13. package/dist/delegation/vc-verifier.js.map +1 -1
  14. package/dist/errors.d.ts +1 -0
  15. package/dist/errors.d.ts.map +1 -1
  16. package/dist/errors.js +1 -0
  17. package/dist/errors.js.map +1 -1
  18. package/dist/index.d.ts +8 -3
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +9 -3
  21. package/dist/index.js.map +1 -1
  22. package/dist/middleware/with-kya-os.d.ts +88 -31
  23. package/dist/middleware/with-kya-os.d.ts.map +1 -1
  24. package/dist/middleware/with-kya-os.js +325 -88
  25. package/dist/middleware/with-kya-os.js.map +1 -1
  26. package/dist/policy/approval.d.ts +34 -0
  27. package/dist/policy/approval.d.ts.map +1 -0
  28. package/dist/policy/approval.js +29 -0
  29. package/dist/policy/approval.js.map +1 -0
  30. package/dist/policy/classifier.d.ts +38 -0
  31. package/dist/policy/classifier.d.ts.map +1 -0
  32. package/dist/policy/classifier.js +97 -0
  33. package/dist/policy/classifier.js.map +1 -0
  34. package/dist/policy/default-engine.d.ts +24 -0
  35. package/dist/policy/default-engine.d.ts.map +1 -0
  36. package/dist/policy/default-engine.js +41 -0
  37. package/dist/policy/default-engine.js.map +1 -0
  38. package/dist/policy/engine.d.ts +12 -0
  39. package/dist/policy/engine.d.ts.map +1 -0
  40. package/dist/policy/engine.js +2 -0
  41. package/dist/policy/engine.js.map +1 -0
  42. package/dist/policy/index.d.ts +7 -0
  43. package/dist/policy/index.d.ts.map +1 -0
  44. package/dist/policy/index.js +7 -0
  45. package/dist/policy/index.js.map +1 -0
  46. package/dist/policy/projection.d.ts +47 -0
  47. package/dist/policy/projection.d.ts.map +1 -0
  48. package/dist/policy/projection.js +33 -0
  49. package/dist/policy/projection.js.map +1 -0
  50. package/dist/policy/types.d.ts +52 -0
  51. package/dist/policy/types.d.ts.map +1 -0
  52. package/dist/policy/types.js +10 -0
  53. package/dist/policy/types.js.map +1 -0
  54. package/dist/proof/errors.d.ts +1 -0
  55. package/dist/proof/errors.d.ts.map +1 -1
  56. package/dist/proof/errors.js +4 -0
  57. package/dist/proof/errors.js.map +1 -1
  58. package/dist/proof/generator.d.ts +28 -4
  59. package/dist/proof/generator.d.ts.map +1 -1
  60. package/dist/proof/generator.js +48 -20
  61. package/dist/proof/generator.js.map +1 -1
  62. package/dist/proof/verifier.d.ts +32 -3
  63. package/dist/proof/verifier.d.ts.map +1 -1
  64. package/dist/proof/verifier.js +85 -6
  65. package/dist/proof/verifier.js.map +1 -1
  66. package/dist/providers/audit-log.d.ts +62 -0
  67. package/dist/providers/audit-log.d.ts.map +1 -0
  68. package/dist/providers/audit-log.js +75 -0
  69. package/dist/providers/audit-log.js.map +1 -0
  70. package/dist/providers/index.d.ts +3 -0
  71. package/dist/providers/index.d.ts.map +1 -1
  72. package/dist/providers/index.js +3 -0
  73. package/dist/providers/index.js.map +1 -1
  74. package/dist/providers/runtime-fetch.d.ts +73 -0
  75. package/dist/providers/runtime-fetch.d.ts.map +1 -0
  76. package/dist/providers/runtime-fetch.js +169 -0
  77. package/dist/providers/runtime-fetch.js.map +1 -0
  78. package/dist/providers/system-clock.d.ts +39 -0
  79. package/dist/providers/system-clock.d.ts.map +1 -0
  80. package/dist/providers/system-clock.js +49 -0
  81. package/dist/providers/system-clock.js.map +1 -0
  82. package/dist/types/protocol.d.ts +38 -3
  83. package/dist/types/protocol.d.ts.map +1 -1
  84. package/dist/types/protocol.js +44 -9
  85. package/dist/types/protocol.js.map +1 -1
  86. package/package.json +20 -15
  87. package/schemas/README.md +1 -1
  88. package/schemas/delegation-credential.json +2 -2
  89. package/schemas/detached-proof.json +12 -3
  90. package/schemas/handshake-request.json +1 -1
  91. package/schemas/handshake-response.json +1 -1
  92. package/schemas/well-known-mcpi.json +1 -1
package/CHANGELOG.md CHANGED
@@ -5,7 +5,228 @@ All notable changes to @kya-os/mcp will be documented here.
5
5
  Format: https://keepachangelog.com/en/1.0.0/
6
6
  Versioning: https://semver.org/spec/v2.0.0.html
7
7
 
8
- ## [Unreleased]
8
+ ## [1.5.0] - 2026-06-01
9
+
10
+ Exposes the policy-request projection as a reusable primitive and adds a
11
+ dedicated `./policy` entry point, so hosts beyond the bundled middleware (for
12
+ example a gateway) can build a `PolicyRequest` from their own resolved facts
13
+ without copying internal logic. Additive over 1.4.x.
14
+
15
+ ### Added
16
+
17
+ - **`buildPolicyRequest(input)` projection helper.** Pure, transport-agnostic
18
+ assembly of resolved facts — principal, delegated scopes, risk, scope-match,
19
+ and optional approvals / budget — into the canonical `PolicyRequest` a
20
+ `PolicyEngine` evaluates. Lets any host present an identical request contract
21
+ to the engine instead of re-deriving the shape.
22
+ - **`./policy` subpath export.** The policy seam (`PolicyRequest`,
23
+ `PolicyDecision`, `PolicyEngine`, `DefaultPolicyEngine`, `RiskClassifier`,
24
+ `buildPolicyRequest`) is now importable directly from `@kya-os/mcp/policy`,
25
+ alongside the existing re-export from the package root.
26
+
27
+ ### Changed
28
+
29
+ - The bundled per-action policy gate now builds its `PolicyRequest` via
30
+ `buildPolicyRequest` rather than an inline literal. No behavior change.
31
+
32
+ ## [1.4.0] - 2026-05-31
33
+
34
+ Ports the KYA-OS authorization primitives developed upstream (xmcp-i) into
35
+ `@kya-os/mcp`: a per-action policy / step-up gate, scope-matcher enforcement,
36
+ signed `needs_authorization` challenges with verifier content binding, and
37
+ shipped runtime providers. Additive over 1.3.x except where noted under
38
+ **Changed** and **Removed**.
39
+
40
+ ### Added
41
+
42
+ - **Signed `needs_authorization` challenge.** The delegation challenge returned
43
+ when a protected tool is invoked without a credential now carries a signed
44
+ detached-JWS proof in `_meta` (`outcome: 'needs_authorization'`). The proof
45
+ binds a `responseHash` over the challenge content — including the
46
+ `authorizationUrl`. A verifier that recomputes the response hash over the
47
+ content it received — via the new `ProofVerifier` content binding (below) —
48
+ detects a tampered / MITM-swapped consent URL; the signature alone proves
49
+ authenticity, not content-match. The challenge content/shape is unchanged; attachment
50
+ is best-effort (no-ops when no session can be resolved). The proof `outcome`
51
+ enum widened to include `'needs_authorization'` across `ProofMeta`,
52
+ `ProofOptions`, `validateDetachedProof`, and the `detached-proof` JSON Schema.
53
+ Success proofs are byte-identical (unaffected).
54
+ - **`wrapWithDelegation` `formatChallenge` hook.** An optional config callback
55
+ that renders the `needs_authorization` challenge content (e.g. a clickable
56
+ markdown consent link for LLM / chat-style MCP clients) **before** the proof is
57
+ signed — so the challenge `responseHash` binds exactly what the client
58
+ receives, keeping the `authorizationUrl` tamper-evident regardless of
59
+ presentation. Defaults to the structured JSON challenge. The consent-basic /
60
+ consent-full examples now render their consent link via this hook instead of
61
+ rewriting the response after signing (which had left the proof bound to stale
62
+ content).
63
+ - **`ProofVerifier` content binding.** `verifyProof(proof, jwk, { request, response })`
64
+ recomputes `requestHash`/`responseHash` over the request/response the verifier
65
+ actually received — via a shared `computeCanonicalHashes` (single source of
66
+ truth with the signer, so they can't drift) — and fails `CONTENT_BINDING_MISMATCH`
67
+ on divergence. This is what realizes substitution detection (the signed
68
+ challenge's anti-MITM, and content-binding for any proof); the signature alone
69
+ proves only authenticity. New `CONTENT_BINDING_MISMATCH` proof-verification
70
+ error code.
71
+ - **Concrete `SystemClockProvider` + `RuntimeFetchProvider`.** The package now
72
+ ships a wall-clock `ClockProvider` and a network-capable `FetchProvider`
73
+ (did:key resolved locally, did:web over HTTPS, StatusList2021 fetch) so a
74
+ consumer no longer hand-rolls them to drive `ProofVerifier`. `RuntimeFetchProvider`
75
+ is the default the middleware uses and replaces the prior internal stub (whose
76
+ `resolveDID` returned `null`); it refuses private-network targets by default
77
+ (see **Security**). The verify-proof / anti-MITM examples now consume both.
78
+ - **Per-action policy / step-up gate (`withPolicyGate`).** A new opt-in
79
+ middleware wrapper that classifies an action's risk (reversibility, blast
80
+ radius, severity) and consults a pluggable Policy-as-Code `PolicyEngine`:
81
+ `allow` runs the handler, `deny` returns a `policy_denied` error, and
82
+ `step_up` returns a `needs_approval` error until N-of-M signed `ApprovalGrant`s
83
+ — each bound to the request hash (TOCTOU-safe) — are supplied. Ships a
84
+ fail-closed `DefaultPolicyEngine` and a built-in `RiskClassifier`; OPA/Rego and
85
+ Cedar adapters are intended follow-ups. Composes after `wrapWithDelegation`;
86
+ no behavior change unless adopted.
87
+ - **`PolicyEngine` PaC port + `policy/` subsystem** (`PolicyRequest`,
88
+ `PolicyDecision`, `RiskClassifier`, `DefaultPolicyEngine`, `ApprovalGrant`,
89
+ `verifyApprovalQuorum`), exported from the package root.
90
+ - **`needs_approval` error** (`NeedsApprovalError`, `createNeedsApprovalError`,
91
+ `isNeedsApprovalError`) and the `policy_denied` error code.
92
+ - **`bytesToBase64` / `base64ToBytes`** are now re-exported from the package root
93
+ (standard-base64 byte helpers, alongside the existing base64url variants).
94
+ - **`AuditLogProvider` — pluggable sink for audit-record retention.** A new
95
+ provider (abstract base + `MemoryAuditLogProvider` / `NoopAuditLogProvider`
96
+ defaults, exported from the root and `./providers`) for persisting the frozen
97
+ `audit.v1` record of each verified tool call. Wire it via `KyaOsConfig.auditLog`
98
+ (default: no-op); `createKyaOsMiddleware` emits a record after each proofed
99
+ call, and a sink failure never breaks the tool response. `buildAuditRecord(ctx)`
100
+ exposes the context→record mapping. Records carry only DID/key id, session,
101
+ audience, scope, request/response hashes, and the verification result — never
102
+ key material or nonces. The storage backend is operator-provided (durable,
103
+ append-only); the package stays storage-agnostic, like the other providers.
104
+ - **Delegation scope on audit records.** Delegation-protected tools record the
105
+ scope they were authorized under: `wrapWithDelegation` threads its `scopeId`
106
+ through a new optional `KyaOsCallContext` (3rd handler argument) into the proof
107
+ meta, so the audit record's `scope` reflects it (was `'-'`). The argument is
108
+ optional and backward-compatible; tool handlers that ignore it are unaffected.
109
+
110
+ ### Changed
111
+
112
+ - **`ProofMeta.responseHash` is now optional** (`string | undefined`). Denial /
113
+ step-up proofs carry no response, so code reading `responseHash` must treat it
114
+ as possibly-absent. `validateDetachedProof` and the `detached-proof` JSON
115
+ Schema no longer require it (and now permit `outcome`/`reason`).
116
+ - **`CrispScope` `prefix`/`regex` matchers are now enforced** (previously inert —
117
+ only exact membership in the flat `scopes[]` was checked). A credential
118
+ declaring a non-exact matcher now grants its pattern set, with ReDoS-safe regex
119
+ evaluation; flat `scopes[]` remain exact-match (unchanged). **Behavioral
120
+ change** for any credential that declared a `prefix`/`regex` matcher: it now
121
+ grants where it previously granted nothing, and a one-time warning is logged on
122
+ first non-exact use. Re-delegations may not introduce crisp matchers absent
123
+ from the parent.
124
+ - **`withPolicyGate`'s `scopeMatched` defaults to `false`** (fail-closed): compose
125
+ it after `wrapWithDelegation` and pass `scopeMatched: true`, or it denies.
126
+ `withPolicyGate` is an optional member of the `KyaOsMiddleware` interface
127
+ (additive; structural implementers/mocks are not broken). New in this release,
128
+ so no prior consumer is affected.
129
+ - **Bundled examples now consume the built `@kya-os/mcp` package** rather than
130
+ reaching into `src/` via relative paths. Nested example packages (consent-basic,
131
+ consent-full, context7, brave-search) link the local build via `file:../..`;
132
+ root-tree examples (node-server, verify-proof, outbound-delegation, statuslist)
133
+ resolve it by package self-reference. Fixes the context7 example, which had
134
+ pinned a stale published `@kya-os/mcp@^1.3.0` (pre-`withKyaOs` rename).
135
+
136
+ ### Spec
137
+
138
+ - **§4.2 — normative MUST on key generation.** An agent's key pair MUST be
139
+ generated by the agent or its designated custodian; the secret key MUST NOT be
140
+ generated by, transmitted to, or escrowed with any registration, DID,
141
+ directory, or reputation service (which receive only the public key). Carves
142
+ out agent-side proxy/HSM custody (§11.0). Closes the key-escrow / IBE-style
143
+ concern where a directory service implicitly holds agents' secret keys.
144
+ - **§6.6 — revocation needs no global list.** Clarified that a verifier checks
145
+ revocation only for the resources it gates and MAY hold revocation state
146
+ locally; `StatusList2021` is the interoperable publish format, not a required
147
+ public certificate-revocation list.
148
+ - **§11.0 — "L2+ is not OAuth-style client registration."** Direct (Level 2+)
149
+ verification still gates on the presented delegation chain, not the agent's
150
+ identity alone — inverting the OAuth Dynamic Client Registration pattern.
151
+ - **§12.5 — per-delegation keys (delegate unlinkability).** Non-normative
152
+ pattern: delegate to a fresh one-off public key per delegation to prevent
153
+ cross-delegation correlation through a shared subject DID.
154
+ - **§2 — reputation scope.** The Responsible Party definition now states that
155
+ reputation and accountability signals are scoped primarily to the Responsible
156
+ Party, not an agent's ephemeral identity.
157
+ - **Terminology.** Standardized on _secret key_ (synonymous with _private key_,
158
+ retained in PKCS#8 / JWK references); fixed the one residual _private key_
159
+ usage in §7.
160
+
161
+ ### Security
162
+
163
+ - **Malformed delegation input no longer crashes.** A malformed `_kyaos_delegation`
164
+ (non-object, missing `credentialSubject.delegation`, or even a throwing
165
+ getter/Proxy accessor) previously surfaced as a JSON-RPC internal error (`-32603`);
166
+ it now returns a clean, signed `delegation_invalid` denial. `validateDelegationChain`
167
+ shape-checks the leaf and returns `{ valid, reason }` (honouring the
168
+ `verify*`/`validate*` never-throw contract); `extractDelegationFromVC` fails
169
+ with a clear error instead of a cryptic `TypeError`; the middleware try/catch is
170
+ now a pure backstop that logs the detail server-side and returns a generic
171
+ reason (no internal/stack detail leaks to the client). The invalid-VC-JWT path
172
+ is now signed as well.
173
+ - **Log-injection / reflection hardening.** Caller-derived values (credential
174
+ ids, scopes) interpolated into delegation-failure reasons and logs are now
175
+ stripped of control characters and length-capped before emission, so a hostile
176
+ credential cannot forge log lines, corrupt a terminal, or reflect raw control
177
+ bytes into a client response.
178
+ - **`RuntimeFetchProvider` refuses private-network targets by default (SSRF).**
179
+ did:web resolution and StatusList2021 fetches reject loopback / link-local /
180
+ RFC-1918 IP-literal hosts (e.g. `did:web:169.254.169.254`, the cloud-metadata
181
+ endpoint) unless constructed with `{ allowPrivateNetworkHosts: true }`. This
182
+ is best-effort defense-in-depth for IP literals — not DNS rebinding; run
183
+ verifiers behind an egress allowlist (`SECURITY.md`).
184
+ - **Signed proofs are now emitted on denial and step-up.** Delegation/scope
185
+ denials and policy step-ups previously produced no proof; they now attach a
186
+ signed detached-JWS proof (`outcome: 'denied' | 'step_up_required'`, no
187
+ `responseHash`), so rejected privileged attempts are non-repudiably auditable.
188
+ - **Fail-closed policy default.** Unclassified ("unknown") high-risk actions are
189
+ denied by the `DefaultPolicyEngine` rather than forwarded.
190
+ - **Denial/step-up proofs are verifiable end-to-end.** `validateDetachedProof`
191
+ and `ProofVerifier` accept response-less proofs (the earlier fix only corrected
192
+ canonical-payload reconstruction); added a real-crypto end-to-end test.
193
+ - **Crisp-scope attenuation.** Re-delegations cannot widen authority via crisp
194
+ matchers absent from the parent — closes a privilege-escalation path that
195
+ enforcing the matcher would otherwise have opened.
196
+ - **ReDoS hardening.** The `regex` matcher rejects nested-quantifier patterns and
197
+ bounds input length. This is a conservative guard, **not** a guarantee — prefer
198
+ `exact`/`prefix` for untrusted issuers, or evaluate via a linear-time engine.
199
+ The `prefix` matcher refuses an empty/`*`-only base (no universal grant).
200
+
201
+ ### Removed
202
+
203
+ - **BREAKING: removed the three unsafe delegation opt-outs.** The
204
+ secure-by-default behavior they bypassed is now unconditional and cannot be
205
+ disabled:
206
+ - `delegation.requireAudienceOnRedelegation` — audience binding on every
207
+ non-root credential in a chain is now mandatory (`SPEC.md` §11.6).
208
+ - `delegation.allowLegacyUnsafeDelegation` — full delegation-chain resolution
209
+ and `credentialStatus` / StatusList revocation checks are always enforced;
210
+ parent-linked credentials without a `resolveDelegationChain` handler, and
211
+ `credentialStatus` without a `statusListResolver`, are rejected.
212
+ - `VerifyDelegationVCOptions.allowNonDelegationSubjectFields` — the
213
+ `credentialSubject` shape check (only `id` + `delegation`) is always
214
+ enforced (`SPEC.md` §6.2; conformance L3.5a).
215
+
216
+ The associated one-time `console.warn` notices are removed along with the
217
+ flags. Migration guidance: `SECURITY.md` → Mandatory Delegation Protections.
218
+ Consumers that did not set these flags are unaffected — the reference issuer
219
+ and all bundled examples already emit conformant credentials.
220
+
221
+ ### Known limitations (policy gate — experimental, non-normative)
222
+
223
+ - Step-up approval grants are **not yet single-use or expiry-bound** (replayable
224
+ for the same action); a server-issued single-use challenge is a planned follow-up.
225
+ - The default approval-signature verifier **rejects all** — integrators must supply
226
+ a real verifier; `isValidApprovalSignature: async () => true` is test-only.
227
+ - `policy_denied` / `needs_approval`, the step-up flow, and the now-normative
228
+ `CrispScope` matcher semantics are **not yet documented in `SPEC.md` /
229
+ `CONFORMANCE.md`** (tracked as follow-ups).
9
230
 
10
231
  ## [1.3.2] - 2026-05-26
11
232
 
@@ -14,8 +14,9 @@ export * from './utils.js';
14
14
  export * from './outbound-proof.js';
15
15
  export * from './outbound-headers.js';
16
16
  export * from './audience-validator.js';
17
+ export * from './scope-matcher.js';
17
18
  export { createDidKeyResolver, resolveDidKeySync, isEd25519DidKey, extractPublicKeyFromDidKey, publicKeyToJwk, } from './did-key-resolver.js';
18
- export { DidWebResolver, createDidWebResolver, isDidWeb, parseDidWeb, didWebToUrl, } from './did-web-resolver.js';
19
+ export { DidWebResolver, createDidWebResolver, isDidWeb, parseDidWeb, didWebToUrl, buildDidWebDocument, } from './did-web-resolver.js';
19
20
  export { MemoryStatusListStorage } from './storage/memory-statuslist-storage.js';
20
21
  export { MemoryDelegationGraphStorage } from './storage/memory-graph-storage.js';
21
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/delegation/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,0BAA0B,EAC1B,cAAc,GACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,QAAQ,EACR,WAAW,EACX,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/delegation/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,0BAA0B,EAC1B,cAAc,GACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,QAAQ,EACR,WAAW,EACX,WAAW,EACX,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC"}
@@ -14,8 +14,9 @@ export * from './utils.js';
14
14
  export * from './outbound-proof.js';
15
15
  export * from './outbound-headers.js';
16
16
  export * from './audience-validator.js';
17
+ export * from './scope-matcher.js';
17
18
  export { createDidKeyResolver, resolveDidKeySync, isEd25519DidKey, extractPublicKeyFromDidKey, publicKeyToJwk, } from './did-key-resolver.js';
18
- export { DidWebResolver, createDidWebResolver, isDidWeb, parseDidWeb, didWebToUrl, } from './did-web-resolver.js';
19
+ export { DidWebResolver, createDidWebResolver, isDidWeb, parseDidWeb, didWebToUrl, buildDidWebDocument, } from './did-web-resolver.js';
19
20
  export { MemoryStatusListStorage } from './storage/memory-statuslist-storage.js';
20
21
  export { MemoryDelegationGraphStorage } from './storage/memory-graph-storage.js';
21
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/delegation/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,0BAA0B,EAC1B,cAAc,GACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,QAAQ,EACR,WAAW,EACX,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/delegation/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,0BAA0B,EAC1B,cAAc,GACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,QAAQ,EACR,WAAW,EACX,WAAW,EACX,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC"}
@@ -0,0 +1,35 @@
1
+ import type { DelegationCredential } from '../types/protocol.js';
2
+ export type ScopeMatcher = 'exact' | 'prefix' | 'regex';
3
+ /**
4
+ * Match a single requested scope/resource value against a pattern by matcher kind.
5
+ *
6
+ * - `exact` : strict string equality.
7
+ * - `prefix` : value starts with the pattern (a single trailing `*` is optional sugar).
8
+ * An empty base ('' or lone '*') matches nothing — it will NOT grant
9
+ * universal scope.
10
+ * - `regex` : anchored full-string match; never throws (invalid patterns → false).
11
+ *
12
+ * SECURITY: the regex pattern is supplied by the credential ISSUER. JS `RegExp`
13
+ * is not linear-time, so this guards against the common catastrophic-backtracking
14
+ * shapes (nested quantifiers) and bounds input length — but it is a conservative
15
+ * mitigation, not a guarantee. Deployments accepting `regex` matchers from
16
+ * untrusted issuers should prefer `exact`/`prefix` or evaluate via a linear-time
17
+ * engine (e.g. RE2).
18
+ */
19
+ export declare function matchScope(pattern: string, matcher: ScopeMatcher, value: string): boolean;
20
+ export interface ScopeSatisfaction {
21
+ satisfied: boolean;
22
+ /**
23
+ * True when satisfaction came via a non-exact (prefix|regex) CrispScope matcher.
24
+ * Callers should surface a warning — non-exact matchers widen effective authority.
25
+ */
26
+ usedNonExactMatcher: boolean;
27
+ }
28
+ /**
29
+ * Decide whether a required scope id is satisfied by a credential.
30
+ *
31
+ * Flat `scopes[]` are matched EXACTLY (backwards-compatible). The opt-in
32
+ * `constraints.crisp.scopes[]` entries are honored per their declared matcher.
33
+ */
34
+ export declare function scopeSatisfies(requiredScopeId: string, credential: DelegationCredential): ScopeSatisfaction;
35
+ //# sourceMappingURL=scope-matcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope-matcher.d.ts","sourceRoot":"","sources":["../../src/delegation/scope-matcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAc,MAAM,sBAAsB,CAAC;AAY7E,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAExD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAsBzF;AAkBD,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,mBAAmB,EAAE,OAAO,CAAC;CAC9B;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,eAAe,EAAE,MAAM,EACvB,UAAU,EAAE,oBAAoB,GAC/B,iBAAiB,CAUnB"}
@@ -0,0 +1,83 @@
1
+ const MAX_REGEX_LEN = 256;
2
+ const MAX_VALUE_LEN = 256;
3
+ /**
4
+ * Conservative detector for the classic catastrophic-backtracking shape — a
5
+ * quantified group whose body also contains a quantifier, e.g. `(a+)+`, `(a*)*`,
6
+ * `(.{1,9})+`. This is a heuristic reject, NOT a proof of safety.
7
+ */
8
+ const NESTED_QUANTIFIER = /\([^()]*[+*?{][^()]*\)\s*[+*{]/;
9
+ /**
10
+ * Match a single requested scope/resource value against a pattern by matcher kind.
11
+ *
12
+ * - `exact` : strict string equality.
13
+ * - `prefix` : value starts with the pattern (a single trailing `*` is optional sugar).
14
+ * An empty base ('' or lone '*') matches nothing — it will NOT grant
15
+ * universal scope.
16
+ * - `regex` : anchored full-string match; never throws (invalid patterns → false).
17
+ *
18
+ * SECURITY: the regex pattern is supplied by the credential ISSUER. JS `RegExp`
19
+ * is not linear-time, so this guards against the common catastrophic-backtracking
20
+ * shapes (nested quantifiers) and bounds input length — but it is a conservative
21
+ * mitigation, not a guarantee. Deployments accepting `regex` matchers from
22
+ * untrusted issuers should prefer `exact`/`prefix` or evaluate via a linear-time
23
+ * engine (e.g. RE2).
24
+ */
25
+ export function matchScope(pattern, matcher, value) {
26
+ switch (matcher) {
27
+ case 'exact':
28
+ return pattern === value;
29
+ case 'prefix': {
30
+ const base = pattern.endsWith('*') ? pattern.slice(0, -1) : pattern;
31
+ // Refuse to grant universal scope via an empty/`*`-only prefix.
32
+ if (base.length === 0)
33
+ return false;
34
+ return value.startsWith(base);
35
+ }
36
+ case 'regex': {
37
+ if (pattern.length > MAX_REGEX_LEN || value.length > MAX_VALUE_LEN)
38
+ return false;
39
+ if (NESTED_QUANTIFIER.test(pattern))
40
+ return false;
41
+ try {
42
+ return new RegExp(`^(?:${pattern})$`).test(value);
43
+ }
44
+ catch {
45
+ return false;
46
+ }
47
+ }
48
+ default:
49
+ return false;
50
+ }
51
+ }
52
+ /**
53
+ * Flat exact-match scope set: delegation.scopes ∪ constraints.scopes.
54
+ * Null-safe by design: scopeSatisfies is a public, never-throw predicate, so a
55
+ * structurally malformed credential (missing constraints) yields an empty set
56
+ * rather than a TypeError.
57
+ */
58
+ function flatScopes(credential) {
59
+ const d = credential?.credentialSubject?.delegation;
60
+ return [...(d?.scopes ?? []), ...(d?.constraints?.scopes ?? [])];
61
+ }
62
+ /** Opt-in CrispScope[] entries (constraints.crisp.scopes), if any. Null-safe. */
63
+ function crispScopes(credential) {
64
+ return credential?.credentialSubject?.delegation?.constraints?.crisp?.scopes ?? [];
65
+ }
66
+ /**
67
+ * Decide whether a required scope id is satisfied by a credential.
68
+ *
69
+ * Flat `scopes[]` are matched EXACTLY (backwards-compatible). The opt-in
70
+ * `constraints.crisp.scopes[]` entries are honored per their declared matcher.
71
+ */
72
+ export function scopeSatisfies(requiredScopeId, credential) {
73
+ if (flatScopes(credential).includes(requiredScopeId)) {
74
+ return { satisfied: true, usedNonExactMatcher: false };
75
+ }
76
+ for (const cs of crispScopes(credential)) {
77
+ if (matchScope(cs.resource, cs.matcher, requiredScopeId)) {
78
+ return { satisfied: true, usedNonExactMatcher: cs.matcher !== 'exact' };
79
+ }
80
+ }
81
+ return { satisfied: false, usedNonExactMatcher: false };
82
+ }
83
+ //# sourceMappingURL=scope-matcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope-matcher.js","sourceRoot":"","sources":["../../src/delegation/scope-matcher.ts"],"names":[],"mappings":"AAEA,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B;;;;GAIG;AACH,MAAM,iBAAiB,GAAG,gCAAgC,CAAC;AAI3D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,UAAU,CAAC,OAAe,EAAE,OAAqB,EAAE,KAAa;IAC9E,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,OAAO;YACV,OAAO,OAAO,KAAK,KAAK,CAAC;QAC3B,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC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,CAAC;IACzD,CAAC;IACD,KAAK,MAAM,EAAE,IAAI,WAAW,CAAC,UAAU,CAAC,EAAE,CAAC;QACzC,IAAI,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,OAAO,EAAE,eAAe,CAAC,EAAE,CAAC;YACzD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,mBAAmB,EAAE,EAAE,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QAC1E,CAAC;IACH,CAAC;IACD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,CAAC;AAC1D,CAAC"}
@@ -34,15 +34,6 @@ export interface VerifyDelegationVCOptions {
34
34
  skipStatus?: boolean;
35
35
  didResolver?: DIDResolver;
36
36
  statusListResolver?: StatusListResolver;
37
- /**
38
- * Accept a delegation credential whose `credentialSubject` carries properties
39
- * beyond `id` and `delegation` (e.g. claim-bearing fields). UNSAFE: mixing
40
- * claim semantics into a permission credential separates designation from
41
- * authorization — the root of the confused-deputy class (KYA-OS §11.6).
42
- * Defaults to `false` (strict). When `true`, the verifier emits a one-time
43
- * per-process warning and accepts the credential.
44
- */
45
- allowNonDelegationSubjectFields?: boolean;
46
37
  }
47
38
  export interface DIDResolver {
48
39
  resolve(did: string): Promise<DIDDocument | null>;
@@ -109,8 +100,7 @@ export declare class DelegationCredentialVerifier {
109
100
  * Reject a delegation credential whose `credentialSubject` carries properties
110
101
  * other than `id` and `delegation`. Claim-bearing fields in a permission
111
102
  * credential separate designation from authorization — the confused-deputy
112
- * class (KYA-OS §11.6). Strict by default; the unsafe opt-out emits a
113
- * one-time per-process warning.
103
+ * class (KYA-OS §11.6). Unconditional as of 1.4.0.
114
104
  */
115
105
  private validateSubjectShape;
116
106
  private verifySignature;
@@ -1 +1 @@
1
- {"version":3,"file":"vc-verifier.d.ts","sourceRoot":"","sources":["../../src/delegation/vc-verifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OA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gC;IAC1D,OAAO,CAAC,KAAK,CAGT;IACJ,OAAO,CAAC,mBAAmB,CAAgB;IAC3C,OAAO,CAAC,QAAQ,CAAS;IACzB;;;;OAIG;IACH,OAAO,CAAC,YAAY,CAAS;gBAEjB,OAAO,CAAC,EAAE;QACpB,WAAW,CAAC,EAAE,WAAW,CAAC;QAC1B,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;QACxC,iBAAiB,CAAC,EAAE,6BAA6B,CAAC;QAClD,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,2CAA2C;QAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB;IAQD;;;;;;;;;;OAUG;IACG,0BAA0B,CAC9B,EAAE,EAAE,oBAAoB,EACxB,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,8BAA8B,CAAC;IA6F1C,OAAO,CAAC,uBAAuB;IA4C/B;;;;;OAKG;IACH,OAAO,CAAC,oBAAoB;YAoBd,eAAe;YAkFf,qBAAqB;IAuCnC,OAAO,CAAC,sBAAsB;IAS9B,OAAO,CAAC,YAAY;IAYpB,OAAO,CAAC,UAAU;IAgBlB,UAAU,IAAI,IAAI;IAKlB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;CAOlC;AAED,wBAAgB,wBAAwB,CAAC,OAAO,CAAC,EAAE;IACjD,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,iBAAiB,CAAC,EAAE,6BAA6B,CAAC;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,4BAA4B,CAE/B"}
@@ -17,10 +17,6 @@ import { isDelegationCredentialExpired, isDelegationCredentialNotYetValid, valid
17
17
  * permission credential must not smuggle claims (KYA-OS §11.6).
18
18
  */
19
19
  const DELEGATION_SUBJECT_KEYS = ["id", "delegation"];
20
- // Module-level warn-once flag for the unsafe opt-out in validateSubjectShape.
21
- // Per-process, mirroring the convention in middleware/with-kya-os.ts so
22
- // operators see a single log line rather than one per verification.
23
- let warnedNonDelegationSubjectFields = false;
24
20
  export class DelegationCredentialVerifier {
25
21
  didResolver;
26
22
  statusListResolver;
@@ -61,7 +57,7 @@ export class DelegationCredentialVerifier {
61
57
  }
62
58
  }
63
59
  const basicCheckStart = Date.now();
64
- const basicValidation = this.validateBasicProperties(vc, options);
60
+ const basicValidation = this.validateBasicProperties(vc);
65
61
  const basicCheckMs = Date.now() - basicCheckStart;
66
62
  if (!basicValidation.valid) {
67
63
  const result = {
@@ -120,7 +116,7 @@ export class DelegationCredentialVerifier {
120
116
  }
121
117
  return result;
122
118
  }
123
- validateBasicProperties(vc, options) {
119
+ validateBasicProperties(vc) {
124
120
  const schemaValidation = validateDelegationCredential(vc);
125
121
  if (!schemaValidation.success) {
126
122
  return {
@@ -147,7 +143,7 @@ export class DelegationCredentialVerifier {
147
143
  if (!vc.proof) {
148
144
  return { valid: false, reason: "Missing proof" };
149
145
  }
150
- const subjectShape = this.validateSubjectShape(vc, options);
146
+ const subjectShape = this.validateSubjectShape(vc);
151
147
  if (!subjectShape.valid) {
152
148
  return subjectShape;
153
149
  }
@@ -157,23 +153,13 @@ export class DelegationCredentialVerifier {
157
153
  * Reject a delegation credential whose `credentialSubject` carries properties
158
154
  * other than `id` and `delegation`. Claim-bearing fields in a permission
159
155
  * credential separate designation from authorization — the confused-deputy
160
- * class (KYA-OS §11.6). Strict by default; the unsafe opt-out emits a
161
- * one-time per-process warning.
156
+ * class (KYA-OS §11.6). Unconditional as of 1.4.0.
162
157
  */
163
- validateSubjectShape(vc, options) {
158
+ validateSubjectShape(vc) {
164
159
  const extraneous = Object.keys(vc.credentialSubject).filter((key) => !DELEGATION_SUBJECT_KEYS.includes(key));
165
160
  if (extraneous.length === 0) {
166
161
  return { valid: true };
167
162
  }
168
- if (options.allowNonDelegationSubjectFields) {
169
- if (!warnedNonDelegationSubjectFields) {
170
- warnedNonDelegationSubjectFields = true;
171
- console.warn(`[DelegationCredentialVerifier] allowNonDelegationSubjectFields is enabled — ` +
172
- `accepting credentialSubject with non-delegation field(s): ${extraneous.join(", ")}. ` +
173
- `Claim-bearing fields in a permission credential are a confused-deputy risk (KYA-OS §11.6).`);
174
- }
175
- return { valid: true };
176
- }
177
163
  return {
178
164
  valid: false,
179
165
  reason: `credentialSubject contains non-delegation field(s): ${extraneous.join(", ")}. ` +
@@ -1 +1 @@
1
- {"version":3,"file":"vc-verifier.js","sourceRoot":"","sources":["../../src/delegation/vc-verifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,EACL,6BAA6B,EAC7B,iCAAiC,EACjC,4BAA4B,GAC7B,MAAM,sBAAsB,CAAC;AAE9B;;;;GAIG;AACH,MAAM,uBAAuB,GAAsB,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;AAExE,8EAA8E;AAC9E,wEAAwE;AACxE,oEAAoE;AACpE,IAAI,gCAAgC,GAAG,KAAK,CAAC;AAwE7C,MAAM,OAAO,4BAA4B;IAC/B,WAAW,CAAe;IAC1B,kBAAkB,CAAsB;IACxC,iBAAiB,CAAiC;IAClD,KAAK,GAAG,IAAI,GAAG,EAGpB,CAAC;IACI,mBAAmB,GAAa,EAAE,CAAC;IACnC,QAAQ,CAAS;IACzB;;;;OAIG;IACK,YAAY,CAAS;IAE7B,YAAY,OAOX;QACC,IAAI,CAAC,WAAW,GAAG,OAAO,EAAE,WAAW,CAAC;QACxC,IAAI,CAAC,kBAAkB,GAAG,OAAO,EAAE,kBAAkB,CAAC;QACtD,IAAI,CAAC,iBAAiB,GAAG,OAAO,EAAE,iBAAiB,CAAC;QACpD,IAAI,CAAC,QAAQ,GAAG,OAAO,EAAE,QAAQ,IAAI,MAAM,CAAC;QAC5C,IAAI,CAAC,YAAY,GAAG,OAAO,EAAE,YAAY,IAAI,IAAI,CAAC;IACpD,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,0BAA0B,CAC9B,EAAwB,EACxB,UAAqC,EAAE;QAE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;IAEO,UAAU,CAAC,EAAU,EAAE,MAAsC;QACnE,iEAAiE;QACjE,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,mBAAmB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACnF,MAAM,QAAQ,GAAG,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,CAAC;YAClD,IAAI,QAAQ,EAAE,CAAC;gBACb,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE;YACjB,MAAM;YACN,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,QAAQ;SACtC,CAAC,CAAC;QACH,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;IAED,UAAU;QACR,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACnB,IAAI,CAAC,mBAAmB,GAAG,EAAE,CAAC;IAChC,CAAC;IAED,eAAe,CAAC,EAAU;QACxB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACtB,MAAM,GAAG,GAAG,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACjD,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC;YACf,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;CACF;AAED,MAAM,UAAU,wBAAwB,CAAC,OAKxC;IACC,OAAO,IAAI,4BAA4B,CAAC,OAAO,CAAC,CAAC;AACnD,CAAC"}
package/dist/errors.d.ts CHANGED
@@ -19,6 +19,7 @@ export declare const KYA_OS_ERROR_CODES: {
19
19
  readonly invalid_request: "invalid_request";
20
20
  readonly needs_authorization: "needs_authorization";
21
21
  readonly insufficient_scope: "insufficient_scope";
22
+ readonly policy_denied: "policy_denied";
22
23
  readonly delegation_expired: "delegation_expired";
23
24
  readonly delegation_not_yet_valid: "delegation_not_yet_valid";
24
25
  readonly delegation_revoked: "delegation_revoked";
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;CAqCrB,CAAC;AAEX,MAAM,MAAM,cAAc,GACxB,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAE/D,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,kBAAkB,CAEpB"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;CAsCrB,CAAC;AAEX,MAAM,MAAM,cAAc,GACxB,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAE/D,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,kBAAkB,CAEpB"}
package/dist/errors.js CHANGED
@@ -23,6 +23,7 @@ export const KYA_OS_ERROR_CODES = {
23
23
  // Delegation errors
24
24
  needs_authorization: "needs_authorization",
25
25
  insufficient_scope: "insufficient_scope",
26
+ policy_denied: "policy_denied",
26
27
  delegation_expired: "delegation_expired",
27
28
  delegation_not_yet_valid: "delegation_not_yet_valid",
28
29
  delegation_revoked: "delegation_revoked",
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,eAAe;IACf,aAAa,EAAE,eAAe;IAC9B,WAAW,EAAE,aAAa;IAC1B,YAAY,EAAE,cAAc;IAC5B,cAAc,EAAE,gBAAgB;IAEhC,wBAAwB;IACxB,aAAa,EAAE,eAAe;IAC9B,kBAAkB,EAAE,oBAAoB;IAExC,6BAA6B;IAC7B,gBAAgB,EAAE,kBAAkB;IACpC,eAAe,EAAE,iBAAiB;IAClC,eAAe,EAAE,iBAAiB;IAElC,oBAAoB;IACpB,mBAAmB,EAAE,qBAAqB;IAC1C,kBAAkB,EAAE,oBAAoB;IACxC,kBAAkB,EAAE,oBAAoB;IACxC,wBAAwB,EAAE,0BAA0B;IACpD,kBAAkB,EAAE,oBAAoB;IACxC,kBAAkB,EAAE,oBAAoB;IACxC,eAAe,EAAE,iBAAiB;IAClC,mBAAmB,EAAE,qBAAqB;IAE1C,eAAe;IACf,aAAa,EAAE,eAAe;IAC9B,aAAa,EAAE,eAAe;IAE9B,kBAAkB;IAClB,cAAc,EAAE,gBAAgB;IAChC,YAAY,EAAE,cAAc;IAE5B,gBAAgB;IAChB,mBAAmB,EAAE,qBAAqB;IAC1C,aAAa,EAAE,eAAe;CACtB,CAAC;AAWX,MAAM,UAAU,gBAAgB,CAC9B,IAA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EAAE,OAAO,EAAE,CAAC;AAClE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -15,9 +15,9 @@
15
15
  * This ensures callers can always handle failures without try/catch on validation paths.
16
16
  */
17
17
  export { KYA_OS_ERROR_CODES, createKyaOsError, type KyaOsErrorCode, type KyaOsErrorResponse, } from './errors.js';
18
- export { base64urlEncodeFromBytes, base64urlDecodeToBytes, } from './utils/base64.js';
19
- export type { DelegationConstraints, DelegationRecord, DelegationCredential, DelegationStatus, CredentialStatus, StatusList2021Credential, Proof, HandshakeRequest, SessionContext, NonceCache, MCPClientInfo, MCPClientSessionInfo, SessionIdentityState, DetachedProof, ProofMeta, CanonicalHashes, AuditRecord, AuditContext, AuditEventContext, NeedsAuthorizationError, AuthorizationDisplay, CrispBudget, CrispScope, } from './types/protocol.js';
20
- export { wrapDelegationAsVC, extractDelegationFromVC, isDelegationCredentialExpired, isDelegationCredentialNotYetValid, validateDelegationCredential, validateDetachedProof, createNeedsAuthorizationError, isNeedsAuthorizationError, DELEGATION_CREDENTIAL_CONTEXT, DEFAULT_SESSION_TTL_MINUTES, DEFAULT_TIMESTAMP_SKEW_SECONDS, NONCE_LENGTH_BYTES, AUTH_NONCE_TTL_MS, ANON_NONCE_TTL_MS, type MetaPolicy, } from './types/protocol.js';
18
+ export { base64urlEncodeFromBytes, base64urlDecodeToBytes, bytesToBase64, base64ToBytes, } from './utils/base64.js';
19
+ export type { DelegationConstraints, DelegationRecord, DelegationCredential, DelegationStatus, CredentialStatus, StatusList2021Credential, Proof, HandshakeRequest, SessionContext, NonceCache, MCPClientInfo, MCPClientSessionInfo, SessionIdentityState, DetachedProof, ProofMeta, CanonicalHashes, AuditRecord, AuditContext, AuditEventContext, NeedsAuthorizationError, NeedsApprovalError, AuthorizationDisplay, CrispBudget, CrispScope, } from './types/protocol.js';
20
+ export { wrapDelegationAsVC, extractDelegationFromVC, isDelegationCredentialExpired, isDelegationCredentialNotYetValid, validateDelegationCredential, validateDetachedProof, createNeedsAuthorizationError, isNeedsAuthorizationError, createNeedsApprovalError, isNeedsApprovalError, DELEGATION_CREDENTIAL_CONTEXT, DEFAULT_SESSION_TTL_MINUTES, DEFAULT_TIMESTAMP_SKEW_SECONDS, NONCE_LENGTH_BYTES, AUTH_NONCE_TTL_MS, ANON_NONCE_TTL_MS, type MetaPolicy, } from './types/protocol.js';
21
21
  export { DelegationCredentialIssuer, createDelegationIssuer, type IssueDelegationOptions, type VCSigningFunction, type IdentityProvider as DelegationIdentityProvider, } from './delegation/vc-issuer.js';
22
22
  export { DelegationCredentialVerifier, createDelegationVerifier, type DelegationVCVerificationResult, type VerifyDelegationVCOptions, type DIDResolver, type DIDDocument, type VerificationMethod, type StatusListResolver, type SignatureVerificationFunction, } from './delegation/vc-verifier.js';
23
23
  export { DelegationGraphManager, createDelegationGraph, type DelegationNode, type DelegationGraphStorageProvider, } from './delegation/delegation-graph.js';
@@ -42,7 +42,12 @@ export { SessionManager, createHandshakeRequest, validateHandshakeFormat, type S
42
42
  export { CryptoProvider, ClockProvider, FetchProvider, StorageProvider, NonceCacheProvider, IdentityProvider, type Identity, type AgentIdentity, } from './providers/base.js';
43
43
  export { MemoryStorageProvider, MemoryNonceCacheProvider, MemoryIdentityProvider, } from './providers/memory.js';
44
44
  export { NodeCryptoProvider } from './providers/node-crypto.js';
45
+ export { SystemClockProvider } from './providers/system-clock.js';
46
+ export { RuntimeFetchProvider } from './providers/runtime-fetch.js';
47
+ export { AuditLogProvider, MemoryAuditLogProvider, NoopAuditLogProvider, buildAuditRecord, } from './providers/audit-log.js';
45
48
  export { createKyaOsMiddleware, type KyaOsConfig, type KyaOsDelegationConfig, type KyaOsIdentityConfig, type KyaOsMiddleware, type KyaOsToolDefinition, type KyaOsToolHandler, type KyaOsServer, withKyaOs, generateIdentity, type WithKyaOsOptions, } from './middleware/index.js';
49
+ export * from './policy/index.js';
50
+ export { matchScope, scopeSatisfies, type ScopeMatcher, type ScopeSatisfaction, } from './delegation/scope-matcher.js';
46
51
  export { logger, createDefaultConsoleLogger, type Logger, type Level, } from './logging/index.js';
47
52
  export { ED25519_PKCS8_DER_HEADER, ED25519_SPKI_DER_HEADER_LENGTH, ED25519_KEY_SIZE, } from './utils/index.js';
48
53
  //# sourceMappingURL=index.d.ts.map