@econ-v1/domain 7.6.39 → 7.6.41

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.
@@ -1,6 +1,8 @@
1
1
  /** @typedef {{ readonly sha256: string, readonly url: string }} ReleaseManifestAsset */
2
2
  /** @typedef {{ readonly max: number, readonly min: number }} ReleaseManifestVersionRange */
3
- /** @typedef {{ readonly buildId: string, readonly channel: string, readonly issuedAtMs: number, readonly manifestVersion: 1, readonly protocolCompatibility: ReleaseManifestVersionRange, readonly shellAssets: readonly ReleaseManifestAsset[], readonly shellVersion: string, readonly signingKeyId: string, readonly storageSchemaCompatibility: ReleaseManifestVersionRange }} UnsignedReleaseManifest */
3
+ /** @typedef {{ readonly abi: number, readonly sha256: string }} ReleaseManifestLoader */
4
+ /** @typedef {{ readonly requiresLoaderAbi: number }} ReleaseManifestBundle */
5
+ /** @typedef {{ readonly sequence?: number, readonly loader?: ReleaseManifestLoader, readonly bundle?: ReleaseManifestBundle, readonly buildId: string, readonly channel: string, readonly issuedAtMs: number, readonly manifestVersion: 1, readonly protocolCompatibility: ReleaseManifestVersionRange, readonly shellAssets: readonly ReleaseManifestAsset[], readonly shellVersion: string, readonly signingKeyId: string, readonly storageSchemaCompatibility: ReleaseManifestVersionRange }} UnsignedReleaseManifest */
4
6
  /** @typedef {UnsignedReleaseManifest & { readonly signature: string }} SignedReleaseManifest */
5
7
  /**
6
8
  * @param {UnsignedReleaseManifest} manifest
@@ -31,7 +33,17 @@ export type ReleaseManifestVersionRange = {
31
33
  readonly max: number;
32
34
  readonly min: number;
33
35
  };
36
+ export type ReleaseManifestLoader = {
37
+ readonly abi: number;
38
+ readonly sha256: string;
39
+ };
40
+ export type ReleaseManifestBundle = {
41
+ readonly requiresLoaderAbi: number;
42
+ };
34
43
  export type UnsignedReleaseManifest = {
44
+ readonly sequence?: number;
45
+ readonly loader?: ReleaseManifestLoader;
46
+ readonly bundle?: ReleaseManifestBundle;
35
47
  readonly buildId: string;
36
48
  readonly channel: string;
37
49
  readonly issuedAtMs: number;
@@ -1 +1 @@
1
- {"version":3,"file":"release-manifest.d.ts","sourceRoot":"","sources":["../../src/models/release-manifest.js"],"names":[],"mappings":"AAgBA,wFAAwF;AACxF,4FAA4F;AAC5F,8YAA8Y;AAC9Y,gGAAgG;AAEhG;;;GAGG;AACH,wDAHW,uBAAuB,GACrB,UAAU,CAoBtB;AAMD;;;GAGG;AACH,sDAHW,OAAO,GACL,qBAAqB,GAAG,SAAS,CAkD7C;AAnGD,2DAA2D;AAE3D,uCAAwC,CAAC,CAAC;;;;;;;;;;mCAY5B;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE;0CACjD;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE;sCAC9C;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,eAAe,EAAE,CAAC,CAAC;IAAC,QAAQ,CAAC,qBAAqB,EAAE,2BAA2B,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,0BAA0B,EAAE,2BAA2B,CAAA;CAAE;oCACpW,uBAAuB,GAAG;IAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE;yBAjBxD,OAAO,WAAW,EAAE,UAAU"}
1
+ {"version":3,"file":"release-manifest.d.ts","sourceRoot":"","sources":["../../src/models/release-manifest.js"],"names":[],"mappings":"AAgBA,wFAAwF;AACxF,4FAA4F;AAC5F,yFAA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AAE;yBAnBxD,OAAO,WAAW,EAAE,UAAU"}
@@ -1 +1 @@
1
- {"version":3,"file":"release-manifest-verifier.d.ts","sourceRoot":"","sources":["../../src/services/release-manifest-verifier.js"],"names":[],"mappings":"AAuBA,oGAAoG;AACpG,uLAAuL;AACvL,sGAAsG;AACtG,8PAA8P;AAE9P;;;;;GAKG;AACH,iDALW,OAAO,qBACP,SAAS,yBAAyB,EAAE,WACpC,4BAA4B,GAC1B,OAAO,CAAC,2BAA2B,CAAC,CAsChD;AAzDD,8IAA8I;AAC9I,iDADW,SAAS,CAAC,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,qBAAqB,CAAC,CAQxI;6CAEY,CAAC,OAAO,kCAAkC,EAAE,MAAM,CAAC;0CACnD;IAAE,QAAQ,CAAC,QAAQ,EAAE,qBAAqB,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,8BAA8B,CAAA;CAAE;wCACzI;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAA;CAAE;2CAC1D;IAAE,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,cAAc,GAAG,eAAe,CAAC,CAAC;IAAC,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,2BAA2B,EAAE,MAAM,CAAA;CAAE;yBAxB/M,OAAO,gBAAgB,EAAE,UAAU;mCACnC,OAAO,+BAA+B,EAAE,oBAAoB;oCAC5D,OAAO,+BAA+B,EAAE,qBAAqB"}
1
+ {"version":3,"file":"release-manifest-verifier.d.ts","sourceRoot":"","sources":["../../src/services/release-manifest-verifier.js"],"names":[],"mappings":"AAuBA,oGAAoG;AACpG,uLAAuL;AACvL,sGAAsG;AACtG,8PAA8P;AAE9P;;;;;GAKG;AACH,iDALW,OAAO,qBACP,SAAS,yBAAyB,EAAE,WACpC,4BAA4B,GAC1B,OAAO,CAAC,2BAA2B,CAAC,CAwChD;AA3DD,8IAA8I;AAC9I,iDADW,SAAS,CAAC,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,qBAAqB,CAAC,CAQxI;6CAEY,CAAC,OAAO,kCAAkC,EAAE,MAAM,CAAC;0CACnD;IAAE,QAAQ,CAAC,QAAQ,EAAE,qBAAqB,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,8BAA8B,CAAA;CAAE;wCACzI;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAA;CAAE;2CAC1D;IAAE,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,cAAc,GAAG,eAAe,CAAC,CAAC;IAAC,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,2BAA2B,EAAE,MAAM,CAAA;CAAE;yBAxB/M,OAAO,gBAAgB,EAAE,UAAU;mCACnC,OAAO,+BAA+B,EAAE,oBAAoB;oCAC5D,OAAO,+BAA+B,EAAE,qBAAqB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@econ-v1/domain",
3
- "version": "7.6.39",
3
+ "version": "7.6.41",
4
4
  "description": "Platform-neutral domain contracts and errors for Node clients",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "author": "Node contributors",
@@ -57,6 +57,6 @@
57
57
  "access": "public"
58
58
  },
59
59
  "dependencies": {
60
- "@econ-v1/ports": "7.6.39"
60
+ "@econ-v1/ports": "7.6.41"
61
61
  }
62
62
  }
@@ -16,7 +16,9 @@ export const RELEASE_MANIFEST_LIMITS = {
16
16
 
17
17
  /** @typedef {{ readonly sha256: string, readonly url: string }} ReleaseManifestAsset */
18
18
  /** @typedef {{ readonly max: number, readonly min: number }} ReleaseManifestVersionRange */
19
- /** @typedef {{ readonly buildId: string, readonly channel: string, readonly issuedAtMs: number, readonly manifestVersion: 1, readonly protocolCompatibility: ReleaseManifestVersionRange, readonly shellAssets: readonly ReleaseManifestAsset[], readonly shellVersion: string, readonly signingKeyId: string, readonly storageSchemaCompatibility: ReleaseManifestVersionRange }} UnsignedReleaseManifest */
19
+ /** @typedef {{ readonly abi: number, readonly sha256: string }} ReleaseManifestLoader */
20
+ /** @typedef {{ readonly requiresLoaderAbi: number }} ReleaseManifestBundle */
21
+ /** @typedef {{ readonly sequence?: number, readonly loader?: ReleaseManifestLoader, readonly bundle?: ReleaseManifestBundle, readonly buildId: string, readonly channel: string, readonly issuedAtMs: number, readonly manifestVersion: 1, readonly protocolCompatibility: ReleaseManifestVersionRange, readonly shellAssets: readonly ReleaseManifestAsset[], readonly shellVersion: string, readonly signingKeyId: string, readonly storageSchemaCompatibility: ReleaseManifestVersionRange }} UnsignedReleaseManifest */
20
22
  /** @typedef {UnsignedReleaseManifest & { readonly signature: string }} SignedReleaseManifest */
21
23
 
22
24
  /**
@@ -25,6 +27,13 @@ export const RELEASE_MANIFEST_LIMITS = {
25
27
  */
26
28
  export function unsignedReleaseManifestToJson(manifest) {
27
29
  return {
30
+ // Sequence zero denotes a legacy payload. Keep its canonical bytes unchanged so
31
+ // releases signed before the ladder extension continue to verify.
32
+ ...(manifest.sequence === undefined || manifest.sequence === 0 ? {} : {
33
+ sequence: manifest.sequence,
34
+ loader: { abi: manifest.loader?.abi ?? 0, sha256: manifest.loader?.sha256 ?? "" },
35
+ bundle: { requiresLoaderAbi: manifest.bundle?.requiresLoaderAbi ?? 0 },
36
+ }),
28
37
  buildId: manifest.buildId,
29
38
  channel: manifest.channel,
30
39
  issuedAtMs: manifest.issuedAtMs,
@@ -67,6 +76,24 @@ export function parseSignedReleaseManifest(candidate) {
67
76
 
68
77
  if (!isSafeNonNegativeInteger(value.issuedAtMs)) return undefined;
69
78
 
79
+ const hasLadderFields = "sequence" in value || "loader" in value || "bundle" in value;
80
+ let sequence = 0;
81
+ let loader = { abi: 0, sha256: "" };
82
+ let bundle = { requiresLoaderAbi: 0 };
83
+ if (hasLadderFields) {
84
+ if (!isSafeNonNegativeInteger(value.sequence) || value.sequence === 0) return undefined;
85
+ if (typeof value.loader !== "object" || value.loader === null || Array.isArray(value.loader)) return undefined;
86
+ if (typeof value.bundle !== "object" || value.bundle === null || Array.isArray(value.bundle)) return undefined;
87
+ const loaderValue = /** @type {Record<string, unknown>} */ (value.loader);
88
+ const bundleValue = /** @type {Record<string, unknown>} */ (value.bundle);
89
+ if (!isSafeNonNegativeInteger(loaderValue.abi)) return undefined;
90
+ if (typeof loaderValue.sha256 !== "string" || !SHA256_HEX.test(loaderValue.sha256)) return undefined;
91
+ if (!isSafeNonNegativeInteger(bundleValue.requiresLoaderAbi)) return undefined;
92
+ sequence = value.sequence;
93
+ loader = { abi: loaderValue.abi, sha256: loaderValue.sha256 };
94
+ bundle = { requiresLoaderAbi: bundleValue.requiresLoaderAbi };
95
+ }
96
+
70
97
  const signingKeyId = boundedString(value.signingKeyId, 1, RELEASE_MANIFEST_LIMITS.maxSigningKeyIdLength);
71
98
  if (signingKeyId === undefined) return undefined;
72
99
 
@@ -88,6 +115,9 @@ export function parseSignedReleaseManifest(candidate) {
88
115
  if (shellAssets === undefined) return undefined;
89
116
 
90
117
  return {
118
+ sequence,
119
+ loader,
120
+ bundle,
91
121
  buildId,
92
122
  channel,
93
123
  issuedAtMs: value.issuedAtMs,
@@ -42,6 +42,8 @@ export async function verifyReleaseManifest(candidate, trustedPublicKeys, option
42
42
  const signatureBytes = hexToBytes(manifest.signature);
43
43
  if (signatureBytes === undefined) return { ok: false, reason: "malformed" };
44
44
 
45
+ // The serializer preserves the original legacy payload despite the parser's
46
+ // zero defaults, and covers sequence/loader/bundle for ladder releases.
45
47
  const canonicalPayload = encodeUtf8(
46
48
  canonicalOutboxPayload(unsignedReleaseManifestToJson(manifest)),
47
49
  );