@neilberkman/sidereon 0.37.0 → 0.39.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.
@@ -4212,7 +4212,13 @@ export class MmapTerrain {
4212
4212
  free(): void;
4213
4213
  [Symbol.dispose](): void;
4214
4214
  /**
4215
- * FNV-1a checksum of the full terrain store byte span.
4215
+ * Internal byte bridge used by the generated Node path adapter.
4216
+ */
4217
+ private static fromBytesAttestedInternal(bytes: Uint8Array, claimed_checksum64: any): MmapTerrain;
4218
+ /**
4219
+ * FNV-1a checksum of the full terrain store byte span as a JavaScript
4220
+ * `bigint`. An attested handle returns its caller-supplied claim without
4221
+ * hashing.
4216
4222
  */
4217
4223
  checksum64(): bigint;
4218
4224
  /**
@@ -4243,6 +4249,15 @@ export class MmapTerrain {
4243
4249
  * Browser runtimes should use [`MmapTerrain.fromBytes`] with fetched bytes.
4244
4250
  */
4245
4251
  static fromPath(path: string): MmapTerrain;
4252
+ /**
4253
+ * Read a terrain store file using a caller-attested full-store checksum.
4254
+ *
4255
+ * `claimedChecksum64` is an exact JavaScript `bigint` in the unsigned
4256
+ * 64-bit range. The claim is returned by [`MmapTerrain.checksum64`] until
4257
+ * [`MmapTerrain.verify`] succeeds. Browser runtimes should use an
4258
+ * application-provided host-I/O bridge.
4259
+ */
4260
+ static fromPathAttested(path: string, claimed_checksum64: bigint): MmapTerrain;
4246
4261
  /**
4247
4262
  * Parse terrain store bytes from an owned `Uint8Array` copy.
4248
4263
  */
@@ -4293,6 +4308,16 @@ export class MmapTerrain {
4293
4308
  * Canonical store bytes for this parsed terrain store.
4294
4309
  */
4295
4310
  toBytes(): Uint8Array;
4311
+ /**
4312
+ * Recompute and verify the store checksums.
4313
+ *
4314
+ * Success changes [`MmapTerrain.digestProvenance`] to `"verified"`.
4315
+ */
4316
+ verify(): void;
4317
+ /**
4318
+ * Checksum provenance: `"verified"` or `"attested"`.
4319
+ */
4320
+ readonly digestProvenance: "verified" | "attested";
4296
4321
  /**
4297
4322
  * File-level vertical datum for the store's orthometric posting payloads.
4298
4323
  */
@@ -5943,18 +5968,49 @@ export class PreciseInterpolantArtifact {
5943
5968
  private constructor();
5944
5969
  free(): void;
5945
5970
  [Symbol.dispose](): void;
5971
+ /**
5972
+ * Internal byte bridge used by the generated Node path adapter.
5973
+ */
5974
+ private static fromBytesAttestedInternal(bytes: Uint8Array, claimed_checksum64: any): PreciseInterpolantArtifact;
5946
5975
  /**
5947
5976
  * Evaluate one satellite state at a J2000-second epoch.
5948
5977
  */
5949
5978
  evaluate(satellite: string, j2000_seconds: number): Sp3State;
5979
+ /**
5980
+ * Read a precise-interpolant artifact from host I/O and open it in memory.
5981
+ *
5982
+ * Browser runtimes should use [`openPreciseInterpolantArtifact`] with
5983
+ * fetched bytes.
5984
+ */
5985
+ static fromPath(path: string): PreciseInterpolantArtifact;
5986
+ /**
5987
+ * Read a precise-interpolant artifact using a caller-attested checksum.
5988
+ *
5989
+ * `claimedChecksum64` is an exact JavaScript `bigint` in the unsigned
5990
+ * 64-bit range. It must equal the checksum declared by the artifact
5991
+ * header; a mismatch fails immediately without hashing the payload.
5992
+ */
5993
+ static fromPathAttested(path: string, claimed_checksum64: bigint): PreciseInterpolantArtifact;
5994
+ /**
5995
+ * Recompute and verify the file-level and per-satellite checksums.
5996
+ *
5997
+ * Success changes [`PreciseInterpolantArtifact.digestProvenance`] to
5998
+ * `"verified"`.
5999
+ */
6000
+ verify(): void;
5950
6001
  /**
5951
6002
  * Number of bytes retained by this artifact handle.
5952
6003
  */
5953
6004
  readonly byteLength: number;
5954
6005
  /**
5955
- * File-level artifact checksum.
6006
+ * File-level artifact checksum as a JavaScript `bigint`. An attested
6007
+ * handle returns its caller-supplied claim without hashing.
5956
6008
  */
5957
6009
  readonly checksum64: bigint;
6010
+ /**
6011
+ * Checksum provenance: `"verified"` or `"attested"`.
6012
+ */
6013
+ readonly digestProvenance: "verified" | "attested";
5958
6014
  /**
5959
6015
  * Satellite tokens present in the artifact, ascending.
5960
6016
  */
@@ -6001,6 +6057,10 @@ export enum PreciseInterpolantArtifactError {
6001
6057
  * A satellite payload checksum did not match its index record.
6002
6058
  */
6003
6059
  SatelliteChecksum = 7,
6060
+ /**
6061
+ * A caller claim did not match the checksum declared by the header.
6062
+ */
6063
+ AttestedChecksumMismatch = 8,
6004
6064
  }
6005
6065
 
6006
6066
  /**
@@ -8460,6 +8520,10 @@ export enum TerrainStoreError {
8460
8520
  * A tile payload checksum did not match its index record.
8461
8521
  */
8462
8522
  Checksum = 5,
8523
+ /**
8524
+ * A caller-attested full-store checksum did not match the bytes opened.
8525
+ */
8526
+ AttestedChecksumMismatch = 6,
8463
8527
  }
8464
8528
 
8465
8529
  /**
@@ -9288,13 +9288,46 @@ class MmapTerrain {
9288
9288
  wasm.__wbg_mmapterrain_free(ptr, 0);
9289
9289
  }
9290
9290
  /**
9291
- * FNV-1a checksum of the full terrain store byte span.
9291
+ * Internal byte bridge used by the generated Node path adapter.
9292
+ * @param {Uint8Array} bytes
9293
+ * @param {any} claimed_checksum64
9294
+ * @returns {MmapTerrain}
9295
+ */
9296
+ static __fromBytesAttested(bytes, claimed_checksum64) {
9297
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
9298
+ const len0 = WASM_VECTOR_LEN;
9299
+ const ret = wasm.mmapterrain___fromBytesAttested(ptr0, len0, claimed_checksum64);
9300
+ if (ret[2]) {
9301
+ throw takeFromExternrefTable0(ret[1]);
9302
+ }
9303
+ return MmapTerrain.__wrap(ret[0]);
9304
+ }
9305
+ /**
9306
+ * FNV-1a checksum of the full terrain store byte span as a JavaScript
9307
+ * `bigint`. An attested handle returns its caller-supplied claim without
9308
+ * hashing.
9292
9309
  * @returns {bigint}
9293
9310
  */
9294
9311
  checksum64() {
9295
9312
  const ret = wasm.mmapterrain_checksum64(this.__wbg_ptr);
9296
9313
  return BigInt.asUintN(64, ret);
9297
9314
  }
9315
+ /**
9316
+ * Checksum provenance: `"verified"` or `"attested"`.
9317
+ * @returns {string}
9318
+ */
9319
+ get digestProvenance() {
9320
+ let deferred1_0;
9321
+ let deferred1_1;
9322
+ try {
9323
+ const ret = wasm.mmapterrain_digestProvenance(this.__wbg_ptr);
9324
+ deferred1_0 = ret[0];
9325
+ deferred1_1 = ret[1];
9326
+ return getStringFromWasm0(ret[0], ret[1]);
9327
+ } finally {
9328
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
9329
+ }
9330
+ }
9298
9331
  /**
9299
9332
  * Ellipsoidal height `h = H + N` in metres at `(longitudeDeg, latitudeDeg)`
9300
9333
  * using the embedded EGM96 1-degree geoid grid.
@@ -9374,6 +9407,26 @@ class MmapTerrain {
9374
9407
  }
9375
9408
  return MmapTerrain.__wrap(ret[0]);
9376
9409
  }
9410
+ /**
9411
+ * Read a terrain store file using a caller-attested full-store checksum.
9412
+ *
9413
+ * `claimedChecksum64` is an exact JavaScript `bigint` in the unsigned
9414
+ * 64-bit range. The claim is returned by [`MmapTerrain.checksum64`] until
9415
+ * [`MmapTerrain.verify`] succeeds. Browser runtimes should use an
9416
+ * application-provided host-I/O bridge.
9417
+ * @param {string} path
9418
+ * @param {any} claimed_checksum64
9419
+ * @returns {MmapTerrain}
9420
+ */
9421
+ static fromPathAttested(path, claimed_checksum64) {
9422
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
9423
+ const len0 = WASM_VECTOR_LEN;
9424
+ const ret = wasm.mmapterrain_fromPathAttested(ptr0, len0, claimed_checksum64);
9425
+ if (ret[2]) {
9426
+ throw takeFromExternrefTable0(ret[1]);
9427
+ }
9428
+ return MmapTerrain.__wrap(ret[0]);
9429
+ }
9377
9430
  /**
9378
9431
  * Parse terrain store bytes from an owned `Uint8Array` copy.
9379
9432
  * @param {Uint8Array} bytes
@@ -9502,6 +9555,17 @@ class MmapTerrain {
9502
9555
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
9503
9556
  return v1;
9504
9557
  }
9558
+ /**
9559
+ * Recompute and verify the store checksums.
9560
+ *
9561
+ * Success changes [`MmapTerrain.digestProvenance`] to `"verified"`.
9562
+ */
9563
+ verify() {
9564
+ const ret = wasm.mmapterrain_verify(this.__wbg_ptr);
9565
+ if (ret[1]) {
9566
+ throw takeFromExternrefTable0(ret[0]);
9567
+ }
9568
+ }
9505
9569
  /**
9506
9570
  * File-level vertical datum for the store's orthometric posting payloads.
9507
9571
  * @returns {VerticalDatum}
@@ -14081,6 +14145,21 @@ class PreciseInterpolantArtifact {
14081
14145
  const ptr = this.__destroy_into_raw();
14082
14146
  wasm.__wbg_preciseinterpolantartifact_free(ptr, 0);
14083
14147
  }
14148
+ /**
14149
+ * Internal byte bridge used by the generated Node path adapter.
14150
+ * @param {Uint8Array} bytes
14151
+ * @param {any} claimed_checksum64
14152
+ * @returns {PreciseInterpolantArtifact}
14153
+ */
14154
+ static __fromBytesAttested(bytes, claimed_checksum64) {
14155
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
14156
+ const len0 = WASM_VECTOR_LEN;
14157
+ const ret = wasm.preciseinterpolantartifact___fromBytesAttested(ptr0, len0, claimed_checksum64);
14158
+ if (ret[2]) {
14159
+ throw takeFromExternrefTable0(ret[1]);
14160
+ }
14161
+ return PreciseInterpolantArtifact.__wrap(ret[0]);
14162
+ }
14084
14163
  /**
14085
14164
  * Number of bytes retained by this artifact handle.
14086
14165
  * @returns {number}
@@ -14090,13 +14169,30 @@ class PreciseInterpolantArtifact {
14090
14169
  return ret >>> 0;
14091
14170
  }
14092
14171
  /**
14093
- * File-level artifact checksum.
14172
+ * File-level artifact checksum as a JavaScript `bigint`. An attested
14173
+ * handle returns its caller-supplied claim without hashing.
14094
14174
  * @returns {bigint}
14095
14175
  */
14096
14176
  get checksum64() {
14097
14177
  const ret = wasm.preciseinterpolantartifact_checksum64(this.__wbg_ptr);
14098
14178
  return BigInt.asUintN(64, ret);
14099
14179
  }
14180
+ /**
14181
+ * Checksum provenance: `"verified"` or `"attested"`.
14182
+ * @returns {string}
14183
+ */
14184
+ get digestProvenance() {
14185
+ let deferred1_0;
14186
+ let deferred1_1;
14187
+ try {
14188
+ const ret = wasm.preciseinterpolantartifact_digestProvenance(this.__wbg_ptr);
14189
+ deferred1_0 = ret[0];
14190
+ deferred1_1 = ret[1];
14191
+ return getStringFromWasm0(ret[0], ret[1]);
14192
+ } finally {
14193
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
14194
+ }
14195
+ }
14100
14196
  /**
14101
14197
  * Evaluate one satellite state at a J2000-second epoch.
14102
14198
  * @param {string} satellite
@@ -14112,6 +14208,42 @@ class PreciseInterpolantArtifact {
14112
14208
  }
14113
14209
  return Sp3State.__wrap(ret[0]);
14114
14210
  }
14211
+ /**
14212
+ * Read a precise-interpolant artifact from host I/O and open it in memory.
14213
+ *
14214
+ * Browser runtimes should use [`openPreciseInterpolantArtifact`] with
14215
+ * fetched bytes.
14216
+ * @param {string} path
14217
+ * @returns {PreciseInterpolantArtifact}
14218
+ */
14219
+ static fromPath(path) {
14220
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
14221
+ const len0 = WASM_VECTOR_LEN;
14222
+ const ret = wasm.preciseinterpolantartifact_fromPath(ptr0, len0);
14223
+ if (ret[2]) {
14224
+ throw takeFromExternrefTable0(ret[1]);
14225
+ }
14226
+ return PreciseInterpolantArtifact.__wrap(ret[0]);
14227
+ }
14228
+ /**
14229
+ * Read a precise-interpolant artifact using a caller-attested checksum.
14230
+ *
14231
+ * `claimedChecksum64` is an exact JavaScript `bigint` in the unsigned
14232
+ * 64-bit range. It must equal the checksum declared by the artifact
14233
+ * header; a mismatch fails immediately without hashing the payload.
14234
+ * @param {string} path
14235
+ * @param {any} claimed_checksum64
14236
+ * @returns {PreciseInterpolantArtifact}
14237
+ */
14238
+ static fromPathAttested(path, claimed_checksum64) {
14239
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
14240
+ const len0 = WASM_VECTOR_LEN;
14241
+ const ret = wasm.preciseinterpolantartifact_fromPathAttested(ptr0, len0, claimed_checksum64);
14242
+ if (ret[2]) {
14243
+ throw takeFromExternrefTable0(ret[1]);
14244
+ }
14245
+ return PreciseInterpolantArtifact.__wrap(ret[0]);
14246
+ }
14115
14247
  /**
14116
14248
  * Satellite tokens present in the artifact, ascending.
14117
14249
  * @returns {string[]}
@@ -14138,13 +14270,25 @@ class PreciseInterpolantArtifact {
14138
14270
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
14139
14271
  }
14140
14272
  }
14273
+ /**
14274
+ * Recompute and verify the file-level and per-satellite checksums.
14275
+ *
14276
+ * Success changes [`PreciseInterpolantArtifact.digestProvenance`] to
14277
+ * `"verified"`.
14278
+ */
14279
+ verify() {
14280
+ const ret = wasm.preciseinterpolantartifact_verify(this.__wbg_ptr);
14281
+ if (ret[1]) {
14282
+ throw takeFromExternrefTable0(ret[0]);
14283
+ }
14284
+ }
14141
14285
  }
14142
14286
  if (Symbol.dispose) PreciseInterpolantArtifact.prototype[Symbol.dispose] = PreciseInterpolantArtifact.prototype.free;
14143
14287
  exports.PreciseInterpolantArtifact = PreciseInterpolantArtifact;
14144
14288
 
14145
14289
  /**
14146
14290
  * Error category for precise-interpolant artifact open or serialization.
14147
- * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7}
14291
+ * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8}
14148
14292
  */
14149
14293
  const PreciseInterpolantArtifactError = Object.freeze({
14150
14294
  /**
@@ -14179,6 +14323,10 @@ const PreciseInterpolantArtifactError = Object.freeze({
14179
14323
  * A satellite payload checksum did not match its index record.
14180
14324
  */
14181
14325
  SatelliteChecksum: 7, "7": "SatelliteChecksum",
14326
+ /**
14327
+ * A caller claim did not match the checksum declared by the header.
14328
+ */
14329
+ AttestedChecksumMismatch: 8, "8": "AttestedChecksumMismatch",
14182
14330
  });
14183
14331
  exports.PreciseInterpolantArtifactError = PreciseInterpolantArtifactError;
14184
14332
 
@@ -20378,7 +20526,7 @@ exports.TerrainGeoidModel = TerrainGeoidModel;
20378
20526
 
20379
20527
  /**
20380
20528
  * Terrain store conversion, serialization, and parsing error variants.
20381
- * @enum {0 | 1 | 2 | 3 | 4 | 5}
20529
+ * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6}
20382
20530
  */
20383
20531
  const TerrainStoreError = Object.freeze({
20384
20532
  /**
@@ -20405,6 +20553,10 @@ const TerrainStoreError = Object.freeze({
20405
20553
  * A tile payload checksum did not match its index record.
20406
20554
  */
20407
20555
  Checksum: 5, "5": "Checksum",
20556
+ /**
20557
+ * A caller-attested full-store checksum did not match the bytes opened.
20558
+ */
20559
+ AttestedChecksumMismatch: 6, "6": "AttestedChecksumMismatch",
20408
20560
  });
20409
20561
  exports.TerrainStoreError = TerrainStoreError;
20410
20562
 
@@ -32575,3 +32727,49 @@ const wasmModule = new WebAssembly.Module(wasmBytes);
32575
32727
  let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
32576
32728
  let wasm = wasmInstance.exports;
32577
32729
  wasm.__wbindgen_start();
32730
+
32731
+ /* sidereon Node path-open adapters */
32732
+ const __sidereonMaxU64 = 0xffff_ffff_ffff_ffffn;
32733
+ const __mmapTerrainFromBytesAttested = MmapTerrain.__fromBytesAttested;
32734
+ const __preciseInterpolantFromBytesAttested = PreciseInterpolantArtifact.__fromBytesAttested;
32735
+
32736
+ function __sidereonClaimedChecksum64(value) {
32737
+ if (typeof value !== 'bigint') {
32738
+ throw new TypeError('claimedChecksum64 must be a bigint');
32739
+ }
32740
+ if (value < 0n || value > __sidereonMaxU64) {
32741
+ throw new RangeError('claimedChecksum64 must be between 0n and 18446744073709551615n');
32742
+ }
32743
+ return value;
32744
+ }
32745
+
32746
+ function __sidereonReadArtifactPath(path) {
32747
+ try {
32748
+ return require('fs').readFileSync(path);
32749
+ } catch (cause) {
32750
+ const reason = cause instanceof Error ? cause.message : String(cause);
32751
+ const message = `${path} failed: ${reason}`;
32752
+ const error = new Error(message);
32753
+ error.name = 'Io';
32754
+ error.kind = 'Io';
32755
+ error.detail = { name: 'Io', message, path: String(path) };
32756
+ throw error;
32757
+ }
32758
+ }
32759
+
32760
+ MmapTerrain.fromPath = function(path) {
32761
+ return MmapTerrain.fromBytes(__sidereonReadArtifactPath(path));
32762
+ };
32763
+ MmapTerrain.fromPathAttested = function(path, claimedChecksum64) {
32764
+ const claim = __sidereonClaimedChecksum64(claimedChecksum64);
32765
+ return __mmapTerrainFromBytesAttested(__sidereonReadArtifactPath(path), claim);
32766
+ };
32767
+ PreciseInterpolantArtifact.fromPath = function(path) {
32768
+ return openPreciseInterpolantArtifact(__sidereonReadArtifactPath(path));
32769
+ };
32770
+ PreciseInterpolantArtifact.fromPathAttested = function(path, claimedChecksum64) {
32771
+ const claim = __sidereonClaimedChecksum64(claimedChecksum64);
32772
+ return __preciseInterpolantFromBytesAttested(__sidereonReadArtifactPath(path), claim);
32773
+ };
32774
+ delete MmapTerrain.__fromBytesAttested;
32775
+ delete PreciseInterpolantArtifact.__fromBytesAttested;
Binary file