@reallyme/codec 0.1.21 → 0.2.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/NOTICE +16 -0
- package/README.md +55 -4
- package/dist/boundary.d.ts +17 -0
- package/dist/boundary.js +277 -0
- package/dist/cbor.d.ts +67 -4
- package/dist/cbor.js +1252 -66
- package/dist/deterministicCborBoundary.d.ts +11 -0
- package/dist/deterministicCborBoundary.js +17 -0
- package/dist/index.d.ts +39 -22
- package/dist/index.js +14 -18
- package/dist/jcs.js +3 -60
- package/dist/multiformat.d.ts +10 -12
- package/dist/multiformat.js +155 -91
- package/dist/operationContract.d.ts +31 -0
- package/dist/operationContract.js +754 -0
- package/dist/pem.d.ts +2 -5
- package/dist/pem.js +265 -41
- package/dist/proto/generated/reallyme/codec/v1/codec_pb.d.ts +906 -13
- package/dist/proto/generated/reallyme/codec/v1/codec_pb.js +278 -23
- package/dist/proto.d.ts +2 -2
- package/dist/proto.js +1 -1
- package/dist/readOutput.d.ts +8 -7
- package/dist/readOutput.js +136 -22
- package/dist/wasm/reallyme_codec_wasm.d.ts +25 -140
- package/dist/wasm/reallyme_codec_wasm.js +134 -428
- package/dist/wasm/reallyme_codec_wasm_bg.wasm +0 -0
- package/dist/wasmProvider.d.ts +5 -31
- package/dist/wasmProvider.js +18 -51
- package/package.json +4 -1
|
@@ -6,9 +6,7 @@
|
|
|
6
6
|
* @returns {Uint8Array}
|
|
7
7
|
*/
|
|
8
8
|
export function base58btcDecode(encoded) {
|
|
9
|
-
const
|
|
10
|
-
const len0 = WASM_VECTOR_LEN;
|
|
11
|
-
const ret = wasm.base58btcDecode(ptr0, len0);
|
|
9
|
+
const ret = wasm.base58btcDecode(encoded);
|
|
12
10
|
if (ret[2]) {
|
|
13
11
|
throw takeFromExternrefTable0(ret[1]);
|
|
14
12
|
}
|
|
@@ -45,9 +43,7 @@ export function base58btcEncode(bytes) {
|
|
|
45
43
|
* @returns {Uint8Array}
|
|
46
44
|
*/
|
|
47
45
|
export function base64Decode(encoded) {
|
|
48
|
-
const
|
|
49
|
-
const len0 = WASM_VECTOR_LEN;
|
|
50
|
-
const ret = wasm.base64Decode(ptr0, len0);
|
|
46
|
+
const ret = wasm.base64Decode(encoded);
|
|
51
47
|
if (ret[2]) {
|
|
52
48
|
throw takeFromExternrefTable0(ret[1]);
|
|
53
49
|
}
|
|
@@ -60,15 +56,21 @@ export function base64Decode(encoded) {
|
|
|
60
56
|
* @returns {string}
|
|
61
57
|
*/
|
|
62
58
|
export function base64Encode(bytes) {
|
|
63
|
-
let
|
|
64
|
-
let
|
|
59
|
+
let deferred2_0;
|
|
60
|
+
let deferred2_1;
|
|
65
61
|
try {
|
|
66
62
|
const ret = wasm.base64Encode(bytes);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
var ptr1 = ret[0];
|
|
64
|
+
var len1 = ret[1];
|
|
65
|
+
if (ret[3]) {
|
|
66
|
+
ptr1 = 0; len1 = 0;
|
|
67
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
68
|
+
}
|
|
69
|
+
deferred2_0 = ptr1;
|
|
70
|
+
deferred2_1 = len1;
|
|
71
|
+
return getStringFromWasm0(ptr1, len1);
|
|
70
72
|
} finally {
|
|
71
|
-
wasm.__wbindgen_free(
|
|
73
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
72
74
|
}
|
|
73
75
|
}
|
|
74
76
|
|
|
@@ -78,9 +80,7 @@ export function base64Encode(bytes) {
|
|
|
78
80
|
* @returns {Uint8Array}
|
|
79
81
|
*/
|
|
80
82
|
export function base64urlDecode(encoded) {
|
|
81
|
-
const
|
|
82
|
-
const len0 = WASM_VECTOR_LEN;
|
|
83
|
-
const ret = wasm.base64urlDecode(ptr0, len0);
|
|
83
|
+
const ret = wasm.base64urlDecode(encoded);
|
|
84
84
|
if (ret[2]) {
|
|
85
85
|
throw takeFromExternrefTable0(ret[1]);
|
|
86
86
|
}
|
|
@@ -93,15 +93,21 @@ export function base64urlDecode(encoded) {
|
|
|
93
93
|
* @returns {string}
|
|
94
94
|
*/
|
|
95
95
|
export function base64urlEncode(bytes) {
|
|
96
|
-
let
|
|
97
|
-
let
|
|
96
|
+
let deferred2_0;
|
|
97
|
+
let deferred2_1;
|
|
98
98
|
try {
|
|
99
99
|
const ret = wasm.base64urlEncode(bytes);
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
var ptr1 = ret[0];
|
|
101
|
+
var len1 = ret[1];
|
|
102
|
+
if (ret[3]) {
|
|
103
|
+
ptr1 = 0; len1 = 0;
|
|
104
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
105
|
+
}
|
|
106
|
+
deferred2_0 = ptr1;
|
|
107
|
+
deferred2_1 = len1;
|
|
108
|
+
return getStringFromWasm0(ptr1, len1);
|
|
103
109
|
} finally {
|
|
104
|
-
wasm.__wbindgen_free(
|
|
110
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
105
111
|
}
|
|
106
112
|
}
|
|
107
113
|
|
|
@@ -112,12 +118,11 @@ export function base64urlEncode(bytes) {
|
|
|
112
118
|
* @returns {boolean}
|
|
113
119
|
*/
|
|
114
120
|
export function bindingTypeMatchesCodec(binding_type, codec_name) {
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
return ret !== 0;
|
|
121
|
+
const ret = wasm.bindingTypeMatchesCodec(binding_type, codec_name);
|
|
122
|
+
if (ret[2]) {
|
|
123
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
124
|
+
}
|
|
125
|
+
return ret[0] !== 0;
|
|
121
126
|
}
|
|
122
127
|
|
|
123
128
|
/**
|
|
@@ -126,15 +131,21 @@ export function bindingTypeMatchesCodec(binding_type, codec_name) {
|
|
|
126
131
|
* @returns {string}
|
|
127
132
|
*/
|
|
128
133
|
export function bytesToLowerHex(bytes) {
|
|
129
|
-
let
|
|
130
|
-
let
|
|
134
|
+
let deferred2_0;
|
|
135
|
+
let deferred2_1;
|
|
131
136
|
try {
|
|
132
137
|
const ret = wasm.bytesToLowerHex(bytes);
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
138
|
+
var ptr1 = ret[0];
|
|
139
|
+
var len1 = ret[1];
|
|
140
|
+
if (ret[3]) {
|
|
141
|
+
ptr1 = 0; len1 = 0;
|
|
142
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
143
|
+
}
|
|
144
|
+
deferred2_0 = ptr1;
|
|
145
|
+
deferred2_1 = len1;
|
|
146
|
+
return getStringFromWasm0(ptr1, len1);
|
|
136
147
|
} finally {
|
|
137
|
-
wasm.__wbindgen_free(
|
|
148
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
138
149
|
}
|
|
139
150
|
}
|
|
140
151
|
|
|
@@ -144,23 +155,21 @@ export function bytesToLowerHex(bytes) {
|
|
|
144
155
|
* @returns {string}
|
|
145
156
|
*/
|
|
146
157
|
export function canonicalizeJson(value_json) {
|
|
147
|
-
let
|
|
148
|
-
let
|
|
158
|
+
let deferred2_0;
|
|
159
|
+
let deferred2_1;
|
|
149
160
|
try {
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
var ptr2 = ret[0];
|
|
154
|
-
var len2 = ret[1];
|
|
161
|
+
const ret = wasm.canonicalizeJson(value_json);
|
|
162
|
+
var ptr1 = ret[0];
|
|
163
|
+
var len1 = ret[1];
|
|
155
164
|
if (ret[3]) {
|
|
156
|
-
|
|
165
|
+
ptr1 = 0; len1 = 0;
|
|
157
166
|
throw takeFromExternrefTable0(ret[2]);
|
|
158
167
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
return getStringFromWasm0(
|
|
168
|
+
deferred2_0 = ptr1;
|
|
169
|
+
deferred2_1 = len1;
|
|
170
|
+
return getStringFromWasm0(ptr1, len1);
|
|
162
171
|
} finally {
|
|
163
|
-
wasm.__wbindgen_free(
|
|
172
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
164
173
|
}
|
|
165
174
|
}
|
|
166
175
|
|
|
@@ -197,45 +206,6 @@ export function dagCborComputeCid(bytes) {
|
|
|
197
206
|
}
|
|
198
207
|
}
|
|
199
208
|
|
|
200
|
-
/**
|
|
201
|
-
* Decode canonical DAG-CBOR bytes into the tagged JSON representation.
|
|
202
|
-
* @param {Uint8Array} bytes
|
|
203
|
-
* @returns {string}
|
|
204
|
-
*/
|
|
205
|
-
export function dagCborDecode(bytes) {
|
|
206
|
-
let deferred2_0;
|
|
207
|
-
let deferred2_1;
|
|
208
|
-
try {
|
|
209
|
-
const ret = wasm.dagCborDecode(bytes);
|
|
210
|
-
var ptr1 = ret[0];
|
|
211
|
-
var len1 = ret[1];
|
|
212
|
-
if (ret[3]) {
|
|
213
|
-
ptr1 = 0; len1 = 0;
|
|
214
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
215
|
-
}
|
|
216
|
-
deferred2_0 = ptr1;
|
|
217
|
-
deferred2_1 = len1;
|
|
218
|
-
return getStringFromWasm0(ptr1, len1);
|
|
219
|
-
} finally {
|
|
220
|
-
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* Encode a tagged JSON representation as canonical DAG-CBOR bytes.
|
|
226
|
-
* @param {string} value_json
|
|
227
|
-
* @returns {Uint8Array}
|
|
228
|
-
*/
|
|
229
|
-
export function dagCborEncode(value_json) {
|
|
230
|
-
const ptr0 = passStringToWasm0(value_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
231
|
-
const len0 = WASM_VECTOR_LEN;
|
|
232
|
-
const ret = wasm.dagCborEncode(ptr0, len0);
|
|
233
|
-
if (ret[2]) {
|
|
234
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
235
|
-
}
|
|
236
|
-
return takeFromExternrefTable0(ret[0]);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
209
|
/**
|
|
240
210
|
* Return the sha2-256 multihash envelope for canonical DAG-CBOR bytes.
|
|
241
211
|
* @param {Uint8Array} bytes
|
|
@@ -262,64 +232,17 @@ export function dagCborSha256ContentHash(bytes) {
|
|
|
262
232
|
return takeFromExternrefTable0(ret[0]);
|
|
263
233
|
}
|
|
264
234
|
|
|
265
|
-
/**
|
|
266
|
-
* Recompute and compare a CIDv1 dag-cbor/sha2-256 string.
|
|
267
|
-
* @param {string} cid
|
|
268
|
-
* @param {Uint8Array} bytes
|
|
269
|
-
* @returns {any}
|
|
270
|
-
*/
|
|
271
|
-
export function dagCborVerifyCid(cid, bytes) {
|
|
272
|
-
const ptr0 = passStringToWasm0(cid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
273
|
-
const len0 = WASM_VECTOR_LEN;
|
|
274
|
-
const ret = wasm.dagCborVerifyCid(ptr0, len0, bytes);
|
|
275
|
-
if (ret[2]) {
|
|
276
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
277
|
-
}
|
|
278
|
-
return takeFromExternrefTable0(ret[0]);
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* Recompute and compare a CID as a `CodecDagCborVerifyCidResult` protobuf message.
|
|
283
|
-
* @param {string} cid
|
|
284
|
-
* @param {Uint8Array} bytes
|
|
285
|
-
* @returns {Uint8Array}
|
|
286
|
-
*/
|
|
287
|
-
export function dagCborVerifyCidProto(cid, bytes) {
|
|
288
|
-
const ptr0 = passStringToWasm0(cid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
289
|
-
const len0 = WASM_VECTOR_LEN;
|
|
290
|
-
const ret = wasm.dagCborVerifyCidProto(ptr0, len0, bytes);
|
|
291
|
-
if (ret[2]) {
|
|
292
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
293
|
-
}
|
|
294
|
-
return takeFromExternrefTable0(ret[0]);
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* Recompute and compare a CID protobuf message with an explicit result status.
|
|
299
|
-
* @param {string} cid
|
|
300
|
-
* @param {Uint8Array} bytes
|
|
301
|
-
* @returns {any}
|
|
302
|
-
*/
|
|
303
|
-
export function dagCborVerifyCidProtoResult(cid, bytes) {
|
|
304
|
-
const ptr0 = passStringToWasm0(cid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
305
|
-
const len0 = WASM_VECTOR_LEN;
|
|
306
|
-
const ret = wasm.dagCborVerifyCidProtoResult(ptr0, len0, bytes);
|
|
307
|
-
if (ret[2]) {
|
|
308
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
309
|
-
}
|
|
310
|
-
return takeFromExternrefTable0(ret[0]);
|
|
311
|
-
}
|
|
312
|
-
|
|
313
235
|
/**
|
|
314
236
|
* Return whether a string parses as a CID.
|
|
315
237
|
* @param {string} cid
|
|
316
238
|
* @returns {boolean}
|
|
317
239
|
*/
|
|
318
240
|
export function isValidCidString(cid) {
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
241
|
+
const ret = wasm.isValidCidString(cid);
|
|
242
|
+
if (ret[2]) {
|
|
243
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
244
|
+
}
|
|
245
|
+
return ret[0] !== 0;
|
|
323
246
|
}
|
|
324
247
|
|
|
325
248
|
/**
|
|
@@ -328,9 +251,7 @@ export function isValidCidString(cid) {
|
|
|
328
251
|
* @returns {Uint8Array}
|
|
329
252
|
*/
|
|
330
253
|
export function lowerHexToBytes(encoded) {
|
|
331
|
-
const
|
|
332
|
-
const len0 = WASM_VECTOR_LEN;
|
|
333
|
-
const ret = wasm.lowerHexToBytes(ptr0, len0);
|
|
254
|
+
const ret = wasm.lowerHexToBytes(encoded);
|
|
334
255
|
if (ret[2]) {
|
|
335
256
|
throw takeFromExternrefTable0(ret[1]);
|
|
336
257
|
}
|
|
@@ -367,15 +288,21 @@ export function multibaseBase58btcEncode(bytes) {
|
|
|
367
288
|
* @returns {string}
|
|
368
289
|
*/
|
|
369
290
|
export function multibaseBase64urlEncode(bytes) {
|
|
370
|
-
let
|
|
371
|
-
let
|
|
291
|
+
let deferred2_0;
|
|
292
|
+
let deferred2_1;
|
|
372
293
|
try {
|
|
373
294
|
const ret = wasm.multibaseBase64urlEncode(bytes);
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
295
|
+
var ptr1 = ret[0];
|
|
296
|
+
var len1 = ret[1];
|
|
297
|
+
if (ret[3]) {
|
|
298
|
+
ptr1 = 0; len1 = 0;
|
|
299
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
300
|
+
}
|
|
301
|
+
deferred2_0 = ptr1;
|
|
302
|
+
deferred2_1 = len1;
|
|
303
|
+
return getStringFromWasm0(ptr1, len1);
|
|
377
304
|
} finally {
|
|
378
|
-
wasm.__wbindgen_free(
|
|
305
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
379
306
|
}
|
|
380
307
|
}
|
|
381
308
|
|
|
@@ -385,93 +312,7 @@ export function multibaseBase64urlEncode(bytes) {
|
|
|
385
312
|
* @returns {Uint8Array}
|
|
386
313
|
*/
|
|
387
314
|
export function multibaseDecode(encoded) {
|
|
388
|
-
const
|
|
389
|
-
const len0 = WASM_VECTOR_LEN;
|
|
390
|
-
const ret = wasm.multibaseDecode(ptr0, len0);
|
|
391
|
-
if (ret[2]) {
|
|
392
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
393
|
-
}
|
|
394
|
-
return takeFromExternrefTable0(ret[0]);
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
/**
|
|
398
|
-
* Resolve a byte slice that starts with a known multicodec prefix.
|
|
399
|
-
* @param {Uint8Array} bytes
|
|
400
|
-
* @returns {any}
|
|
401
|
-
*/
|
|
402
|
-
export function multicodecLookupPrefix(bytes) {
|
|
403
|
-
const ret = wasm.multicodecLookupPrefix(bytes);
|
|
404
|
-
if (ret[2]) {
|
|
405
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
406
|
-
}
|
|
407
|
-
return takeFromExternrefTable0(ret[0]);
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
/**
|
|
411
|
-
* Resolve a prefix as a `CodecMulticodecLookupResult` protobuf message.
|
|
412
|
-
* @param {Uint8Array} bytes
|
|
413
|
-
* @returns {Uint8Array}
|
|
414
|
-
*/
|
|
415
|
-
export function multicodecLookupPrefixProto(bytes) {
|
|
416
|
-
const ret = wasm.multicodecLookupPrefixProto(bytes);
|
|
417
|
-
if (ret[2]) {
|
|
418
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
419
|
-
}
|
|
420
|
-
return takeFromExternrefTable0(ret[0]);
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
/**
|
|
424
|
-
* Resolve a prefix protobuf message with an explicit result status.
|
|
425
|
-
* @param {Uint8Array} bytes
|
|
426
|
-
* @returns {any}
|
|
427
|
-
*/
|
|
428
|
-
export function multicodecLookupPrefixProtoResult(bytes) {
|
|
429
|
-
const ret = wasm.multicodecLookupPrefixProtoResult(bytes);
|
|
430
|
-
if (ret[2]) {
|
|
431
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
432
|
-
}
|
|
433
|
-
return takeFromExternrefTable0(ret[0]);
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
/**
|
|
437
|
-
* Return multicodec metadata for a canonical codec name.
|
|
438
|
-
* @param {string} codec_name
|
|
439
|
-
* @returns {any}
|
|
440
|
-
*/
|
|
441
|
-
export function multicodecPrefixForName(codec_name) {
|
|
442
|
-
const ptr0 = passStringToWasm0(codec_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
443
|
-
const len0 = WASM_VECTOR_LEN;
|
|
444
|
-
const ret = wasm.multicodecPrefixForName(ptr0, len0);
|
|
445
|
-
if (ret[2]) {
|
|
446
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
447
|
-
}
|
|
448
|
-
return takeFromExternrefTable0(ret[0]);
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
/**
|
|
452
|
-
* Return multicodec metadata as a `CodecMulticodecSpec` protobuf message.
|
|
453
|
-
* @param {string} codec_name
|
|
454
|
-
* @returns {Uint8Array}
|
|
455
|
-
*/
|
|
456
|
-
export function multicodecPrefixForNameProto(codec_name) {
|
|
457
|
-
const ptr0 = passStringToWasm0(codec_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
458
|
-
const len0 = WASM_VECTOR_LEN;
|
|
459
|
-
const ret = wasm.multicodecPrefixForNameProto(ptr0, len0);
|
|
460
|
-
if (ret[2]) {
|
|
461
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
462
|
-
}
|
|
463
|
-
return takeFromExternrefTable0(ret[0]);
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
/**
|
|
467
|
-
* Return multicodec metadata protobuf bytes with an explicit result status.
|
|
468
|
-
* @param {string} codec_name
|
|
469
|
-
* @returns {any}
|
|
470
|
-
*/
|
|
471
|
-
export function multicodecPrefixForNameProtoResult(codec_name) {
|
|
472
|
-
const ptr0 = passStringToWasm0(codec_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
473
|
-
const len0 = WASM_VECTOR_LEN;
|
|
474
|
-
const ret = wasm.multicodecPrefixForNameProtoResult(ptr0, len0);
|
|
315
|
+
const ret = wasm.multibaseDecode(encoded);
|
|
475
316
|
if (ret[2]) {
|
|
476
317
|
throw takeFromExternrefTable0(ret[1]);
|
|
477
318
|
}
|
|
@@ -485,39 +326,6 @@ export function multicodecPrefixForNameProtoResult(codec_name) {
|
|
|
485
326
|
*/
|
|
486
327
|
export function multicodecStripPrefix(bytes) {
|
|
487
328
|
const ret = wasm.multicodecStripPrefix(bytes);
|
|
488
|
-
return ret;
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
/**
|
|
492
|
-
* Return the supported multicodec table.
|
|
493
|
-
* @returns {any}
|
|
494
|
-
*/
|
|
495
|
-
export function multicodecTable() {
|
|
496
|
-
const ret = wasm.multicodecTable();
|
|
497
|
-
if (ret[2]) {
|
|
498
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
499
|
-
}
|
|
500
|
-
return takeFromExternrefTable0(ret[0]);
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
/**
|
|
504
|
-
* Return the supported multicodec table as protobuf bytes.
|
|
505
|
-
* @returns {Uint8Array}
|
|
506
|
-
*/
|
|
507
|
-
export function multicodecTableProto() {
|
|
508
|
-
const ret = wasm.multicodecTableProto();
|
|
509
|
-
if (ret[2]) {
|
|
510
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
511
|
-
}
|
|
512
|
-
return takeFromExternrefTable0(ret[0]);
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
/**
|
|
516
|
-
* Return the supported multicodec table protobuf bytes with an explicit result status.
|
|
517
|
-
* @returns {any}
|
|
518
|
-
*/
|
|
519
|
-
export function multicodecTableProtoResult() {
|
|
520
|
-
const ret = wasm.multicodecTableProtoResult();
|
|
521
329
|
if (ret[2]) {
|
|
522
330
|
throw takeFromExternrefTable0(ret[1]);
|
|
523
331
|
}
|
|
@@ -531,50 +339,31 @@ export function multicodecTableProtoResult() {
|
|
|
531
339
|
* @returns {string}
|
|
532
340
|
*/
|
|
533
341
|
export function multikeyEncode(codec_name, public_key) {
|
|
534
|
-
let
|
|
535
|
-
let
|
|
342
|
+
let deferred2_0;
|
|
343
|
+
let deferred2_1;
|
|
536
344
|
try {
|
|
537
|
-
const
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
var ptr2 = ret[0];
|
|
541
|
-
var len2 = ret[1];
|
|
345
|
+
const ret = wasm.multikeyEncode(codec_name, public_key);
|
|
346
|
+
var ptr1 = ret[0];
|
|
347
|
+
var len1 = ret[1];
|
|
542
348
|
if (ret[3]) {
|
|
543
|
-
|
|
349
|
+
ptr1 = 0; len1 = 0;
|
|
544
350
|
throw takeFromExternrefTable0(ret[2]);
|
|
545
351
|
}
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
return getStringFromWasm0(
|
|
352
|
+
deferred2_0 = ptr1;
|
|
353
|
+
deferred2_1 = len1;
|
|
354
|
+
return getStringFromWasm0(ptr1, len1);
|
|
549
355
|
} finally {
|
|
550
|
-
wasm.__wbindgen_free(
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
/**
|
|
555
|
-
* Parse and validate a multikey string.
|
|
556
|
-
* @param {string} multikey
|
|
557
|
-
* @returns {any}
|
|
558
|
-
*/
|
|
559
|
-
export function multikeyParse(multikey) {
|
|
560
|
-
const ptr0 = passStringToWasm0(multikey, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
561
|
-
const len0 = WASM_VECTOR_LEN;
|
|
562
|
-
const ret = wasm.multikeyParse(ptr0, len0);
|
|
563
|
-
if (ret[2]) {
|
|
564
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
356
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
565
357
|
}
|
|
566
|
-
return takeFromExternrefTable0(ret[0]);
|
|
567
358
|
}
|
|
568
359
|
|
|
569
360
|
/**
|
|
570
|
-
*
|
|
571
|
-
* @param {
|
|
361
|
+
* Execute one generated binary protobuf request and return a fully discriminated response.
|
|
362
|
+
* @param {Uint8Array} request
|
|
572
363
|
* @returns {Uint8Array}
|
|
573
364
|
*/
|
|
574
|
-
export function
|
|
575
|
-
const
|
|
576
|
-
const len0 = WASM_VECTOR_LEN;
|
|
577
|
-
const ret = wasm.multikeyParseProto(ptr0, len0);
|
|
365
|
+
export function processOperation(request) {
|
|
366
|
+
const ret = wasm.processOperation(request);
|
|
578
367
|
if (ret[2]) {
|
|
579
368
|
throw takeFromExternrefTable0(ret[1]);
|
|
580
369
|
}
|
|
@@ -582,112 +371,24 @@ export function multikeyParseProto(multikey) {
|
|
|
582
371
|
}
|
|
583
372
|
|
|
584
373
|
/**
|
|
585
|
-
*
|
|
586
|
-
* @param {
|
|
587
|
-
* @returns {any}
|
|
588
|
-
*/
|
|
589
|
-
export function multikeyParseProtoResult(multikey) {
|
|
590
|
-
const ptr0 = passStringToWasm0(multikey, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
591
|
-
const len0 = WASM_VECTOR_LEN;
|
|
592
|
-
const ret = wasm.multikeyParseProtoResult(ptr0, len0);
|
|
593
|
-
if (ret[2]) {
|
|
594
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
595
|
-
}
|
|
596
|
-
return takeFromExternrefTable0(ret[0]);
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
/**
|
|
600
|
-
* Decode PEM text armor with caller-supplied size and label policy.
|
|
601
|
-
* @param {string} input
|
|
602
|
-
* @param {string} options_json
|
|
603
|
-
* @returns {any}
|
|
604
|
-
*/
|
|
605
|
-
export function pemDecode(input, options_json) {
|
|
606
|
-
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
607
|
-
const len0 = WASM_VECTOR_LEN;
|
|
608
|
-
const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
609
|
-
const len1 = WASM_VECTOR_LEN;
|
|
610
|
-
const ret = wasm.pemDecode(ptr0, len0, ptr1, len1);
|
|
611
|
-
if (ret[2]) {
|
|
612
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
613
|
-
}
|
|
614
|
-
return takeFromExternrefTable0(ret[0]);
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
/**
|
|
618
|
-
* Decode PEM text armor as a `CodecPemDecodeResult` protobuf message.
|
|
619
|
-
* @param {string} input
|
|
620
|
-
* @param {string} options_json
|
|
374
|
+
* Execute one generated ProtoJSON request and return a discriminated response.
|
|
375
|
+
* @param {Uint8Array} request_json
|
|
621
376
|
* @returns {Uint8Array}
|
|
622
377
|
*/
|
|
623
|
-
export function
|
|
624
|
-
const
|
|
625
|
-
const len0 = WASM_VECTOR_LEN;
|
|
626
|
-
const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
627
|
-
const len1 = WASM_VECTOR_LEN;
|
|
628
|
-
const ret = wasm.pemDecodeProto(ptr0, len0, ptr1, len1);
|
|
378
|
+
export function processOperationJson(request_json) {
|
|
379
|
+
const ret = wasm.processOperationJson(request_json);
|
|
629
380
|
if (ret[2]) {
|
|
630
381
|
throw takeFromExternrefTable0(ret[1]);
|
|
631
382
|
}
|
|
632
383
|
return takeFromExternrefTable0(ret[0]);
|
|
633
384
|
}
|
|
634
385
|
|
|
635
|
-
/**
|
|
636
|
-
* Decode PEM text armor protobuf bytes with an explicit result status.
|
|
637
|
-
* @param {string} input
|
|
638
|
-
* @param {string} options_json
|
|
639
|
-
* @returns {any}
|
|
640
|
-
*/
|
|
641
|
-
export function pemDecodeProtoResult(input, options_json) {
|
|
642
|
-
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
643
|
-
const len0 = WASM_VECTOR_LEN;
|
|
644
|
-
const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
645
|
-
const len1 = WASM_VECTOR_LEN;
|
|
646
|
-
const ret = wasm.pemDecodeProtoResult(ptr0, len0, ptr1, len1);
|
|
647
|
-
if (ret[2]) {
|
|
648
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
649
|
-
}
|
|
650
|
-
return takeFromExternrefTable0(ret[0]);
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
/**
|
|
654
|
-
* Encode DER bytes as PEM text armor.
|
|
655
|
-
* @param {string} label
|
|
656
|
-
* @param {Uint8Array} der
|
|
657
|
-
* @param {string} options_json
|
|
658
|
-
* @returns {string}
|
|
659
|
-
*/
|
|
660
|
-
export function pemEncode(label, der, options_json) {
|
|
661
|
-
let deferred4_0;
|
|
662
|
-
let deferred4_1;
|
|
663
|
-
try {
|
|
664
|
-
const ptr0 = passStringToWasm0(label, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
665
|
-
const len0 = WASM_VECTOR_LEN;
|
|
666
|
-
const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
667
|
-
const len1 = WASM_VECTOR_LEN;
|
|
668
|
-
const ret = wasm.pemEncode(ptr0, len0, der, ptr1, len1);
|
|
669
|
-
var ptr3 = ret[0];
|
|
670
|
-
var len3 = ret[1];
|
|
671
|
-
if (ret[3]) {
|
|
672
|
-
ptr3 = 0; len3 = 0;
|
|
673
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
674
|
-
}
|
|
675
|
-
deferred4_0 = ptr3;
|
|
676
|
-
deferred4_1 = len3;
|
|
677
|
-
return getStringFromWasm0(ptr3, len3);
|
|
678
|
-
} finally {
|
|
679
|
-
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
|
|
683
386
|
/**
|
|
684
387
|
* Fail closed when a codec name is not in the supported table.
|
|
685
388
|
* @param {string} codec_name
|
|
686
389
|
*/
|
|
687
390
|
export function requireSupportedMulticodec(codec_name) {
|
|
688
|
-
const
|
|
689
|
-
const len0 = WASM_VECTOR_LEN;
|
|
690
|
-
const ret = wasm.requireSupportedMulticodec(ptr0, len0);
|
|
391
|
+
const ret = wasm.requireSupportedMulticodec(codec_name);
|
|
691
392
|
if (ret[1]) {
|
|
692
393
|
throw takeFromExternrefTable0(ret[0]);
|
|
693
394
|
}
|
|
@@ -699,10 +400,11 @@ export function requireSupportedMulticodec(codec_name) {
|
|
|
699
400
|
* @returns {any}
|
|
700
401
|
*/
|
|
701
402
|
export function tryParseCid(cid) {
|
|
702
|
-
const
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
403
|
+
const ret = wasm.tryParseCid(cid);
|
|
404
|
+
if (ret[2]) {
|
|
405
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
406
|
+
}
|
|
407
|
+
return takeFromExternrefTable0(ret[0]);
|
|
706
408
|
}
|
|
707
409
|
|
|
708
410
|
/**
|
|
@@ -712,13 +414,7 @@ export function tryParseCid(cid) {
|
|
|
712
414
|
* @param {string} multikey
|
|
713
415
|
*/
|
|
714
416
|
export function validateKeyBinding(binding_type, algorithm, multikey) {
|
|
715
|
-
const
|
|
716
|
-
const len0 = WASM_VECTOR_LEN;
|
|
717
|
-
var ptr1 = isLikeNone(algorithm) ? 0 : passStringToWasm0(algorithm, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
718
|
-
var len1 = WASM_VECTOR_LEN;
|
|
719
|
-
const ptr2 = passStringToWasm0(multikey, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
720
|
-
const len2 = WASM_VECTOR_LEN;
|
|
721
|
-
const ret = wasm.validateKeyBinding(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
417
|
+
const ret = wasm.validateKeyBinding(binding_type, isLikeNone(algorithm) ? 0 : addToExternrefTable0(algorithm), multikey);
|
|
722
418
|
if (ret[1]) {
|
|
723
419
|
throw takeFromExternrefTable0(ret[0]);
|
|
724
420
|
}
|
|
@@ -726,42 +422,52 @@ export function validateKeyBinding(binding_type, algorithm, multikey) {
|
|
|
726
422
|
function __wbg_get_imports() {
|
|
727
423
|
const import0 = {
|
|
728
424
|
__proto__: null,
|
|
425
|
+
__wbg___wbindgen_string_get_b0ca35b86a603356: function(arg0, arg1) {
|
|
426
|
+
const obj = arg1;
|
|
427
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
428
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
429
|
+
var len1 = WASM_VECTOR_LEN;
|
|
430
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
431
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
432
|
+
},
|
|
729
433
|
__wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
|
|
730
434
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
731
435
|
},
|
|
732
|
-
|
|
733
|
-
const ret = arg0.
|
|
436
|
+
__wbg_charCodeAt_2a30bc7c17474cc6: function(arg0, arg1) {
|
|
437
|
+
const ret = arg0.charCodeAt(arg1 >>> 0);
|
|
734
438
|
return ret;
|
|
735
439
|
},
|
|
736
|
-
|
|
737
|
-
const ret =
|
|
440
|
+
__wbg_fill_5663f5c647107cce: function(arg0, arg1, arg2, arg3) {
|
|
441
|
+
const ret = arg0.fill(arg1, arg2 >>> 0, arg3 >>> 0);
|
|
738
442
|
return ret;
|
|
739
443
|
},
|
|
740
|
-
|
|
741
|
-
const ret =
|
|
444
|
+
__wbg_length_02c64e687322fa34: function(arg0) {
|
|
445
|
+
const ret = arg0.length;
|
|
446
|
+
return ret;
|
|
447
|
+
},
|
|
448
|
+
__wbg_length_1f0964f4a5e2c6d8: function(arg0) {
|
|
449
|
+
const ret = arg0.length;
|
|
742
450
|
return ret;
|
|
743
451
|
},
|
|
744
452
|
__wbg_new_from_slice_77cdfb7977362f3c: function(arg0, arg1) {
|
|
745
453
|
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
746
454
|
return ret;
|
|
747
455
|
},
|
|
456
|
+
__wbg_new_with_length_e6785c33c8e4cce8: function(arg0) {
|
|
457
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
458
|
+
return ret;
|
|
459
|
+
},
|
|
748
460
|
__wbg_prototypesetcall_4770620bbe4688a0: function(arg0, arg1, arg2) {
|
|
749
461
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
750
462
|
},
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
return ret;
|
|
463
|
+
__wbg_set_61e45ae8061eca11: function(arg0, arg1, arg2) {
|
|
464
|
+
arg0.set(arg1, arg2 >>> 0);
|
|
754
465
|
},
|
|
755
|
-
|
|
756
|
-
const ret =
|
|
757
|
-
return ret;
|
|
758
|
-
}, arguments); },
|
|
759
|
-
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
760
|
-
// Cast intrinsic for `F64 -> Externref`.
|
|
761
|
-
const ret = arg0;
|
|
466
|
+
__wbg_subarray_3ed232c8a6baee09: function(arg0, arg1, arg2) {
|
|
467
|
+
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
762
468
|
return ret;
|
|
763
469
|
},
|
|
764
|
-
|
|
470
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
765
471
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
766
472
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
767
473
|
return ret;
|
|
@@ -793,6 +499,14 @@ function getArrayU8FromWasm0(ptr, len) {
|
|
|
793
499
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
794
500
|
}
|
|
795
501
|
|
|
502
|
+
let cachedDataViewMemory0 = null;
|
|
503
|
+
function getDataViewMemory0() {
|
|
504
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
505
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
506
|
+
}
|
|
507
|
+
return cachedDataViewMemory0;
|
|
508
|
+
}
|
|
509
|
+
|
|
796
510
|
function getStringFromWasm0(ptr, len) {
|
|
797
511
|
return decodeText(ptr >>> 0, len);
|
|
798
512
|
}
|
|
@@ -805,15 +519,6 @@ function getUint8ArrayMemory0() {
|
|
|
805
519
|
return cachedUint8ArrayMemory0;
|
|
806
520
|
}
|
|
807
521
|
|
|
808
|
-
function handleError(f, args) {
|
|
809
|
-
try {
|
|
810
|
-
return f.apply(this, args);
|
|
811
|
-
} catch (e) {
|
|
812
|
-
const idx = addToExternrefTable0(e);
|
|
813
|
-
wasm.__wbindgen_exn_store(idx);
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
|
|
817
522
|
function isLikeNone(x) {
|
|
818
523
|
return x === undefined || x === null;
|
|
819
524
|
}
|
|
@@ -895,6 +600,7 @@ function __wbg_finalize_init(instance, module) {
|
|
|
895
600
|
wasmInstance = instance;
|
|
896
601
|
wasm = instance.exports;
|
|
897
602
|
wasmModule = module;
|
|
603
|
+
cachedDataViewMemory0 = null;
|
|
898
604
|
cachedUint8ArrayMemory0 = null;
|
|
899
605
|
wasm.__wbindgen_start();
|
|
900
606
|
return wasm;
|