@kya-os/mcp-i-core 1.1.13-canary.2 → 1.2.1-canary.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 (81) hide show
  1. package/dist/__tests__/utils/mock-providers.d.ts +5 -3
  2. package/dist/__tests__/utils/mock-providers.d.ts.map +1 -1
  3. package/dist/__tests__/utils/mock-providers.js +23 -12
  4. package/dist/__tests__/utils/mock-providers.js.map +1 -1
  5. package/dist/index.d.ts +33 -22
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +20 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/providers/base.d.ts +18 -3
  10. package/dist/providers/base.d.ts.map +1 -1
  11. package/dist/providers/base.js +5 -1
  12. package/dist/providers/base.js.map +1 -1
  13. package/dist/providers/memory.d.ts +2 -2
  14. package/dist/providers/memory.d.ts.map +1 -1
  15. package/dist/providers/memory.js +9 -5
  16. package/dist/providers/memory.js.map +1 -1
  17. package/dist/runtime/base.d.ts +40 -1
  18. package/dist/runtime/base.d.ts.map +1 -1
  19. package/dist/runtime/base.js +148 -20
  20. package/dist/runtime/base.js.map +1 -1
  21. package/dist/services/access-control.service.d.ts +121 -0
  22. package/dist/services/access-control.service.d.ts.map +1 -0
  23. package/dist/services/access-control.service.js +458 -0
  24. package/dist/services/access-control.service.js.map +1 -0
  25. package/dist/services/crypto.service.d.ts +69 -0
  26. package/dist/services/crypto.service.d.ts.map +1 -0
  27. package/dist/services/crypto.service.js +225 -0
  28. package/dist/services/crypto.service.js.map +1 -0
  29. package/dist/services/errors.d.ts +49 -0
  30. package/dist/services/errors.d.ts.map +1 -0
  31. package/dist/services/errors.js +66 -0
  32. package/dist/services/errors.js.map +1 -0
  33. package/dist/services/index.d.ts +5 -0
  34. package/dist/services/index.d.ts.map +1 -0
  35. package/dist/services/index.js +8 -0
  36. package/dist/services/index.js.map +1 -0
  37. package/dist/services/proof-verifier.d.ts +98 -0
  38. package/dist/services/proof-verifier.d.ts.map +1 -0
  39. package/dist/services/proof-verifier.js +319 -0
  40. package/dist/services/proof-verifier.js.map +1 -0
  41. package/dist/services/storage.service.d.ts +116 -0
  42. package/dist/services/storage.service.d.ts.map +1 -0
  43. package/dist/services/storage.service.js +405 -0
  44. package/dist/services/storage.service.js.map +1 -0
  45. package/dist/utils/base64.d.ts +31 -0
  46. package/dist/utils/base64.d.ts.map +1 -0
  47. package/dist/utils/base64.js +138 -0
  48. package/dist/utils/base64.js.map +1 -0
  49. package/dist/utils/index.d.ts +3 -1
  50. package/dist/utils/index.d.ts.map +1 -1
  51. package/dist/utils/index.js +2 -0
  52. package/dist/utils/index.js.map +1 -1
  53. package/dist/utils/storage-keys.d.ts +120 -0
  54. package/dist/utils/storage-keys.d.ts.map +1 -0
  55. package/dist/utils/storage-keys.js +217 -0
  56. package/dist/utils/storage-keys.js.map +1 -0
  57. package/package.json +5 -4
  58. package/dist/compliance/schema-verifier-v2.d.ts +0 -110
  59. package/dist/compliance/schema-verifier-v2.d.ts.map +0 -1
  60. package/dist/compliance/schema-verifier-v2.js +0 -510
  61. package/dist/compliance/schema-verifier-v2.js.map +0 -1
  62. package/dist/did/resolver.d.ts +0 -92
  63. package/dist/did/resolver.d.ts.map +0 -1
  64. package/dist/did/resolver.js +0 -203
  65. package/dist/did/resolver.js.map +0 -1
  66. package/dist/proof/proof-engine.d.ts +0 -89
  67. package/dist/proof/proof-engine.d.ts.map +0 -1
  68. package/dist/proof/proof-engine.js +0 -249
  69. package/dist/proof/proof-engine.js.map +0 -1
  70. package/dist/runtime/base-v2.d.ts +0 -117
  71. package/dist/runtime/base-v2.d.ts.map +0 -1
  72. package/dist/runtime/base-v2.js +0 -328
  73. package/dist/runtime/base-v2.js.map +0 -1
  74. package/dist/types/providers.d.ts +0 -142
  75. package/dist/types/providers.d.ts.map +0 -1
  76. package/dist/types/providers.js +0 -43
  77. package/dist/types/providers.js.map +0 -1
  78. package/dist/verification/interfaces.d.ts +0 -125
  79. package/dist/verification/interfaces.d.ts.map +0 -1
  80. package/dist/verification/interfaces.js +0 -101
  81. package/dist/verification/interfaces.js.map +0 -1
@@ -0,0 +1,319 @@
1
+ "use strict";
2
+ /**
3
+ * ProofVerifier
4
+ *
5
+ * Centralized proof verification service that validates DetachedProof
6
+ * signatures, enforces nonce replay protection, and checks timestamp skew.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.ProofVerifier = void 0;
10
+ const crypto_service_js_1 = require("./crypto.service.js");
11
+ const proof_1 = require("@kya-os/contracts/proof");
12
+ const json_canonicalize_1 = require("json-canonicalize");
13
+ const errors_js_1 = require("./errors.js");
14
+ class ProofVerifier {
15
+ cryptoService;
16
+ clock;
17
+ nonceCache;
18
+ fetch;
19
+ timestampSkewSeconds;
20
+ nonceTtlSeconds;
21
+ constructor(config) {
22
+ this.cryptoService = new crypto_service_js_1.CryptoService(config.cryptoProvider);
23
+ this.clock = config.clockProvider;
24
+ this.nonceCache = config.nonceCacheProvider;
25
+ this.fetch = config.fetchProvider;
26
+ this.timestampSkewSeconds = config.timestampSkewSeconds ?? 120; // Default 2 minutes
27
+ this.nonceTtlSeconds = config.nonceTtlSeconds ?? 300; // Default 5 minutes
28
+ }
29
+ /**
30
+ * Verify a DetachedProof
31
+ * Automatically reconstructs canonical payload from proof.meta for signature verification
32
+ * @param proof - The proof to verify
33
+ * @param publicKeyJwk - Ed25519 public key in JWK format (from DID document)
34
+ * @returns Verification result
35
+ */
36
+ async verifyProof(proof, publicKeyJwk) {
37
+ try {
38
+ // 1. Validate proof structure
39
+ const structureValidation = await this.validateProofStructure(proof);
40
+ if (!structureValidation.valid) {
41
+ return structureValidation;
42
+ }
43
+ const validatedProof = structureValidation.proof;
44
+ // 2. Check nonce replay protection (scoped to agent DID to prevent cross-agent replay attacks)
45
+ const nonceValidation = await this.validateNonce(validatedProof.meta.nonce, validatedProof.meta.did);
46
+ if (!nonceValidation.valid) {
47
+ return nonceValidation;
48
+ }
49
+ // 3. Check timestamp skew
50
+ const timestampValidation = await this.validateTimestamp(validatedProof.meta.ts);
51
+ if (!timestampValidation.valid) {
52
+ return timestampValidation;
53
+ }
54
+ // 4. Reconstruct canonical payload from proof meta
55
+ const canonicalPayloadString = this.buildCanonicalPayload(validatedProof.meta);
56
+ const canonicalPayloadBytes = new TextEncoder().encode(canonicalPayloadString);
57
+ // 5. Verify JWS signature with detached canonical payload
58
+ const signatureValidation = await this.verifySignature(validatedProof.jws, publicKeyJwk, canonicalPayloadBytes, validatedProof.meta.kid);
59
+ if (!signatureValidation.valid) {
60
+ return signatureValidation;
61
+ }
62
+ // 6. Add nonce to cache to prevent replay (scoped to agent DID)
63
+ await this.addNonceToCache(validatedProof.meta.nonce, validatedProof.meta.did);
64
+ return {
65
+ valid: true,
66
+ };
67
+ }
68
+ catch (error) {
69
+ // Security-safe failure: never throw, always return error result
70
+ return {
71
+ valid: false,
72
+ reason: "Proof verification error",
73
+ errorCode: errors_js_1.PROOF_VERIFICATION_ERROR_CODES.VERIFICATION_ERROR,
74
+ error: error instanceof Error ? error : new Error(String(error)),
75
+ details: {
76
+ errorMessage: error instanceof Error ? error.message : String(error),
77
+ },
78
+ };
79
+ }
80
+ }
81
+ /**
82
+ * Verify proof with detached payload (for CLI/verifier compatibility)
83
+ * @param proof - The proof to verify
84
+ * @param canonicalPayload - Canonical JSON payload (for detached JWS) as string or Uint8Array
85
+ * @param publicKeyJwk - Ed25519 public key in JWK format
86
+ * @returns Verification result
87
+ */
88
+ async verifyProofDetached(proof, canonicalPayload, publicKeyJwk) {
89
+ try {
90
+ // 1. Validate proof structure
91
+ const structureValidation = await this.validateProofStructure(proof);
92
+ if (!structureValidation.valid) {
93
+ return structureValidation;
94
+ }
95
+ const validatedProof = structureValidation.proof;
96
+ // 2. Check nonce replay protection (scoped to agent DID to prevent cross-agent replay attacks)
97
+ const nonceValidation = await this.validateNonce(validatedProof.meta.nonce, validatedProof.meta.did);
98
+ if (!nonceValidation.valid) {
99
+ return nonceValidation;
100
+ }
101
+ // 3. Check timestamp skew
102
+ const timestampValidation = await this.validateTimestamp(validatedProof.meta.ts);
103
+ if (!timestampValidation.valid) {
104
+ return timestampValidation;
105
+ }
106
+ // 4. Convert canonical payload to Uint8Array if needed
107
+ const canonicalPayloadBytes = canonicalPayload instanceof Uint8Array
108
+ ? canonicalPayload
109
+ : new TextEncoder().encode(canonicalPayload);
110
+ // 5. Verify JWS signature with detached payload
111
+ const signatureValidation = await this.verifySignature(validatedProof.jws, publicKeyJwk, canonicalPayloadBytes, validatedProof.meta.kid);
112
+ if (!signatureValidation.valid) {
113
+ return signatureValidation;
114
+ }
115
+ // 6. Add nonce to cache (scoped to agent DID)
116
+ await this.addNonceToCache(validatedProof.meta.nonce, validatedProof.meta.did);
117
+ return {
118
+ valid: true,
119
+ };
120
+ }
121
+ catch (error) {
122
+ // Security-safe failure: never throw, always return error result
123
+ return {
124
+ valid: false,
125
+ reason: "Proof verification error",
126
+ errorCode: errors_js_1.PROOF_VERIFICATION_ERROR_CODES.VERIFICATION_ERROR,
127
+ error: error instanceof Error ? error : new Error(String(error)),
128
+ details: {
129
+ errorMessage: error instanceof Error ? error.message : String(error),
130
+ },
131
+ };
132
+ }
133
+ }
134
+ /**
135
+ * Validate proof structure using Zod schema
136
+ * @private
137
+ */
138
+ async validateProofStructure(proof) {
139
+ const validationResult = proof_1.DetachedProofSchema.safeParse(proof);
140
+ if (!validationResult.success) {
141
+ return {
142
+ valid: false,
143
+ reason: "Invalid proof structure",
144
+ errorCode: errors_js_1.PROOF_VERIFICATION_ERROR_CODES.INVALID_PROOF_STRUCTURE,
145
+ error: new Error(`Proof validation failed: ${validationResult.error.message}`),
146
+ details: {
147
+ zodErrors: validationResult.error.errors,
148
+ },
149
+ };
150
+ }
151
+ return {
152
+ valid: true,
153
+ proof: validationResult.data,
154
+ };
155
+ }
156
+ /**
157
+ * Validate nonce replay protection
158
+ * @private
159
+ */
160
+ async validateNonce(nonce, agentDid) {
161
+ const nonceUsed = await this.nonceCache.has(nonce, agentDid);
162
+ if (nonceUsed) {
163
+ return {
164
+ valid: false,
165
+ reason: "Nonce already used (replay attack detected)",
166
+ errorCode: errors_js_1.PROOF_VERIFICATION_ERROR_CODES.NONCE_REPLAY_DETECTED,
167
+ details: {
168
+ nonce,
169
+ agentDid,
170
+ },
171
+ };
172
+ }
173
+ return { valid: true };
174
+ }
175
+ /**
176
+ * Validate timestamp skew
177
+ * @private
178
+ */
179
+ async validateTimestamp(timestamp) {
180
+ // Convert seconds to milliseconds for clock provider (which uses Date.now())
181
+ const timestampMs = timestamp * 1000;
182
+ if (!this.clock.isWithinSkew(timestampMs, this.timestampSkewSeconds)) {
183
+ return {
184
+ valid: false,
185
+ reason: `Timestamp out of skew window (skew: ${this.timestampSkewSeconds}s)`,
186
+ errorCode: errors_js_1.PROOF_VERIFICATION_ERROR_CODES.TIMESTAMP_SKEW_EXCEEDED,
187
+ details: {
188
+ timestamp,
189
+ timestampMs,
190
+ skewSeconds: this.timestampSkewSeconds,
191
+ currentTime: this.clock.now(),
192
+ },
193
+ };
194
+ }
195
+ return { valid: true };
196
+ }
197
+ /**
198
+ * Verify JWS signature
199
+ * @private
200
+ */
201
+ async verifySignature(jws, publicKeyJwk, canonicalPayloadBytes, expectedKid) {
202
+ const signatureValid = await this.cryptoService.verifyJWS(jws, publicKeyJwk, {
203
+ detachedPayload: canonicalPayloadBytes,
204
+ expectedKid,
205
+ alg: "EdDSA",
206
+ });
207
+ if (!signatureValid) {
208
+ return {
209
+ valid: false,
210
+ reason: "Invalid JWS signature",
211
+ errorCode: errors_js_1.PROOF_VERIFICATION_ERROR_CODES.INVALID_JWS_SIGNATURE,
212
+ details: {
213
+ jwsLength: jws.length,
214
+ expectedKid,
215
+ actualKid: publicKeyJwk.kid,
216
+ },
217
+ };
218
+ }
219
+ return { valid: true };
220
+ }
221
+ /**
222
+ * Add nonce to cache to prevent replay (scoped to agent DID)
223
+ * @private
224
+ */
225
+ async addNonceToCache(nonce, agentDid) {
226
+ // Pass TTL in seconds, not absolute timestamp
227
+ await this.nonceCache.add(nonce, this.nonceTtlSeconds, agentDid);
228
+ }
229
+ /**
230
+ * Fetch public key from DID document
231
+ * @param did - DID to resolve
232
+ * @param kid - Key ID (optional, defaults to first verification method)
233
+ * @returns Ed25519 JWK or null if not found
234
+ * @throws {ProofVerificationError} If DID resolution fails with specific error code
235
+ */
236
+ async fetchPublicKeyFromDID(did, kid) {
237
+ try {
238
+ const didDoc = await this.fetch.resolveDID(did);
239
+ if (!didDoc) {
240
+ throw new errors_js_1.ProofVerificationError(errors_js_1.PROOF_VERIFICATION_ERROR_CODES.DID_DOCUMENT_NOT_FOUND, `DID document not found: ${did}`, { did });
241
+ }
242
+ if (!didDoc.verificationMethod ||
243
+ didDoc.verificationMethod.length === 0) {
244
+ throw new errors_js_1.ProofVerificationError(errors_js_1.PROOF_VERIFICATION_ERROR_CODES.VERIFICATION_METHOD_NOT_FOUND, `No verification methods found in DID document: ${did}`, { did });
245
+ }
246
+ // Find verification method by kid or use first one
247
+ let verificationMethod;
248
+ if (kid) {
249
+ const kidWithHash = kid.startsWith("#") ? kid : `#${kid}`;
250
+ verificationMethod = didDoc.verificationMethod.find((vm) => vm.id === kidWithHash || vm.id === `${did}${kidWithHash}`);
251
+ if (!verificationMethod) {
252
+ throw new errors_js_1.ProofVerificationError(errors_js_1.PROOF_VERIFICATION_ERROR_CODES.VERIFICATION_METHOD_NOT_FOUND, `Verification method not found for kid: ${kid}`, {
253
+ did,
254
+ kid,
255
+ availableKids: didDoc.verificationMethod.map((vm) => vm.id),
256
+ });
257
+ }
258
+ }
259
+ else {
260
+ verificationMethod = didDoc.verificationMethod[0];
261
+ }
262
+ if (!verificationMethod?.publicKeyJwk) {
263
+ throw new errors_js_1.ProofVerificationError(errors_js_1.PROOF_VERIFICATION_ERROR_CODES.PUBLIC_KEY_NOT_FOUND, `Public key JWK not found in verification method`, { did, kid, verificationMethodId: verificationMethod?.id });
264
+ }
265
+ const jwk = verificationMethod.publicKeyJwk;
266
+ // Validate it's an Ed25519 key
267
+ if (jwk.kty !== "OKP" || jwk.crv !== "Ed25519" || !jwk.x) {
268
+ throw new errors_js_1.ProofVerificationError(errors_js_1.PROOF_VERIFICATION_ERROR_CODES.INVALID_JWK_FORMAT, `Unsupported key type or curve: kty=${jwk.kty}, crv=${jwk.crv}`, { did, kid, jwk: { kty: jwk.kty, crv: jwk.crv } });
269
+ }
270
+ return jwk;
271
+ }
272
+ catch (error) {
273
+ if (error instanceof errors_js_1.ProofVerificationError) {
274
+ throw error;
275
+ }
276
+ console.error("[ProofVerifier] Failed to fetch public key from DID:", error);
277
+ throw new errors_js_1.ProofVerificationError(errors_js_1.PROOF_VERIFICATION_ERROR_CODES.DID_RESOLUTION_FAILED, `DID resolution failed: ${error instanceof Error ? error.message : String(error)}`, {
278
+ did,
279
+ kid,
280
+ originalError: error instanceof Error ? error.message : String(error),
281
+ });
282
+ }
283
+ }
284
+ /**
285
+ * Build canonical payload from proof meta
286
+ *
287
+ * CRITICAL: This must reconstruct the exact JWS payload structure that was originally signed.
288
+ * The original JWS payload uses standard JWT claims (aud, sub, iss) plus custom proof claims,
289
+ * NOT the proof.meta structure directly.
290
+ *
291
+ * @param meta - Proof metadata
292
+ * @returns Canonical JSON string matching the original JWS payload structure
293
+ */
294
+ buildCanonicalPayload(meta) {
295
+ // Reconstruct the original JWS payload structure that was signed
296
+ // This matches the structure used in proof generation (proof.ts, proof-generator.ts)
297
+ const payload = {
298
+ // Standard JWT claims (RFC 7519) - these are what was actually signed
299
+ aud: meta.audience, // Audience (who the token is for)
300
+ sub: meta.did, // Subject (agent DID)
301
+ iss: meta.did, // Issuer (agent DID - self-issued)
302
+ // Custom MCP-I proof claims
303
+ requestHash: meta.requestHash,
304
+ responseHash: meta.responseHash,
305
+ ts: meta.ts,
306
+ nonce: meta.nonce,
307
+ sessionId: meta.sessionId,
308
+ // Optional claims (only include if present)
309
+ ...(meta.scopeId && { scopeId: meta.scopeId }),
310
+ ...(meta.delegationRef && { delegationRef: meta.delegationRef }),
311
+ ...(meta.clientDid && { clientDid: meta.clientDid }),
312
+ };
313
+ // Canonicalize the reconstructed payload using the same function as proof generation
314
+ // CRITICAL: Must use json-canonicalize canonicalize() to match proof.ts exactly
315
+ return (0, json_canonicalize_1.canonicalize)(payload);
316
+ }
317
+ }
318
+ exports.ProofVerifier = ProofVerifier;
319
+ //# sourceMappingURL=proof-verifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proof-verifier.js","sourceRoot":"","sources":["../../src/services/proof-verifier.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,2DAAqE;AAKrE,mDAGiC;AACjC,yDAAiD;AACjD,2CAIqB;AAmBrB,MAAa,aAAa;IAChB,aAAa,CAAgB;IAC7B,KAAK,CAAgB;IACrB,UAAU,CAAqB;IAC/B,KAAK,CAAgB;IACrB,oBAAoB,CAAS;IAC7B,eAAe,CAAS;IAEhC,YAAY,MAA2B;QACrC,IAAI,CAAC,aAAa,GAAG,IAAI,iCAAa,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;QAC9D,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,aAAa,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,kBAAkB,CAAC;QAC5C,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,aAAa,CAAC;QAClC,IAAI,CAAC,oBAAoB,GAAG,MAAM,CAAC,oBAAoB,IAAI,GAAG,CAAC,CAAC,oBAAoB;QACpF,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,IAAI,GAAG,CAAC,CAAC,oBAAoB;IAC5E,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,WAAW,CACf,KAAoB,EACpB,YAAwB;QAExB,IAAI,CAAC;YACH,8BAA8B;YAC9B,MAAM,mBAAmB,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;YACrE,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,C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AG,EAAE,sBAAsB;YACrC,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,mCAAmC;YAElD,4BAA4B;YAC5B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,SAAS,EAAE,IAAI,CAAC,SAAS;YAEzB,4CAA4C;YAC5C,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;YAC9C,GAAG,CAAC,IAAI,CAAC,aAAa,IAAI,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC;YAChE,GAAG,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC;SACrD,CAAC;QAEF,qFAAqF;QACrF,gFAAgF;QAChF,OAAO,IAAA,gCAAY,EAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;CACF;AArbD,sCAqbC"}
@@ -0,0 +1,116 @@
1
+ /**
2
+ * Storage Service Factory
3
+ *
4
+ * Auto-selects storage providers based on available configuration.
5
+ * Priority: Redis > Cloudflare KV > Cloudflare Durable Objects > Memory
6
+ *
7
+ * @package @kya-os/mcp-i-core
8
+ */
9
+ import { StorageProvider, NonceCacheProvider } from "../providers/base.js";
10
+ /**
11
+ * Storage service configuration
12
+ */
13
+ export interface StorageServiceConfig {
14
+ /** Redis URL (e.g., "redis://localhost:6379") */
15
+ redisUrl?: string;
16
+ /** Cloudflare KV namespace */
17
+ kvNamespace?: {
18
+ get(key: string): Promise<string | null>;
19
+ put(key: string, value: string, options?: {
20
+ expirationTtl?: number;
21
+ }): Promise<void>;
22
+ delete(key: string): Promise<void>;
23
+ list(options?: {
24
+ prefix?: string;
25
+ }): Promise<{
26
+ keys: Array<{
27
+ name: string;
28
+ }>;
29
+ }>;
30
+ };
31
+ /** Cloudflare Durable Object state */
32
+ durableObjectState?: {
33
+ storage: {
34
+ get(key: string): Promise<string | undefined>;
35
+ put(key: string, value: string): Promise<void>;
36
+ delete(key: string): Promise<void>;
37
+ list(options?: {
38
+ prefix?: string;
39
+ }): Promise<Map<string, string>>;
40
+ };
41
+ };
42
+ /** Fallback to memory if no external storage configured (default: true) */
43
+ fallbackToMemory?: boolean;
44
+ }
45
+ /**
46
+ * Storage providers result
47
+ */
48
+ export interface StorageProviders {
49
+ storageProvider: StorageProvider;
50
+ nonceCacheProvider: NonceCacheProvider;
51
+ }
52
+ /**
53
+ * Key helper functions for consistent key formatting
54
+ */
55
+ export declare class StorageKeyHelpers {
56
+ /**
57
+ * Build delegation key using composite format
58
+ * Format: delegation:${userDid}:${agentDid}:${projectId}
59
+ */
60
+ static buildDelegationKey(userDid: string, agentDid: string, projectId: string): string;
61
+ /**
62
+ * Build session key
63
+ * Format: session:${sessionId}
64
+ */
65
+ static buildSessionKey(sessionId: string): string;
66
+ /**
67
+ * Build nonce key
68
+ * Format: nonce:${agentDid}:${nonce}
69
+ */
70
+ static buildNonceKey(agentDid: string, nonce: string): string;
71
+ /**
72
+ * Parse delegation key back into components
73
+ *
74
+ * Format: delegation:${userDid}:${agentDid}:${projectId}
75
+ *
76
+ * Note: DIDs contain colons (e.g., did:key:z123), so we can't simply split by ":"
77
+ * Instead, we:
78
+ * 1. Check that key starts with "delegation:"
79
+ * 2. Take the last part as projectId (doesn't contain colons)
80
+ * 3. Find where agentDid starts (look for "did:" pattern)
81
+ * 4. Everything before agentDid is userDid, everything between agentDid and projectId is agentDid
82
+ *
83
+ * Strategy: Since DIDs always start with "did:", we can find the second occurrence of "did:"
84
+ * to determine where agentDid begins. However, this assumes userDid and agentDid both start with "did:".
85
+ *
86
+ * For keys like "delegation:did:key:user123:did:key:agent456:project-789":
87
+ * - Remove "delegation:" prefix → "did:key:user123:did:key:agent456:project-789"
88
+ * - Find last ":" → separates agentDid from projectId
89
+ * - projectId = "project-789"
90
+ * - Find second occurrence of "did:" → separates userDid from agentDid
91
+ * - userDid = "did:key:user123"
92
+ * - agentDid = "did:key:agent456"
93
+ */
94
+ static parseDelegationKey(key: string): {
95
+ userDid: string;
96
+ agentDid: string;
97
+ projectId: string;
98
+ } | null;
99
+ }
100
+ /**
101
+ * Create storage providers based on configuration
102
+ *
103
+ * Priority order:
104
+ * 1. Redis (if redisUrl provided)
105
+ * 2. Cloudflare KV (if kvNamespace provided)
106
+ * 3. Cloudflare Durable Objects (if durableObjectState provided)
107
+ * 4. In-memory fallback (if fallbackToMemory is true, default)
108
+ */
109
+ export declare function createStorageProviders(config: StorageServiceConfig): Promise<StorageProviders>;
110
+ /**
111
+ * Migration utility for legacy key formats
112
+ *
113
+ * Migrates keys from old format (e.g., `agent:${did}:delegation`) to new composite format
114
+ */
115
+ export declare function migrateLegacyKeys(oldKeyPrefix: string, newKeyFormat: (oldKey: string) => string | null, storageProvider: StorageProvider, batchSize?: number): Promise<number>;
116
+ //# sourceMappingURL=storage.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.service.d.ts","sourceRoot":"","sources":["../../src/services/storage.service.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,eAAe,EACf,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAM9B;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,8BAA8B;IAC9B,WAAW,CAAC,EAAE;QACZ,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;QACzC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;YAAE,aAAa,CAAC,EAAE,MAAM,CAAA;SAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QACrF,MAAM,CAAC,GAAG,EAAE,MAAM,GA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