@openplanr/protocol 0.6.0 → 0.6.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.
- package/lib/dashboard/closed-json-contract.mjs +99 -109
- package/lib/dashboard/operate-experience-audit-display-contract.d.mts +128 -153
- package/lib/dashboard/operate-experience-audit-display-contract.mjs +530 -585
- package/lib/dashboard/operate-experience-display-contract.d.mts +415 -437
- package/lib/dashboard/operate-experience-display-contract.mjs +768 -831
- package/lib/dashboard/operate-experience-surface-contract.d.mts +143 -148
- package/lib/dashboard/operate-experience-surface-contract.mjs +72 -73
- package/lib/dashboard/operate-review-contract.d.mts +7 -14
- package/lib/dashboard/operate-review-contract.mjs +46 -42
- package/lib/dashboard/operate-review-display-workspace-contract.d.mts +2 -5
- package/lib/dashboard/operate-review-display-workspace-contract.mjs +158 -104
- package/lib/dashboard/operate-review-payload-safety.mjs +4 -2
- package/lib/dashboard/operate-review-workspace-projection-v2.d.mts +47 -33
- package/lib/protocol/index.d.ts +2647 -543
- package/package.json +1 -1
- package/registries/commands.json +7 -7
- package/registries/skills.json +6 -6
- package/src/browser-contracts.d.mts +4 -1
- package/src/browser-contracts.mjs +16 -5
- package/src/canonical-json.d.mts +3 -1
- package/src/canonical-json.mjs +57 -20
- package/src/compat/live-evidence-v2.mjs +1604 -485
- package/src/compat/operate-experience-live-patch.mjs +67 -15
- package/src/compat/operating-planning-contracts.mjs +183 -51
- package/src/contracts.d.mts +54 -13
- package/src/contracts.mjs +655 -345
- package/src/design-contracts.mjs +58 -21
- package/src/design-handoff-contracts.d.mts +67 -11
- package/src/design-handoff-contracts.mjs +243 -98
- package/src/design-publication-contracts.mjs +98 -33
- package/src/diagram-authoring-contracts.d.mts +422 -78
- package/src/diagram-authoring-contracts.mjs +1697 -326
- package/src/diagram-contracts.d.mts +4 -1
- package/src/diagram-contracts.mjs +16 -4
- package/src/enterprise-contracts.d.mts +211 -46
- package/src/enterprise-contracts.mjs +727 -175
- package/src/errors.mjs +4 -0
- package/src/generated/canonical-registries.mjs +13 -13
- package/src/index.d.mts +8 -8
- package/src/index.mjs +36 -20
- package/src/json-schema.d.mts +21 -6
- package/src/json-schema.mjs +66 -18
- package/src/planning-contracts.d.mts +8 -2
- package/src/planning-contracts.mjs +33 -7
- package/src/registries.d.mts +11 -3
- package/src/registries.mjs +369 -87
- package/src/review-experience-contracts.d.mts +7 -2
- package/src/review-experience-contracts.mjs +198 -49
- package/src/semver.mjs +5 -1
- package/src/skill-source-contracts.d.mts +36 -16
- package/src/skill-source-contracts.mjs +25 -6
- package/src/task-contracts.d.mts +13 -3
- package/src/task-contracts.mjs +181 -40
- package/src/workspace-contracts.d.mts +38 -10
- package/src/workspace-contracts.mjs +147 -33
package/package.json
CHANGED
package/registries/commands.json
CHANGED
|
@@ -293,7 +293,7 @@
|
|
|
293
293
|
"ownerPackage": "openplanr",
|
|
294
294
|
"source": {
|
|
295
295
|
"path": "packages/cli/src/cli/commands/diagram/index.ts",
|
|
296
|
-
"digest": "sha256:
|
|
296
|
+
"digest": "sha256:67aeefb682ad56cf3429a38bd98c913261cea3dbaeaf5e31ab11d873bce4b02a"
|
|
297
297
|
},
|
|
298
298
|
"authorityClass": "workflow",
|
|
299
299
|
"machineJson": true,
|
|
@@ -377,7 +377,7 @@
|
|
|
377
377
|
"ownerPackage": "openplanr",
|
|
378
378
|
"source": {
|
|
379
379
|
"path": "docs/generated/utility-command-catalog.json",
|
|
380
|
-
"digest": "sha256:
|
|
380
|
+
"digest": "sha256:02c19f6bd7d805e1d101c020f64270b17c785b8bffb36184da57a20755b21960"
|
|
381
381
|
},
|
|
382
382
|
"authorityClass": "workflow",
|
|
383
383
|
"machineJson": false,
|
|
@@ -482,7 +482,7 @@
|
|
|
482
482
|
"ownerPackage": "openplanr",
|
|
483
483
|
"source": {
|
|
484
484
|
"path": "packages/cli/src/cli/commands/init-deterministic.ts",
|
|
485
|
-
"digest": "sha256:
|
|
485
|
+
"digest": "sha256:7bd117fac77363d2233cf91e8ae280cff7da04b6671ad4e0b3bc39af07701747"
|
|
486
486
|
},
|
|
487
487
|
"authorityClass": "workflow",
|
|
488
488
|
"machineJson": false,
|
|
@@ -566,7 +566,7 @@
|
|
|
566
566
|
"ownerPackage": "openplanr",
|
|
567
567
|
"source": {
|
|
568
568
|
"path": "docs/generated/utility-command-catalog.json",
|
|
569
|
-
"digest": "sha256:
|
|
569
|
+
"digest": "sha256:02c19f6bd7d805e1d101c020f64270b17c785b8bffb36184da57a20755b21960"
|
|
570
570
|
},
|
|
571
571
|
"authorityClass": "workflow",
|
|
572
572
|
"machineJson": true,
|
|
@@ -776,7 +776,7 @@
|
|
|
776
776
|
"ownerPackage": "openplanr",
|
|
777
777
|
"source": {
|
|
778
778
|
"path": "packages/cli/src/cli/commands/setup.ts",
|
|
779
|
-
"digest": "sha256:
|
|
779
|
+
"digest": "sha256:8cc9b0df403edf08a900baf0e2755db0b9238c9e7465b04fca92b322fd5a5b7d"
|
|
780
780
|
},
|
|
781
781
|
"authorityClass": "workflow",
|
|
782
782
|
"machineJson": false,
|
|
@@ -965,7 +965,7 @@
|
|
|
965
965
|
"ownerPackage": "openplanr",
|
|
966
966
|
"source": {
|
|
967
967
|
"path": "packages/cli/src/cli/commands/upgrade.ts",
|
|
968
|
-
"digest": "sha256:
|
|
968
|
+
"digest": "sha256:f88457767ccf7034ee601a9e107f9976c0432632e5aa68463150d590e704bc7e"
|
|
969
969
|
},
|
|
970
970
|
"authorityClass": "workflow",
|
|
971
971
|
"machineJson": false,
|
|
@@ -1948,5 +1948,5 @@
|
|
|
1948
1948
|
]
|
|
1949
1949
|
}
|
|
1950
1950
|
],
|
|
1951
|
-
"documentDigest": "sha256:
|
|
1951
|
+
"documentDigest": "sha256:9f33355d22aaa2ee1d20f91aed15abbeefd85c7a405449acd610a7cfa12e2f46"
|
|
1952
1952
|
}
|
package/registries/skills.json
CHANGED
|
@@ -624,7 +624,7 @@
|
|
|
624
624
|
"lifecycle": "active",
|
|
625
625
|
"authorityClass": "planning-write",
|
|
626
626
|
"source": "skills/planr-design/openplanr.skill.json",
|
|
627
|
-
"sourceDigest": "sha256:
|
|
627
|
+
"sourceDigest": "sha256:f766320e0acf0d321f996ad6b3115a2e7d4d386b10d760de1ba056b2b3b1e735",
|
|
628
628
|
"triggerPolicy": {
|
|
629
629
|
"include": [
|
|
630
630
|
"Create an initial product design direction",
|
|
@@ -685,7 +685,7 @@
|
|
|
685
685
|
"lifecycle": "active",
|
|
686
686
|
"authorityClass": "planning-write",
|
|
687
687
|
"source": "skills/planr-design-loop/openplanr.skill.json",
|
|
688
|
-
"sourceDigest": "sha256:
|
|
688
|
+
"sourceDigest": "sha256:3e1c445f7e16605852ca252e13f4be26152ca536c4c3a0411ad30e3f2568579b",
|
|
689
689
|
"triggerPolicy": {
|
|
690
690
|
"include": [
|
|
691
691
|
"Explore multiple design directions or variants",
|
|
@@ -746,7 +746,7 @@
|
|
|
746
746
|
"lifecycle": "active",
|
|
747
747
|
"authorityClass": "review-evidence",
|
|
748
748
|
"source": "skills/planr-design-review/openplanr.skill.json",
|
|
749
|
-
"sourceDigest": "sha256:
|
|
749
|
+
"sourceDigest": "sha256:0344f576cc93658bcd7265fbac08908d08f4ef4d9aa05b6fdfed63a249e51632",
|
|
750
750
|
"triggerPolicy": {
|
|
751
751
|
"include": [
|
|
752
752
|
"Review or critique an existing OpenPlanr design",
|
|
@@ -803,7 +803,7 @@
|
|
|
803
803
|
{
|
|
804
804
|
"skillId": "planr-diagram",
|
|
805
805
|
"skillVersion": "1.1.0",
|
|
806
|
-
"description": "Create, inspect, verify, or rerender professional offline diagrams. Use for architecture, process, sequence, data, state, or relationship visuals from intent or source.",
|
|
806
|
+
"description": "Create, edit, inspect, verify, or rerender professional offline diagrams. Use for architecture, process, sequence, data, state, or relationship visuals from intent or source.",
|
|
807
807
|
"lifecycle": "active",
|
|
808
808
|
"authorityClass": "artifact-authoring",
|
|
809
809
|
"source": "skills/planr-diagram/openplanr.skill.json",
|
|
@@ -1179,7 +1179,7 @@
|
|
|
1179
1179
|
"lifecycle": "active",
|
|
1180
1180
|
"authorityClass": "planning-write",
|
|
1181
1181
|
"source": "skills/planr-plan/openplanr.skill.json",
|
|
1182
|
-
"sourceDigest": "sha256:
|
|
1182
|
+
"sourceDigest": "sha256:5d747d2be313ac2e06534936043744f663939e8d72644c31936daa42f2bc500c",
|
|
1183
1183
|
"triggerPolicy": {
|
|
1184
1184
|
"include": [
|
|
1185
1185
|
"Decompose a specification into user stories and implementation tasks",
|
|
@@ -1664,5 +1664,5 @@
|
|
|
1664
1664
|
}
|
|
1665
1665
|
],
|
|
1666
1666
|
"compatibilityAliases": [],
|
|
1667
|
-
"documentDigest": "sha256:
|
|
1667
|
+
"documentDigest": "sha256:63f0c16bcbca6cdf811e606835e91c2474f37122903e4e84d43a357159d58786"
|
|
1668
1668
|
}
|
|
@@ -3,5 +3,8 @@ export declare const PROTOCOL_V16_CONTRACTS: Readonly<Record<string, string>>;
|
|
|
3
3
|
export declare const PROTOCOL_V17_CONTRACTS: Readonly<Record<string, string>>;
|
|
4
4
|
export declare const PROTOCOL_V18_CONTRACTS: Readonly<Record<string, string>>;
|
|
5
5
|
export declare const PROTOCOL_V111_CONTRACTS: Readonly<Record<string, string>>;
|
|
6
|
-
export declare function protocolAssetUrl(
|
|
6
|
+
export declare function protocolAssetUrl(
|
|
7
|
+
kind: string,
|
|
8
|
+
options?: { protocolVersion?: '1.5.0' | '1.6.0' | '1.7.0' | '1.8.0' | '1.11.0' | '1.13.0' },
|
|
9
|
+
): URL;
|
|
7
10
|
export declare const PROTOCOL_V113_CONTRACTS: Readonly<Record<string, string>>;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import { DESIGN_HANDOFF_CONTRACT_FILES } from './design-handoff-contracts.mjs';
|
|
3
|
+
import { DIAGRAM_AUTHORING_CONTRACT_FILES } from './diagram-authoring-contracts.mjs';
|
|
1
4
|
import {
|
|
2
5
|
PROTOCOL_V16_CONTRACT_FILES,
|
|
3
6
|
PROTOCOL_V17_CONTRACT_FILES,
|
|
4
7
|
PROTOCOL_V18_CONTRACT_FILES,
|
|
5
8
|
} from './skill-source-contracts.mjs';
|
|
6
|
-
import { DESIGN_HANDOFF_CONTRACT_FILES } from './design-handoff-contracts.mjs';
|
|
7
|
-
import { DIAGRAM_AUTHORING_CONTRACT_FILES } from './diagram-authoring-contracts.mjs';
|
|
8
9
|
|
|
10
|
+
/** @type {typeof import('./browser-contracts.d.mts').PROTOCOL_V15_CONTRACTS} */
|
|
9
11
|
export const PROTOCOL_V15_CONTRACTS = Object.freeze({
|
|
10
12
|
'command-catalog': 'command-catalog.schema.json',
|
|
11
13
|
'generated-asset-manifest': 'generated-asset-manifest.schema.json',
|
|
@@ -18,17 +20,22 @@ export const PROTOCOL_V15_CONTRACTS = Object.freeze({
|
|
|
18
20
|
'skill-catalog': 'skill-catalog.schema.json',
|
|
19
21
|
'task-kind-registry': 'task-kind-registry.schema.json',
|
|
20
22
|
'task-manifest': 'task-manifest.schema.json',
|
|
21
|
-
'task-output-manifest': 'task-output-manifest.schema.json'
|
|
23
|
+
'task-output-manifest': 'task-output-manifest.schema.json',
|
|
22
24
|
});
|
|
23
25
|
|
|
26
|
+
/** @type {typeof import('./browser-contracts.d.mts').PROTOCOL_V16_CONTRACTS} */
|
|
24
27
|
export const PROTOCOL_V16_CONTRACTS = PROTOCOL_V16_CONTRACT_FILES;
|
|
28
|
+
/** @type {typeof import('./browser-contracts.d.mts').PROTOCOL_V17_CONTRACTS} */
|
|
25
29
|
export const PROTOCOL_V17_CONTRACTS = PROTOCOL_V17_CONTRACT_FILES;
|
|
30
|
+
/** @type {typeof import('./browser-contracts.d.mts').PROTOCOL_V18_CONTRACTS} */
|
|
26
31
|
export const PROTOCOL_V18_CONTRACTS = PROTOCOL_V18_CONTRACT_FILES;
|
|
32
|
+
/** @type {typeof import('./browser-contracts.d.mts').PROTOCOL_V111_CONTRACTS} */
|
|
27
33
|
export const PROTOCOL_V111_CONTRACTS = Object.freeze({
|
|
28
34
|
'design-review-metadata-payload': 'design-review-metadata-payload.schema.json',
|
|
29
35
|
...DESIGN_HANDOFF_CONTRACT_FILES,
|
|
30
36
|
});
|
|
31
37
|
|
|
38
|
+
/** @type {typeof import('./browser-contracts.d.mts').PROTOCOL_V113_CONTRACTS} */
|
|
32
39
|
export const PROTOCOL_V113_CONTRACTS = DIAGRAM_AUTHORING_CONTRACT_FILES;
|
|
33
40
|
|
|
34
41
|
const PROTOCOL_CONTRACTS_BY_VERSION = Object.freeze({
|
|
@@ -40,10 +47,14 @@ const PROTOCOL_CONTRACTS_BY_VERSION = Object.freeze({
|
|
|
40
47
|
'1.13.0': PROTOCOL_V113_CONTRACTS,
|
|
41
48
|
});
|
|
42
49
|
|
|
43
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* Resolve a packaged schema asset without a source checkout or Node-only API.
|
|
52
|
+
* @type {typeof import('./browser-contracts.d.mts').protocolAssetUrl}
|
|
53
|
+
*/
|
|
44
54
|
export function protocolAssetUrl(kind, { protocolVersion = '1.5.0' } = {}) {
|
|
45
55
|
const contracts = Object.hasOwn(PROTOCOL_CONTRACTS_BY_VERSION, protocolVersion)
|
|
46
|
-
? PROTOCOL_CONTRACTS_BY_VERSION[protocolVersion]
|
|
56
|
+
? PROTOCOL_CONTRACTS_BY_VERSION[protocolVersion]
|
|
57
|
+
: null;
|
|
47
58
|
const filename = contracts && Object.hasOwn(contracts, kind) ? contracts[kind] : null;
|
|
48
59
|
if (!filename) {
|
|
49
60
|
throw new RangeError(`Unknown browser-safe Protocol contract: ${kind}@${protocolVersion}`);
|
package/src/canonical-json.d.mts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export declare function canonicalizeJson(value: unknown): string;
|
|
2
2
|
export declare function sha256Hex(value: string | Uint8Array): string;
|
|
3
3
|
export declare function sha256Jcs(value: unknown): `sha256:${string}`;
|
|
4
|
-
export declare function withDocumentDigest<T extends Record<string, unknown>>(
|
|
4
|
+
export declare function withDocumentDigest<T extends Record<string, unknown>>(
|
|
5
|
+
value: T,
|
|
6
|
+
): T & { documentDigest: `sha256:${string}` };
|
|
5
7
|
export declare function verifyDocumentDigest(value: unknown): boolean;
|
package/src/canonical-json.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @ts-check
|
|
1
2
|
const hasOwn = (value, key) => Object.prototype.hasOwnProperty.call(value, key);
|
|
2
3
|
|
|
3
4
|
function assertUnicodeScalarString(value, path) {
|
|
@@ -26,14 +27,16 @@ function serialize(value, path, seen) {
|
|
|
26
27
|
if (!Number.isFinite(value)) throw new TypeError(`JCS requires a finite number at ${path}.`);
|
|
27
28
|
return JSON.stringify(value);
|
|
28
29
|
}
|
|
29
|
-
if (typeof value !== 'object')
|
|
30
|
+
if (typeof value !== 'object')
|
|
31
|
+
throw new TypeError(`JCS cannot canonicalize ${typeof value} at ${path}.`);
|
|
30
32
|
if (seen.has(value)) throw new TypeError(`JCS cannot canonicalize a cycle at ${path}.`);
|
|
31
33
|
seen.add(value);
|
|
32
34
|
try {
|
|
33
35
|
if (Array.isArray(value)) {
|
|
34
36
|
const entries = [];
|
|
35
37
|
for (let index = 0; index < value.length; index += 1) {
|
|
36
|
-
if (!hasOwn(value, index))
|
|
38
|
+
if (!hasOwn(value, index))
|
|
39
|
+
throw new TypeError(`JCS cannot canonicalize a sparse array at ${path}[${index}].`);
|
|
37
40
|
entries.push(serialize(value[index], `${path}[${index}]`, seen));
|
|
38
41
|
}
|
|
39
42
|
return `[${entries.join(',')}]`;
|
|
@@ -42,17 +45,22 @@ function serialize(value, path, seen) {
|
|
|
42
45
|
if (prototype !== Object.prototype && prototype !== null) {
|
|
43
46
|
throw new TypeError(`JCS requires a plain JSON object at ${path}.`);
|
|
44
47
|
}
|
|
45
|
-
const entries = Object.keys(value)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
const entries = Object.keys(value)
|
|
49
|
+
.sort()
|
|
50
|
+
.map((key) => {
|
|
51
|
+
assertUnicodeScalarString(key, `${path} key`);
|
|
52
|
+
return `${JSON.stringify(key)}:${serialize(value[key], `${path}.${key}`, seen)}`;
|
|
53
|
+
});
|
|
49
54
|
return `{${entries.join(',')}}`;
|
|
50
55
|
} finally {
|
|
51
56
|
seen.delete(value);
|
|
52
57
|
}
|
|
53
58
|
}
|
|
54
59
|
|
|
55
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* RFC 8785 JSON canonicalization for already parsed JSON values.
|
|
62
|
+
* @type {typeof import('./canonical-json.d.mts').canonicalizeJson}
|
|
63
|
+
*/
|
|
56
64
|
export function canonicalizeJson(value) {
|
|
57
65
|
return serialize(value, '$', new Set());
|
|
58
66
|
}
|
|
@@ -70,10 +78,16 @@ const SHA256_K = new Uint32Array([
|
|
|
70
78
|
|
|
71
79
|
const rotr = (value, bits) => (value >>> bits) | (value << (32 - bits));
|
|
72
80
|
|
|
73
|
-
/**
|
|
81
|
+
/**
|
|
82
|
+
* Dependency-free synchronous SHA-256 for browser and Node runtimes.
|
|
83
|
+
* @type {typeof import('./canonical-json.d.mts').sha256Hex}
|
|
84
|
+
*/
|
|
74
85
|
export function sha256Hex(value) {
|
|
75
86
|
const candidate = typeof value === 'string' ? new TextEncoder().encode(value) : value;
|
|
76
|
-
if (
|
|
87
|
+
if (
|
|
88
|
+
!ArrayBuffer.isView(candidate) ||
|
|
89
|
+
Object.prototype.toString.call(candidate) !== '[object Uint8Array]'
|
|
90
|
+
) {
|
|
77
91
|
throw new TypeError('sha256Hex expects a string or Uint8Array.');
|
|
78
92
|
}
|
|
79
93
|
const input = new Uint8Array(candidate.buffer, candidate.byteOffset, candidate.byteLength);
|
|
@@ -99,12 +113,20 @@ export function sha256Hex(value) {
|
|
|
99
113
|
for (let offset = 0; offset < bytes.length; offset += 64) {
|
|
100
114
|
for (let index = 0; index < 16; index += 1) words[index] = view.getUint32(offset + index * 4);
|
|
101
115
|
for (let index = 16; index < 64; index += 1) {
|
|
102
|
-
const s0 =
|
|
103
|
-
|
|
116
|
+
const s0 =
|
|
117
|
+
rotr(words[index - 15], 7) ^ rotr(words[index - 15], 18) ^ (words[index - 15] >>> 3);
|
|
118
|
+
const s1 =
|
|
119
|
+
rotr(words[index - 2], 17) ^ rotr(words[index - 2], 19) ^ (words[index - 2] >>> 10);
|
|
104
120
|
words[index] = (words[index - 16] + s0 + words[index - 7] + s1) >>> 0;
|
|
105
121
|
}
|
|
106
|
-
let a = h0;
|
|
107
|
-
let
|
|
122
|
+
let a = h0;
|
|
123
|
+
let b = h1;
|
|
124
|
+
let c = h2;
|
|
125
|
+
let d = h3;
|
|
126
|
+
let e = h4;
|
|
127
|
+
let f = h5;
|
|
128
|
+
let g = h6;
|
|
129
|
+
let h = h7;
|
|
108
130
|
for (let index = 0; index < 64; index += 1) {
|
|
109
131
|
const s1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
|
|
110
132
|
const choice = (e & f) ^ (~e & g);
|
|
@@ -112,27 +134,42 @@ export function sha256Hex(value) {
|
|
|
112
134
|
const s0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);
|
|
113
135
|
const majority = (a & b) ^ (a & c) ^ (b & c);
|
|
114
136
|
const temp2 = (s0 + majority) >>> 0;
|
|
115
|
-
h = g;
|
|
116
|
-
|
|
137
|
+
h = g;
|
|
138
|
+
g = f;
|
|
139
|
+
f = e;
|
|
140
|
+
e = (d + temp1) >>> 0;
|
|
141
|
+
d = c;
|
|
142
|
+
c = b;
|
|
143
|
+
b = a;
|
|
144
|
+
a = (temp1 + temp2) >>> 0;
|
|
117
145
|
}
|
|
118
|
-
h0 = (h0 + a) >>> 0;
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
146
|
+
h0 = (h0 + a) >>> 0;
|
|
147
|
+
h1 = (h1 + b) >>> 0;
|
|
148
|
+
h2 = (h2 + c) >>> 0;
|
|
149
|
+
h3 = (h3 + d) >>> 0;
|
|
150
|
+
h4 = (h4 + e) >>> 0;
|
|
151
|
+
h5 = (h5 + f) >>> 0;
|
|
152
|
+
h6 = (h6 + g) >>> 0;
|
|
153
|
+
h7 = (h7 + h) >>> 0;
|
|
122
154
|
}
|
|
123
|
-
return [h0, h1, h2, h3, h4, h5, h6, h7]
|
|
155
|
+
return [h0, h1, h2, h3, h4, h5, h6, h7]
|
|
156
|
+
.map((part) => part.toString(16).padStart(8, '0'))
|
|
157
|
+
.join('');
|
|
124
158
|
}
|
|
125
159
|
|
|
160
|
+
/** @type {typeof import('./canonical-json.d.mts').sha256Jcs} */
|
|
126
161
|
export function sha256Jcs(value) {
|
|
127
162
|
return `sha256:${sha256Hex(canonicalizeJson(value))}`;
|
|
128
163
|
}
|
|
129
164
|
|
|
165
|
+
/** @type {typeof import('./canonical-json.d.mts').withDocumentDigest} */
|
|
130
166
|
export function withDocumentDigest(value) {
|
|
131
167
|
const copy = { ...value };
|
|
132
168
|
delete copy.documentDigest;
|
|
133
169
|
return { ...copy, documentDigest: sha256Jcs(copy) };
|
|
134
170
|
}
|
|
135
171
|
|
|
172
|
+
/** @type {typeof import('./canonical-json.d.mts').verifyDocumentDigest} */
|
|
136
173
|
export function verifyDocumentDigest(value) {
|
|
137
174
|
if (!value || typeof value !== 'object' || Array.isArray(value)) return false;
|
|
138
175
|
const copy = { ...value };
|