@kya-os/contracts 1.2.1 → 1.2.2

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 (57) hide show
  1. package/dist/delegation/constraints.d.ts +982 -0
  2. package/dist/delegation/constraints.js +205 -0
  3. package/dist/delegation/index.d.ts +8 -0
  4. package/dist/delegation/index.js +24 -0
  5. package/dist/delegation/schemas.d.ts +3787 -0
  6. package/dist/delegation/schemas.js +230 -0
  7. package/dist/did/index.d.ts +8 -0
  8. package/dist/did/index.js +24 -0
  9. package/dist/did/resolve-contract.d.ts +220 -0
  10. package/dist/did/resolve-contract.js +32 -0
  11. package/dist/did/types.d.ts +164 -0
  12. package/dist/did/types.js +71 -0
  13. package/dist/env/constants.d.ts +58 -0
  14. package/dist/env/constants.js +60 -0
  15. package/dist/env/index.d.ts +5 -0
  16. package/dist/env/index.js +21 -0
  17. package/dist/index.d.ts +9 -1
  18. package/dist/index.js +17 -2
  19. package/dist/proof/index.d.ts +9 -0
  20. package/dist/proof/index.js +25 -0
  21. package/dist/proof/proof-record.d.ts +838 -0
  22. package/dist/proof/proof-record.js +134 -0
  23. package/dist/proof/signing-spec.d.ts +147 -0
  24. package/dist/proof/signing-spec.js +123 -0
  25. package/dist/runtime/errors.d.ts +348 -0
  26. package/dist/runtime/errors.js +120 -0
  27. package/dist/runtime/headers.d.ts +84 -0
  28. package/dist/runtime/headers.js +82 -0
  29. package/dist/runtime/index.d.ts +6 -0
  30. package/dist/runtime/index.js +22 -0
  31. package/dist/tlkrc/index.d.ts +5 -0
  32. package/dist/tlkrc/index.js +21 -0
  33. package/dist/tlkrc/rotation.d.ts +246 -0
  34. package/dist/tlkrc/rotation.js +127 -0
  35. package/dist/vc/index.d.ts +8 -0
  36. package/dist/vc/index.js +24 -0
  37. package/dist/vc/schemas.d.ts +2484 -0
  38. package/dist/vc/schemas.js +225 -0
  39. package/dist/vc/statuslist.d.ts +494 -0
  40. package/dist/vc/statuslist.js +133 -0
  41. package/package.json +51 -6
  42. package/dist/cli.d.ts.map +0 -1
  43. package/dist/cli.js.map +0 -1
  44. package/dist/handshake.d.ts.map +0 -1
  45. package/dist/handshake.js.map +0 -1
  46. package/dist/index.d.ts.map +0 -1
  47. package/dist/index.js.map +0 -1
  48. package/dist/proof.d.ts.map +0 -1
  49. package/dist/proof.js.map +0 -1
  50. package/dist/registry.d.ts.map +0 -1
  51. package/dist/registry.js.map +0 -1
  52. package/dist/test.d.ts.map +0 -1
  53. package/dist/test.js.map +0 -1
  54. package/dist/utils/validation.d.ts.map +0 -1
  55. package/dist/utils/validation.js.map +0 -1
  56. package/dist/verifier.d.ts.map +0 -1
  57. package/dist/verifier.js.map +0 -1
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ /**
3
+ * DID Document Types (W3C Compliant)
4
+ *
5
+ * These types conform to the W3C DID Core specification and provide
6
+ * TypeScript parity with the Python implementation.
7
+ *
8
+ * Related Spec: MCP-I §2.1, §2.3
9
+ * Python Reference: DID-Documentation.md, DID-Service.md
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.isVerificationMethod = isVerificationMethod;
13
+ exports.isVerificationMethodReference = isVerificationMethodReference;
14
+ exports.isDidDocument = isDidDocument;
15
+ exports.extractDidMethod = extractDidMethod;
16
+ exports.extractKeyId = extractKeyId;
17
+ /**
18
+ * Helper type guards
19
+ */
20
+ /**
21
+ * Type guard to check if a value is a VerificationMethod
22
+ */
23
+ function isVerificationMethod(value) {
24
+ return (typeof value === 'object' &&
25
+ value !== null &&
26
+ typeof value.id === 'string' &&
27
+ typeof value.type === 'string' &&
28
+ typeof value.controller === 'string');
29
+ }
30
+ /**
31
+ * Type guard to check if a value is a string reference to a verification method
32
+ */
33
+ function isVerificationMethodReference(value) {
34
+ return typeof value === 'string';
35
+ }
36
+ /**
37
+ * Type guard to check if a DID Document is valid (basic structural check)
38
+ */
39
+ function isDidDocument(value) {
40
+ return (typeof value === 'object' &&
41
+ value !== null &&
42
+ typeof value.id === 'string' &&
43
+ value.id.startsWith('did:'));
44
+ }
45
+ /**
46
+ * Extract DID method from a DID string
47
+ *
48
+ * @param did - The DID string (e.g., "did:key:z6Mk...")
49
+ * @returns The method name (e.g., "key") or null if invalid
50
+ */
51
+ function extractDidMethod(did) {
52
+ const parts = did.split(':');
53
+ if (parts.length < 3 || parts[0] !== 'did') {
54
+ return null;
55
+ }
56
+ return parts[1];
57
+ }
58
+ /**
59
+ * Extract key ID from a DID URL
60
+ *
61
+ * @param didUrl - A DID URL with fragment (e.g., "did:key:z6Mk...#key-1")
62
+ * @returns The fragment part (e.g., "key-1") or null if no fragment
63
+ */
64
+ function extractKeyId(didUrl) {
65
+ const hashIndex = didUrl.indexOf('#');
66
+ if (hashIndex === -1) {
67
+ return null;
68
+ }
69
+ return didUrl.substring(hashIndex + 1);
70
+ }
71
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Environment Constants
3
+ *
4
+ * System-wide constants for algorithms, TTLs, and limits
5
+ *
6
+ * Related Spec: MCP-I §8
7
+ * Python Reference: All service documentation files
8
+ */
9
+ /**
10
+ * Hash algorithm for cryptographic operations
11
+ */
12
+ export declare const HASH_ALGO: "SHA-256";
13
+ /**
14
+ * Supported signature algorithms
15
+ */
16
+ export declare const SIG_ALGOS: readonly ["Ed25519", "ES256"];
17
+ export type SignatureAlgorithm = (typeof SIG_ALGOS)[number];
18
+ /**
19
+ * Nonce TTL in milliseconds (5 minutes)
20
+ */
21
+ export declare const NONCE_TTL_MS: number;
22
+ /**
23
+ * Resume token TTL in milliseconds (10 minutes)
24
+ */
25
+ export declare const RESUME_TOKEN_TTL_MS: number;
26
+ /**
27
+ * StatusList2021 cache TTL in seconds (1 minute)
28
+ */
29
+ export declare const STATUSLIST_CACHE_SEC = 60;
30
+ /**
31
+ * DID resolution timeout in milliseconds (500ms)
32
+ */
33
+ export declare const DID_RESOLVE_TIMEOUT_MS = 500;
34
+ /**
35
+ * Default session TTL in minutes (30 minutes)
36
+ */
37
+ export declare const DEFAULT_SESSION_TTL_MINUTES = 30;
38
+ /**
39
+ * Maximum timestamp skew in seconds (2 minutes)
40
+ */
41
+ export declare const MAX_TIMESTAMP_SKEW_SEC = 120;
42
+ /**
43
+ * Maximum delegation chain depth
44
+ */
45
+ export declare const MAX_DELEGATION_CHAIN_DEPTH = 10;
46
+ /**
47
+ * Maximum status list size (1 million entries)
48
+ */
49
+ export declare const MAX_STATUSLIST_SIZE = 1000000;
50
+ /**
51
+ * Proof archive TTL in seconds (30 days)
52
+ */
53
+ export declare const PROOF_ARCHIVE_TTL_SEC: number;
54
+ /**
55
+ * Key rotation grace period in seconds (24 hours)
56
+ */
57
+ export declare const KEY_ROTATION_GRACE_PERIOD_SEC: number;
58
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ /**
3
+ * Environment Constants
4
+ *
5
+ * System-wide constants for algorithms, TTLs, and limits
6
+ *
7
+ * Related Spec: MCP-I §8
8
+ * Python Reference: All service documentation files
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.KEY_ROTATION_GRACE_PERIOD_SEC = exports.PROOF_ARCHIVE_TTL_SEC = exports.MAX_STATUSLIST_SIZE = exports.MAX_DELEGATION_CHAIN_DEPTH = exports.MAX_TIMESTAMP_SKEW_SEC = exports.DEFAULT_SESSION_TTL_MINUTES = exports.DID_RESOLVE_TIMEOUT_MS = exports.STATUSLIST_CACHE_SEC = exports.RESUME_TOKEN_TTL_MS = exports.NONCE_TTL_MS = exports.SIG_ALGOS = exports.HASH_ALGO = void 0;
12
+ /**
13
+ * Hash algorithm for cryptographic operations
14
+ */
15
+ exports.HASH_ALGO = 'SHA-256';
16
+ /**
17
+ * Supported signature algorithms
18
+ */
19
+ exports.SIG_ALGOS = ['Ed25519', 'ES256'];
20
+ /**
21
+ * Nonce TTL in milliseconds (5 minutes)
22
+ */
23
+ exports.NONCE_TTL_MS = 5 * 60 * 1000;
24
+ /**
25
+ * Resume token TTL in milliseconds (10 minutes)
26
+ */
27
+ exports.RESUME_TOKEN_TTL_MS = 10 * 60 * 1000;
28
+ /**
29
+ * StatusList2021 cache TTL in seconds (1 minute)
30
+ */
31
+ exports.STATUSLIST_CACHE_SEC = 60;
32
+ /**
33
+ * DID resolution timeout in milliseconds (500ms)
34
+ */
35
+ exports.DID_RESOLVE_TIMEOUT_MS = 500;
36
+ /**
37
+ * Default session TTL in minutes (30 minutes)
38
+ */
39
+ exports.DEFAULT_SESSION_TTL_MINUTES = 30;
40
+ /**
41
+ * Maximum timestamp skew in seconds (2 minutes)
42
+ */
43
+ exports.MAX_TIMESTAMP_SKEW_SEC = 120;
44
+ /**
45
+ * Maximum delegation chain depth
46
+ */
47
+ exports.MAX_DELEGATION_CHAIN_DEPTH = 10;
48
+ /**
49
+ * Maximum status list size (1 million entries)
50
+ */
51
+ exports.MAX_STATUSLIST_SIZE = 1000000;
52
+ /**
53
+ * Proof archive TTL in seconds (30 days)
54
+ */
55
+ exports.PROOF_ARCHIVE_TTL_SEC = 30 * 24 * 60 * 60;
56
+ /**
57
+ * Key rotation grace period in seconds (24 hours)
58
+ */
59
+ exports.KEY_ROTATION_GRACE_PERIOD_SEC = 24 * 60 * 60;
60
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Environment Constants Module
3
+ */
4
+ export * from './constants.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * Environment Constants Module
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
17
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ __exportStar(require("./constants.js"), exports);
21
+ //# sourceMappingURL=index.js.map
package/dist/index.d.ts CHANGED
@@ -3,6 +3,14 @@
3
3
  *
4
4
  * This package provides a single source of truth for all types and contracts
5
5
  * used across the XMCP-I ecosystem, including runtime, CLI, verifier, and registry.
6
+ *
7
+ * NOTE: Some exports may conflict. Use subpath imports for new modules:
8
+ * - import { ... } from '@kya-os/contracts/did'
9
+ * - import { ... } from '@kya-os/contracts/vc'
10
+ * - import { ... } from '@kya-os/contracts/delegation'
11
+ * - import { ... } from '@kya-os/contracts/runtime'
12
+ * - import { ... } from '@kya-os/contracts/tlkrc'
13
+ * - import { ... } from '@kya-os/contracts/env'
6
14
  */
7
15
  export * from "./handshake.js";
8
16
  export * from "./proof.js";
@@ -11,6 +19,6 @@ export * from "./registry.js";
11
19
  export * from "./cli.js";
12
20
  export * from "./test.js";
13
21
  export * from "./utils/validation.js";
14
- export declare const CONTRACTS_VERSION = "1.0.0";
22
+ export declare const CONTRACTS_VERSION = "1.2.1";
15
23
  export declare const SUPPORTED_XMCP_I_VERSION = "^1.0.0";
16
24
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -4,6 +4,14 @@
4
4
  *
5
5
  * This package provides a single source of truth for all types and contracts
6
6
  * used across the XMCP-I ecosystem, including runtime, CLI, verifier, and registry.
7
+ *
8
+ * NOTE: Some exports may conflict. Use subpath imports for new modules:
9
+ * - import { ... } from '@kya-os/contracts/did'
10
+ * - import { ... } from '@kya-os/contracts/vc'
11
+ * - import { ... } from '@kya-os/contracts/delegation'
12
+ * - import { ... } from '@kya-os/contracts/runtime'
13
+ * - import { ... } from '@kya-os/contracts/tlkrc'
14
+ * - import { ... } from '@kya-os/contracts/env'
7
15
  */
8
16
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
17
  if (k2 === undefined) k2 = k;
@@ -21,7 +29,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
29
  };
22
30
  Object.defineProperty(exports, "__esModule", { value: true });
23
31
  exports.SUPPORTED_XMCP_I_VERSION = exports.CONTRACTS_VERSION = void 0;
24
- // Re-export all schemas and types from submodules
32
+ // Legacy exports (maintain backward compatibility)
25
33
  __exportStar(require("./handshake.js"), exports);
26
34
  __exportStar(require("./proof.js"), exports);
27
35
  __exportStar(require("./verifier.js"), exports);
@@ -30,6 +38,13 @@ __exportStar(require("./cli.js"), exports);
30
38
  __exportStar(require("./test.js"), exports);
31
39
  __exportStar(require("./utils/validation.js"), exports);
32
40
  // Version information
33
- exports.CONTRACTS_VERSION = "1.0.0";
41
+ exports.CONTRACTS_VERSION = "1.2.1";
34
42
  exports.SUPPORTED_XMCP_I_VERSION = "^1.0.0";
43
+ // New MCP-I contract types are available via subpath imports:
44
+ // import { ... } from '@kya-os/contracts/did'
45
+ // import { ... } from '@kya-os/contracts/vc'
46
+ // import { ... } from '@kya-os/contracts/delegation'
47
+ // import { ... } from '@kya-os/contracts/runtime'
48
+ // import { ... } from '@kya-os/contracts/tlkrc'
49
+ // import { ... } from '@kya-os/contracts/env'
35
50
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Proof Module Exports
3
+ *
4
+ * Note: This module exports proof record and signing spec types.
5
+ * The existing proof.ts file with DetachedProofSchema is separate.
6
+ */
7
+ export * from './signing-spec.js';
8
+ export * from './proof-record.js';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ /**
3
+ * Proof Module Exports
4
+ *
5
+ * Note: This module exports proof record and signing spec types.
6
+ * The existing proof.ts file with DetachedProofSchema is separate.
7
+ */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
20
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ __exportStar(require("./signing-spec.js"), exports);
24
+ __exportStar(require("./proof-record.js"), exports);
25
+ //# sourceMappingURL=index.js.map