@kya-os/mcp 1.18.0 → 1.21.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.
- package/CHANGELOG.md +377 -0
- package/CONFORMANCE.md +10 -4
- package/README.md +58 -1
- package/SPEC.md +37 -3
- package/dist/card/cimd.js +6 -2
- package/dist/card/cimd.js.map +1 -1
- package/dist/card/index.d.ts +1 -0
- package/dist/card/index.js +1 -0
- package/dist/card/index.js.map +1 -1
- package/dist/card/revocation.d.ts +21 -10
- package/dist/card/revocation.js +12 -16
- package/dist/card/revocation.js.map +1 -1
- package/dist/card/status-list-proof.d.ts +32 -0
- package/dist/card/status-list-proof.js +102 -0
- package/dist/card/status-list-proof.js.map +1 -0
- package/dist/delegation/bitstring.d.ts +41 -6
- package/dist/delegation/bitstring.js +36 -21
- package/dist/delegation/bitstring.js.map +1 -1
- package/dist/delegation/index.d.ts +1 -0
- package/dist/delegation/index.js +1 -0
- package/dist/delegation/index.js.map +1 -1
- package/dist/delegation/statuslist-manager.d.ts +20 -4
- package/dist/delegation/statuslist-manager.js +16 -0
- package/dist/delegation/statuslist-manager.js.map +1 -1
- package/dist/delegation/verification-method-key.d.ts +4 -1
- package/dist/delegation/verification-method-key.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/middleware/index.d.ts +3 -1
- package/dist/middleware/index.js +2 -0
- package/dist/middleware/index.js.map +1 -1
- package/dist/middleware/kya-os-transport.d.ts +43 -12
- package/dist/middleware/kya-os-transport.js +151 -28
- package/dist/middleware/kya-os-transport.js.map +1 -1
- package/dist/middleware/mcp-tool-callback.d.ts +48 -0
- package/dist/middleware/mcp-tool-callback.js +38 -0
- package/dist/middleware/mcp-tool-callback.js.map +1 -0
- package/dist/middleware/serve-in-process.d.ts +41 -0
- package/dist/middleware/serve-in-process.js +86 -0
- package/dist/middleware/serve-in-process.js.map +1 -0
- package/dist/middleware/with-kya-os-server.d.ts +14 -3
- package/dist/middleware/with-kya-os-server.js +4 -1
- package/dist/middleware/with-kya-os-server.js.map +1 -1
- package/dist/middleware/with-kya-os.config-types.d.ts +24 -0
- package/dist/middleware/with-kya-os.d.ts +4 -0
- package/dist/middleware/with-kya-os.delegation-gate.d.ts +2 -1
- package/dist/middleware/with-kya-os.delegation-gate.js +12 -18
- package/dist/middleware/with-kya-os.delegation-gate.js.map +1 -1
- package/dist/middleware/with-kya-os.delegation-verify.d.ts +7 -12
- package/dist/middleware/with-kya-os.delegation-verify.js +37 -9
- package/dist/middleware/with-kya-os.delegation-verify.js.map +1 -1
- package/dist/middleware/with-kya-os.deps.d.ts +15 -4
- package/dist/middleware/with-kya-os.helpers.d.ts +5 -0
- package/dist/middleware/with-kya-os.helpers.js +13 -0
- package/dist/middleware/with-kya-os.helpers.js.map +1 -1
- package/dist/middleware/with-kya-os.js +23 -0
- package/dist/middleware/with-kya-os.js.map +1 -1
- package/dist/middleware/with-kya-os.outcome.d.ts +18 -0
- package/dist/middleware/with-kya-os.outcome.js +36 -0
- package/dist/middleware/with-kya-os.outcome.js.map +1 -0
- package/dist/middleware/with-kya-os.policy-gate.d.ts +2 -1
- package/dist/middleware/with-kya-os.policy-gate.js +2 -1
- package/dist/middleware/with-kya-os.policy-gate.js.map +1 -1
- package/dist/middleware/with-kya-os.session.d.ts +76 -10
- package/dist/middleware/with-kya-os.session.js +739 -164
- package/dist/middleware/with-kya-os.session.js.map +1 -1
- package/dist/middleware/with-kya-os.types.d.ts +102 -8
- package/dist/proof/generator.d.ts +13 -0
- package/dist/proof/generator.js +15 -0
- package/dist/proof/generator.js.map +1 -1
- package/dist/proof/verifier.js +14 -9
- package/dist/proof/verifier.js.map +1 -1
- package/dist/utils/statuslist-bits.d.ts +15 -0
- package/dist/utils/statuslist-bits.js +44 -6
- package/dist/utils/statuslist-bits.js.map +1 -1
- package/dist/utils/statuslist-gzip.d.ts +18 -0
- package/dist/utils/statuslist-gzip.js +45 -0
- package/dist/utils/statuslist-gzip.js.map +1 -0
- package/package.json +3 -1
package/dist/card/index.d.ts
CHANGED
|
@@ -39,4 +39,5 @@ export * from './delegation.js';
|
|
|
39
39
|
export * from './builder.js';
|
|
40
40
|
export * from './middleware.js';
|
|
41
41
|
export * from './revocation.js';
|
|
42
|
+
export * from './status-list-proof.js';
|
|
42
43
|
export { createSafeFetch, fetchTransport, isBlockedAddress, type SafeFetch, type SafeFetchOptions, type SafeFetchResponse, type SafeFetchTransport, type TransportInit, type DnsLookup, type DnsAddress, } from '../utils/safe-fetch.js';
|
package/dist/card/index.js
CHANGED
|
@@ -39,6 +39,7 @@ export * from './delegation.js';
|
|
|
39
39
|
export * from './builder.js';
|
|
40
40
|
export * from './middleware.js';
|
|
41
41
|
export * from './revocation.js';
|
|
42
|
+
export * from './status-list-proof.js';
|
|
42
43
|
// The SSRF-hardened fetch is the card's production wiring for resolveCard / status-list
|
|
43
44
|
// resolution — export it (and the address classifier) so consumers can actually reach it,
|
|
44
45
|
// not just the mocked-transport unit tests.
|
package/dist/card/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/card/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/card/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AAEvC,wFAAwF;AACxF,0FAA0F;AAC1F,4CAA4C;AAC5C,OAAO,EACL,eAAe,EACf,cAAc,EACd,gBAAgB,GAQjB,MAAM,wBAAwB,CAAC"}
|
|
@@ -10,11 +10,13 @@
|
|
|
10
10
|
*
|
|
11
11
|
* `createRevocationChecker` is the DEFAULT implementation over W3C Bitstring Status List v1.0
|
|
12
12
|
* (`BitstringStatusListEntry` — the StatusList2021 SUCCESSOR). It resolves the entry's
|
|
13
|
-
* `statusListCredential` through the injected, SSRF-hardened {@link SafeFetch} seam,
|
|
14
|
-
*
|
|
13
|
+
* `statusListCredential` through the injected, SSRF-hardened {@link SafeFetch} seam, checks the
|
|
14
|
+
* list's proof through the injected `verifyStatusList` seam when one is given, inflates the
|
|
15
|
+
* multibase / GZIP `encodedList` bitstring, and reads the bit at `statusListIndex`.
|
|
15
16
|
*
|
|
16
|
-
* FAIL-CLOSED is the invariant: an unreachable status list, a malformed credential, a
|
|
17
|
-
* mismatched `statusPurpose`, or an out-of-range index all resolve to
|
|
17
|
+
* FAIL-CLOSED is the invariant: an unreachable status list, a malformed credential, a list whose
|
|
18
|
+
* proof is rejected, a mismatched `statusPurpose`, or an out-of-range index all resolve to
|
|
19
|
+
* `{ revoked: true }` —
|
|
18
20
|
* the absence of proof-of-liveness is treated as revoked, never as "probably fine".
|
|
19
21
|
*
|
|
20
22
|
* Each verdict also reports `fresh`: `true` only when read from a LIVE, in-validity-window
|
|
@@ -27,6 +29,7 @@
|
|
|
27
29
|
*/
|
|
28
30
|
import type { SafeFetch } from '../utils/safe-fetch.js';
|
|
29
31
|
import type { BitstringStatusListEntry } from './schema.js';
|
|
32
|
+
import type { StatusListProofVerifier } from './status-list-proof.js';
|
|
30
33
|
/** The `statusPurpose` this checker evaluates by default (revocation, not suspension). */
|
|
31
34
|
export declare const STATUS_PURPOSE_REVOCATION = "revocation";
|
|
32
35
|
/**
|
|
@@ -73,12 +76,20 @@ export interface RevocationCheckerDeps {
|
|
|
73
76
|
/** `statusPurpose` to honour; default {@link STATUS_PURPOSE_REVOCATION}. */
|
|
74
77
|
statusPurpose?: string;
|
|
75
78
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
|
|
79
|
+
* Checks the fetched status-list credential's proof before any bit is read, as W3C Bitstring
|
|
80
|
+
* Status List v1.0 requires (SPEC.md §6.10). A list it rejects (`false` or a throw) resolves
|
|
81
|
+
* {@link FAIL_CLOSED}. {@link createStatusListProofVerifier} covers `eddsa-jcs-2022` lists.
|
|
82
|
+
* Without it the bits are read unchecked, so whoever serves the list can clear a revocation;
|
|
83
|
+
* it stays optional until 2.0 only so existing callers keep working.
|
|
84
|
+
*/
|
|
85
|
+
verifyStatusList?: StatusListProofVerifier;
|
|
86
|
+
/**
|
|
87
|
+
* Injectable GZIP inflation seam ({@link Decompress}). DEFAULT = `statusListGzipCodec.decompress`,
|
|
88
|
+
* which loads `node:zlib` on first use and bounds inflation to the 16 MiB cap (so a decompression
|
|
89
|
+
* bomb THROWS mid-inflation ⇒ fail-closed, never allocating the whole payload). Non-Node
|
|
90
|
+
* runtimes inject a `DecompressionStream`-based impl; when they do, `node:zlib` is never loaded.
|
|
91
|
+
* An injected impl SHOULD bound its own output — {@link decodeStatusList} still applies the cap
|
|
92
|
+
* as a post-inflation backstop regardless.
|
|
82
93
|
*/
|
|
83
94
|
decompress?: Decompress;
|
|
84
95
|
}
|
package/dist/card/revocation.js
CHANGED
|
@@ -10,11 +10,13 @@
|
|
|
10
10
|
*
|
|
11
11
|
* `createRevocationChecker` is the DEFAULT implementation over W3C Bitstring Status List v1.0
|
|
12
12
|
* (`BitstringStatusListEntry` — the StatusList2021 SUCCESSOR). It resolves the entry's
|
|
13
|
-
* `statusListCredential` through the injected, SSRF-hardened {@link SafeFetch} seam,
|
|
14
|
-
*
|
|
13
|
+
* `statusListCredential` through the injected, SSRF-hardened {@link SafeFetch} seam, checks the
|
|
14
|
+
* list's proof through the injected `verifyStatusList` seam when one is given, inflates the
|
|
15
|
+
* multibase / GZIP `encodedList` bitstring, and reads the bit at `statusListIndex`.
|
|
15
16
|
*
|
|
16
|
-
* FAIL-CLOSED is the invariant: an unreachable status list, a malformed credential, a
|
|
17
|
-
* mismatched `statusPurpose`, or an out-of-range index all resolve to
|
|
17
|
+
* FAIL-CLOSED is the invariant: an unreachable status list, a malformed credential, a list whose
|
|
18
|
+
* proof is rejected, a mismatched `statusPurpose`, or an out-of-range index all resolve to
|
|
19
|
+
* `{ revoked: true }` —
|
|
18
20
|
* the absence of proof-of-liveness is treated as revoked, never as "probably fine".
|
|
19
21
|
*
|
|
20
22
|
* Each verdict also reports `fresh`: `true` only when read from a LIVE, in-validity-window
|
|
@@ -27,7 +29,8 @@
|
|
|
27
29
|
*/
|
|
28
30
|
import { isRecord } from '../utils/guards.js';
|
|
29
31
|
import { assertStatusPurpose } from '../utils/statuslist-purpose.js';
|
|
30
|
-
import {
|
|
32
|
+
import { decodeStatusListPayload, parseStatusListIndex, readStatusBit, } from '../utils/statuslist-bits.js';
|
|
33
|
+
import { statusListGzipCodec } from '../utils/statuslist-gzip.js';
|
|
31
34
|
/** The `statusPurpose` this checker evaluates by default (revocation, not suspension). */
|
|
32
35
|
export const STATUS_PURPOSE_REVOCATION = 'revocation';
|
|
33
36
|
/** Fail-closed verdict: status indeterminate ⇒ treat as revoked AND not fresh. */
|
|
@@ -40,10 +43,13 @@ const FAIL_CLOSED = { revoked: true, fresh: false };
|
|
|
40
43
|
export function createRevocationChecker(deps) {
|
|
41
44
|
const clock = deps.now ?? (() => Date.now());
|
|
42
45
|
const wantedPurpose = deps.statusPurpose ?? STATUS_PURPOSE_REVOCATION;
|
|
43
|
-
const decompress = deps.decompress ??
|
|
46
|
+
const decompress = deps.decompress ?? statusListGzipCodec.decompress;
|
|
44
47
|
return async function check(entry) {
|
|
45
48
|
try {
|
|
46
49
|
const credential = await fetchStatusList(entry.statusListCredential, deps.fetch);
|
|
50
|
+
if (deps.verifyStatusList && (await deps.verifyStatusList(credential)) !== true) {
|
|
51
|
+
throw new Error('revocation: status-list proof rejected');
|
|
52
|
+
}
|
|
47
53
|
assertStatusPurpose(statusListSubject(credential).statusPurpose, wantedPurpose);
|
|
48
54
|
const bits = await decodeStatusList(credential, decompress);
|
|
49
55
|
const revoked = readStatusBit(bits, parseStatusListIndex(entry.statusListIndex));
|
|
@@ -100,16 +106,6 @@ function statusListSubject(credential) {
|
|
|
100
106
|
throw new Error('revocation: status-list has no credentialSubject');
|
|
101
107
|
return subject;
|
|
102
108
|
}
|
|
103
|
-
/**
|
|
104
|
-
* DEFAULT {@link Decompress}: `node:zlib` `gunzipSync` bounded to {@link MAX_STATUS_LIST_BYTES}
|
|
105
|
-
* so an oversized inflation THROWS mid-stream (fail-closed) instead of allocating the whole bomb.
|
|
106
|
-
* Pulled in via a DYNAMIC `import('node:zlib')` — only when no `decompress` was injected — so a
|
|
107
|
-
* Workers / Deno / browser bundle that supplies its own seam keeps `node:zlib` out of the graph.
|
|
108
|
-
*/
|
|
109
|
-
async function defaultNodeGunzip(bytes) {
|
|
110
|
-
const { gunzipSync } = await import('node:zlib');
|
|
111
|
-
return new Uint8Array(gunzipSync(bytes, { maxOutputLength: MAX_STATUS_LIST_BYTES }));
|
|
112
|
-
}
|
|
113
109
|
/**
|
|
114
110
|
* Inflate the multibase / GZIP `encodedList` into the raw status bitstring bytes via the shared
|
|
115
111
|
* `decodeStatusListPayload` primitive (strip + decode + POST-inflation 16 MiB backstop): the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revocation.js","sourceRoot":"","sources":["../../src/card/revocation.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"revocation.js","sourceRoot":"","sources":["../../src/card/revocation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,aAAa,GACd,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAKlE,0FAA0F;AAC1F,MAAM,CAAC,MAAM,yBAAyB,GAAG,YAAY,CAAC;AA6EtD,kFAAkF;AAClF,MAAM,WAAW,GAAqB,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAEtE;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CACrC,IAA2B;IAE3B,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IAC7C,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,IAAI,yBAAyB,CAAC;IACtE,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,mBAAmB,CAAC,UAAU,CAAC;IACrE,OAAO,KAAK,UAAU,KAAK,CAAC,KAA+B;QACzD,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,MAAM,eAAe,CAAC,KAAK,CAAC,oBAAoB,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;YACjF,IAAI,IAAI,CAAC,gBAAgB,IAAI,CAAC,MAAM,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;gBAChF,MAAM,IAAI,KAAK,CAA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,CAAC,SAAS,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;IACzF,IAAI,UAAU,KAAK,IAAI,IAAI,SAAS,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC,CAAC,qCAAqC;IAClG,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,GAAG,KAAK;QAAE,OAAO,KAAK,CAAC,CAAC,+BAA+B;IACjG,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,GAAG,KAAK;QAAE,OAAO,KAAK,CAAC,CAAC,gBAAgB;IAChF,OAAO,IAAI,CAAC;AACd,CAAC;AAED,sFAAsF;AACtF,SAAS,YAAY,CAAC,OAAgB,EAAE,MAAe;IACrD,OAAO,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;AAClD,CAAC;AAED,wGAAwG;AACxG,SAAS,SAAS,CAAC,KAAc;IAC/B,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC1C,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC3C,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC7B,OAAO,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KYA-OS Entity Card — status-list PROOF check (W3C Data Integrity, `eddsa-jcs-2022`).
|
|
3
|
+
*
|
|
4
|
+
* W3C Bitstring Status List v1.0 has a verifier check every proof on the status-list credential
|
|
5
|
+
* before it reads a bit: the list is what says a credential is revoked, so a list nobody verified
|
|
6
|
+
* lets whoever serves it clear a revocation. {@link createRevocationChecker} takes that check as
|
|
7
|
+
* its `verifyStatusList` seam, the way the rest of the card layer takes credential proofs, and
|
|
8
|
+
* {@link createStatusListProofVerifier} is a ready implementation for lists signed with
|
|
9
|
+
* `DataIntegrityProof` / `eddsa-jcs-2022` by an Ed25519 key in the list issuer's DID document.
|
|
10
|
+
*
|
|
11
|
+
* The construction is the cryptosuite's, step for step: the proof options without `proofValue`,
|
|
12
|
+
* carrying the document's `@context`, and the document without `proof`, each RFC 8785-canonicalized
|
|
13
|
+
* and SHA-256 hashed; the signature is Ed25519 over the two hashes concatenated, `proofValue` is
|
|
14
|
+
* base58btc multibase. The key is the issuer's verification method `proof.verificationMethod`
|
|
15
|
+
* names, and that method must belong to the list's `issuer`. Every failure returns `false`.
|
|
16
|
+
*/
|
|
17
|
+
import type { DIDResolver } from '../delegation/vc-verifier.types.js';
|
|
18
|
+
/**
|
|
19
|
+
* Checks a fetched status-list credential's proof. Resolves `true` only when the proof verifies;
|
|
20
|
+
* `false` or a throw rejects the list, and the revocation checker then fails closed.
|
|
21
|
+
*/
|
|
22
|
+
export type StatusListProofVerifier = (credential: Record<string, unknown>) => boolean | Promise<boolean>;
|
|
23
|
+
/** Dependencies for {@link createStatusListProofVerifier}. */
|
|
24
|
+
export interface StatusListProofVerifierDeps {
|
|
25
|
+
/** Resolves the list issuer's DID document, e.g. `createDidWebResolver` or `createDidKeyResolver`. */
|
|
26
|
+
didResolver: DIDResolver;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Build a {@link StatusListProofVerifier} for `DataIntegrityProof` / `eddsa-jcs-2022` status lists.
|
|
30
|
+
* Pass it to {@link createRevocationChecker} as `verifyStatusList`.
|
|
31
|
+
*/
|
|
32
|
+
export declare function createStatusListProofVerifier(deps: StatusListProofVerifierDeps): StatusListProofVerifier;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KYA-OS Entity Card — status-list PROOF check (W3C Data Integrity, `eddsa-jcs-2022`).
|
|
3
|
+
*
|
|
4
|
+
* W3C Bitstring Status List v1.0 has a verifier check every proof on the status-list credential
|
|
5
|
+
* before it reads a bit: the list is what says a credential is revoked, so a list nobody verified
|
|
6
|
+
* lets whoever serves it clear a revocation. {@link createRevocationChecker} takes that check as
|
|
7
|
+
* its `verifyStatusList` seam, the way the rest of the card layer takes credential proofs, and
|
|
8
|
+
* {@link createStatusListProofVerifier} is a ready implementation for lists signed with
|
|
9
|
+
* `DataIntegrityProof` / `eddsa-jcs-2022` by an Ed25519 key in the list issuer's DID document.
|
|
10
|
+
*
|
|
11
|
+
* The construction is the cryptosuite's, step for step: the proof options without `proofValue`,
|
|
12
|
+
* carrying the document's `@context`, and the document without `proof`, each RFC 8785-canonicalized
|
|
13
|
+
* and SHA-256 hashed; the signature is Ed25519 over the two hashes concatenated, `proofValue` is
|
|
14
|
+
* base58btc multibase. The key is the issuer's verification method `proof.verificationMethod`
|
|
15
|
+
* names, and that method must belong to the list's `issuer`. Every failure returns `false`.
|
|
16
|
+
*/
|
|
17
|
+
import { canonicalize } from 'json-canonicalize';
|
|
18
|
+
import { isRecord } from '../utils/guards.js';
|
|
19
|
+
import { base58Decode } from '../utils/base58.js';
|
|
20
|
+
import { verificationMethodJwk } from '../delegation/verification-method-key.js';
|
|
21
|
+
import { ed25519VerifyRaw, sha256 } from './proof/canonical.js';
|
|
22
|
+
const ED25519_SIGNATURE_LENGTH = 64;
|
|
23
|
+
/** A 64-byte signature is at most 88 base58 characters; bound the decode before it runs. */
|
|
24
|
+
const MAX_PROOF_VALUE_BASE58 = 100;
|
|
25
|
+
/**
|
|
26
|
+
* Build a {@link StatusListProofVerifier} for `DataIntegrityProof` / `eddsa-jcs-2022` status lists.
|
|
27
|
+
* Pass it to {@link createRevocationChecker} as `verifyStatusList`.
|
|
28
|
+
*/
|
|
29
|
+
export function createStatusListProofVerifier(deps) {
|
|
30
|
+
return async function verifyStatusList(credential) {
|
|
31
|
+
try {
|
|
32
|
+
return await verifyEddsaJcs2022(credential, deps.didResolver);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
async function verifyEddsaJcs2022(document, didResolver) {
|
|
40
|
+
const proof = document.proof;
|
|
41
|
+
// One proof object: a proof set or chain is not a shape this check reads.
|
|
42
|
+
if (!isRecord(proof))
|
|
43
|
+
return false;
|
|
44
|
+
if (proof.type !== 'DataIntegrityProof' || proof.cryptosuite !== 'eddsa-jcs-2022')
|
|
45
|
+
return false;
|
|
46
|
+
if (proof.proofPurpose !== 'assertionMethod')
|
|
47
|
+
return false;
|
|
48
|
+
const { proofValue, verificationMethod } = proof;
|
|
49
|
+
if (typeof proofValue !== 'string' || !proofValue.startsWith('z'))
|
|
50
|
+
return false;
|
|
51
|
+
if (typeof verificationMethod !== 'string')
|
|
52
|
+
return false;
|
|
53
|
+
const issuer = issuerOf(document);
|
|
54
|
+
const did = verificationMethod.split('#')[0];
|
|
55
|
+
if (issuer === undefined || did !== issuer)
|
|
56
|
+
return false;
|
|
57
|
+
const signature = base58Decode(proofValue.slice(1), MAX_PROOF_VALUE_BASE58);
|
|
58
|
+
if (signature.length !== ED25519_SIGNATURE_LENGTH)
|
|
59
|
+
return false;
|
|
60
|
+
const didDocument = await didResolver.resolve(did);
|
|
61
|
+
const method = didDocument?.verificationMethod?.find((vm) => methodId(vm, did) === verificationMethod);
|
|
62
|
+
const jwk = method ? verificationMethodJwk(method) : undefined;
|
|
63
|
+
if (!jwk || jwk.kty !== 'OKP' || jwk.crv !== 'Ed25519')
|
|
64
|
+
return false;
|
|
65
|
+
const unsecured = { ...document };
|
|
66
|
+
delete unsecured.proof;
|
|
67
|
+
const options = { ...proof };
|
|
68
|
+
delete options.proofValue;
|
|
69
|
+
if (options['@context'] !== undefined) {
|
|
70
|
+
// The proof may name its own @context only as a prefix of the document's.
|
|
71
|
+
if (!startsWith(contexts(document['@context']), contexts(options['@context'])))
|
|
72
|
+
return false;
|
|
73
|
+
unsecured['@context'] = options['@context'];
|
|
74
|
+
}
|
|
75
|
+
if (unsecured['@context'] !== undefined)
|
|
76
|
+
options['@context'] = unsecured['@context'];
|
|
77
|
+
const encoder = new TextEncoder();
|
|
78
|
+
const proofHash = await sha256(encoder.encode(canonicalize(options)));
|
|
79
|
+
const documentHash = await sha256(encoder.encode(canonicalize(unsecured)));
|
|
80
|
+
const hashData = new Uint8Array(proofHash.length + documentHash.length);
|
|
81
|
+
hashData.set(proofHash, 0);
|
|
82
|
+
hashData.set(documentHash, proofHash.length);
|
|
83
|
+
return ed25519VerifyRaw(jwk, signature, hashData);
|
|
84
|
+
}
|
|
85
|
+
/** The credential's `issuer` DID, whether a bare string or an `{ id }` object. */
|
|
86
|
+
function issuerOf(document) {
|
|
87
|
+
const issuer = document.issuer;
|
|
88
|
+
if (typeof issuer === 'string')
|
|
89
|
+
return issuer;
|
|
90
|
+
return isRecord(issuer) && typeof issuer.id === 'string' ? issuer.id : undefined;
|
|
91
|
+
}
|
|
92
|
+
/** A verification method's absolute id: DID documents may write it relative (`#key-1`). */
|
|
93
|
+
function methodId(method, did) {
|
|
94
|
+
return method.id.startsWith('#') ? `${did}${method.id}` : method.id;
|
|
95
|
+
}
|
|
96
|
+
function contexts(value) {
|
|
97
|
+
return Array.isArray(value) ? value : value === undefined ? [] : [value];
|
|
98
|
+
}
|
|
99
|
+
function startsWith(whole, prefix) {
|
|
100
|
+
return prefix.length <= whole.length && prefix.every((entry, i) => canonicalize(entry) === canonicalize(whole[i]));
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=status-list-proof.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-list-proof.js","sourceRoot":"","sources":["../../src/card/status-list-proof.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,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AK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAC3E,CAAC;AAED,SAAS,UAAU,CAAC,KAAgB,EAAE,MAAiB;IACrD,OAAO,MAAM,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrH,CAAC"}
|
|
@@ -13,9 +13,20 @@
|
|
|
13
13
|
*
|
|
14
14
|
* Related Spec: W3C Bitstring Status List v1.0 (successor to StatusList2021)
|
|
15
15
|
*/
|
|
16
|
+
/**
|
|
17
|
+
* Compresses a status bitstring for publication. MUST produce GZIP: it is the
|
|
18
|
+
* only compression a status-list reader accepts, and `encode()` throws on
|
|
19
|
+
* anything else. {@link statusListGzipCodec} is the shipped implementation
|
|
20
|
+
* and the default.
|
|
21
|
+
*/
|
|
16
22
|
export interface CompressionFunction {
|
|
17
23
|
compress(data: Uint8Array): Promise<Uint8Array>;
|
|
18
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Inflates a GZIP status-list payload. MUST reject input that is not GZIP;
|
|
27
|
+
* a decoder throws when it returns its input unchanged. {@link statusListGzipCodec}
|
|
28
|
+
* is the shipped implementation and the default.
|
|
29
|
+
*/
|
|
19
30
|
export interface DecompressionFunction {
|
|
20
31
|
decompress(data: Uint8Array): Promise<Uint8Array>;
|
|
21
32
|
}
|
|
@@ -23,22 +34,46 @@ export declare class BitstringManager {
|
|
|
23
34
|
private compressor;
|
|
24
35
|
private bits;
|
|
25
36
|
private size;
|
|
26
|
-
|
|
37
|
+
/**
|
|
38
|
+
* @param compressor - GZIP-compresses the bitstring on `encode()`. Defaults
|
|
39
|
+
* to {@link statusListGzipCodec}; `encode()` throws on output that is not GZIP.
|
|
40
|
+
* @param _decompressor - Accepted for signature symmetry with `decode()` and
|
|
41
|
+
* `fromSetBits()`, and for back-compat. The instance never decompresses:
|
|
42
|
+
* `decode()` inflates before construction, so nothing is stored.
|
|
43
|
+
*/
|
|
44
|
+
constructor(size: number, compressor?: CompressionFunction, _decompressor?: DecompressionFunction);
|
|
27
45
|
setBit(index: number, value: boolean): void;
|
|
28
46
|
getBit(index: number): boolean;
|
|
29
47
|
getSetBits(): number[];
|
|
30
48
|
encode(): Promise<string>;
|
|
31
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Decode an `encodedList` into a manager.
|
|
51
|
+
*
|
|
52
|
+
* @param compressor - Used by the returned manager's `encode()`. Defaults to
|
|
53
|
+
* {@link statusListGzipCodec}.
|
|
54
|
+
* @param decompressor - Inflates the GZIP payload. Defaults to
|
|
55
|
+
* {@link statusListGzipCodec}; decoding throws on a payload that is not
|
|
56
|
+
* GZIP and on a decompressor that returns its input unchanged.
|
|
57
|
+
*/
|
|
58
|
+
static decode(encodedList: string, compressor?: CompressionFunction, decompressor?: DecompressionFunction): Promise<BitstringManager>;
|
|
32
59
|
getRawBits(): Uint8Array;
|
|
33
60
|
getSize(): number;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
61
|
+
/**
|
|
62
|
+
* A manager of `size` entries with `setBits` set.
|
|
63
|
+
*
|
|
64
|
+
* @param compressor - Used by `encode()`. Defaults to {@link statusListGzipCodec}.
|
|
65
|
+
* @param decompressor - Accepted for symmetry with `decode()`; unused.
|
|
66
|
+
*/
|
|
67
|
+
static fromSetBits(size: number, setBits: number[], compressor?: CompressionFunction, decompressor?: DecompressionFunction): BitstringManager;
|
|
37
68
|
}
|
|
38
69
|
/**
|
|
39
70
|
* Read one status bit straight off an `encodedList` (decode + bounded inflate +
|
|
40
71
|
* MSB-first read via `utils/statuslist-bits`). Fail-CLOSED: an out-of-range or
|
|
41
72
|
* NaN index cannot be proven clear, so `readStatusBit` throws rather than
|
|
42
73
|
* reading as "not set".
|
|
74
|
+
*
|
|
75
|
+
* @param decompressor - Inflates the GZIP payload. Defaults to
|
|
76
|
+
* {@link statusListGzipCodec}; reading throws on a payload that is not GZIP
|
|
77
|
+
* and on a decompressor that returns its input unchanged.
|
|
43
78
|
*/
|
|
44
|
-
export declare function isIndexSet(encodedList: string, index: number, decompressor
|
|
79
|
+
export declare function isIndexSet(encodedList: string, index: number, decompressor?: DecompressionFunction): Promise<boolean>;
|
|
@@ -13,16 +13,24 @@
|
|
|
13
13
|
*
|
|
14
14
|
* Related Spec: W3C Bitstring Status List v1.0 (successor to StatusList2021)
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
16
|
+
import { decodeStatusListPayload, encodeStatusListPayload, readStatusBit, } from '../utils/statuslist-bits.js';
|
|
17
|
+
import { statusListGzipCodec } from '../utils/statuslist-gzip.js';
|
|
18
|
+
/** Inflate an `encodedList` to its raw bitstring, with the shipped GZIP codec by default. */
|
|
19
|
+
function inflate(encodedList, decompressor = statusListGzipCodec) {
|
|
20
|
+
return decodeStatusListPayload(encodedList, (bytes) => decompressor.decompress(bytes));
|
|
21
|
+
}
|
|
17
22
|
export class BitstringManager {
|
|
18
23
|
compressor;
|
|
19
24
|
bits;
|
|
20
25
|
size;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
/**
|
|
27
|
+
* @param compressor - GZIP-compresses the bitstring on `encode()`. Defaults
|
|
28
|
+
* to {@link statusListGzipCodec}; `encode()` throws on output that is not GZIP.
|
|
29
|
+
* @param _decompressor - Accepted for signature symmetry with `decode()` and
|
|
30
|
+
* `fromSetBits()`, and for back-compat. The instance never decompresses:
|
|
31
|
+
* `decode()` inflates before construction, so nothing is stored.
|
|
32
|
+
*/
|
|
33
|
+
constructor(size, compressor = statusListGzipCodec, _decompressor) {
|
|
26
34
|
this.compressor = compressor;
|
|
27
35
|
this.size = size;
|
|
28
36
|
const byteCount = Math.ceil(size / 8);
|
|
@@ -63,11 +71,19 @@ export class BitstringManager {
|
|
|
63
71
|
return setBits;
|
|
64
72
|
}
|
|
65
73
|
async encode() {
|
|
66
|
-
|
|
67
|
-
return MULTIBASE_BASE64URL + this.base64urlEncode(compressed);
|
|
74
|
+
return encodeStatusListPayload(this.bits, (bytes) => this.compressor.compress(bytes));
|
|
68
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Decode an `encodedList` into a manager.
|
|
78
|
+
*
|
|
79
|
+
* @param compressor - Used by the returned manager's `encode()`. Defaults to
|
|
80
|
+
* {@link statusListGzipCodec}.
|
|
81
|
+
* @param decompressor - Inflates the GZIP payload. Defaults to
|
|
82
|
+
* {@link statusListGzipCodec}; decoding throws on a payload that is not
|
|
83
|
+
* GZIP and on a decompressor that returns its input unchanged.
|
|
84
|
+
*/
|
|
69
85
|
static async decode(encodedList, compressor, decompressor) {
|
|
70
|
-
const decompressed = await
|
|
86
|
+
const decompressed = await inflate(encodedList, decompressor);
|
|
71
87
|
const size = decompressed.length * 8;
|
|
72
88
|
const manager = new BitstringManager(size, compressor, decompressor);
|
|
73
89
|
manager.bits = decompressed;
|
|
@@ -79,16 +95,12 @@ export class BitstringManager {
|
|
|
79
95
|
getSize() {
|
|
80
96
|
return this.size;
|
|
81
97
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
.map((byte) => String.fromCharCode(byte))
|
|
89
|
-
.join('');
|
|
90
|
-
return btoa(binary);
|
|
91
|
-
}
|
|
98
|
+
/**
|
|
99
|
+
* A manager of `size` entries with `setBits` set.
|
|
100
|
+
*
|
|
101
|
+
* @param compressor - Used by `encode()`. Defaults to {@link statusListGzipCodec}.
|
|
102
|
+
* @param decompressor - Accepted for symmetry with `decode()`; unused.
|
|
103
|
+
*/
|
|
92
104
|
static fromSetBits(size, setBits, compressor, decompressor) {
|
|
93
105
|
const manager = new BitstringManager(size, compressor, decompressor);
|
|
94
106
|
for (const index of setBits) {
|
|
@@ -102,9 +114,12 @@ export class BitstringManager {
|
|
|
102
114
|
* MSB-first read via `utils/statuslist-bits`). Fail-CLOSED: an out-of-range or
|
|
103
115
|
* NaN index cannot be proven clear, so `readStatusBit` throws rather than
|
|
104
116
|
* reading as "not set".
|
|
117
|
+
*
|
|
118
|
+
* @param decompressor - Inflates the GZIP payload. Defaults to
|
|
119
|
+
* {@link statusListGzipCodec}; reading throws on a payload that is not GZIP
|
|
120
|
+
* and on a decompressor that returns its input unchanged.
|
|
105
121
|
*/
|
|
106
122
|
export async function isIndexSet(encodedList, index, decompressor) {
|
|
107
|
-
|
|
108
|
-
return readStatusBit(decompressed, index);
|
|
123
|
+
return readStatusBit(await inflate(encodedList, decompressor), index);
|
|
109
124
|
}
|
|
110
125
|
//# sourceMappingURL=bitstring.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitstring.js","sourceRoot":"","sources":["../../src/delegation/bitstring.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"bitstring.js","sourceRoot":"","sources":["../../src/delegation/bitstring.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,aAAa,GACd,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAqBlE,6FAA6F;AAC7F,SAAS,OAAO,CACd,WAAmB,EACnB,eAAsC,mBAAmB;IAEzD,OAAO,uBAAuB,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;AACzF,CAAC;AAED,MAAM,OAAO,gBAAgB;IAajB;IAZF,IAAI,CAAa;IACjB,IAAI,CAAS;IAErB;;;;;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AC,IAAI,CAAC;IACnB,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,WAAW,CAChB,IAAY,EACZ,OAAiB,EACjB,UAAgC,EAChC,YAAoC;QAEpC,MAAM,OAAO,GAAG,IAAI,gBAAgB,CAAC,IAAI,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;QACrE,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAC9B,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,WAAmB,EACnB,KAAa,EACb,YAAoC;IAEpC,OAAO,aAAa,CAAC,MAAM,OAAO,CAAC,WAAW,EAAE,YAAY,CAAC,EAAE,KAAK,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -10,6 +10,7 @@ export * from './status-cache.js';
|
|
|
10
10
|
export * from './verification-method-key.js';
|
|
11
11
|
export * from './vc-jwt-verify.js';
|
|
12
12
|
export * from './bitstring.js';
|
|
13
|
+
export { statusListGzipCodec } from '../utils/statuslist-gzip.js';
|
|
13
14
|
export * from './statuslist-manager.js';
|
|
14
15
|
export * from './delegation-graph.js';
|
|
15
16
|
export * from './cascading-revocation.js';
|
package/dist/delegation/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export * from './status-cache.js';
|
|
|
10
10
|
export * from './verification-method-key.js';
|
|
11
11
|
export * from './vc-jwt-verify.js';
|
|
12
12
|
export * from './bitstring.js';
|
|
13
|
+
export { statusListGzipCodec } from '../utils/statuslist-gzip.js';
|
|
13
14
|
export * from './statuslist-manager.js';
|
|
14
15
|
export * from './delegation-graph.js';
|
|
15
16
|
export * from './cascading-revocation.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/delegation/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,0BAA0B,EAC1B,cAAc,GACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,QAAQ,EACR,WAAW,EACX,WAAW,EACX,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,gBAAgB,GAGjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/delegation/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,0BAA0B,EAC1B,cAAc,GACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,QAAQ,EACR,WAAW,EACX,WAAW,EACX,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,gBAAgB,GAGjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC"}
|
|
@@ -26,8 +26,8 @@ export declare class StatusList2021Manager {
|
|
|
26
26
|
private storage;
|
|
27
27
|
private identity;
|
|
28
28
|
private signingFunction;
|
|
29
|
-
private compressor
|
|
30
|
-
private decompressor
|
|
29
|
+
private compressor?;
|
|
30
|
+
private decompressor?;
|
|
31
31
|
private statusListBaseUrl;
|
|
32
32
|
private defaultListSize;
|
|
33
33
|
/**
|
|
@@ -36,7 +36,18 @@ export declare class StatusList2021Manager {
|
|
|
36
36
|
* bit with a stale copy.
|
|
37
37
|
*/
|
|
38
38
|
private updateLocks;
|
|
39
|
-
|
|
39
|
+
/**
|
|
40
|
+
* @param compressor - GZIP-compresses the bitstring of every list this
|
|
41
|
+
* manager publishes. Defaults to `statusListGzipCodec` (through
|
|
42
|
+
* {@link BitstringManager}). Status-list readers accept only GZIP, so a
|
|
43
|
+
* list published without it would read as revoked everywhere; publishing
|
|
44
|
+
* throws instead.
|
|
45
|
+
* @param decompressor - Inflates the GZIP lists this manager reads. Defaults
|
|
46
|
+
* to `statusListGzipCodec` (through {@link BitstringManager}). Reading
|
|
47
|
+
* throws on a list that is not GZIP and on a decompressor that returns its
|
|
48
|
+
* input unchanged.
|
|
49
|
+
*/
|
|
50
|
+
constructor(storage: StatusListStorageProvider, identity: StatusListIdentityProvider, signingFunction: VCSigningFunction, compressor?: CompressionFunction | undefined, decompressor?: DecompressionFunction | undefined, options?: {
|
|
40
51
|
statusListBaseUrl?: string;
|
|
41
52
|
defaultListSize?: number;
|
|
42
53
|
});
|
|
@@ -62,7 +73,12 @@ export declare class StatusList2021Manager {
|
|
|
62
73
|
getStatusListBaseUrl(): string;
|
|
63
74
|
getDefaultListSize(): number;
|
|
64
75
|
}
|
|
65
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Build a {@link StatusList2021Manager}. `compressor` and `decompressor`
|
|
78
|
+
* default to `statusListGzipCodec`; when supplied they MUST GZIP and
|
|
79
|
+
* inflate GZIP, as the manager's constructor documents.
|
|
80
|
+
*/
|
|
81
|
+
export declare function createStatusListManager(storage: StatusListStorageProvider, identity: StatusListIdentityProvider, signingFunction: VCSigningFunction, compressor?: CompressionFunction, decompressor?: DecompressionFunction, options?: {
|
|
66
82
|
statusListBaseUrl?: string;
|
|
67
83
|
defaultListSize?: number;
|
|
68
84
|
}): StatusList2021Manager;
|
|
@@ -23,6 +23,17 @@ export class StatusList2021Manager {
|
|
|
23
23
|
* bit with a stale copy.
|
|
24
24
|
*/
|
|
25
25
|
updateLocks = new Map();
|
|
26
|
+
/**
|
|
27
|
+
* @param compressor - GZIP-compresses the bitstring of every list this
|
|
28
|
+
* manager publishes. Defaults to `statusListGzipCodec` (through
|
|
29
|
+
* {@link BitstringManager}). Status-list readers accept only GZIP, so a
|
|
30
|
+
* list published without it would read as revoked everywhere; publishing
|
|
31
|
+
* throws instead.
|
|
32
|
+
* @param decompressor - Inflates the GZIP lists this manager reads. Defaults
|
|
33
|
+
* to `statusListGzipCodec` (through {@link BitstringManager}). Reading
|
|
34
|
+
* throws on a list that is not GZIP and on a decompressor that returns its
|
|
35
|
+
* input unchanged.
|
|
36
|
+
*/
|
|
26
37
|
constructor(storage, identity, signingFunction, compressor, decompressor, options) {
|
|
27
38
|
this.storage = storage;
|
|
28
39
|
this.identity = identity;
|
|
@@ -167,6 +178,11 @@ export class StatusList2021Manager {
|
|
|
167
178
|
return this.defaultListSize;
|
|
168
179
|
}
|
|
169
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* Build a {@link StatusList2021Manager}. `compressor` and `decompressor`
|
|
183
|
+
* default to `statusListGzipCodec`; when supplied they MUST GZIP and
|
|
184
|
+
* inflate GZIP, as the manager's constructor documents.
|
|
185
|
+
*/
|
|
170
186
|
export function createStatusListManager(storage, identity, signingFunction, compressor, decompressor, options) {
|
|
171
187
|
return new StatusList2021Manager(storage, identity, signingFunction, compressor, decompressor, options);
|
|
172
188
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statuslist-manager.js","sourceRoot":"","sources":["../../src/delegation/statuslist-manager.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,EAAE,gBAAgB,EAAwD,MAAM,gBAAgB,CAAC;AACxG,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAsBrE,MAAM,OAAO,qBAAqB;
|
|
1
|
+
{"version":3,"file":"statuslist-manager.js","sourceRoot":"","sources":["../../src/delegation/statuslist-manager.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,EAAE,gBAAgB,EAAwD,MAAM,gBAAgB,CAAC;AACxG,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,mBA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