@kya-os/mcp 1.2.0 → 1.3.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 (79) hide show
  1. package/CHANGELOG.md +32 -10
  2. package/LICENSE +1 -1
  3. package/README.md +14 -14
  4. package/dist/auth/handshake.d.ts +1 -1
  5. package/dist/auth/handshake.js +1 -1
  6. package/dist/delegation/cascading-revocation.d.ts +1 -1
  7. package/dist/delegation/cascading-revocation.js +1 -1
  8. package/dist/delegation/delegation-graph.d.ts +1 -1
  9. package/dist/delegation/delegation-graph.js +1 -1
  10. package/dist/delegation/did-web-resolver.d.ts +51 -1
  11. package/dist/delegation/did-web-resolver.d.ts.map +1 -1
  12. package/dist/delegation/did-web-resolver.js +108 -0
  13. package/dist/delegation/did-web-resolver.js.map +1 -1
  14. package/dist/delegation/outbound-headers.d.ts +14 -14
  15. package/dist/delegation/outbound-headers.d.ts.map +1 -1
  16. package/dist/delegation/outbound-headers.js +15 -15
  17. package/dist/delegation/outbound-headers.js.map +1 -1
  18. package/dist/delegation/outbound-proof.d.ts +2 -2
  19. package/dist/delegation/outbound-proof.js +2 -2
  20. package/dist/delegation/vc-issuer.d.ts +1 -1
  21. package/dist/delegation/vc-issuer.js +1 -1
  22. package/dist/delegation/vc-verifier.d.ts +2 -1
  23. package/dist/delegation/vc-verifier.d.ts.map +1 -1
  24. package/dist/delegation/vc-verifier.js +1 -1
  25. package/dist/delegation/vc-verifier.js.map +1 -1
  26. package/dist/errors.d.ts +6 -6
  27. package/dist/errors.d.ts.map +1 -1
  28. package/dist/errors.js +3 -3
  29. package/dist/errors.js.map +1 -1
  30. package/dist/index.d.ts +5 -5
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +4 -4
  33. package/dist/index.js.map +1 -1
  34. package/dist/logging/logger.d.ts +1 -1
  35. package/dist/logging/logger.js +1 -1
  36. package/dist/middleware/index.d.ts +6 -6
  37. package/dist/middleware/index.d.ts.map +1 -1
  38. package/dist/middleware/index.js +6 -6
  39. package/dist/middleware/index.js.map +1 -1
  40. package/dist/middleware/{mcpi-transport.d.ts → kya-os-transport.d.ts} +8 -8
  41. package/dist/middleware/kya-os-transport.d.ts.map +1 -0
  42. package/dist/middleware/{mcpi-transport.js → kya-os-transport.js} +9 -9
  43. package/dist/middleware/kya-os-transport.js.map +1 -0
  44. package/dist/middleware/{with-mcpi-server.d.ts → with-kya-os-server.d.ts} +24 -24
  45. package/dist/middleware/with-kya-os-server.d.ts.map +1 -0
  46. package/dist/middleware/{with-mcpi-server.js → with-kya-os-server.js} +26 -26
  47. package/dist/middleware/with-kya-os-server.js.map +1 -0
  48. package/dist/middleware/{with-mcpi.d.ts → with-kya-os.d.ts} +40 -40
  49. package/dist/middleware/with-kya-os.d.ts.map +1 -0
  50. package/dist/middleware/{with-mcpi.js → with-kya-os.js} +41 -41
  51. package/dist/middleware/with-kya-os.js.map +1 -0
  52. package/dist/proof/generator.d.ts +1 -1
  53. package/dist/proof/generator.js +1 -1
  54. package/dist/proof/verifier.js +1 -1
  55. package/dist/proof/verifier.js.map +1 -1
  56. package/dist/providers/base.d.ts +32 -3
  57. package/dist/providers/base.d.ts.map +1 -1
  58. package/dist/providers/base.js.map +1 -1
  59. package/dist/providers/node-crypto.d.ts +2 -2
  60. package/dist/providers/node-crypto.js +2 -2
  61. package/dist/session/manager.d.ts +5 -5
  62. package/dist/session/manager.d.ts.map +1 -1
  63. package/dist/session/manager.js +9 -9
  64. package/dist/session/manager.js.map +1 -1
  65. package/dist/types/protocol.d.ts +3 -3
  66. package/dist/types/protocol.js +3 -3
  67. package/package.json +4 -4
  68. package/schemas/README.md +6 -6
  69. package/schemas/delegation-credential.json +3 -3
  70. package/schemas/detached-proof.json +1 -1
  71. package/schemas/handshake-request.json +3 -3
  72. package/schemas/handshake-response.json +2 -2
  73. package/schemas/well-known-mcpi.json +7 -7
  74. package/dist/middleware/mcpi-transport.d.ts.map +0 -1
  75. package/dist/middleware/mcpi-transport.js.map +0 -1
  76. package/dist/middleware/with-mcpi-server.d.ts.map +0 -1
  77. package/dist/middleware/with-mcpi-server.js.map +0 -1
  78. package/dist/middleware/with-mcpi.d.ts.map +0 -1
  79. package/dist/middleware/with-mcpi.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -7,14 +7,36 @@ Versioning: https://semver.org/spec/v2.0.0.html
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ### Added
11
+
12
+ - **Generic `Identity` interface** exported from the root entry point.
13
+ Captures the shape shared by every subject the protocol speaks about
14
+ (DID + verification-method id + key material). `AgentIdentity` now
15
+ extends `Identity`; the agent-flavoured shape is unchanged for
16
+ existing consumers.
17
+ - **`buildDidWebDocument(identity, options?)`** in
18
+ `delegation/did-web-resolver`. Produces the DID Document a `did:web`
19
+ controller serves at its resolution URL (see `didWebToUrl`),
20
+ completing the producer/consumer round-trip with `DidWebResolver`.
21
+ Emits both `publicKeyJwk` and `publicKeyMultibase` for cross-format
22
+ interop, matching the `Ed25519VerificationKey2020` form used by the
23
+ did:key resolver.
24
+ - Optional `@context` field on `DIDDocument` so produced documents can
25
+ declare the JSON-LD contexts they reference.
26
+
10
27
  ### Changed
11
28
 
12
- - **Package renamed from `@mcp-i/core` to `@kya-os/mcp`.** Reframed under
13
- the KYA-OS taxonomy: MCP-I is the identity surface of KYA-OS (Know
14
- Your Agent Operating System), the umbrella protocol for agent
15
- identity, authorization, and observability. Version stays at 1.2.0 —
16
- the wire format, exports (`MCPI*`), and behavior are unchanged. The
17
- old `@mcp-i/core` package is deprecated and points at this one.
29
+ - **Package renamed from `@mcp-i/core` to `@kya-os/mcp`.** Renamed
30
+ under the KYA-OS protocol (Know Your Agent Operating System), the
31
+ agent identity, authorization, and observability protocol donated
32
+ to DIF TAAWG. Version stays at 1.2.0 — the wire format, public
33
+ exports, and behavior are unchanged. The old `@mcp-i/core` package
34
+ is deprecated and points at this one.
35
+ - **Spec renamed from KYA-OS to KYA-OS** across `SPEC.md`,
36
+ `CONFORMANCE.md`, `GOVERNANCE.md`, and example READMEs. Wire-format
37
+ identifiers (`_kyaos` tool name, well-known path, JSON Schema
38
+ files, JSON-LD context URLs) are deferred to a later cutover so
39
+ this doc-only rename doesn't break running implementations.
18
40
  - **Spec cut to `1.0.0`** (was `0.1.0-draft` in `SPEC.md`, `1.0.0-draft`
19
41
  in `CONFORMANCE.md`). The wire format was already pinned at `1.0.0`
20
42
  in the handshake protocol-version field; the spec docs now match.
@@ -22,14 +44,14 @@ Versioning: https://semver.org/spec/v2.0.0.html
22
44
  semver is independent of package semver: the spec describes the wire
23
45
  protocol, the package describes the implementation shipping it.
24
46
  - Delegation middleware remains strict by default for chain and status-list validation.
25
- - Added `delegation.allowLegacyUnsafeDelegation` to `createMCPIMiddleware` as a temporary migration escape hatch for legacy integrations.
47
+ - Added `delegation.allowLegacyUnsafeDelegation` to `createKyaOsMiddleware` as a temporary migration escape hatch for legacy integrations.
26
48
  - Added middleware tests covering legacy-compatibility behavior for parent-linked and status-list credentials.
27
49
 
28
50
  ## [1.0.0-draft] - 2026-03-12
29
51
 
30
52
  ### Added
31
53
 
32
- - SPEC.md protocol specification defining MCP-I extension for cryptographic identity
54
+ - SPEC.md protocol specification defining KYA-OS extension for cryptographic identity
33
55
  - Supported DID methods: `did:key` (ephemeral/dev) and `did:web` (production)
34
56
  - Ed25519/EdDSA cryptography for signing and verification
35
57
  - Delegation module with W3C Verifiable Credential issuance and verification
@@ -46,14 +68,14 @@ Versioning: https://semver.org/spec/v2.0.0.html
46
68
  - Auth module with `verifyOrHints` orchestration and sensitive scope detection
47
69
  - Resume token storage for authorization flows
48
70
  - `needs_authorization` hint response pattern
49
- - MCP SDK middleware wrapper (`createMCPIMiddleware`)
71
+ - MCP SDK middleware wrapper (`createKyaOsMiddleware`)
50
72
  - Tool wrapping with automatic proof generation
51
73
  - Handshake tool registration and handling
52
74
  - Provider abstractions: CryptoProvider, ClockProvider, FetchProvider, StorageProvider, NonceCacheProvider, IdentityProvider
53
75
  - In-memory implementations for all providers (testing)
54
76
  - Configurable logging with debug, info, warn, error levels
55
77
  - Pure TypeScript protocol type definitions (zero runtime dependencies)
56
- - Well-known endpoint (`/.well-known/mcpi`) for server discovery
78
+ - Well-known endpoint (`/.well-known/kyaos-os-os`) for server discovery
57
79
  - Outbound delegation proof JWT builder for downstream API calls
58
80
  - Three-tier conformance levels:
59
81
  - Level 1: Core Crypto (key generation, signing, hashing, DID resolution)
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 MCP-Identity
3
+ Copyright (c) 2026 KYA-OS
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
  <a href="https://modelcontextprotocol-identity.io">
3
3
  <picture>
4
4
  <source media="(prefers-color-scheme: dark)" srcset="https://modelcontextprotocol-identity.io/images/logo-mark_white.svg">
5
- <img alt="MCP-I" src="https://modelcontextprotocol-identity.io/images/logo-mark_black.svg" width="64">
5
+ <img alt="" src="https://modelcontextprotocol-identity.io/images/logo-mark_black.svg" width="64">
6
6
  </picture>
7
7
  </a>
8
8
  </p>
@@ -15,16 +15,16 @@
15
15
  <a href="https://www.npmjs.com/package/@kya-os/mcp"><img src="https://img.shields.io/npm/v/@kya-os/mcp" alt="npm"></a>
16
16
  <a href="https://modelcontextprotocol-identity.io"><img src="https://img.shields.io/badge/spec-modelcontextprotocol--identity.io-blue" alt="spec"></a>
17
17
  <a href="https://identity.foundation/working-groups/agent-and-authorization.html"><img src="https://img.shields.io/badge/DIF-TAAWG-purple" alt="DIF TAAWG"></a>
18
- <a href="./LICENSE"><img src="https://img.shields.io/github/license/modelcontextprotocol-identity/mcp-i-core" alt="license"></a>
18
+ <a href="./LICENSE"><img src="https://img.shields.io/github/license/decentralized-identity/kya-os-mcp" alt="license"></a>
19
19
  </p>
20
20
 
21
21
  <p align="center">
22
- <em><code>@kya-os/mcp</code> is the reference implementation of <strong>MCP-I</strong>, the identity surface of <strong>KYA-OS</strong> (Know Your Agent Operating System). KYA-OS is the umbrella protocol for agent identity, authorization, and observability; MCP-I is its first surface, binding those primitives to Model Context Protocol servers.</em>
22
+ <em><code>@kya-os/mcp</code> is the reference implementation of the <strong>KYA-OS</strong> (Know Your Agent Operating System) protocol for Model Context Protocol servers binding KYA-OS's identity, delegation, and proof primitives into MCP. KYA-OS is the agent identity, authorization, and observability protocol.</em>
23
23
  </p>
24
24
 
25
25
  ---
26
26
 
27
- AI agents call tools on your behalf. But today, there's no way to know *who* called, *whether they were allowed to*, or *what actually happened*. MCP-I fixes that for Model Context Protocol servers.
27
+ AI agents call tools on your behalf. But today, there's no way to know *who* called, *whether they were allowed to*, or *what actually happened*. `@kya-os/mcp` fixes that for Model Context Protocol servers.
28
28
 
29
29
  - **Every server gets a cryptographic identity** (DID) — no accounts, no API keys, no central registry
30
30
  - **Every tool call gets a signed proof** — a tamper-evident receipt the agent can't forge or deny
@@ -55,31 +55,31 @@ server.registerTool('greet', { description: 'Say hello' }, async (args) => ({
55
55
 
56
56
  ```typescript
57
57
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
58
- import { withMCPI, NodeCryptoProvider } from '@kya-os/mcp'; // +1 line
58
+ import { withKyaOs, NodeCryptoProvider } from '@kya-os/mcp'; // +1 line
59
59
 
60
60
  const server = new McpServer({ name: 'my-server', version: '1.0.0' });
61
- await withMCPI(server, { crypto: new NodeCryptoProvider() }); // +1 line
61
+ await withKyaOs(server, { crypto: new NodeCryptoProvider() }); // +1 line
62
62
 
63
63
  server.registerTool('greet', { description: 'Say hello' }, async (args) => ({
64
64
  content: [{ type: 'text', text: `Hello, ${args.name}!` }],
65
65
  }));
66
66
  ```
67
67
 
68
- That's it. `withMCPI` auto-generates an Ed25519 identity, registers the `_mcpi` protocol tool, and wraps the transport so every tool response includes a detached JWS proof in `_meta` — invisible to the LLM, verifiable by anyone.
68
+ That's it. `withKyaOs` auto-generates an Ed25519 identity, registers the `_kyaos` protocol tool, and wraps the transport so every tool response includes a detached JWS proof in `_meta` — invisible to the LLM, verifiable by anyone.
69
69
 
70
- > See the full working example: [examples/context7-with-mcpi](./examples/context7-with-mcpi/) — a real MCP server (Context7) migrated with exactly 2 lines of code.
70
+ > See the full working example: [examples/context7-with-kya-os](./examples/context7-with-kya-os/) — a real MCP server (Context7) migrated with exactly 2 lines of code.
71
71
 
72
72
  ---
73
73
 
74
74
  ## Protect Tools with Human Consent
75
75
 
76
- Some tools shouldn't run without a human saying "yes." MCP-I adds per-tool authorization using W3C Verifiable Credentials:
76
+ Some tools shouldn't run without a human saying "yes." KYA-OS MCP adds per-tool authorization using W3C Verifiable Credentials:
77
77
 
78
78
  ```typescript
79
- const checkout = mcpi.wrapWithDelegation(
79
+ const checkout = kyaos.wrapWithDelegation(
80
80
  'checkout',
81
81
  { scopeId: 'cart:write', consentUrl: 'https://example.com/consent' },
82
- mcpi.wrapWithProof('checkout', async (args) => ({
82
+ kyaos.wrapWithProof('checkout', async (args) => ({
83
83
  content: [{ type: 'text', text: `Order placed: ${args.item}` }],
84
84
  })),
85
85
  );
@@ -94,8 +94,8 @@ When an agent calls `checkout` without a delegation credential, it gets back a `
94
94
  ## See It in Action
95
95
 
96
96
  ```bash
97
- git clone https://github.com/modelcontextprotocol-identity/mcp-i-core.git
98
- cd mcp-i-core && npm install
97
+ git clone https://github.com/decentralized-identity/kya-os-mcp.git
98
+ cd kya-os-mcp && npm install
99
99
  bash scripts/demo.sh
100
100
  ```
101
101
 
@@ -106,7 +106,7 @@ This starts all example servers and opens [MCP Inspector](https://github.com/mod
106
106
  | 3001 | [node-server](./examples/node-server/) | Proofs + restricted tools (low-level API) |
107
107
  | 3002 | [consent-basic](./examples/consent-basic/) | Human consent flow with built-in UI |
108
108
  | 3003 | [consent-full](./examples/consent-full/) | Production consent UI ([@kya-os/consent](https://www.npmjs.com/package/@kya-os/consent)) |
109
- | 3004 | [context7-with-mcpi](./examples/context7-with-mcpi/) | 2-line migration of a real MCP server |
109
+ | 3004 | [context7-with-kya-os](./examples/context7-with-kya-os/) | 2-line migration of a real MCP server |
110
110
 
111
111
  Also available: [outbound-delegation](./examples/outbound-delegation/) (gateway pattern), [verify-proof](./examples/verify-proof/) (standalone verification), [statuslist](./examples/statuslist/) (revocation lifecycle).
112
112
 
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Authorization Handshake — Platform-agnostic Protocol Reference
3
3
  *
4
- * Orchestrates the MCP-I authorization flow:
4
+ * Orchestrates the KYA-OS authorization flow:
5
5
  * 1. Check agent reputation (optional)
6
6
  * 2. Verify delegation exists
7
7
  * 3. Return needs_authorization error if missing
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Authorization Handshake — Platform-agnostic Protocol Reference
3
3
  *
4
- * Orchestrates the MCP-I authorization flow:
4
+ * Orchestrates the KYA-OS authorization flow:
5
5
  * 1. Check agent reputation (optional)
6
6
  * 2. Verify delegation exists
7
7
  * 3. Return needs_authorization error if missing
@@ -4,7 +4,7 @@
4
4
  * Implements cascading revocation per Python POC design.
5
5
  * When a parent delegation is revoked, all children are automatically revoked.
6
6
  *
7
- * Related Spec: MCP-I §4.4, Delegation Chains
7
+ * Related Spec: KYA-OS §4.4, Delegation Chains
8
8
  */
9
9
  import { DelegationGraphManager } from './delegation-graph.js';
10
10
  import { StatusList2021Manager } from './statuslist-manager.js';
@@ -4,7 +4,7 @@
4
4
  * Implements cascading revocation per Python POC design.
5
5
  * When a parent delegation is revoked, all children are automatically revoked.
6
6
  *
7
- * Related Spec: MCP-I §4.4, Delegation Chains
7
+ * Related Spec: KYA-OS §4.4, Delegation Chains
8
8
  */
9
9
  export class CascadingRevocationManager {
10
10
  graph;
@@ -4,7 +4,7 @@
4
4
  * Tracks parent-child relationships between delegation credentials.
5
5
  * Critical for cascading revocation per Delegation-Revocation.md.
6
6
  *
7
- * Related Spec: MCP-I §4.4, Delegation Chains
7
+ * Related Spec: KYA-OS §4.4, Delegation Chains
8
8
  */
9
9
  export interface DelegationNode {
10
10
  id: string;
@@ -4,7 +4,7 @@
4
4
  * Tracks parent-child relationships between delegation credentials.
5
5
  * Critical for cascading revocation per Delegation-Revocation.md.
6
6
  *
7
- * Related Spec: MCP-I §4.4, Delegation Chains
7
+ * Related Spec: KYA-OS §4.4, Delegation Chains
8
8
  */
9
9
  export class DelegationGraphManager {
10
10
  storage;
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * @see https://w3c-ccg.github.io/did-method-web/
12
12
  */
13
- import type { FetchProvider } from '../providers/base.js';
13
+ import type { FetchProvider, Identity } from '../providers/base.js';
14
14
  import type { DIDResolver, DIDDocument } from './vc-verifier.js';
15
15
  /**
16
16
  * Parsed components of a did:web DID
@@ -79,5 +79,55 @@ export declare class DidWebResolver implements DIDResolver {
79
79
  export declare function createDidWebResolver(fetchProvider: FetchProvider, options?: {
80
80
  cacheTtl?: number;
81
81
  }): DIDResolver;
82
+ /**
83
+ * Options for {@link buildDidWebDocument}.
84
+ */
85
+ export interface BuildDidWebDocumentOptions {
86
+ /**
87
+ * Additional JSON-LD contexts appended after the defaults
88
+ * (`did/v1`, `ed25519-2020/v1`). Use to declare credential or
89
+ * service contexts the controller publishes alongside its keys.
90
+ */
91
+ additionalContexts?: readonly string[];
92
+ }
93
+ /**
94
+ * Build the DID Document a did:web controller serves at its
95
+ * resolution URL (see {@link didWebToUrl}).
96
+ *
97
+ * Emits a single Ed25519 verification method derived from
98
+ * `identity.publicKey` (base64-encoded raw bytes — the
99
+ * {@link Identity} convention). Both `publicKeyJwk` and
100
+ * `publicKeyMultibase` are included for cross-format interop with
101
+ * verifiers that prefer one over the other.
102
+ *
103
+ * The verification method is published in both `authentication` and
104
+ * `assertionMethod`, matching the {@link createDidKeyResolver} output
105
+ * and the most common verifier expectations.
106
+ *
107
+ * The function is purely synchronous and performs no I/O. Hosts
108
+ * publish the returned object verbatim (e.g. as the body of a
109
+ * `/.well-known/did.json` route).
110
+ *
111
+ * @param identity - Subject identity. `did` must be a `did:web:` DID;
112
+ * `kid` must reference the same DID (`<did>#<fragment>`).
113
+ * @param options - Optional context extensions.
114
+ * @returns DID Document satisfying the W3C DID Core data model.
115
+ * @throws Error when `identity.did` is not a `did:web:` DID, when
116
+ * `identity.kid` does not reference `identity.did`, or when
117
+ * `identity.publicKey` is not a valid base64 string of the
118
+ * expected length.
119
+ *
120
+ * @example
121
+ * ```typescript
122
+ * const document = buildDidWebDocument({
123
+ * did: 'did:web:example.com:agents:bot1',
124
+ * kid: 'did:web:example.com:agents:bot1#keys-1',
125
+ * publicKey: agent.publicKey, // base64-encoded Ed25519
126
+ * createdAt: new Date().toISOString(),
127
+ * });
128
+ * // Serve `document` at https://example.com/agents/bot1/did.json
129
+ * ```
130
+ */
131
+ export declare function buildDidWebDocument(identity: Identity, options?: BuildDidWebDocumentOptions): DIDDocument;
82
132
  export {};
83
133
  //# sourceMappingURL=did-web-resolver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"did-web-resolver.d.ts","sourceRoot":"","sources":["../../src/delegation/did-web-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAsB,MAAM,kBAAkB,CAAC;AAGrF;;GAEG;AACH,UAAU,YAAY;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AA0DD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE7C;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CA0B5D;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAsBtD;AAED;;GAEG;AACH,qBAAa,cAAe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C,aAAa,CAAgB;IACrC,OAAO,CAAC,KAAK,CAA4D;IACzE,OAAO,CAAC,QAAQ,CAAS;gBAEb,aAAa,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE;IAMzE;;;;;OAKG;IACG,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAgEvD;;OAEG;IACH,UAAU,IAAI,IAAI;IAIlB;;OAEG;IACH,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;CAGnC;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,aAAa,EAC5B,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9B,WAAW,CAEb;AAeD;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACxC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,QAAQ,EAClB,OAAO,CAAC,EAAE,0BAA0B,GACnC,WAAW,CAoCb"}
@@ -11,6 +11,9 @@
11
11
  * @see https://w3c-ccg.github.io/did-method-web/
12
12
  */
13
13
  import { logger } from '../logging/index.js';
14
+ import { base58Encode } from '../utils/base58.js';
15
+ import { base64ToBytes } from '../utils/base64.js';
16
+ import { publicKeyToJwk } from './did-key-resolver.js';
14
17
  /**
15
18
  * Type guard for checking if value is a valid DID Document structure
16
19
  */
@@ -215,4 +218,109 @@ export class DidWebResolver {
215
218
  export function createDidWebResolver(fetchProvider, options) {
216
219
  return new DidWebResolver(fetchProvider, options);
217
220
  }
221
+ /** Ed25519 multicodec prefix (0xed 0x01) used for `publicKeyMultibase`. */
222
+ const ED25519_MULTICODEC_PREFIX = new Uint8Array([0xed, 0x01]);
223
+ /**
224
+ * Default JSON-LD contexts for an Ed25519-keyed did:web Document.
225
+ * `did/v1` is required by DID Core; `ed25519-2020/v1` defines the
226
+ * `Ed25519VerificationKey2020` type emitted below.
227
+ */
228
+ const DEFAULT_DID_WEB_CONTEXTS = [
229
+ 'https://www.w3.org/ns/did/v1',
230
+ 'https://w3id.org/security/suites/ed25519-2020/v1',
231
+ ];
232
+ /**
233
+ * Build the DID Document a did:web controller serves at its
234
+ * resolution URL (see {@link didWebToUrl}).
235
+ *
236
+ * Emits a single Ed25519 verification method derived from
237
+ * `identity.publicKey` (base64-encoded raw bytes — the
238
+ * {@link Identity} convention). Both `publicKeyJwk` and
239
+ * `publicKeyMultibase` are included for cross-format interop with
240
+ * verifiers that prefer one over the other.
241
+ *
242
+ * The verification method is published in both `authentication` and
243
+ * `assertionMethod`, matching the {@link createDidKeyResolver} output
244
+ * and the most common verifier expectations.
245
+ *
246
+ * The function is purely synchronous and performs no I/O. Hosts
247
+ * publish the returned object verbatim (e.g. as the body of a
248
+ * `/.well-known/did.json` route).
249
+ *
250
+ * @param identity - Subject identity. `did` must be a `did:web:` DID;
251
+ * `kid` must reference the same DID (`<did>#<fragment>`).
252
+ * @param options - Optional context extensions.
253
+ * @returns DID Document satisfying the W3C DID Core data model.
254
+ * @throws Error when `identity.did` is not a `did:web:` DID, when
255
+ * `identity.kid` does not reference `identity.did`, or when
256
+ * `identity.publicKey` is not a valid base64 string of the
257
+ * expected length.
258
+ *
259
+ * @example
260
+ * ```typescript
261
+ * const document = buildDidWebDocument({
262
+ * did: 'did:web:example.com:agents:bot1',
263
+ * kid: 'did:web:example.com:agents:bot1#keys-1',
264
+ * publicKey: agent.publicKey, // base64-encoded Ed25519
265
+ * createdAt: new Date().toISOString(),
266
+ * });
267
+ * // Serve `document` at https://example.com/agents/bot1/did.json
268
+ * ```
269
+ */
270
+ export function buildDidWebDocument(identity, options) {
271
+ if (!isDidWeb(identity.did)) {
272
+ throw new Error(`buildDidWebDocument: identity.did must be a did:web DID (got "${identity.did}")`);
273
+ }
274
+ if (!identity.kid.startsWith(`${identity.did}#`)) {
275
+ throw new Error(`buildDidWebDocument: identity.kid "${identity.kid}" does not reference identity.did "${identity.did}"`);
276
+ }
277
+ const publicKeyBytes = decodePublicKey(identity.publicKey);
278
+ const publicKeyJwk = publicKeyToJwk(publicKeyBytes);
279
+ const publicKeyMultibase = encodeEd25519Multibase(publicKeyBytes);
280
+ const verificationMethod = {
281
+ id: identity.kid,
282
+ type: 'Ed25519VerificationKey2020',
283
+ controller: identity.did,
284
+ publicKeyJwk,
285
+ publicKeyMultibase,
286
+ };
287
+ const contexts = options?.additionalContexts?.length
288
+ ? [...DEFAULT_DID_WEB_CONTEXTS, ...options.additionalContexts]
289
+ : [...DEFAULT_DID_WEB_CONTEXTS];
290
+ return {
291
+ '@context': contexts,
292
+ id: identity.did,
293
+ verificationMethod: [verificationMethod],
294
+ authentication: [identity.kid],
295
+ assertionMethod: [identity.kid],
296
+ };
297
+ }
298
+ /**
299
+ * Decode a base64-encoded Ed25519 public key to raw bytes.
300
+ *
301
+ * The {@link Identity} contract documents `publicKey` as base64 of the
302
+ * 32-byte Ed25519 public key. We accept that length only — anything
303
+ * else is a programming error and surfaces as a thrown construction
304
+ * exception (per the repository error contract: construction throws,
305
+ * verification/resolution returns).
306
+ */
307
+ function decodePublicKey(publicKeyBase64) {
308
+ const bytes = base64ToBytes(publicKeyBase64);
309
+ if (bytes.length !== 32) {
310
+ throw new Error(`buildDidWebDocument: expected 32-byte Ed25519 public key, got ${bytes.length} bytes after base64 decode`);
311
+ }
312
+ return bytes;
313
+ }
314
+ /**
315
+ * Encode raw Ed25519 public key bytes as `publicKeyMultibase`
316
+ * (multicodec-tagged, base58btc-encoded, `z`-prefixed). Matches the
317
+ * encoding used by {@link createDidKeyResolver} for the equivalent
318
+ * field on did:key documents.
319
+ */
320
+ function encodeEd25519Multibase(publicKeyBytes) {
321
+ const multicodec = new Uint8Array(ED25519_MULTICODEC_PREFIX.length + publicKeyBytes.length);
322
+ multicodec.set(ED25519_MULTICODEC_PREFIX);
323
+ multicodec.set(publicKeyBytes, ED25519_MULTICODEC_PREFIX.length);
324
+ return `z${base58Encode(multicodec)}`;
325
+ }
218
326
  //# sourceMappingURL=did-web-resolver.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"did-web-resolver.js","sourceRoot":"","sources":["../../src/delegation/did-web-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAU7C;;GAEG;AACH,SAAS,kBAAkB,CAAC,KAAc;IACxC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,GAAG,GAAG,KAAgC,CAAC;IAE7C,sCAAsC;IACtC,IAAI,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5D,OAAO,KAAK,CAAC;IACf,CAAC;IAED,iEAAiE;IACjE,IAAI,GAAG,CAAC,oBAAoB,CAAC,KAAK,SAAS,EAAE,CAAC;QAC5C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,EAAE,CAAC;YAC9C,OAAO,KAAK,CAAC;QACf,CAAC;QAED,qDAAqD;QACrD,KAAK,MAAM,EAAE,IAAI,GAAG,CAAC,oBAAoB,CAAC,EAAE,CAAC;YAC3C,IAAI,CAAC,yBAAyB,CAAC,EAAE,CAAC,EAAE,CAAC;gBACnC,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;GAEG;AACH,SAAS,yBAAyB,CAAC,KAAc;IAC/C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,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,cAA0B;IACxD,MAAM,UAAU,GAAG,IAAI,UAAU,CAC/B,yBAAyB,CAAC,MAAM,GAAG,cAAc,CAAC,MAAM,CACzD,CAAC;IACF,UAAU,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;IAC1C,UAAU,CAAC,GAAG,CAAC,cAAc,EAAE,yBAAyB,CAAC,MAAM,CAAC,CAAC;IACjE,OAAO,IAAI,YAAY,CAAC,UAAU,CAAC,EAAE,CAAC;AACxC,CAAC"}
@@ -4,23 +4,23 @@
4
4
  * Builds the full set of outbound delegation headers for forwarding
5
5
  * delegation context to downstream services.
6
6
  *
7
- * Headers (MCP-I §7):
8
- * - KYA-Agent-DID: the original agent's DID
9
- * - KYA-Delegation-Chain: the delegation chain ID (vcId of the root delegation)
10
- * - KYA-Session-Id: the current session ID
11
- * - KYA-Delegation-Proof: a signed JWT proving the delegation is being forwarded
7
+ * Headers (KYA-OS §7):
8
+ * - KYA-OS-Agent-DID: the original agent's DID
9
+ * - KYA-OS-Delegation-Chain: the delegation chain ID (vcId of the root delegation)
10
+ * - KYA-OS-Session-Id: the current session ID
11
+ * - KYA-OS-Delegation-Proof: a signed JWT proving the delegation is being forwarded
12
12
  *
13
- * Related Spec: MCP-I §7 — Outbound Delegation Propagation
13
+ * Related Spec: KYA-OS §7 — Outbound Delegation Propagation
14
14
  */
15
15
  import type { SessionContext, DelegationRecord } from '../types/protocol.js';
16
16
  /**
17
17
  * Header names for outbound delegation propagation
18
18
  */
19
19
  export declare const OUTBOUND_HEADER_NAMES: {
20
- readonly AGENT_DID: "KYA-Agent-DID";
21
- readonly DELEGATION_CHAIN: "KYA-Delegation-Chain";
22
- readonly SESSION_ID: "KYA-Session-Id";
23
- readonly DELEGATION_PROOF: "KYA-Delegation-Proof";
20
+ readonly AGENT_DID: "KYA-OS-Agent-DID";
21
+ readonly DELEGATION_CHAIN: "KYA-OS-Delegation-Chain";
22
+ readonly SESSION_ID: "KYA-OS-Session-Id";
23
+ readonly DELEGATION_PROOF: "KYA-OS-Delegation-Proof";
24
24
  };
25
25
  /**
26
26
  * Context required to build outbound delegation headers
@@ -43,10 +43,10 @@ export interface OutboundDelegationContext {
43
43
  * Outbound delegation headers to attach to downstream requests
44
44
  */
45
45
  export interface OutboundDelegationHeaders {
46
- 'KYA-Agent-DID': string;
47
- 'KYA-Delegation-Chain': string;
48
- 'KYA-Session-Id': string;
49
- 'KYA-Delegation-Proof': string;
46
+ 'KYA-OS-Agent-DID': string;
47
+ 'KYA-OS-Delegation-Chain': string;
48
+ 'KYA-OS-Session-Id': string;
49
+ 'KYA-OS-Delegation-Proof': string;
50
50
  }
51
51
  /**
52
52
  * Build outbound delegation headers for forwarding to downstream services.
@@ -1 +1 @@
1
- {"version":3,"file":"outbound-headers.d.ts","sourceRoot":"","sources":["../../src/delegation/outbound-headers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAM7E;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;CAKxB,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,kCAAkC;IAClC,OAAO,EAAE,cAAc,CAAC;IACxB,4CAA4C;IAC5C,UAAU,EAAE,gBAAgB,CAAC;IAC7B,sDAAsD;IACtD,cAAc,EAAE;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,eAAe,EAAE,MAAM,CAAC;IACxB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,gBAAgB,EAAE,MAAM,CAAC;IACzB,sBAAsB,EAAE,MAAM,CAAC;CAChC;AAgDD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,8BAA8B,CAClD,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,yBAAyB,CAAC,CAuDpC"}
1
+ {"version":3,"file":"outbound-headers.d.ts","sourceRoot":"","sources":["../../src/delegation/outbound-headers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAM7E;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;CAKxB,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,kCAAkC;IAClC,OAAO,EAAE,cAAc,CAAC;IACxB,4CAA4C;IAC5C,UAAU,EAAE,gBAAgB,CAAC;IAC7B,sDAAsD;IACtD,cAAc,EAAE;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,yBAAyB,EAAE,MAAM,CAAC;IAClC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,yBAAyB,EAAE,MAAM,CAAC;CACnC;AAgDD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,8BAA8B,CAClD,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,yBAAyB,CAAC,CAuDpC"}
@@ -4,13 +4,13 @@
4
4
  * Builds the full set of outbound delegation headers for forwarding
5
5
  * delegation context to downstream services.
6
6
  *
7
- * Headers (MCP-I §7):
8
- * - KYA-Agent-DID: the original agent's DID
9
- * - KYA-Delegation-Chain: the delegation chain ID (vcId of the root delegation)
10
- * - KYA-Session-Id: the current session ID
11
- * - KYA-Delegation-Proof: a signed JWT proving the delegation is being forwarded
7
+ * Headers (KYA-OS §7):
8
+ * - KYA-OS-Agent-DID: the original agent's DID
9
+ * - KYA-OS-Delegation-Chain: the delegation chain ID (vcId of the root delegation)
10
+ * - KYA-OS-Session-Id: the current session ID
11
+ * - KYA-OS-Delegation-Proof: a signed JWT proving the delegation is being forwarded
12
12
  *
13
- * Related Spec: MCP-I §7 — Outbound Delegation Propagation
13
+ * Related Spec: KYA-OS §7 — Outbound Delegation Propagation
14
14
  */
15
15
  import { buildDelegationProofJWT } from './outbound-proof.js';
16
16
  import { extractPublicKeyFromDidKey, isEd25519DidKey } from './did-key-resolver.js';
@@ -20,10 +20,10 @@ import { logger } from '../logging/index.js';
20
20
  * Header names for outbound delegation propagation
21
21
  */
22
22
  export const OUTBOUND_HEADER_NAMES = {
23
- AGENT_DID: 'KYA-Agent-DID',
24
- DELEGATION_CHAIN: 'KYA-Delegation-Chain',
25
- SESSION_ID: 'KYA-Session-Id',
26
- DELEGATION_PROOF: 'KYA-Delegation-Proof',
23
+ AGENT_DID: 'KYA-OS-Agent-DID',
24
+ DELEGATION_CHAIN: 'KYA-OS-Delegation-Chain',
25
+ SESSION_ID: 'KYA-OS-Session-Id',
26
+ DELEGATION_PROOF: 'KYA-OS-Delegation-Proof',
27
27
  };
28
28
  /**
29
29
  * Extract hostname from a URL
@@ -107,7 +107,7 @@ export async function buildOutboundDelegationHeaders(context) {
107
107
  // Build the private key JWK from the server identity
108
108
  const privateKeyJwk = buildPrivateKeyJwk(serverIdentity.privateKey, serverIdentity.did);
109
109
  // Build the delegation proof JWT
110
- // Per MCP-I §7, the JWT has:
110
+ // Per KYA-OS §7, the JWT has:
111
111
  // - iss: serverDid (the MCP server forwarding the request)
112
112
  // - sub: agentDid (the original agent)
113
113
  // - aud: targetHostname (the downstream service)
@@ -129,10 +129,10 @@ export async function buildOutboundDelegationHeaders(context) {
129
129
  targetHostname,
130
130
  });
131
131
  return {
132
- 'KYA-Agent-DID': session.agentDid,
133
- 'KYA-Delegation-Chain': delegation.vcId,
134
- 'KYA-Session-Id': session.sessionId,
135
- 'KYA-Delegation-Proof': jwt,
132
+ 'KYA-OS-Agent-DID': session.agentDid,
133
+ 'KYA-OS-Delegation-Chain': delegation.vcId,
134
+ 'KYA-OS-Session-Id': session.sessionId,
135
+ 'KYA-OS-Delegation-Proof': jwt,
136
136
  };
137
137
  }
138
138
  //# sourceMappingURL=outbound-headers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"outbound-headers.js","sourceRoot":"","sources":["../../src/delegation/outbound-headers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,uBAAuB,EAA0B,MAAM,qBAAqB,CAAC;AACtF,OAAO,EAAE,0BAA0B,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,SAAS,EAAE,eAAe;IAC1B,gBAAgB,EAAE,sBAAsB;IACxC,UAAU,EAAE,gBAAgB;IAC5B,gBAAgB,EAAE,sBAAsB;CAChC,CAAC;AA8BX;;GAEG;AACH,SAAS,eAAe,CAAC,GAAW;IAClC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5B,OAAO,MAAM,CAAC,QAAQ,CAAC;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,CAAC,IAAI,CAAC,yCAAyC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;QAChE,OAAO,GAAG,CAAC;IACb,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CACzB,gBAAwB,EACxB,SAAiB;IAEjB,qCAAqC;IACrC,MAAM,eAAe,GAAG,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAExD,qEAAqE;IACrE,MAAM,IAAI,GAAG,eAAe,CAAC,MAAM,KAAK,EAAE;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AAS,EAAE,OAAO,CAAC,SAAS;QAC5B,cAAc;KACf,CAAC,CAAC;IAEH,OAAO;QACL,kBAAkB,EAAE,OAAO,CAAC,QAAQ;QACpC,yBAAyB,EAAE,UAAU,CAAC,IAAI;QAC1C,mBAAmB,EAAE,OAAO,CAAC,SAAS;QACtC,yBAAyB,EAAE,GAAG;KAC/B,CAAC;AACJ,CAAC"}
@@ -5,9 +5,9 @@
5
5
  * Enables downstream services to independently verify the delegation chain.
6
6
  *
7
7
  * Wire format: signed compact EdDSA JWT (60s TTL, per-call jti)
8
- * Header injection: KYA-Delegation-Id, KYA-Delegation-Chain, KYA-Delegation-Proof, KYA-Granted-Scopes
8
+ * Header injection: KYA-OS-Delegation-Id, KYA-OS-Delegation-Chain, KYA-OS-Delegation-Proof, KYA-OS-Granted-Scopes
9
9
  *
10
- * Related Spec: MCP-I §2 — Outbound Delegation Propagation
10
+ * Related Spec: KYA-OS §2 — Outbound Delegation Propagation
11
11
  */
12
12
  import type { DelegationRecord } from '../types/protocol.js';
13
13
  export interface Ed25519PrivateJWK {
@@ -5,9 +5,9 @@
5
5
  * Enables downstream services to independently verify the delegation chain.
6
6
  *
7
7
  * Wire format: signed compact EdDSA JWT (60s TTL, per-call jti)
8
- * Header injection: KYA-Delegation-Id, KYA-Delegation-Chain, KYA-Delegation-Proof, KYA-Granted-Scopes
8
+ * Header injection: KYA-OS-Delegation-Id, KYA-OS-Delegation-Chain, KYA-OS-Delegation-Proof, KYA-OS-Granted-Scopes
9
9
  *
10
- * Related Spec: MCP-I §2 — Outbound Delegation Propagation
10
+ * Related Spec: KYA-OS §2 — Outbound Delegation Propagation
11
11
  */
12
12
  import { SignJWT, importJWK } from 'jose';
13
13
  /**
@@ -5,7 +5,7 @@
5
5
  * Follows the Python POC design (Delegation-Service.md:136-163) where
6
6
  * delegations are issued AS W3C VCs.
7
7
  *
8
- * Related Spec: MCP-I §4.1, §4.2, W3C VC Data Model 1.1
8
+ * Related Spec: KYA-OS §4.1, §4.2, W3C VC Data Model 1.1
9
9
  */
10
10
  import type { DelegationCredential, DelegationRecord, CredentialStatus, Proof } from '../types/protocol.js';
11
11
  export interface IssueDelegationOptions {