space-data-module-sdk 0.7.0 → 0.8.1
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 +2 -2
- package/schemas/spacedatastandards/PLG.fbs +191 -0
- package/src/AGENTS.md +1 -1
- 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 +53 -32
- package/src/compiler/compileModule.js +9 -1
- package/src/compliance/index.js +4 -0
- package/src/compliance/pluginCompliance.js +158 -2
- package/src/embeddedManifest.js +25 -5
- package/src/generated/orbpro/invoke/plugin-invoke-request.js +2 -2
- package/src/generated/orbpro/invoke/plugin-invoke-response.js +2 -2
- package/src/generated/orbpro/stream/flat-buffer-type-ref.js +2 -2
- package/src/generated/orbpro/stream/typed-arena-buffer.js +2 -2
- package/src/generated/spacedatastandards/plg/entry-function.js +86 -0
- package/src/generated/spacedatastandards/plg/entry-function.ts +119 -0
- package/src/generated/spacedatastandards/plg/index.js +16 -0
- package/src/generated/spacedatastandards/plg/index.ts +11 -0
- package/src/generated/spacedatastandards/plg/plg.js +657 -0
- package/src/generated/spacedatastandards/plg/plg.ts +924 -0
- package/src/generated/spacedatastandards/plg/plugin-capability.js +66 -0
- package/src/generated/spacedatastandards/plg/plugin-capability.ts +84 -0
- package/src/generated/spacedatastandards/plg/plugin-category.js +15 -0
- package/src/generated/spacedatastandards/plg/plugin-category.ts +53 -0
- package/src/generated/spacedatastandards/plg/plugin-dependency.js +63 -0
- package/src/generated/spacedatastandards/plg/plugin-dependency.ts +86 -0
- package/src/generated/spacedatastandards/plg/publication-state.js +9 -0
- package/src/generated/spacedatastandards/plg/publication-state.ts +23 -0
- package/src/generated/spacedatastandards/plg/purchase-tier.js +9 -0
- package/src/generated/spacedatastandards/plg/purchase-tier.ts +23 -0
- package/src/index.d.ts +1 -1
- package/src/invoke/codec.js +1 -1
- package/src/manifest/browser.js +7 -0
- package/src/manifest/index.js +7 -0
- package/src/manifest/legacyToPlg.js +249 -0
- package/src/manifest/plgCodec.js +826 -0
- package/src/standards/sharedCatalog.js +132 -0
- package/src/transport/records.js +34 -3
- package/src/vendor/flatbuffers/LICENSE +202 -0
- package/src/vendor/flatbuffers/builder.js +534 -0
- package/src/vendor/flatbuffers/byte-buffer.js +253 -0
- package/src/vendor/flatbuffers/constants.js +4 -0
- package/src/vendor/flatbuffers/encoding.js +5 -0
- package/src/vendor/flatbuffers/flatbuffers.js +5 -0
- package/src/vendor/flatbuffers/utils.js +4 -0
- 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
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { FILE_IDENTIFIER_LENGTH, SIZEOF_INT } from './constants.js';
|
|
2
|
+
import { Encoding } from './encoding.js';
|
|
3
|
+
import { float32, float64, int32, isLittleEndian } from './utils.js';
|
|
4
|
+
export class ByteBuffer {
|
|
5
|
+
/**
|
|
6
|
+
* Create a new ByteBuffer with a given array of bytes (`Uint8Array`)
|
|
7
|
+
*/
|
|
8
|
+
constructor(bytes_) {
|
|
9
|
+
this.bytes_ = bytes_;
|
|
10
|
+
this.position_ = 0;
|
|
11
|
+
this.text_decoder_ = new TextDecoder();
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Create and allocate a new ByteBuffer with a given size.
|
|
15
|
+
*/
|
|
16
|
+
static allocate(byte_size) {
|
|
17
|
+
return new ByteBuffer(new Uint8Array(byte_size));
|
|
18
|
+
}
|
|
19
|
+
clear() {
|
|
20
|
+
this.position_ = 0;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Get the underlying `Uint8Array`.
|
|
24
|
+
*/
|
|
25
|
+
bytes() {
|
|
26
|
+
return this.bytes_;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Get the buffer's position.
|
|
30
|
+
*/
|
|
31
|
+
position() {
|
|
32
|
+
return this.position_;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Set the buffer's position.
|
|
36
|
+
*/
|
|
37
|
+
setPosition(position) {
|
|
38
|
+
this.position_ = position;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Get the buffer's capacity.
|
|
42
|
+
*/
|
|
43
|
+
capacity() {
|
|
44
|
+
return this.bytes_.length;
|
|
45
|
+
}
|
|
46
|
+
readInt8(offset) {
|
|
47
|
+
return (this.readUint8(offset) << 24) >> 24;
|
|
48
|
+
}
|
|
49
|
+
readUint8(offset) {
|
|
50
|
+
return this.bytes_[offset];
|
|
51
|
+
}
|
|
52
|
+
readInt16(offset) {
|
|
53
|
+
return (this.readUint16(offset) << 16) >> 16;
|
|
54
|
+
}
|
|
55
|
+
readUint16(offset) {
|
|
56
|
+
return this.bytes_[offset] | (this.bytes_[offset + 1] << 8);
|
|
57
|
+
}
|
|
58
|
+
readInt32(offset) {
|
|
59
|
+
return (this.bytes_[offset] |
|
|
60
|
+
(this.bytes_[offset + 1] << 8) |
|
|
61
|
+
(this.bytes_[offset + 2] << 16) |
|
|
62
|
+
(this.bytes_[offset + 3] << 24));
|
|
63
|
+
}
|
|
64
|
+
readUint32(offset) {
|
|
65
|
+
return this.readInt32(offset) >>> 0;
|
|
66
|
+
}
|
|
67
|
+
readInt64(offset) {
|
|
68
|
+
return BigInt.asIntN(64, BigInt(this.readUint32(offset)) +
|
|
69
|
+
(BigInt(this.readUint32(offset + 4)) << BigInt(32)));
|
|
70
|
+
}
|
|
71
|
+
readUint64(offset) {
|
|
72
|
+
return BigInt.asUintN(64, BigInt(this.readUint32(offset)) +
|
|
73
|
+
(BigInt(this.readUint32(offset + 4)) << BigInt(32)));
|
|
74
|
+
}
|
|
75
|
+
readFloat32(offset) {
|
|
76
|
+
int32[0] = this.readInt32(offset);
|
|
77
|
+
return float32[0];
|
|
78
|
+
}
|
|
79
|
+
readFloat64(offset) {
|
|
80
|
+
int32[isLittleEndian ? 0 : 1] = this.readInt32(offset);
|
|
81
|
+
int32[isLittleEndian ? 1 : 0] = this.readInt32(offset + 4);
|
|
82
|
+
return float64[0];
|
|
83
|
+
}
|
|
84
|
+
writeInt8(offset, value) {
|
|
85
|
+
this.bytes_[offset] = value;
|
|
86
|
+
}
|
|
87
|
+
writeUint8(offset, value) {
|
|
88
|
+
this.bytes_[offset] = value;
|
|
89
|
+
}
|
|
90
|
+
writeInt16(offset, value) {
|
|
91
|
+
this.bytes_[offset] = value;
|
|
92
|
+
this.bytes_[offset + 1] = value >> 8;
|
|
93
|
+
}
|
|
94
|
+
writeUint16(offset, value) {
|
|
95
|
+
this.bytes_[offset] = value;
|
|
96
|
+
this.bytes_[offset + 1] = value >> 8;
|
|
97
|
+
}
|
|
98
|
+
writeInt32(offset, value) {
|
|
99
|
+
this.bytes_[offset] = value;
|
|
100
|
+
this.bytes_[offset + 1] = value >> 8;
|
|
101
|
+
this.bytes_[offset + 2] = value >> 16;
|
|
102
|
+
this.bytes_[offset + 3] = value >> 24;
|
|
103
|
+
}
|
|
104
|
+
writeUint32(offset, value) {
|
|
105
|
+
this.bytes_[offset] = value;
|
|
106
|
+
this.bytes_[offset + 1] = value >> 8;
|
|
107
|
+
this.bytes_[offset + 2] = value >> 16;
|
|
108
|
+
this.bytes_[offset + 3] = value >> 24;
|
|
109
|
+
}
|
|
110
|
+
writeInt64(offset, value) {
|
|
111
|
+
this.writeInt32(offset, Number(BigInt.asIntN(32, value)));
|
|
112
|
+
this.writeInt32(offset + 4, Number(BigInt.asIntN(32, value >> BigInt(32))));
|
|
113
|
+
}
|
|
114
|
+
writeUint64(offset, value) {
|
|
115
|
+
this.writeUint32(offset, Number(BigInt.asUintN(32, value)));
|
|
116
|
+
this.writeUint32(offset + 4, Number(BigInt.asUintN(32, value >> BigInt(32))));
|
|
117
|
+
}
|
|
118
|
+
writeFloat32(offset, value) {
|
|
119
|
+
float32[0] = value;
|
|
120
|
+
this.writeInt32(offset, int32[0]);
|
|
121
|
+
}
|
|
122
|
+
writeFloat64(offset, value) {
|
|
123
|
+
float64[0] = value;
|
|
124
|
+
this.writeInt32(offset, int32[isLittleEndian ? 0 : 1]);
|
|
125
|
+
this.writeInt32(offset + 4, int32[isLittleEndian ? 1 : 0]);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Return the file identifier. Behavior is undefined for FlatBuffers whose
|
|
129
|
+
* schema does not include a file_identifier (likely points at padding or the
|
|
130
|
+
* start of a the root vtable).
|
|
131
|
+
*/
|
|
132
|
+
getBufferIdentifier() {
|
|
133
|
+
if (this.bytes_.length <
|
|
134
|
+
this.position_ + SIZEOF_INT + FILE_IDENTIFIER_LENGTH) {
|
|
135
|
+
throw new Error('FlatBuffers: ByteBuffer is too short to contain an identifier.');
|
|
136
|
+
}
|
|
137
|
+
let result = '';
|
|
138
|
+
for (let i = 0; i < FILE_IDENTIFIER_LENGTH; i++) {
|
|
139
|
+
result += String.fromCharCode(this.readInt8(this.position_ + SIZEOF_INT + i));
|
|
140
|
+
}
|
|
141
|
+
return result;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Look up a field in the vtable, return an offset into the object, or 0 if the
|
|
145
|
+
* field is not present.
|
|
146
|
+
*/
|
|
147
|
+
__offset(bb_pos, vtable_offset) {
|
|
148
|
+
const vtable = bb_pos - this.readInt32(bb_pos);
|
|
149
|
+
return vtable_offset < this.readInt16(vtable)
|
|
150
|
+
? this.readInt16(vtable + vtable_offset)
|
|
151
|
+
: 0;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Initialize any Table-derived type to point to the union at the given offset.
|
|
155
|
+
*/
|
|
156
|
+
__union(t, offset) {
|
|
157
|
+
t.bb_pos = offset + this.readInt32(offset);
|
|
158
|
+
t.bb = this;
|
|
159
|
+
return t;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Create a JavaScript string from UTF-8 data stored inside the FlatBuffer.
|
|
163
|
+
* This allocates a new string and converts to wide chars upon each access.
|
|
164
|
+
*
|
|
165
|
+
* To avoid the conversion to string, pass Encoding.UTF8_BYTES as the
|
|
166
|
+
* "optionalEncoding" argument. This is useful for avoiding conversion when
|
|
167
|
+
* the data will just be packaged back up in another FlatBuffer later on.
|
|
168
|
+
*
|
|
169
|
+
* @param offset
|
|
170
|
+
* @param opt_encoding Defaults to UTF16_STRING
|
|
171
|
+
*/
|
|
172
|
+
__string(offset, opt_encoding) {
|
|
173
|
+
offset += this.readInt32(offset);
|
|
174
|
+
const length = this.readInt32(offset);
|
|
175
|
+
offset += SIZEOF_INT;
|
|
176
|
+
const utf8bytes = this.bytes_.subarray(offset, offset + length);
|
|
177
|
+
if (opt_encoding === Encoding.UTF8_BYTES)
|
|
178
|
+
return utf8bytes;
|
|
179
|
+
else
|
|
180
|
+
return this.text_decoder_.decode(utf8bytes);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Handle unions that can contain string as its member, if a Table-derived type then initialize it,
|
|
184
|
+
* if a string then return a new one
|
|
185
|
+
*
|
|
186
|
+
* WARNING: strings are immutable in JS so we can't change the string that the user gave us, this
|
|
187
|
+
* makes the behaviour of __union_with_string different compared to __union
|
|
188
|
+
*/
|
|
189
|
+
__union_with_string(o, offset) {
|
|
190
|
+
if (typeof o === 'string') {
|
|
191
|
+
return this.__string(offset);
|
|
192
|
+
}
|
|
193
|
+
return this.__union(o, offset);
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Retrieve the relative offset stored at "offset"
|
|
197
|
+
*/
|
|
198
|
+
__indirect(offset) {
|
|
199
|
+
return offset + this.readInt32(offset);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Get the start of data of a vector whose offset is stored at "offset" in this object.
|
|
203
|
+
*/
|
|
204
|
+
__vector(offset) {
|
|
205
|
+
return offset + this.readInt32(offset) + SIZEOF_INT; // data starts after the length
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Get the length of a vector whose offset is stored at "offset" in this object.
|
|
209
|
+
*/
|
|
210
|
+
__vector_len(offset) {
|
|
211
|
+
return this.readInt32(offset + this.readInt32(offset));
|
|
212
|
+
}
|
|
213
|
+
__has_identifier(ident) {
|
|
214
|
+
if (ident.length != FILE_IDENTIFIER_LENGTH) {
|
|
215
|
+
throw new Error('FlatBuffers: file identifier must be length ' + FILE_IDENTIFIER_LENGTH);
|
|
216
|
+
}
|
|
217
|
+
for (let i = 0; i < FILE_IDENTIFIER_LENGTH; i++) {
|
|
218
|
+
if (ident.charCodeAt(i) != this.readInt8(this.position() + SIZEOF_INT + i)) {
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return true;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* A helper function for generating list for obj api
|
|
226
|
+
*/
|
|
227
|
+
createScalarList(listAccessor, listLength) {
|
|
228
|
+
const ret = [];
|
|
229
|
+
for (let i = 0; i < listLength; ++i) {
|
|
230
|
+
const val = listAccessor(i);
|
|
231
|
+
if (val !== null) {
|
|
232
|
+
ret.push(val);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return ret;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* A helper function for generating list for obj api
|
|
239
|
+
* @param listAccessor function that accepts an index and return data at that index
|
|
240
|
+
* @param listLength listLength
|
|
241
|
+
* @param res result list
|
|
242
|
+
*/
|
|
243
|
+
createObjList(listAccessor, listLength) {
|
|
244
|
+
const ret = [];
|
|
245
|
+
for (let i = 0; i < listLength; ++i) {
|
|
246
|
+
const val = listAccessor(i);
|
|
247
|
+
if (val !== null) {
|
|
248
|
+
ret.push(val.unpack());
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return ret;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { FILE_IDENTIFIER_LENGTH, SIZEOF_INT, SIZEOF_SHORT, SIZE_PREFIX_LENGTH, } from './constants.js';
|
|
2
|
+
export { float32, float64, int32, isLittleEndian } from './utils.js';
|
|
3
|
+
export { Builder } from './builder.js';
|
|
4
|
+
export { ByteBuffer } from './byte-buffer.js';
|
|
5
|
+
export { Encoding } from './encoding.js';
|
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
|
-
}
|