space-data-module-sdk 0.4.1 → 0.5.3

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/README.md CHANGED
@@ -12,7 +12,7 @@ This repository is the source of truth for module-level concerns:
12
12
  - standards-aware compliance and capability validation
13
13
  - module compilation and protection
14
14
  - the `sds.bundle` single-file custom section
15
- - deployment authorization and encrypted transport envelopes
15
+ - deployment authorization plus SDS publication records (`REC`, `PNM`, `ENC`)
16
16
  - the first canonical module hostcall/import ABI surface
17
17
 
18
18
  <p align="center">
@@ -36,9 +36,11 @@ A module built with this SDK is a `.wasm` artifact with:
36
36
  - manifest bytes
37
37
  - resolved deployment plans and input bindings
38
38
  - deployment authorization
39
- - detached signatures
40
- - encrypted transport envelopes
41
39
  - auxiliary FlatBuffer or raw payloads
40
+ - optional appended SDS `REC` publication trailers carrying:
41
+ - `PNM` digital-signature/publication metadata
42
+ - `ENC` encrypted-delivery metadata
43
+ - auxiliary FlatBuffer or raw payloads
42
44
 
43
45
  The module contract stays the same whether the artifact is loaded directly,
44
46
  wrapped in a deployment envelope, or shipped as one bundled `.wasm` file.
@@ -240,8 +242,11 @@ The full contract split is documented in
240
242
  ## Single-File Bundles
241
243
 
242
244
  `sds.bundle` keeps module delivery to one file without changing WebAssembly
243
- loadability. The SDK appends a standard custom section, not raw trailer bytes,
244
- so the bundled artifact still compiles as a normal `.wasm` module.
245
+ loadability for the runtime payload itself. The SDK writes the bundle as a
246
+ standard custom section inside the wasm module and, when the artifact is
247
+ signed or encrypted for publication, appends an SDS `REC` trailer after the
248
+ wasm bytes. Loaders must scan and strip that trailer before handing bytes to a
249
+ runtime such as WasmEdge.
245
250
 
246
251
  The reference path lives in
247
252
  [`examples/single-file-bundle`](./examples/single-file-bundle):
@@ -263,8 +268,9 @@ publication descriptor. That descriptor covers:
263
268
 
264
269
  - standalone module packages
265
270
  - attached module artifacts shipped inside another language library
266
- - discovery of bundled wasm, sidecar signatures, and encrypted transport
267
- FlatBuffers
271
+ - discovery of bundled wasm
272
+ - appended `REC` trailers carrying `PNM` and optional `ENC`
273
+ - sidecar `PNM` / `ENC` FlatBuffers when a package does not embed the trailer
268
274
 
269
275
  The full standard is in
270
276
  [`docs/module-publication-standard.md`](./docs/module-publication-standard.md),
@@ -280,8 +286,10 @@ For npm packages, the simplest form is:
280
286
  }
281
287
  ```
282
288
 
283
- When signature or transport metadata is published in the same file, it belongs
284
- inside `sds.bundle`, not as raw bytes after the end of the wasm binary.
289
+ When publication metadata is published in the same file, it belongs in an
290
+ appended SDS `REC` trailer. Loaders scan from the end of the protected blob,
291
+ resolve `PNM` / `ENC`, strip or decrypt as needed, and only then instantiate
292
+ the remaining raw wasm bytes.
285
293
 
286
294
  ## Host ABI
287
295
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "space-data-module-sdk",
3
- "version": "0.4.1",
3
+ "version": "0.5.3",
4
4
  "description": "Module SDK for building, validating, signing, and deploying WebAssembly modules on the Space Data Network.",
5
5
  "type": "module",
6
6
  "types": "./src/index.d.ts",
@@ -12,8 +12,16 @@
12
12
  "space-data-module": "bin/space-data-module.js"
13
13
  },
14
14
  "exports": {
15
- ".": "./src/index.js",
16
- "./manifest": "./src/manifest/index.js",
15
+ ".": {
16
+ "browser": "./src/browser.js",
17
+ "default": "./src/index.js"
18
+ },
19
+ "./manifest": {
20
+ "browser": "./src/manifest/browser.js",
21
+ "default": "./src/manifest/index.js"
22
+ },
23
+ "./embedded-manifest": "./src/embeddedManifest.js",
24
+ "./capabilities": "./src/capabilities.js",
17
25
  "./compliance": "./src/compliance/index.js",
18
26
  "./auth": "./src/auth/index.js",
19
27
  "./transport": "./src/transport/index.js",
@@ -46,7 +54,7 @@
46
54
  "flatbuffers": "^25.9.23",
47
55
  "hd-wallet-wasm": "1.6.0",
48
56
  "sdn-emception": "1.0.0",
49
- "spacedatastandards.org": "23.3.3-0.3.4"
57
+ "spacedatastandards.org": "git+https://github.com/DigitalArsenal/spacedatastandards.org.git#09af351a1"
50
58
  },
51
59
  "devDependencies": {
52
60
  "express": "^4.21.2",
package/src/browser.js ADDED
@@ -0,0 +1,8 @@
1
+ export * from "./manifest/browser.js";
2
+ export * from "./auth/index.js";
3
+ export * from "./transport/index.js";
4
+ export * from "./bundle/index.js";
5
+ export * from "./capabilities.js";
6
+ export * from "./deployment/index.js";
7
+ export * from "./invoke/index.js";
8
+ export * from "./runtime/index.js";
@@ -20,6 +20,7 @@ import {
20
20
  moduleBundleEncodingToName,
21
21
  moduleBundleRoleToName,
22
22
  } from "./codec.js";
23
+ import { extractPublicationRecordCollection } from "../transport/records.js";
23
24
 
24
25
  const textDecoder = new TextDecoder();
25
26
  const textEncoder = new TextEncoder();
@@ -86,7 +87,11 @@ export function decodeUnsignedLeb128(bytes, offset = 0) {
86
87
  }
87
88
 
88
89
  export function parseWasmModuleSections(bytes) {
89
- const wasmBytes = normalizeBytes(bytes, "wasm bytes");
90
+ const protectedArtifact = extractPublicationRecordCollection(bytes);
91
+ const wasmBytes = normalizeBytes(
92
+ protectedArtifact?.payloadBytes ?? bytes,
93
+ "wasm bytes",
94
+ );
90
95
  if (wasmBytes.length < 8) {
91
96
  throw new Error("WASM module is truncated.");
92
97
  }
@@ -345,10 +350,12 @@ export async function computeCanonicalModuleHash(
345
350
  bytes,
346
351
  options = {},
347
352
  ) {
353
+ const protectedArtifact = extractPublicationRecordCollection(bytes);
354
+ const candidateBytes = protectedArtifact?.payloadBytes ?? bytes;
348
355
  const prefix = String(
349
356
  options.customSectionPrefix ?? SDS_CUSTOM_SECTION_PREFIX,
350
357
  );
351
- const canonicalWasmBytes = stripWasmCustomSections(bytes, (section) =>
358
+ const canonicalWasmBytes = stripWasmCustomSections(candidateBytes, (section) =>
352
359
  section.name.startsWith(prefix),
353
360
  );
354
361
  const hashBytes = await sha256Bytes(canonicalWasmBytes);
@@ -360,7 +367,11 @@ export async function computeCanonicalModuleHash(
360
367
  }
361
368
 
362
369
  export async function createSingleFileBundle(options = {}) {
363
- const wasmBytes = normalizeBytes(options.wasmBytes, "wasmBytes");
370
+ const protectedArtifact = extractPublicationRecordCollection(options.wasmBytes);
371
+ const wasmBytes = normalizeBytes(
372
+ protectedArtifact?.payloadBytes ?? options.wasmBytes,
373
+ "wasmBytes",
374
+ );
364
375
  const manifestBytes =
365
376
  options.manifestBytes !== undefined
366
377
  ? normalizeBytes(options.manifestBytes, "manifestBytes")
@@ -422,7 +433,11 @@ export async function createSingleFileBundle(options = {}) {
422
433
  }
423
434
 
424
435
  export async function parseSingleFileBundle(bytes, options = {}) {
425
- const wasmBytes = normalizeBytes(bytes, "wasm bytes");
436
+ const protectedArtifact = extractPublicationRecordCollection(bytes);
437
+ const wasmBytes = normalizeBytes(
438
+ protectedArtifact?.payloadBytes ?? bytes,
439
+ "wasm bytes",
440
+ );
426
441
  const customSections = listWasmCustomSections(wasmBytes);
427
442
  const bundleSectionName = String(
428
443
  options.bundleSectionName ?? SDS_BUNDLE_SECTION_NAME,
@@ -462,6 +477,8 @@ export async function parseSingleFileBundle(bytes, options = {}) {
462
477
  ) ?? null;
463
478
  return {
464
479
  wasmBytes,
480
+ protectedArtifactBytes: protectedArtifact?.protectedBytes ?? null,
481
+ publicationRecords: protectedArtifact ?? null,
465
482
  bundleBytes,
466
483
  bundle,
467
484
  entries: parsedEntries,
@@ -0,0 +1,46 @@
1
+ export const RecommendedCapabilityIds = Object.freeze([
2
+ "clock",
3
+ "random",
4
+ "logging",
5
+ "timers",
6
+ "schedule_cron",
7
+ "http",
8
+ "tls",
9
+ "websocket",
10
+ "mqtt",
11
+ "tcp",
12
+ "udp",
13
+ "network",
14
+ "filesystem",
15
+ "pipe",
16
+ "pubsub",
17
+ "protocol_handle",
18
+ "protocol_dial",
19
+ "database",
20
+ "storage_adapter",
21
+ "storage_query",
22
+ "storage_write",
23
+ "context_read",
24
+ "context_write",
25
+ "process_exec",
26
+ "crypto_hash",
27
+ "crypto_sign",
28
+ "crypto_verify",
29
+ "crypto_encrypt",
30
+ "crypto_decrypt",
31
+ "crypto_key_agreement",
32
+ "crypto_kdf",
33
+ "wallet_sign",
34
+ "ipfs",
35
+ "scene_access",
36
+ "entity_access",
37
+ "render_hooks",
38
+ ]);
39
+
40
+ export const StandaloneWasiCapabilityIds = Object.freeze([
41
+ "logging",
42
+ "clock",
43
+ "random",
44
+ "filesystem",
45
+ "pipe",
46
+ ]);
@@ -26,7 +26,12 @@ import { runWithEmceptionLock } from "./emceptionNode.js";
26
26
  import { encodePluginManifest, toEmbeddedPluginManifest } from "../manifest/index.js";
27
27
  import { DefaultInvokeExports, InvokeSurface } from "../runtime/constants.js";
28
28
  import {
29
- encryptJsonForRecipient,
29
+ appendPublicationRecordCollection,
30
+ createEncryptedEnvelopePayload,
31
+ createPublicationNotice,
32
+ encodePublicationRecordCollection,
33
+ encryptBytesForRecipient,
34
+ extractPublicationRecordCollection,
30
35
  generateX25519Keypair,
31
36
  } from "../transport/index.js";
32
37
  import { createSingleFileBundle } from "../bundle/index.js";
@@ -642,15 +647,6 @@ export async function protectModuleArtifact(options = {}) {
642
647
  authorization: signedAuthorization,
643
648
  };
644
649
 
645
- let encryptedEnvelope = null;
646
- if (options.recipientPublicKeyHex) {
647
- encryptedEnvelope = await encryptJsonForRecipient({
648
- payload,
649
- recipientPublicKey: hexToBytes(options.recipientPublicKeyHex),
650
- context: "space-data-module-sdk/package",
651
- });
652
- }
653
-
654
650
  let singleFileBundle = null;
655
651
  if (options.singleFileBundle === true) {
656
652
  const additionalEntries = [
@@ -661,20 +657,90 @@ export async function protectModuleArtifact(options = {}) {
661
657
  wasmBytes,
662
658
  manifest,
663
659
  authorization: signedAuthorization,
664
- transportEnvelope: encryptedEnvelope,
665
660
  entries: additionalEntries,
666
661
  });
667
662
  }
668
663
 
664
+ const bundleBytes = singleFileBundle?.wasmBytes ?? wasmBytes;
665
+ let publicationNotice = null;
666
+ let publicationRecordsBytes = null;
667
+ let protectedArtifactBytes = null;
668
+ let encryptedEnvelope = null;
669
+
670
+ if (options.recipientPublicKeyHex) {
671
+ const encryptedBase = await encryptBytesForRecipient({
672
+ plaintext: bundleBytes,
673
+ recipientPublicKey: hexToBytes(options.recipientPublicKeyHex),
674
+ context: "space-data-module-sdk/package",
675
+ rootType: "WASM",
676
+ });
677
+ const encryptedBaseBytes = base64ToBytes(encryptedBase.protectedBlobBase64);
678
+ const parsedEncryptedBase = extractPublicationRecordCollection(encryptedBaseBytes);
679
+ publicationNotice = await createPublicationNotice({
680
+ payloadBytes: parsedEncryptedBase.payloadBytes,
681
+ artifactId,
682
+ programId,
683
+ fileName: `${artifactId}.wasm`,
684
+ fileId: programId,
685
+ signer,
686
+ });
687
+ publicationRecordsBytes = encodePublicationRecordCollection({
688
+ enc: parsedEncryptedBase.enc,
689
+ pnm: publicationNotice,
690
+ });
691
+ protectedArtifactBytes = appendPublicationRecordCollection(
692
+ parsedEncryptedBase.payloadBytes,
693
+ publicationRecordsBytes,
694
+ );
695
+ encryptedEnvelope = createEncryptedEnvelopePayload({
696
+ protectedBlobBytes: protectedArtifactBytes,
697
+ parsedProtectedBlob: {
698
+ payloadBytes: parsedEncryptedBase.payloadBytes,
699
+ recordCollectionBytes: publicationRecordsBytes,
700
+ enc: parsedEncryptedBase.enc,
701
+ pnm: publicationNotice,
702
+ },
703
+ enc: parsedEncryptedBase.enc,
704
+ context: parsedEncryptedBase.enc?.context,
705
+ });
706
+ } else {
707
+ publicationNotice = await createPublicationNotice({
708
+ payloadBytes: bundleBytes,
709
+ artifactId,
710
+ programId,
711
+ fileName: `${artifactId}.wasm`,
712
+ fileId: programId,
713
+ signer,
714
+ });
715
+ publicationRecordsBytes = encodePublicationRecordCollection({
716
+ pnm: publicationNotice,
717
+ });
718
+ protectedArtifactBytes = appendPublicationRecordCollection(
719
+ bundleBytes,
720
+ publicationRecordsBytes,
721
+ );
722
+ }
723
+
724
+ if (singleFileBundle) {
725
+ singleFileBundle = {
726
+ ...singleFileBundle,
727
+ wasmBytes: protectedArtifactBytes,
728
+ };
729
+ }
730
+
669
731
  return {
670
732
  mnemonic: identity.mnemonic,
671
733
  signingPublicKeyHex: bytesToHex(identity.signingKey.publicKey),
672
734
  signingPath: identity.signingKey.path,
673
735
  payload,
674
- encrypted: Boolean(encryptedEnvelope),
736
+ publicationNotice,
737
+ publicationRecordsBytes,
738
+ protectedArtifactBytes,
739
+ protectedArtifactBase64: bytesToBase64(protectedArtifactBytes),
740
+ encrypted: Boolean(options.recipientPublicKeyHex),
675
741
  encryptedEnvelope,
676
742
  singleFileBundle,
677
- bundledWasmBytes: singleFileBundle?.wasmBytes ?? null,
743
+ bundledWasmBytes: singleFileBundle?.wasmBytes ?? protectedArtifactBytes,
678
744
  };
679
745
  }
680
746
 
@@ -4,12 +4,14 @@ import {
4
4
  getWasmExportNamesFromFile,
5
5
  loadManifestFromFile,
6
6
  loadComplianceConfig,
7
- RecommendedCapabilityIds,
8
- StandaloneWasiCapabilityIds,
9
7
  resolveManifestFiles,
10
8
  validatePluginArtifact,
11
9
  validatePluginManifest,
12
10
  } from "./pluginCompliance.js";
11
+ import {
12
+ RecommendedCapabilityIds,
13
+ StandaloneWasiCapabilityIds,
14
+ } from "../capabilities.js";
13
15
  import { validateManifestAgainstStandardsCatalog } from "../standards/index.js";
14
16
 
15
17
  function mergeReport(baseReport, issues) {
@@ -12,53 +12,10 @@ import {
12
12
  ProtocolTransportKind,
13
13
  RuntimeTarget,
14
14
  } from "../runtime/constants.js";
15
-
16
- export const RecommendedCapabilityIds = Object.freeze([
17
- "clock",
18
- "random",
19
- "logging",
20
- "timers",
21
- "schedule_cron",
22
- "http",
23
- "tls",
24
- "websocket",
25
- "mqtt",
26
- "tcp",
27
- "udp",
28
- "network",
29
- "filesystem",
30
- "pipe",
31
- "pubsub",
32
- "protocol_handle",
33
- "protocol_dial",
34
- "database",
35
- "storage_adapter",
36
- "storage_query",
37
- "storage_write",
38
- "context_read",
39
- "context_write",
40
- "process_exec",
41
- "crypto_hash",
42
- "crypto_sign",
43
- "crypto_verify",
44
- "crypto_encrypt",
45
- "crypto_decrypt",
46
- "crypto_key_agreement",
47
- "crypto_kdf",
48
- "wallet_sign",
49
- "ipfs",
50
- "scene_access",
51
- "entity_access",
52
- "render_hooks",
53
- ]);
54
-
55
- export const StandaloneWasiCapabilityIds = Object.freeze([
56
- "logging",
57
- "clock",
58
- "random",
59
- "filesystem",
60
- "pipe",
61
- ]);
15
+ import {
16
+ RecommendedCapabilityIds,
17
+ StandaloneWasiCapabilityIds,
18
+ } from "../capabilities.js";
62
19
 
63
20
  const RecommendedCapabilitySet = new Set(RecommendedCapabilityIds);
64
21
  const StandaloneWasiCapabilitySet = new Set(StandaloneWasiCapabilityIds);
package/src/index.d.ts CHANGED
@@ -380,14 +380,69 @@ export interface X25519Keypair {
380
380
  privateKey: Uint8Array;
381
381
  }
382
382
 
383
+ export interface EncRecord {
384
+ version: number;
385
+ keyExchange: string;
386
+ symmetric: string;
387
+ keyDerivation: string;
388
+ ephemeralPublicKey: Uint8Array | null;
389
+ nonceStart: Uint8Array | null;
390
+ recipientKeyId: Uint8Array | null;
391
+ context: string | null;
392
+ schemaHash: Uint8Array | null;
393
+ rootType: string | null;
394
+ timestamp: number;
395
+ }
396
+
397
+ export interface PublicationNotice {
398
+ multiformatAddress: string | null;
399
+ publishTimestamp: string | null;
400
+ cid: string | null;
401
+ fileName: string | null;
402
+ fileId: string | null;
403
+ signature: string | null;
404
+ timestampSignature: string | null;
405
+ signatureType: string | null;
406
+ timestampSignatureType: string | null;
407
+ }
408
+
409
+ export interface PublicationRecordEntry {
410
+ standard: string | null;
411
+ recordType: number;
412
+ value: EncRecord | PublicationNotice | unknown;
413
+ }
414
+
415
+ export interface PublicationRecordCollection {
416
+ version: string;
417
+ records: PublicationRecordEntry[];
418
+ enc: EncRecord | null;
419
+ pnm: PublicationNotice | null;
420
+ recordCollectionBytes: Uint8Array;
421
+ }
422
+
423
+ export interface ExtractedPublicationRecordCollection
424
+ extends PublicationRecordCollection {
425
+ payloadBytes: Uint8Array;
426
+ protectedBytes: Uint8Array;
427
+ footerBytes: Uint8Array;
428
+ footerMagic: string;
429
+ recordCollectionLength: number;
430
+ }
431
+
383
432
  export interface EncryptedEnvelope {
384
433
  version: number;
385
434
  scheme: string;
386
435
  context: string;
387
- senderPublicKeyBase64: string;
388
- saltBase64: string;
389
- ivBase64: string;
390
- ciphertextBase64: string;
436
+ protectedBlobBase64?: string | null;
437
+ recordCollectionBase64?: string | null;
438
+ ciphertextBase64?: string | null;
439
+ senderPublicKeyBase64?: string | null;
440
+ nonceStartBase64?: string | null;
441
+ recipientKeyIdBase64?: string | null;
442
+ encRecordBase64?: string | null;
443
+ pnmRecordBase64?: string | null;
444
+ saltBase64?: string | null;
445
+ ivBase64?: string | null;
391
446
  }
392
447
 
393
448
  export function generateX25519Keypair(): Promise<X25519Keypair>;
@@ -397,8 +452,16 @@ export function encryptBytesForRecipient(options: {
397
452
  recipientPublicKey: Uint8Array | string;
398
453
  context?: string;
399
454
  senderKeyPair?: X25519Keypair;
455
+ recipientKeyId?: Uint8Array | ArrayBuffer | string | null;
456
+ schemaHash?: Uint8Array | ArrayBuffer | string | null;
457
+ rootType?: string | null;
400
458
  }): Promise<EncryptedEnvelope>;
401
459
 
460
+ export function decryptProtectedBytes(options: {
461
+ protectedBytes: Uint8Array | ArrayBuffer;
462
+ recipientPrivateKey: Uint8Array | string;
463
+ }): Promise<Uint8Array>;
464
+
402
465
  export function decryptBytesFromEnvelope(options: {
403
466
  envelope: EncryptedEnvelope;
404
467
  recipientPrivateKey: Uint8Array | string;
@@ -416,6 +479,78 @@ export function decryptJsonFromEnvelope(options: {
416
479
  recipientPrivateKey: Uint8Array | string;
417
480
  }): Promise<unknown>;
418
481
 
482
+ export function decryptPublicationRecordCollection(options: {
483
+ protectedBytes: Uint8Array | ArrayBuffer;
484
+ recipientPrivateKey: Uint8Array | string;
485
+ }): Promise<{
486
+ payloadBytes: Uint8Array;
487
+ decryptedBytes: Uint8Array;
488
+ publication: ExtractedPublicationRecordCollection | null;
489
+ }>;
490
+
491
+ export const TRAILER_MAGIC_TEXT: string;
492
+ export const TRAILER_FOOTER_LENGTH: number;
493
+
494
+ export function createCidV1Raw(
495
+ payloadBytes: Uint8Array | ArrayBuffer,
496
+ ): Promise<string>;
497
+
498
+ export function encodeEncRecord(record?: Partial<EncRecord>): Uint8Array;
499
+ export function decodeEncRecord(
500
+ bytes: Uint8Array | ArrayBuffer | ArrayBufferView,
501
+ ): EncRecord;
502
+ export function encodePnmRecord(
503
+ record?: Partial<PublicationNotice>,
504
+ ): Uint8Array;
505
+ export function decodePnmRecord(
506
+ bytes: Uint8Array | ArrayBuffer | ArrayBufferView,
507
+ ): PublicationNotice;
508
+ export function encodePublicationRecordCollection(options: {
509
+ version?: string;
510
+ enc?: Partial<EncRecord> | null;
511
+ pnm?: Partial<PublicationNotice> | null;
512
+ }): Uint8Array;
513
+ export function decodePublicationRecordCollection(
514
+ bytes: Uint8Array | ArrayBuffer | ArrayBufferView,
515
+ ): PublicationRecordCollection;
516
+ export function appendPublicationRecordCollection(
517
+ payloadBytes: Uint8Array | ArrayBuffer,
518
+ recordCollectionBytes: Uint8Array | ArrayBuffer,
519
+ ): Uint8Array;
520
+ export function extractPublicationRecordCollection(
521
+ bytes: Uint8Array | ArrayBuffer | ArrayBufferView,
522
+ ): ExtractedPublicationRecordCollection | null;
523
+ export function stripPublicationRecordCollection(
524
+ bytes: Uint8Array | ArrayBuffer | ArrayBufferView,
525
+ ): Uint8Array;
526
+ export function createPublicationNotice(options: {
527
+ payloadBytes: Uint8Array | ArrayBuffer;
528
+ cid?: string | null;
529
+ publishTimestamp?: string | null;
530
+ publishTimestampMs?: number;
531
+ fileName?: string | null;
532
+ fileId?: string | null;
533
+ artifactId?: string | null;
534
+ programId?: string | null;
535
+ multiformatAddress?: string | null;
536
+ signature?: string | null;
537
+ timestampSignature?: string | null;
538
+ signatureType?: string | null;
539
+ timestampSignatureType?: string | null;
540
+ signer?: Signer | null;
541
+ }): Promise<PublicationNotice>;
542
+ export function createEncryptedEnvelopePayload(options: {
543
+ protectedBlobBytes: Uint8Array | ArrayBuffer;
544
+ parsedProtectedBlob?: ExtractedPublicationRecordCollection | null;
545
+ enc?: EncRecord | null;
546
+ context?: string | null;
547
+ scheme?: string | null;
548
+ version?: number;
549
+ }): EncryptedEnvelope;
550
+ export function decodeProtectedBlobBase64(
551
+ base64: string,
552
+ ): ExtractedPublicationRecordCollection | null;
553
+
419
554
  // --- Compiler ---
420
555
 
421
556
  export interface CompilationResult {
@@ -453,6 +588,10 @@ export interface ProtectedArtifact {
453
588
  manifestHashHex: string;
454
589
  authorization: SignedEnvelope;
455
590
  };
591
+ publicationNotice: PublicationNotice | null;
592
+ publicationRecordsBytes: Uint8Array | null;
593
+ protectedArtifactBytes: Uint8Array;
594
+ protectedArtifactBase64: string;
456
595
  encrypted: boolean;
457
596
  encryptedEnvelope: EncryptedEnvelope | null;
458
597
  singleFileBundle: { wasmBytes: Uint8Array } | null;
@@ -591,9 +730,24 @@ export function createSingleFileBundle(options: {
591
730
  entries?: Array<Record<string, unknown>>;
592
731
  }): Promise<{ wasmBytes: Uint8Array }>;
593
732
 
733
+ export interface ParsedSingleFileBundle {
734
+ wasmBytes: Uint8Array;
735
+ protectedArtifactBytes: Uint8Array | null;
736
+ publicationRecords: ExtractedPublicationRecordCollection | null;
737
+ bundleBytes: Uint8Array;
738
+ bundle: unknown;
739
+ entries: Array<Record<string, unknown>>;
740
+ manifest: PluginManifest | null;
741
+ deploymentPlan: ModuleDeploymentPlan | null;
742
+ customSections: Array<Record<string, unknown>>;
743
+ canonicalWasmBytes: Uint8Array;
744
+ canonicalModuleHash: Uint8Array;
745
+ canonicalModuleHashHex: string;
746
+ }
747
+
594
748
  export function parseSingleFileBundle(
595
749
  wasmBytes: Uint8Array,
596
- ): unknown;
750
+ ): Promise<ParsedSingleFileBundle>;
597
751
 
598
752
  export function parseWasmModuleSections(
599
753
  bytes: Uint8Array,
package/src/index.js CHANGED
@@ -4,6 +4,7 @@ export * from "./auth/index.js";
4
4
  export * from "./transport/index.js";
5
5
  export * from "./compiler/index.js";
6
6
  export * from "./bundle/index.js";
7
+ export * from "./capabilities.js";
7
8
  export * from "./standards/index.js";
8
9
  export * from "./host/index.js";
9
10
  export * from "./invoke/index.js";
@@ -0,0 +1,15 @@
1
+ export * from "../generated/orbpro/manifest.js";
2
+ export { PayloadWireFormat } from "../generated/orbpro/stream/payload-wire-format.js";
3
+ export {
4
+ FlatBufferTypeRefT,
5
+ FlatBufferTypeRefT as PayloadTypeRef,
6
+ } from "../generated/orbpro/stream/flat-buffer-type-ref.js";
7
+ export { decodePluginManifest, encodePluginManifest } from "./codec.js";
8
+ export { toEmbeddedPluginManifest } from "./normalize.js";
9
+ export {
10
+ clonePayloadTypeRef,
11
+ getPayloadTypeWireFormat,
12
+ normalizePayloadWireFormatName,
13
+ payloadTypeRefsMatch,
14
+ selectPreferredPayloadTypeRef,
15
+ } from "./typeRefs.js";
@@ -1,4 +1,6 @@
1
1
  export {
2
+ decryptProtectedBytes,
3
+ decryptPublicationRecordCollection,
2
4
  decryptBytesFromEnvelope,
3
5
  decryptJsonFromEnvelope,
4
6
  encryptBytesForRecipient,
@@ -6,3 +8,20 @@ export {
6
8
  generateX25519Keypair,
7
9
  } from "./pki.js";
8
10
 
11
+ export {
12
+ appendPublicationRecordCollection,
13
+ createCidV1Raw,
14
+ createEncryptedEnvelopePayload,
15
+ createPublicationNotice,
16
+ decodeEncRecord,
17
+ decodePnmRecord,
18
+ decodeProtectedBlobBase64,
19
+ decodePublicationRecordCollection,
20
+ encodeEncRecord,
21
+ encodePnmRecord,
22
+ encodePublicationRecordCollection,
23
+ extractPublicationRecordCollection,
24
+ stripPublicationRecordCollection,
25
+ TRAILER_FOOTER_LENGTH,
26
+ TRAILER_MAGIC_TEXT,
27
+ } from "./records.js";