space-data-module-sdk 0.6.1 → 0.8.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/README.md +16 -23
- package/bin/space-data-module.js +5 -3
- package/package.json +6 -2
- package/src/AGENTS.md +1 -1
- package/src/browser.js +1 -0
- package/src/bundle/AGENTS.md +6 -5
- package/src/bundle/codec.js +163 -48
- package/src/bundle/constants.js +1 -1
- package/src/bundle/wasm.js +22 -23
- package/src/compiler/compileModule.js +9 -1
- package/src/index.d.ts +189 -1
- package/src/index.js +1 -0
- package/src/licensing/index.d.ts +20 -0
- package/src/licensing/index.js +11 -0
- package/src/licensing/records.js +858 -0
- package/src/transport/records.js +34 -3
- package/schemas/ModuleBundle.fbs +0 -108
- package/src/generated/orbpro/module/canonicalization-rule.d.ts +0 -48
- package/src/generated/orbpro/module/canonicalization-rule.js +0 -95
- package/src/generated/orbpro/module/canonicalization-rule.ts +0 -142
- package/src/generated/orbpro/module/module-bundle-entry-role.d.ts +0 -11
- package/src/generated/orbpro/module/module-bundle-entry-role.js +0 -14
- package/src/generated/orbpro/module/module-bundle-entry-role.ts +0 -15
- package/src/generated/orbpro/module/module-bundle-entry.d.ts +0 -97
- package/src/generated/orbpro/module/module-bundle-entry.js +0 -219
- package/src/generated/orbpro/module/module-bundle-entry.ts +0 -287
- package/src/generated/orbpro/module/module-bundle.d.ts +0 -86
- package/src/generated/orbpro/module/module-bundle.js +0 -213
- package/src/generated/orbpro/module/module-bundle.ts +0 -277
- package/src/generated/orbpro/module/module-payload-encoding.d.ts +0 -9
- package/src/generated/orbpro/module/module-payload-encoding.js +0 -12
- package/src/generated/orbpro/module/module-payload-encoding.ts +0 -13
- package/src/generated/orbpro/module.d.ts +0 -5
- package/src/generated/orbpro/module.js +0 -7
- package/src/generated/orbpro/module.ts +0 -9
package/src/transport/records.js
CHANGED
|
@@ -7,10 +7,16 @@ import {
|
|
|
7
7
|
KeyExchange,
|
|
8
8
|
SymmetricAlgo,
|
|
9
9
|
} from "spacedatastandards.org/lib/js/ENC/main.js";
|
|
10
|
+
import { MBL } from "spacedatastandards.org/lib/js/MBL/main.js";
|
|
10
11
|
import { PNM, PNMT } from "spacedatastandards.org/lib/js/PNM/main.js";
|
|
11
12
|
import { REC, RECT } from "spacedatastandards.org/lib/js/REC/REC.js";
|
|
12
13
|
import { Record, RecordT } from "spacedatastandards.org/lib/js/REC/Record.js";
|
|
13
14
|
import { RecordType } from "spacedatastandards.org/lib/js/REC/RecordType.js";
|
|
15
|
+
import {
|
|
16
|
+
decodeModuleBundleTable,
|
|
17
|
+
encodeModuleBundle,
|
|
18
|
+
moduleBundleTableFromObject,
|
|
19
|
+
} from "../bundle/codec.js";
|
|
14
20
|
|
|
15
21
|
import {
|
|
16
22
|
base64ToBytes,
|
|
@@ -51,6 +57,7 @@ const KDF_NAME_BY_VALUE = Object.freeze(
|
|
|
51
57
|
),
|
|
52
58
|
);
|
|
53
59
|
const RECORD_TYPE_BY_STANDARD = Object.freeze({
|
|
60
|
+
MBL: RecordType.MBL,
|
|
54
61
|
ENC: RecordType.ENC,
|
|
55
62
|
PNM: RecordType.PNM,
|
|
56
63
|
});
|
|
@@ -567,6 +574,15 @@ export function decodePnmRecord(bytes) {
|
|
|
567
574
|
|
|
568
575
|
export function encodePublicationRecordCollection(options = {}) {
|
|
569
576
|
const records = [];
|
|
577
|
+
if (options.mbl) {
|
|
578
|
+
records.push(
|
|
579
|
+
new RecordT(
|
|
580
|
+
RECORD_TYPE_BY_STANDARD.MBL,
|
|
581
|
+
moduleBundleTableFromObject(options.mbl),
|
|
582
|
+
"MBL",
|
|
583
|
+
),
|
|
584
|
+
);
|
|
585
|
+
}
|
|
570
586
|
if (options.enc) {
|
|
571
587
|
records.push(new RecordT(RECORD_TYPE_BY_STANDARD.ENC, encTableFromObject(options.enc), "ENC"));
|
|
572
588
|
}
|
|
@@ -574,9 +590,9 @@ export function encodePublicationRecordCollection(options = {}) {
|
|
|
574
590
|
records.push(new RecordT(RECORD_TYPE_BY_STANDARD.PNM, pnmTableFromObject(options.pnm), "PNM"));
|
|
575
591
|
}
|
|
576
592
|
if (records.length === 0) {
|
|
577
|
-
throw new Error("At least one ENC or PNM record is required.");
|
|
593
|
+
throw new Error("At least one MBL, ENC, or PNM record is required.");
|
|
578
594
|
}
|
|
579
|
-
const builder = new flatbuffers.Builder(
|
|
595
|
+
const builder = new flatbuffers.Builder(1024);
|
|
580
596
|
const root = new RECT(
|
|
581
597
|
normalizeStringField(options.version) ?? DEFAULT_RECORD_COLLECTION_VERSION,
|
|
582
598
|
records,
|
|
@@ -606,6 +622,8 @@ export function decodePublicationRecordCollection(bytes) {
|
|
|
606
622
|
throw new Error("REC trailer does not contain any records.");
|
|
607
623
|
}
|
|
608
624
|
const records = [];
|
|
625
|
+
let mbl = null;
|
|
626
|
+
let mblBytes = null;
|
|
609
627
|
let enc = null;
|
|
610
628
|
let pnm = null;
|
|
611
629
|
for (let index = 0; index < recordTables.length; index += 1) {
|
|
@@ -647,7 +665,18 @@ export function decodePublicationRecordCollection(bytes) {
|
|
|
647
665
|
throw new Error(`REC trailer record ${index} is missing a value.`);
|
|
648
666
|
}
|
|
649
667
|
let value = null;
|
|
650
|
-
if (standard === "
|
|
668
|
+
if (standard === "MBL") {
|
|
669
|
+
const mblTable = recordTable.value(new MBL());
|
|
670
|
+
if (!mblTable) {
|
|
671
|
+
throw new Error(`REC trailer record ${index} MBL payload is missing.`);
|
|
672
|
+
}
|
|
673
|
+
if (mbl) {
|
|
674
|
+
throw new Error("REC trailer contains multiple MBL records.");
|
|
675
|
+
}
|
|
676
|
+
mbl = decodeModuleBundleTable(mblTable);
|
|
677
|
+
mblBytes = encodeModuleBundle(mbl);
|
|
678
|
+
value = mbl;
|
|
679
|
+
} else if (standard === "ENC") {
|
|
651
680
|
const encTable = recordTable.value(new ENC());
|
|
652
681
|
if (!encTable) {
|
|
653
682
|
throw new Error(`REC trailer record ${index} ENC payload is missing.`);
|
|
@@ -687,6 +716,8 @@ export function decodePublicationRecordCollection(bytes) {
|
|
|
687
716
|
normalizeStringField(collectionTable.version()) ??
|
|
688
717
|
DEFAULT_RECORD_COLLECTION_VERSION,
|
|
689
718
|
records,
|
|
719
|
+
mbl,
|
|
720
|
+
mblBytes,
|
|
690
721
|
enc,
|
|
691
722
|
pnm,
|
|
692
723
|
recordCollectionBytes: buffer,
|
package/schemas/ModuleBundle.fbs
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
// Space Data Module SDK - Single-file Module Bundle Schema
|
|
2
|
-
//
|
|
3
|
-
// Draft schema for packaging a loadable WebAssembly module together with
|
|
4
|
-
// SDS-typed metadata inside one `sds.bundle` custom section.
|
|
5
|
-
|
|
6
|
-
include "TypedArenaBuffer.fbs";
|
|
7
|
-
|
|
8
|
-
namespace orbpro.module;
|
|
9
|
-
|
|
10
|
-
/// Logical role for one payload carried in the bundle.
|
|
11
|
-
enum ModuleBundleEntryRole : ubyte {
|
|
12
|
-
MANIFEST = 0,
|
|
13
|
-
AUTHORIZATION = 1,
|
|
14
|
-
SIGNATURE = 2,
|
|
15
|
-
TRANSPORT = 3,
|
|
16
|
-
ATTESTATION = 4,
|
|
17
|
-
AUXILIARY = 5
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/// Serialization format used by an entry payload.
|
|
21
|
-
enum ModulePayloadEncoding : ubyte {
|
|
22
|
-
RAW_BYTES = 0,
|
|
23
|
-
FLATBUFFER = 1,
|
|
24
|
-
JSON_UTF8 = 2,
|
|
25
|
-
CBOR = 3
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/// Canonicalization rule applied before hashing or signature verification.
|
|
29
|
-
table CanonicalizationRule {
|
|
30
|
-
/// Schema version for the canonicalization contract.
|
|
31
|
-
version: uint16 = 1;
|
|
32
|
-
|
|
33
|
-
/// Strip any custom section whose name starts with this prefix before
|
|
34
|
-
/// hashing the module for signature verification.
|
|
35
|
-
stripped_custom_section_prefix: string;
|
|
36
|
-
|
|
37
|
-
/// Name of the required root custom section carrying this bundle.
|
|
38
|
-
bundle_section_name: string;
|
|
39
|
-
|
|
40
|
-
/// Hash function identifier, for example `sha256`.
|
|
41
|
-
hash_algorithm: string;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/// One payload carried inside the bundle.
|
|
45
|
-
table ModuleBundleEntry {
|
|
46
|
-
/// Stable bundle-local identifier.
|
|
47
|
-
entry_id: string (required, key);
|
|
48
|
-
|
|
49
|
-
/// High-level semantic role of the payload.
|
|
50
|
-
role: ModuleBundleEntryRole = AUXILIARY;
|
|
51
|
-
|
|
52
|
-
/// Optional logical section name within the bundle, for example
|
|
53
|
-
/// `sds.authorization`.
|
|
54
|
-
section_name: string;
|
|
55
|
-
|
|
56
|
-
/// SDS/shared-module schema identity when the payload is itself a
|
|
57
|
-
/// FlatBuffer.
|
|
58
|
-
type_ref: orbpro.stream.FlatBufferTypeRef;
|
|
59
|
-
|
|
60
|
-
/// Encoding used for `payload`.
|
|
61
|
-
payload_encoding: ModulePayloadEncoding = RAW_BYTES;
|
|
62
|
-
|
|
63
|
-
/// Optional media type for transitional payloads such as JSON envelopes.
|
|
64
|
-
media_type: string;
|
|
65
|
-
|
|
66
|
-
/// Implementation-defined bit flags for signed/encrypted/compressed state.
|
|
67
|
-
flags: uint32 = 0;
|
|
68
|
-
|
|
69
|
-
/// SHA-256 of the payload bytes.
|
|
70
|
-
sha256: [ubyte];
|
|
71
|
-
|
|
72
|
-
/// Embedded payload bytes. For single-file deployment this should be
|
|
73
|
-
/// populated for every entry.
|
|
74
|
-
payload: [ubyte];
|
|
75
|
-
|
|
76
|
-
/// Human-readable description for tooling and diagnostics.
|
|
77
|
-
description: string;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/// Metadata stored in the required `sds.bundle` custom section.
|
|
81
|
-
table ModuleBundle {
|
|
82
|
-
/// Bundle schema version.
|
|
83
|
-
bundle_version: uint16 = 1;
|
|
84
|
-
|
|
85
|
-
/// Human-readable package format label.
|
|
86
|
-
module_format: string;
|
|
87
|
-
|
|
88
|
-
/// Canonicalization rule used to compute module hashes.
|
|
89
|
-
canonicalization: CanonicalizationRule;
|
|
90
|
-
|
|
91
|
-
/// SHA-256 of the wasm module after stripping `sds.*` custom sections.
|
|
92
|
-
canonical_module_hash: [ubyte];
|
|
93
|
-
|
|
94
|
-
/// SHA-256 of the canonical plugin manifest bytes.
|
|
95
|
-
manifest_hash: [ubyte];
|
|
96
|
-
|
|
97
|
-
/// Legacy ABI export retained for backward compatibility.
|
|
98
|
-
manifest_export_symbol: string;
|
|
99
|
-
|
|
100
|
-
/// Legacy ABI export retained for backward compatibility.
|
|
101
|
-
manifest_size_symbol: string;
|
|
102
|
-
|
|
103
|
-
/// Payloads embedded in the bundle.
|
|
104
|
-
entries: [ModuleBundleEntry];
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
root_type ModuleBundle;
|
|
108
|
-
file_identifier "SMDB";
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import * as flatbuffers from 'flatbuffers';
|
|
2
|
-
/**
|
|
3
|
-
* Canonicalization rule applied before hashing or signature verification.
|
|
4
|
-
*/
|
|
5
|
-
export declare class CanonicalizationRule implements flatbuffers.IUnpackableObject<CanonicalizationRuleT> {
|
|
6
|
-
bb: flatbuffers.ByteBuffer | null;
|
|
7
|
-
bb_pos: number;
|
|
8
|
-
__init(i: number, bb: flatbuffers.ByteBuffer): CanonicalizationRule;
|
|
9
|
-
static getRootAsCanonicalizationRule(bb: flatbuffers.ByteBuffer, obj?: CanonicalizationRule): CanonicalizationRule;
|
|
10
|
-
static getSizePrefixedRootAsCanonicalizationRule(bb: flatbuffers.ByteBuffer, obj?: CanonicalizationRule): CanonicalizationRule;
|
|
11
|
-
/**
|
|
12
|
-
* Schema version for the canonicalization contract.
|
|
13
|
-
*/
|
|
14
|
-
version(): number;
|
|
15
|
-
/**
|
|
16
|
-
* Strip any custom section whose name starts with this prefix before
|
|
17
|
-
* hashing the module for signature verification.
|
|
18
|
-
*/
|
|
19
|
-
strippedCustomSectionPrefix(): string | null;
|
|
20
|
-
strippedCustomSectionPrefix(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
|
|
21
|
-
/**
|
|
22
|
-
* Name of the required root custom section carrying this bundle.
|
|
23
|
-
*/
|
|
24
|
-
bundleSectionName(): string | null;
|
|
25
|
-
bundleSectionName(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
|
|
26
|
-
/**
|
|
27
|
-
* Hash function identifier, for example `sha256`.
|
|
28
|
-
*/
|
|
29
|
-
hashAlgorithm(): string | null;
|
|
30
|
-
hashAlgorithm(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
|
|
31
|
-
static startCanonicalizationRule(builder: flatbuffers.Builder): void;
|
|
32
|
-
static addVersion(builder: flatbuffers.Builder, version: number): void;
|
|
33
|
-
static addStrippedCustomSectionPrefix(builder: flatbuffers.Builder, strippedCustomSectionPrefixOffset: flatbuffers.Offset): void;
|
|
34
|
-
static addBundleSectionName(builder: flatbuffers.Builder, bundleSectionNameOffset: flatbuffers.Offset): void;
|
|
35
|
-
static addHashAlgorithm(builder: flatbuffers.Builder, hashAlgorithmOffset: flatbuffers.Offset): void;
|
|
36
|
-
static endCanonicalizationRule(builder: flatbuffers.Builder): flatbuffers.Offset;
|
|
37
|
-
static createCanonicalizationRule(builder: flatbuffers.Builder, version: number, strippedCustomSectionPrefixOffset: flatbuffers.Offset, bundleSectionNameOffset: flatbuffers.Offset, hashAlgorithmOffset: flatbuffers.Offset): flatbuffers.Offset;
|
|
38
|
-
unpack(): CanonicalizationRuleT;
|
|
39
|
-
unpackTo(_o: CanonicalizationRuleT): void;
|
|
40
|
-
}
|
|
41
|
-
export declare class CanonicalizationRuleT implements flatbuffers.IGeneratedObject {
|
|
42
|
-
version: number;
|
|
43
|
-
strippedCustomSectionPrefix: string | Uint8Array | null;
|
|
44
|
-
bundleSectionName: string | Uint8Array | null;
|
|
45
|
-
hashAlgorithm: string | Uint8Array | null;
|
|
46
|
-
constructor(version?: number, strippedCustomSectionPrefix?: string | Uint8Array | null, bundleSectionName?: string | Uint8Array | null, hashAlgorithm?: string | Uint8Array | null);
|
|
47
|
-
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
|
48
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
// automatically generated by the FlatBuffers compiler, do not modify
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
|
3
|
-
import * as flatbuffers from "flatbuffers/mjs/flatbuffers.js";
|
|
4
|
-
/**
|
|
5
|
-
* Canonicalization rule applied before hashing or signature verification.
|
|
6
|
-
*/
|
|
7
|
-
export class CanonicalizationRule {
|
|
8
|
-
bb = null;
|
|
9
|
-
bb_pos = 0;
|
|
10
|
-
__init(i, bb) {
|
|
11
|
-
this.bb_pos = i;
|
|
12
|
-
this.bb = bb;
|
|
13
|
-
return this;
|
|
14
|
-
}
|
|
15
|
-
static getRootAsCanonicalizationRule(bb, obj) {
|
|
16
|
-
return (obj || new CanonicalizationRule()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
17
|
-
}
|
|
18
|
-
static getSizePrefixedRootAsCanonicalizationRule(bb, obj) {
|
|
19
|
-
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
|
20
|
-
return (obj || new CanonicalizationRule()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Schema version for the canonicalization contract.
|
|
24
|
-
*/
|
|
25
|
-
version() {
|
|
26
|
-
const offset = this.bb.__offset(this.bb_pos, 4);
|
|
27
|
-
return offset ? this.bb.readUint16(this.bb_pos + offset) : 1;
|
|
28
|
-
}
|
|
29
|
-
strippedCustomSectionPrefix(optionalEncoding) {
|
|
30
|
-
const offset = this.bb.__offset(this.bb_pos, 6);
|
|
31
|
-
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
|
|
32
|
-
}
|
|
33
|
-
bundleSectionName(optionalEncoding) {
|
|
34
|
-
const offset = this.bb.__offset(this.bb_pos, 8);
|
|
35
|
-
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
|
|
36
|
-
}
|
|
37
|
-
hashAlgorithm(optionalEncoding) {
|
|
38
|
-
const offset = this.bb.__offset(this.bb_pos, 10);
|
|
39
|
-
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
|
|
40
|
-
}
|
|
41
|
-
static startCanonicalizationRule(builder) {
|
|
42
|
-
builder.startObject(4);
|
|
43
|
-
}
|
|
44
|
-
static addVersion(builder, version) {
|
|
45
|
-
builder.addFieldInt16(0, version, 1);
|
|
46
|
-
}
|
|
47
|
-
static addStrippedCustomSectionPrefix(builder, strippedCustomSectionPrefixOffset) {
|
|
48
|
-
builder.addFieldOffset(1, strippedCustomSectionPrefixOffset, 0);
|
|
49
|
-
}
|
|
50
|
-
static addBundleSectionName(builder, bundleSectionNameOffset) {
|
|
51
|
-
builder.addFieldOffset(2, bundleSectionNameOffset, 0);
|
|
52
|
-
}
|
|
53
|
-
static addHashAlgorithm(builder, hashAlgorithmOffset) {
|
|
54
|
-
builder.addFieldOffset(3, hashAlgorithmOffset, 0);
|
|
55
|
-
}
|
|
56
|
-
static endCanonicalizationRule(builder) {
|
|
57
|
-
const offset = builder.endObject();
|
|
58
|
-
return offset;
|
|
59
|
-
}
|
|
60
|
-
static createCanonicalizationRule(builder, version, strippedCustomSectionPrefixOffset, bundleSectionNameOffset, hashAlgorithmOffset) {
|
|
61
|
-
CanonicalizationRule.startCanonicalizationRule(builder);
|
|
62
|
-
CanonicalizationRule.addVersion(builder, version);
|
|
63
|
-
CanonicalizationRule.addStrippedCustomSectionPrefix(builder, strippedCustomSectionPrefixOffset);
|
|
64
|
-
CanonicalizationRule.addBundleSectionName(builder, bundleSectionNameOffset);
|
|
65
|
-
CanonicalizationRule.addHashAlgorithm(builder, hashAlgorithmOffset);
|
|
66
|
-
return CanonicalizationRule.endCanonicalizationRule(builder);
|
|
67
|
-
}
|
|
68
|
-
unpack() {
|
|
69
|
-
return new CanonicalizationRuleT(this.version(), this.strippedCustomSectionPrefix(), this.bundleSectionName(), this.hashAlgorithm());
|
|
70
|
-
}
|
|
71
|
-
unpackTo(_o) {
|
|
72
|
-
_o.version = this.version();
|
|
73
|
-
_o.strippedCustomSectionPrefix = this.strippedCustomSectionPrefix();
|
|
74
|
-
_o.bundleSectionName = this.bundleSectionName();
|
|
75
|
-
_o.hashAlgorithm = this.hashAlgorithm();
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
export class CanonicalizationRuleT {
|
|
79
|
-
version;
|
|
80
|
-
strippedCustomSectionPrefix;
|
|
81
|
-
bundleSectionName;
|
|
82
|
-
hashAlgorithm;
|
|
83
|
-
constructor(version = 1, strippedCustomSectionPrefix = null, bundleSectionName = null, hashAlgorithm = null) {
|
|
84
|
-
this.version = version;
|
|
85
|
-
this.strippedCustomSectionPrefix = strippedCustomSectionPrefix;
|
|
86
|
-
this.bundleSectionName = bundleSectionName;
|
|
87
|
-
this.hashAlgorithm = hashAlgorithm;
|
|
88
|
-
}
|
|
89
|
-
pack(builder) {
|
|
90
|
-
const strippedCustomSectionPrefix = (this.strippedCustomSectionPrefix !== null ? builder.createString(this.strippedCustomSectionPrefix) : 0);
|
|
91
|
-
const bundleSectionName = (this.bundleSectionName !== null ? builder.createString(this.bundleSectionName) : 0);
|
|
92
|
-
const hashAlgorithm = (this.hashAlgorithm !== null ? builder.createString(this.hashAlgorithm) : 0);
|
|
93
|
-
return CanonicalizationRule.createCanonicalizationRule(builder, this.version, strippedCustomSectionPrefix, bundleSectionName, hashAlgorithm);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
// automatically generated by the FlatBuffers compiler, do not modify
|
|
2
|
-
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
|
4
|
-
|
|
5
|
-
import * as flatbuffers from 'flatbuffers';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Canonicalization rule applied before hashing or signature verification.
|
|
11
|
-
*/
|
|
12
|
-
export class CanonicalizationRule implements flatbuffers.IUnpackableObject<CanonicalizationRuleT> {
|
|
13
|
-
bb: flatbuffers.ByteBuffer|null = null;
|
|
14
|
-
bb_pos = 0;
|
|
15
|
-
__init(i:number, bb:flatbuffers.ByteBuffer):CanonicalizationRule {
|
|
16
|
-
this.bb_pos = i;
|
|
17
|
-
this.bb = bb;
|
|
18
|
-
return this;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
static getRootAsCanonicalizationRule(bb:flatbuffers.ByteBuffer, obj?:CanonicalizationRule):CanonicalizationRule {
|
|
22
|
-
return (obj || new CanonicalizationRule()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
static getSizePrefixedRootAsCanonicalizationRule(bb:flatbuffers.ByteBuffer, obj?:CanonicalizationRule):CanonicalizationRule {
|
|
26
|
-
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
|
27
|
-
return (obj || new CanonicalizationRule()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Schema version for the canonicalization contract.
|
|
32
|
-
*/
|
|
33
|
-
version():number {
|
|
34
|
-
const offset = this.bb!.__offset(this.bb_pos, 4);
|
|
35
|
-
return offset ? this.bb!.readUint16(this.bb_pos + offset) : 1;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Strip any custom section whose name starts with this prefix before
|
|
40
|
-
* hashing the module for signature verification.
|
|
41
|
-
*/
|
|
42
|
-
strippedCustomSectionPrefix():string|null
|
|
43
|
-
strippedCustomSectionPrefix(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
|
44
|
-
strippedCustomSectionPrefix(optionalEncoding?:any):string|Uint8Array|null {
|
|
45
|
-
const offset = this.bb!.__offset(this.bb_pos, 6);
|
|
46
|
-
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Name of the required root custom section carrying this bundle.
|
|
51
|
-
*/
|
|
52
|
-
bundleSectionName():string|null
|
|
53
|
-
bundleSectionName(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
|
54
|
-
bundleSectionName(optionalEncoding?:any):string|Uint8Array|null {
|
|
55
|
-
const offset = this.bb!.__offset(this.bb_pos, 8);
|
|
56
|
-
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Hash function identifier, for example `sha256`.
|
|
61
|
-
*/
|
|
62
|
-
hashAlgorithm():string|null
|
|
63
|
-
hashAlgorithm(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
|
64
|
-
hashAlgorithm(optionalEncoding?:any):string|Uint8Array|null {
|
|
65
|
-
const offset = this.bb!.__offset(this.bb_pos, 10);
|
|
66
|
-
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
static startCanonicalizationRule(builder:flatbuffers.Builder) {
|
|
70
|
-
builder.startObject(4);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
static addVersion(builder:flatbuffers.Builder, version:number) {
|
|
74
|
-
builder.addFieldInt16(0, version, 1);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
static addStrippedCustomSectionPrefix(builder:flatbuffers.Builder, strippedCustomSectionPrefixOffset:flatbuffers.Offset) {
|
|
78
|
-
builder.addFieldOffset(1, strippedCustomSectionPrefixOffset, 0);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
static addBundleSectionName(builder:flatbuffers.Builder, bundleSectionNameOffset:flatbuffers.Offset) {
|
|
82
|
-
builder.addFieldOffset(2, bundleSectionNameOffset, 0);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
static addHashAlgorithm(builder:flatbuffers.Builder, hashAlgorithmOffset:flatbuffers.Offset) {
|
|
86
|
-
builder.addFieldOffset(3, hashAlgorithmOffset, 0);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
static endCanonicalizationRule(builder:flatbuffers.Builder):flatbuffers.Offset {
|
|
90
|
-
const offset = builder.endObject();
|
|
91
|
-
return offset;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
static createCanonicalizationRule(builder:flatbuffers.Builder, version:number, strippedCustomSectionPrefixOffset:flatbuffers.Offset, bundleSectionNameOffset:flatbuffers.Offset, hashAlgorithmOffset:flatbuffers.Offset):flatbuffers.Offset {
|
|
95
|
-
CanonicalizationRule.startCanonicalizationRule(builder);
|
|
96
|
-
CanonicalizationRule.addVersion(builder, version);
|
|
97
|
-
CanonicalizationRule.addStrippedCustomSectionPrefix(builder, strippedCustomSectionPrefixOffset);
|
|
98
|
-
CanonicalizationRule.addBundleSectionName(builder, bundleSectionNameOffset);
|
|
99
|
-
CanonicalizationRule.addHashAlgorithm(builder, hashAlgorithmOffset);
|
|
100
|
-
return CanonicalizationRule.endCanonicalizationRule(builder);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
unpack(): CanonicalizationRuleT {
|
|
104
|
-
return new CanonicalizationRuleT(
|
|
105
|
-
this.version(),
|
|
106
|
-
this.strippedCustomSectionPrefix(),
|
|
107
|
-
this.bundleSectionName(),
|
|
108
|
-
this.hashAlgorithm()
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
unpackTo(_o: CanonicalizationRuleT): void {
|
|
114
|
-
_o.version = this.version();
|
|
115
|
-
_o.strippedCustomSectionPrefix = this.strippedCustomSectionPrefix();
|
|
116
|
-
_o.bundleSectionName = this.bundleSectionName();
|
|
117
|
-
_o.hashAlgorithm = this.hashAlgorithm();
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export class CanonicalizationRuleT implements flatbuffers.IGeneratedObject {
|
|
122
|
-
constructor(
|
|
123
|
-
public version: number = 1,
|
|
124
|
-
public strippedCustomSectionPrefix: string|Uint8Array|null = null,
|
|
125
|
-
public bundleSectionName: string|Uint8Array|null = null,
|
|
126
|
-
public hashAlgorithm: string|Uint8Array|null = null
|
|
127
|
-
){}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
|
131
|
-
const strippedCustomSectionPrefix = (this.strippedCustomSectionPrefix !== null ? builder.createString(this.strippedCustomSectionPrefix!) : 0);
|
|
132
|
-
const bundleSectionName = (this.bundleSectionName !== null ? builder.createString(this.bundleSectionName!) : 0);
|
|
133
|
-
const hashAlgorithm = (this.hashAlgorithm !== null ? builder.createString(this.hashAlgorithm!) : 0);
|
|
134
|
-
|
|
135
|
-
return CanonicalizationRule.createCanonicalizationRule(builder,
|
|
136
|
-
this.version,
|
|
137
|
-
strippedCustomSectionPrefix,
|
|
138
|
-
bundleSectionName,
|
|
139
|
-
hashAlgorithm
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// automatically generated by the FlatBuffers compiler, do not modify
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
|
3
|
-
/**
|
|
4
|
-
* Logical role for one payload carried in the bundle.
|
|
5
|
-
*/
|
|
6
|
-
export var ModuleBundleEntryRole;
|
|
7
|
-
(function (ModuleBundleEntryRole) {
|
|
8
|
-
ModuleBundleEntryRole[ModuleBundleEntryRole["MANIFEST"] = 0] = "MANIFEST";
|
|
9
|
-
ModuleBundleEntryRole[ModuleBundleEntryRole["AUTHORIZATION"] = 1] = "AUTHORIZATION";
|
|
10
|
-
ModuleBundleEntryRole[ModuleBundleEntryRole["SIGNATURE"] = 2] = "SIGNATURE";
|
|
11
|
-
ModuleBundleEntryRole[ModuleBundleEntryRole["TRANSPORT"] = 3] = "TRANSPORT";
|
|
12
|
-
ModuleBundleEntryRole[ModuleBundleEntryRole["ATTESTATION"] = 4] = "ATTESTATION";
|
|
13
|
-
ModuleBundleEntryRole[ModuleBundleEntryRole["AUXILIARY"] = 5] = "AUXILIARY";
|
|
14
|
-
})(ModuleBundleEntryRole || (ModuleBundleEntryRole = {}));
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// automatically generated by the FlatBuffers compiler, do not modify
|
|
2
|
-
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Logical role for one payload carried in the bundle.
|
|
7
|
-
*/
|
|
8
|
-
export enum ModuleBundleEntryRole {
|
|
9
|
-
MANIFEST = 0,
|
|
10
|
-
AUTHORIZATION = 1,
|
|
11
|
-
SIGNATURE = 2,
|
|
12
|
-
TRANSPORT = 3,
|
|
13
|
-
ATTESTATION = 4,
|
|
14
|
-
AUXILIARY = 5
|
|
15
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import * as flatbuffers from 'flatbuffers';
|
|
2
|
-
import { ModuleBundleEntryRole } from '../../orbpro/module/module-bundle-entry-role.js';
|
|
3
|
-
import { ModulePayloadEncoding } from '../../orbpro/module/module-payload-encoding.js';
|
|
4
|
-
import { FlatBufferTypeRef, FlatBufferTypeRefT } from '../../orbpro/stream/flat-buffer-type-ref.js';
|
|
5
|
-
/**
|
|
6
|
-
* One payload carried inside the bundle.
|
|
7
|
-
*/
|
|
8
|
-
export declare class ModuleBundleEntry implements flatbuffers.IUnpackableObject<ModuleBundleEntryT> {
|
|
9
|
-
bb: flatbuffers.ByteBuffer | null;
|
|
10
|
-
bb_pos: number;
|
|
11
|
-
__init(i: number, bb: flatbuffers.ByteBuffer): ModuleBundleEntry;
|
|
12
|
-
static getRootAsModuleBundleEntry(bb: flatbuffers.ByteBuffer, obj?: ModuleBundleEntry): ModuleBundleEntry;
|
|
13
|
-
static getSizePrefixedRootAsModuleBundleEntry(bb: flatbuffers.ByteBuffer, obj?: ModuleBundleEntry): ModuleBundleEntry;
|
|
14
|
-
/**
|
|
15
|
-
* Stable bundle-local identifier.
|
|
16
|
-
*/
|
|
17
|
-
entryId(): string | null;
|
|
18
|
-
entryId(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
|
|
19
|
-
/**
|
|
20
|
-
* High-level semantic role of the payload.
|
|
21
|
-
*/
|
|
22
|
-
role(): ModuleBundleEntryRole;
|
|
23
|
-
/**
|
|
24
|
-
* Optional logical section name within the bundle, for example
|
|
25
|
-
* `sds.authorization`.
|
|
26
|
-
*/
|
|
27
|
-
sectionName(): string | null;
|
|
28
|
-
sectionName(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
|
|
29
|
-
/**
|
|
30
|
-
* SDS/shared-module schema identity when the payload is itself a
|
|
31
|
-
* FlatBuffer.
|
|
32
|
-
*/
|
|
33
|
-
typeRef(obj?: FlatBufferTypeRef): FlatBufferTypeRef | null;
|
|
34
|
-
/**
|
|
35
|
-
* Encoding used for `payload`.
|
|
36
|
-
*/
|
|
37
|
-
payloadEncoding(): ModulePayloadEncoding;
|
|
38
|
-
/**
|
|
39
|
-
* Optional media type for transitional payloads such as JSON envelopes.
|
|
40
|
-
*/
|
|
41
|
-
mediaType(): string | null;
|
|
42
|
-
mediaType(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
|
|
43
|
-
/**
|
|
44
|
-
* Implementation-defined bit flags for signed/encrypted/compressed state.
|
|
45
|
-
*/
|
|
46
|
-
flags(): number;
|
|
47
|
-
/**
|
|
48
|
-
* SHA-256 of the payload bytes.
|
|
49
|
-
*/
|
|
50
|
-
sha256(index: number): number | null;
|
|
51
|
-
sha256Length(): number;
|
|
52
|
-
sha256Array(): Uint8Array | null;
|
|
53
|
-
/**
|
|
54
|
-
* Embedded payload bytes. For single-file deployment this should be
|
|
55
|
-
* populated for every entry.
|
|
56
|
-
*/
|
|
57
|
-
payload(index: number): number | null;
|
|
58
|
-
payloadLength(): number;
|
|
59
|
-
payloadArray(): Uint8Array | null;
|
|
60
|
-
/**
|
|
61
|
-
* Human-readable description for tooling and diagnostics.
|
|
62
|
-
*/
|
|
63
|
-
description(): string | null;
|
|
64
|
-
description(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
|
|
65
|
-
static startModuleBundleEntry(builder: flatbuffers.Builder): void;
|
|
66
|
-
static addEntryId(builder: flatbuffers.Builder, entryIdOffset: flatbuffers.Offset): void;
|
|
67
|
-
static addRole(builder: flatbuffers.Builder, role: ModuleBundleEntryRole): void;
|
|
68
|
-
static addSectionName(builder: flatbuffers.Builder, sectionNameOffset: flatbuffers.Offset): void;
|
|
69
|
-
static addTypeRef(builder: flatbuffers.Builder, typeRefOffset: flatbuffers.Offset): void;
|
|
70
|
-
static addPayloadEncoding(builder: flatbuffers.Builder, payloadEncoding: ModulePayloadEncoding): void;
|
|
71
|
-
static addMediaType(builder: flatbuffers.Builder, mediaTypeOffset: flatbuffers.Offset): void;
|
|
72
|
-
static addFlags(builder: flatbuffers.Builder, flags: number): void;
|
|
73
|
-
static addSha256(builder: flatbuffers.Builder, sha256Offset: flatbuffers.Offset): void;
|
|
74
|
-
static createSha256Vector(builder: flatbuffers.Builder, data: number[] | Uint8Array): flatbuffers.Offset;
|
|
75
|
-
static startSha256Vector(builder: flatbuffers.Builder, numElems: number): void;
|
|
76
|
-
static addPayload(builder: flatbuffers.Builder, payloadOffset: flatbuffers.Offset): void;
|
|
77
|
-
static createPayloadVector(builder: flatbuffers.Builder, data: number[] | Uint8Array): flatbuffers.Offset;
|
|
78
|
-
static startPayloadVector(builder: flatbuffers.Builder, numElems: number): void;
|
|
79
|
-
static addDescription(builder: flatbuffers.Builder, descriptionOffset: flatbuffers.Offset): void;
|
|
80
|
-
static endModuleBundleEntry(builder: flatbuffers.Builder): flatbuffers.Offset;
|
|
81
|
-
unpack(): ModuleBundleEntryT;
|
|
82
|
-
unpackTo(_o: ModuleBundleEntryT): void;
|
|
83
|
-
}
|
|
84
|
-
export declare class ModuleBundleEntryT implements flatbuffers.IGeneratedObject {
|
|
85
|
-
entryId: string | Uint8Array | null;
|
|
86
|
-
role: ModuleBundleEntryRole;
|
|
87
|
-
sectionName: string | Uint8Array | null;
|
|
88
|
-
typeRef: FlatBufferTypeRefT | null;
|
|
89
|
-
payloadEncoding: ModulePayloadEncoding;
|
|
90
|
-
mediaType: string | Uint8Array | null;
|
|
91
|
-
flags: number;
|
|
92
|
-
sha256: (number)[];
|
|
93
|
-
payload: (number)[];
|
|
94
|
-
description: string | Uint8Array | null;
|
|
95
|
-
constructor(entryId?: string | Uint8Array | null, role?: ModuleBundleEntryRole, sectionName?: string | Uint8Array | null, typeRef?: FlatBufferTypeRefT | null, payloadEncoding?: ModulePayloadEncoding, mediaType?: string | Uint8Array | null, flags?: number, sha256?: (number)[], payload?: (number)[], description?: string | Uint8Array | null);
|
|
96
|
-
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
|
97
|
-
}
|