@kya-os/mcp 1.13.0 → 1.14.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 (54) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/dist/card/delegation.d.ts +4 -4
  3. package/dist/card/delegation.d.ts.map +1 -1
  4. package/dist/card/delegation.js +2 -2
  5. package/dist/card/delegation.js.map +1 -1
  6. package/dist/card/revocation.d.ts +9 -3
  7. package/dist/card/revocation.d.ts.map +1 -1
  8. package/dist/card/revocation.js +6 -53
  9. package/dist/card/revocation.js.map +1 -1
  10. package/dist/card/verify.d.ts +2 -2
  11. package/dist/card/verify.d.ts.map +1 -1
  12. package/dist/card/verify.js.map +1 -1
  13. package/dist/delegation/bitstring.d.ts +6 -0
  14. package/dist/delegation/bitstring.d.ts.map +1 -1
  15. package/dist/delegation/bitstring.js +8 -48
  16. package/dist/delegation/bitstring.js.map +1 -1
  17. package/dist/delegation/did-key-resolver.d.ts +4 -0
  18. package/dist/delegation/did-key-resolver.d.ts.map +1 -1
  19. package/dist/delegation/did-key-resolver.js +2 -2
  20. package/dist/delegation/did-key-resolver.js.map +1 -1
  21. package/dist/delegation/index.d.ts +1 -0
  22. package/dist/delegation/index.d.ts.map +1 -1
  23. package/dist/delegation/index.js +1 -0
  24. package/dist/delegation/index.js.map +1 -1
  25. package/dist/delegation/statuslist-manager.d.ts.map +1 -1
  26. package/dist/delegation/statuslist-manager.js +4 -11
  27. package/dist/delegation/statuslist-manager.js.map +1 -1
  28. package/dist/delegation/vc-jwt-verify.d.ts.map +1 -1
  29. package/dist/delegation/vc-jwt-verify.js +5 -3
  30. package/dist/delegation/vc-jwt-verify.js.map +1 -1
  31. package/dist/delegation/vc-verification-checks.d.ts.map +1 -1
  32. package/dist/delegation/vc-verification-checks.js +3 -2
  33. package/dist/delegation/vc-verification-checks.js.map +1 -1
  34. package/dist/delegation/verification-method-key.d.ts +15 -0
  35. package/dist/delegation/verification-method-key.d.ts.map +1 -0
  36. package/dist/delegation/verification-method-key.js +56 -0
  37. package/dist/delegation/verification-method-key.js.map +1 -0
  38. package/dist/integrations/cheqd/dlr.d.ts +9 -1
  39. package/dist/integrations/cheqd/dlr.d.ts.map +1 -1
  40. package/dist/integrations/cheqd/dlr.js +25 -0
  41. package/dist/integrations/cheqd/dlr.js.map +1 -1
  42. package/dist/integrations/cheqd/index.d.ts +1 -0
  43. package/dist/integrations/cheqd/index.d.ts.map +1 -1
  44. package/dist/integrations/cheqd/index.js +1 -0
  45. package/dist/integrations/cheqd/index.js.map +1 -1
  46. package/dist/integrations/cheqd/statuslist-resolver.d.ts +74 -0
  47. package/dist/integrations/cheqd/statuslist-resolver.d.ts.map +1 -0
  48. package/dist/integrations/cheqd/statuslist-resolver.js +138 -0
  49. package/dist/integrations/cheqd/statuslist-resolver.js.map +1 -0
  50. package/dist/utils/statuslist-bits.d.ts +51 -0
  51. package/dist/utils/statuslist-bits.d.ts.map +1 -0
  52. package/dist/utils/statuslist-bits.js +106 -0
  53. package/dist/utils/statuslist-bits.js.map +1 -0
  54. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statuslist-resolver.js","sourceRoot":"","sources":["../../../src/integrations/cheqd/statuslist-resolver.ts"],"names":[],"mappings":"AAqCA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,aAAa,GACd,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAsBpD,MAAM,OAAO,uBAAuB;IACjB,IAAI,CAAiC;IACrC,UAAU,CAAS;IAC5B,KAAK,CAA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MAAM,eAAe,GAAG,aAAa,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YACrE,IAAI,MAAM,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,eAAe,CAAC,EAAE,CAAC;gBAC5E,OAAO;YACT,CAAC;QACH,CAAC;QACD,MAAM,IAAI,KAAK,CACb,2EAA2E,CAC5E,CAAC;IACJ,CAAC;CACF;AAED,MAAM,UAAU,6BAA6B,CAC3C,OAAuC;IAEvC,OAAO,IAAI,uBAAuB,CAAC,OAAO,CAAC,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Hard ceiling on an INFLATED status bitstring (16 MiB ≈ 134M entries — far
3
+ * beyond any herd-privacy list). A fixed cap costs nothing legitimate while
4
+ * stopping a decompression bomb; exceeding it throws (fail-closed).
5
+ */
6
+ export declare const MAX_STATUS_LIST_BYTES: number;
7
+ /**
8
+ * The W3C Bitstring Status List `encodedList` multibase prefix (base64url,
9
+ * no padding). A gzip stream's fixed magic byte (0x1f) makes its base64url
10
+ * start with `H`, never `u`, so a leading `u` is unambiguously the multibase
11
+ * code rather than payload.
12
+ */
13
+ export declare const MULTIBASE_BASE64URL = "u";
14
+ /**
15
+ * Parse a decimal `statusListIndex` (a non-negative integer expressed as a
16
+ * string), fail-closed. Canonical decimal ONLY: `Number()` alone would coerce
17
+ * whitespace (`" "` → 0), hex (`"0x2A"` → 42), `"+42"`, and `"1e1"` → 10 —
18
+ * silently reading a DIFFERENT (often clear) bit than the credential names,
19
+ * so a revoked credential could read as live.
20
+ */
21
+ export declare function parseStatusListIndex(raw: string): number;
22
+ /**
23
+ * Decode a status-list `encodedList` to the raw bitstring: strip the optional
24
+ * multibase `u` prefix, base64url-decode, run the injected decompressor, and
25
+ * re-check the {@link MAX_STATUS_LIST_BYTES} cap POST-inflation as a backstop
26
+ * (a production decompressor SHOULD also bound output during inflation).
27
+ * The decompressor is the bare-function common denominator — an
28
+ * object-shaped `DecompressionFunction` adapts inline:
29
+ * `(b) => decompressor.decompress(b)`.
30
+ */
31
+ export declare function decodeStatusListPayload(encodedList: string, decompress: (bytes: Uint8Array) => Uint8Array | Promise<Uint8Array>): Promise<Uint8Array>;
32
+ /**
33
+ * Read the status bit at `index` — MSB-first within each byte (W3C Bitstring
34
+ * encoding). Uses FULL-PRECISION arithmetic (`Math.floor(index / 8)`) rather
35
+ * than 32-bit bitwise ops, which coerce to uint32 first: an index ≥ 2^32
36
+ * would silently wrap onto a low byte and read the WRONG — often clear — bit,
37
+ * turning an out-of-range index that MUST fail-closed into a fail-OPEN "not
38
+ * revoked". NaN/negative/fractional/out-of-buffer indexes throw.
39
+ */
40
+ export declare function readStatusBit(bits: Uint8Array, index: number): boolean;
41
+ /**
42
+ * Assert a status-list credential is fit to ANCHOR (publish) — signed, and
43
+ * actually carrying a bitstring. Method-agnostic on purpose: the cheqd DLR
44
+ * publisher enforces it today; any future anchoring integration (another
45
+ * DLR-bearing DID method, a different chain) imports the same guard rather
46
+ * than re-deriving "what makes a status list publishable". An unsigned or
47
+ * bitstring-less list anchored on-chain would be an unverifiable — and
48
+ * therefore fail-closed-unusable — revocation source for every holder.
49
+ */
50
+ export declare function assertAnchorableStatusListCredential(content: unknown): void;
51
+ //# sourceMappingURL=statuslist-bits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statuslist-bits.d.ts","sourceRoot":"","sources":["../../src/utils/statuslist-bits.ts"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,QAAmB,CAAC;AAEtD;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAWxD;AAED;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,CAC3C,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,GAClE,OAAO,CAAC,UAAU,CAAC,CAUrB;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAUtE;AAED;;;;;;;;GAQG;AACH,wBAAgB,oCAAoC,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAiB3E"}
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Status-list primitives — the ONE home for the mechanics every W3C
3
+ * status-list reader AND publisher in this package shares (StatusList2021 /
4
+ * Bitstring Status List v1.0): canonical index parsing, bounded payload
5
+ * inflation, the MSB-first bit read, and the anchor-fitness guard.
6
+ *
7
+ * Consumers: `delegation/bitstring.ts` (+ `statuslist-manager.ts`) and
8
+ * `card/revocation.ts` — previously each carried its own copy of exactly this
9
+ * knowledge, with the drift risk the source comments could only pledge away.
10
+ * The seams' POLICIES stay where they are (the delegation path throws and the
11
+ * caller maps to `status_unresolvable`; the card path catches everything into
12
+ * `FAIL_CLOSED` and models freshness) — only the mechanics live here.
13
+ *
14
+ * FAIL-CLOSED throughout: a non-canonical index, an oversized inflation, or
15
+ * an unreadable bit throws rather than reading as "not revoked".
16
+ */
17
+ import { base64urlDecodeToBytes } from './base64.js';
18
+ import { isRecord } from './guards.js';
19
+ /**
20
+ * Hard ceiling on an INFLATED status bitstring (16 MiB ≈ 134M entries — far
21
+ * beyond any herd-privacy list). A fixed cap costs nothing legitimate while
22
+ * stopping a decompression bomb; exceeding it throws (fail-closed).
23
+ */
24
+ export const MAX_STATUS_LIST_BYTES = 16 * 1024 * 1024;
25
+ /**
26
+ * The W3C Bitstring Status List `encodedList` multibase prefix (base64url,
27
+ * no padding). A gzip stream's fixed magic byte (0x1f) makes its base64url
28
+ * start with `H`, never `u`, so a leading `u` is unambiguously the multibase
29
+ * code rather than payload.
30
+ */
31
+ export const MULTIBASE_BASE64URL = 'u';
32
+ /**
33
+ * Parse a decimal `statusListIndex` (a non-negative integer expressed as a
34
+ * string), fail-closed. Canonical decimal ONLY: `Number()` alone would coerce
35
+ * whitespace (`" "` → 0), hex (`"0x2A"` → 42), `"+42"`, and `"1e1"` → 10 —
36
+ * silently reading a DIFFERENT (often clear) bit than the credential names,
37
+ * so a revoked credential could read as live.
38
+ */
39
+ export function parseStatusListIndex(raw) {
40
+ if (!/^[0-9]+$/.test(raw)) {
41
+ throw new Error(`Invalid statusListIndex "${raw}" — must be a canonical non-negative decimal`);
42
+ }
43
+ const index = Number(raw);
44
+ if (!Number.isSafeInteger(index)) {
45
+ throw new Error(`statusListIndex "${raw}" exceeds the safe integer range`);
46
+ }
47
+ return index;
48
+ }
49
+ /**
50
+ * Decode a status-list `encodedList` to the raw bitstring: strip the optional
51
+ * multibase `u` prefix, base64url-decode, run the injected decompressor, and
52
+ * re-check the {@link MAX_STATUS_LIST_BYTES} cap POST-inflation as a backstop
53
+ * (a production decompressor SHOULD also bound output during inflation).
54
+ * The decompressor is the bare-function common denominator — an
55
+ * object-shaped `DecompressionFunction` adapts inline:
56
+ * `(b) => decompressor.decompress(b)`.
57
+ */
58
+ export async function decodeStatusListPayload(encodedList, decompress) {
59
+ const payload = encodedList[0] === MULTIBASE_BASE64URL ? encodedList.slice(1) : encodedList;
60
+ const inflated = await decompress(base64urlDecodeToBytes(payload));
61
+ if (inflated.length > MAX_STATUS_LIST_BYTES) {
62
+ throw new Error(`Status list too large: ${inflated.length} bytes exceeds ${MAX_STATUS_LIST_BYTES}`);
63
+ }
64
+ return inflated instanceof Uint8Array ? inflated : new Uint8Array(inflated);
65
+ }
66
+ /**
67
+ * Read the status bit at `index` — MSB-first within each byte (W3C Bitstring
68
+ * encoding). Uses FULL-PRECISION arithmetic (`Math.floor(index / 8)`) rather
69
+ * than 32-bit bitwise ops, which coerce to uint32 first: an index ≥ 2^32
70
+ * would silently wrap onto a low byte and read the WRONG — often clear — bit,
71
+ * turning an out-of-range index that MUST fail-closed into a fail-OPEN "not
72
+ * revoked". NaN/negative/fractional/out-of-buffer indexes throw.
73
+ */
74
+ export function readStatusBit(bits, index) {
75
+ const byte = Number.isInteger(index) && index >= 0
76
+ ? bits[Math.floor(index / 8)]
77
+ : undefined;
78
+ if (byte === undefined) {
79
+ throw new Error(`Bit index ${index} out of range for the status list`);
80
+ }
81
+ return (byte & (0x80 >> index % 8)) !== 0;
82
+ }
83
+ /**
84
+ * Assert a status-list credential is fit to ANCHOR (publish) — signed, and
85
+ * actually carrying a bitstring. Method-agnostic on purpose: the cheqd DLR
86
+ * publisher enforces it today; any future anchoring integration (another
87
+ * DLR-bearing DID method, a different chain) imports the same guard rather
88
+ * than re-deriving "what makes a status list publishable". An unsigned or
89
+ * bitstring-less list anchored on-chain would be an unverifiable — and
90
+ * therefore fail-closed-unusable — revocation source for every holder.
91
+ */
92
+ export function assertAnchorableStatusListCredential(content) {
93
+ if (!isRecord(content)) {
94
+ throw new Error('Status list credential must be an object');
95
+ }
96
+ if (!content.proof) {
97
+ throw new Error('Refusing to publish an UNSIGNED status list credential');
98
+ }
99
+ const subject = content.credentialSubject;
100
+ if (!isRecord(subject) ||
101
+ typeof subject.encodedList !== 'string' ||
102
+ subject.encodedList.length === 0) {
103
+ throw new Error('Status list credential is missing credentialSubject.encodedList');
104
+ }
105
+ }
106
+ //# sourceMappingURL=statuslist-bits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statuslist-bits.js","sourceRoot":"","sources":["../../src/utils/statuslist-bits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,C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,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QAC7B,CAAC,CAAC,SAAS,CAAC;IACd,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CACb,aAAa,KAAK,mCAAmC,CACtD,CAAC;IACJ,CAAC;IACD,OAAO,CAAC,IAAI,GAAG,CAAC,IAAI,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAC5C,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,oCAAoC,CAAC,OAAgB;IACnE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IACD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAC5E,CAAC;IACD,MAAM,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAC1C,IACE,CAAC,QAAQ,CAAC,OAAO,CAAC;QAClB,OAAO,OAAO,CAAC,WAAW,KAAK,QAAQ;QACvC,OAAO,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,EAChC,CAAC;QACD,MAAM,IAAI,KAAK,CACb,iEAAiE,CAClE,CAAC;IACJ,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kya-os/mcp",
3
- "version": "1.13.0",
3
+ "version": "1.14.0",
4
4
  "description": "Reference implementation of the KYA-OS protocol for Model Context Protocol servers: identity, delegation, proofs, sessions, and verifiable audit trails",
5
5
  "license": "MIT",
6
6
  "type": "module",