@reallyme/codec 0.1.20 → 0.1.22
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 -2
- package/dist/boundary.d.ts +11 -0
- package/dist/boundary.js +250 -0
- package/dist/cbor.js +119 -29
- package/dist/index.d.ts +7 -4
- package/dist/index.js +4 -0
- package/dist/jcs.js +3 -60
- package/dist/multiformat.js +57 -14
- package/dist/pem.d.ts +4 -4
- package/dist/pem.js +183 -36
- package/dist/proto/generated/reallyme/codec/v1/codec_pb.d.ts +335 -1
- package/dist/proto/generated/reallyme/codec/v1/codec_pb.js +149 -14
- package/dist/proto.d.ts +2 -2
- package/dist/proto.js +1 -1
- package/dist/protoProcess.d.ts +16 -0
- package/dist/protoProcess.js +282 -0
- package/dist/readOutput.d.ts +1 -1
- package/dist/readOutput.js +84 -21
- package/dist/wasm/reallyme_codec_wasm.d.ts +35 -95
- package/dist/wasm/reallyme_codec_wasm.js +153 -290
- package/dist/wasm/reallyme_codec_wasm_bg.wasm +0 -0
- package/dist/wasmProvider.d.ts +4 -18
- package/dist/wasmProvider.js +18 -25
- package/package.json +1 -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
|
|
|
@@ -227,9 +236,7 @@ export function dagCborDecode(bytes) {
|
|
|
227
236
|
* @returns {Uint8Array}
|
|
228
237
|
*/
|
|
229
238
|
export function dagCborEncode(value_json) {
|
|
230
|
-
const
|
|
231
|
-
const len0 = WASM_VECTOR_LEN;
|
|
232
|
-
const ret = wasm.dagCborEncode(ptr0, len0);
|
|
239
|
+
const ret = wasm.dagCborEncode(value_json);
|
|
233
240
|
if (ret[2]) {
|
|
234
241
|
throw takeFromExternrefTable0(ret[1]);
|
|
235
242
|
}
|
|
@@ -269,41 +276,7 @@ export function dagCborSha256ContentHash(bytes) {
|
|
|
269
276
|
* @returns {any}
|
|
270
277
|
*/
|
|
271
278
|
export function dagCborVerifyCid(cid, bytes) {
|
|
272
|
-
const
|
|
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);
|
|
279
|
+
const ret = wasm.dagCborVerifyCid(cid, bytes);
|
|
307
280
|
if (ret[2]) {
|
|
308
281
|
throw takeFromExternrefTable0(ret[1]);
|
|
309
282
|
}
|
|
@@ -316,10 +289,11 @@ export function dagCborVerifyCidProtoResult(cid, bytes) {
|
|
|
316
289
|
* @returns {boolean}
|
|
317
290
|
*/
|
|
318
291
|
export function isValidCidString(cid) {
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
292
|
+
const ret = wasm.isValidCidString(cid);
|
|
293
|
+
if (ret[2]) {
|
|
294
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
295
|
+
}
|
|
296
|
+
return ret[0] !== 0;
|
|
323
297
|
}
|
|
324
298
|
|
|
325
299
|
/**
|
|
@@ -328,9 +302,7 @@ export function isValidCidString(cid) {
|
|
|
328
302
|
* @returns {Uint8Array}
|
|
329
303
|
*/
|
|
330
304
|
export function lowerHexToBytes(encoded) {
|
|
331
|
-
const
|
|
332
|
-
const len0 = WASM_VECTOR_LEN;
|
|
333
|
-
const ret = wasm.lowerHexToBytes(ptr0, len0);
|
|
305
|
+
const ret = wasm.lowerHexToBytes(encoded);
|
|
334
306
|
if (ret[2]) {
|
|
335
307
|
throw takeFromExternrefTable0(ret[1]);
|
|
336
308
|
}
|
|
@@ -367,15 +339,21 @@ export function multibaseBase58btcEncode(bytes) {
|
|
|
367
339
|
* @returns {string}
|
|
368
340
|
*/
|
|
369
341
|
export function multibaseBase64urlEncode(bytes) {
|
|
370
|
-
let
|
|
371
|
-
let
|
|
342
|
+
let deferred2_0;
|
|
343
|
+
let deferred2_1;
|
|
372
344
|
try {
|
|
373
345
|
const ret = wasm.multibaseBase64urlEncode(bytes);
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
346
|
+
var ptr1 = ret[0];
|
|
347
|
+
var len1 = ret[1];
|
|
348
|
+
if (ret[3]) {
|
|
349
|
+
ptr1 = 0; len1 = 0;
|
|
350
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
351
|
+
}
|
|
352
|
+
deferred2_0 = ptr1;
|
|
353
|
+
deferred2_1 = len1;
|
|
354
|
+
return getStringFromWasm0(ptr1, len1);
|
|
377
355
|
} finally {
|
|
378
|
-
wasm.__wbindgen_free(
|
|
356
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
379
357
|
}
|
|
380
358
|
}
|
|
381
359
|
|
|
@@ -385,9 +363,7 @@ export function multibaseBase64urlEncode(bytes) {
|
|
|
385
363
|
* @returns {Uint8Array}
|
|
386
364
|
*/
|
|
387
365
|
export function multibaseDecode(encoded) {
|
|
388
|
-
const
|
|
389
|
-
const len0 = WASM_VECTOR_LEN;
|
|
390
|
-
const ret = wasm.multibaseDecode(ptr0, len0);
|
|
366
|
+
const ret = wasm.multibaseDecode(encoded);
|
|
391
367
|
if (ret[2]) {
|
|
392
368
|
throw takeFromExternrefTable0(ret[1]);
|
|
393
369
|
}
|
|
@@ -407,71 +383,13 @@ export function multicodecLookupPrefix(bytes) {
|
|
|
407
383
|
return takeFromExternrefTable0(ret[0]);
|
|
408
384
|
}
|
|
409
385
|
|
|
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
386
|
/**
|
|
437
387
|
* Return multicodec metadata for a canonical codec name.
|
|
438
388
|
* @param {string} codec_name
|
|
439
389
|
* @returns {any}
|
|
440
390
|
*/
|
|
441
391
|
export function multicodecPrefixForName(codec_name) {
|
|
442
|
-
const
|
|
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);
|
|
392
|
+
const ret = wasm.multicodecPrefixForName(codec_name);
|
|
475
393
|
if (ret[2]) {
|
|
476
394
|
throw takeFromExternrefTable0(ret[1]);
|
|
477
395
|
}
|
|
@@ -485,15 +403,6 @@ export function multicodecPrefixForNameProtoResult(codec_name) {
|
|
|
485
403
|
*/
|
|
486
404
|
export function multicodecStripPrefix(bytes) {
|
|
487
405
|
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
406
|
if (ret[2]) {
|
|
498
407
|
throw takeFromExternrefTable0(ret[1]);
|
|
499
408
|
}
|
|
@@ -501,23 +410,11 @@ export function multicodecTable() {
|
|
|
501
410
|
}
|
|
502
411
|
|
|
503
412
|
/**
|
|
504
|
-
* Return the supported multicodec table
|
|
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.
|
|
413
|
+
* Return the supported multicodec table.
|
|
517
414
|
* @returns {any}
|
|
518
415
|
*/
|
|
519
|
-
export function
|
|
520
|
-
const ret = wasm.
|
|
416
|
+
export function multicodecTable() {
|
|
417
|
+
const ret = wasm.multicodecTable();
|
|
521
418
|
if (ret[2]) {
|
|
522
419
|
throw takeFromExternrefTable0(ret[1]);
|
|
523
420
|
}
|
|
@@ -531,23 +428,21 @@ export function multicodecTableProtoResult() {
|
|
|
531
428
|
* @returns {string}
|
|
532
429
|
*/
|
|
533
430
|
export function multikeyEncode(codec_name, public_key) {
|
|
534
|
-
let
|
|
535
|
-
let
|
|
431
|
+
let deferred2_0;
|
|
432
|
+
let deferred2_1;
|
|
536
433
|
try {
|
|
537
|
-
const
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
var ptr2 = ret[0];
|
|
541
|
-
var len2 = ret[1];
|
|
434
|
+
const ret = wasm.multikeyEncode(codec_name, public_key);
|
|
435
|
+
var ptr1 = ret[0];
|
|
436
|
+
var len1 = ret[1];
|
|
542
437
|
if (ret[3]) {
|
|
543
|
-
|
|
438
|
+
ptr1 = 0; len1 = 0;
|
|
544
439
|
throw takeFromExternrefTable0(ret[2]);
|
|
545
440
|
}
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
return getStringFromWasm0(
|
|
441
|
+
deferred2_0 = ptr1;
|
|
442
|
+
deferred2_1 = len1;
|
|
443
|
+
return getStringFromWasm0(ptr1, len1);
|
|
549
444
|
} finally {
|
|
550
|
-
wasm.__wbindgen_free(
|
|
445
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
551
446
|
}
|
|
552
447
|
}
|
|
553
448
|
|
|
@@ -557,9 +452,7 @@ export function multikeyEncode(codec_name, public_key) {
|
|
|
557
452
|
* @returns {any}
|
|
558
453
|
*/
|
|
559
454
|
export function multikeyParse(multikey) {
|
|
560
|
-
const
|
|
561
|
-
const len0 = WASM_VECTOR_LEN;
|
|
562
|
-
const ret = wasm.multikeyParse(ptr0, len0);
|
|
455
|
+
const ret = wasm.multikeyParse(multikey);
|
|
563
456
|
if (ret[2]) {
|
|
564
457
|
throw takeFromExternrefTable0(ret[1]);
|
|
565
458
|
}
|
|
@@ -567,29 +460,13 @@ export function multikeyParse(multikey) {
|
|
|
567
460
|
}
|
|
568
461
|
|
|
569
462
|
/**
|
|
570
|
-
*
|
|
571
|
-
* @param {
|
|
572
|
-
* @
|
|
573
|
-
*/
|
|
574
|
-
export function multikeyParseProto(multikey) {
|
|
575
|
-
const ptr0 = passStringToWasm0(multikey, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
576
|
-
const len0 = WASM_VECTOR_LEN;
|
|
577
|
-
const ret = wasm.multikeyParseProto(ptr0, len0);
|
|
578
|
-
if (ret[2]) {
|
|
579
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
580
|
-
}
|
|
581
|
-
return takeFromExternrefTable0(ret[0]);
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
/**
|
|
585
|
-
* Parse and validate a multikey protobuf message with an explicit result status.
|
|
586
|
-
* @param {string} multikey
|
|
463
|
+
* Decode PEM armor bytes with caller-supplied size and label policy.
|
|
464
|
+
* @param {Uint8Array} input
|
|
465
|
+
* @param {string} options_json
|
|
587
466
|
* @returns {any}
|
|
588
467
|
*/
|
|
589
|
-
export function
|
|
590
|
-
const
|
|
591
|
-
const len0 = WASM_VECTOR_LEN;
|
|
592
|
-
const ret = wasm.multikeyParseProtoResult(ptr0, len0);
|
|
468
|
+
export function pemDecode(input, options_json) {
|
|
469
|
+
const ret = wasm.pemDecode(input, options_json);
|
|
593
470
|
if (ret[2]) {
|
|
594
471
|
throw takeFromExternrefTable0(ret[1]);
|
|
595
472
|
}
|
|
@@ -597,17 +474,14 @@ export function multikeyParseProtoResult(multikey) {
|
|
|
597
474
|
}
|
|
598
475
|
|
|
599
476
|
/**
|
|
600
|
-
*
|
|
601
|
-
* @param {string}
|
|
477
|
+
* Encode DER bytes as wipeable PEM armor bytes.
|
|
478
|
+
* @param {string} label
|
|
479
|
+
* @param {Uint8Array} der
|
|
602
480
|
* @param {string} options_json
|
|
603
|
-
* @returns {
|
|
481
|
+
* @returns {Uint8Array}
|
|
604
482
|
*/
|
|
605
|
-
export function
|
|
606
|
-
const
|
|
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);
|
|
483
|
+
export function pemEncode(label, der, options_json) {
|
|
484
|
+
const ret = wasm.pemEncode(label, der, options_json);
|
|
611
485
|
if (ret[2]) {
|
|
612
486
|
throw takeFromExternrefTable0(ret[1]);
|
|
613
487
|
}
|
|
@@ -615,17 +489,12 @@ export function pemDecode(input, options_json) {
|
|
|
615
489
|
}
|
|
616
490
|
|
|
617
491
|
/**
|
|
618
|
-
*
|
|
619
|
-
* @param {
|
|
620
|
-
* @param {string} options_json
|
|
492
|
+
* Execute one generated binary protobuf request and return a binary result envelope.
|
|
493
|
+
* @param {Uint8Array} request
|
|
621
494
|
* @returns {Uint8Array}
|
|
622
495
|
*/
|
|
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);
|
|
496
|
+
export function processProto(request) {
|
|
497
|
+
const ret = wasm.processProto(request);
|
|
629
498
|
if (ret[2]) {
|
|
630
499
|
throw takeFromExternrefTable0(ret[1]);
|
|
631
500
|
}
|
|
@@ -633,61 +502,24 @@ export function pemDecodeProto(input, options_json) {
|
|
|
633
502
|
}
|
|
634
503
|
|
|
635
504
|
/**
|
|
636
|
-
*
|
|
637
|
-
* @param {
|
|
638
|
-
* @
|
|
639
|
-
* @returns {any}
|
|
505
|
+
* Execute one generated ProtoJSON request and return a binary result envelope.
|
|
506
|
+
* @param {Uint8Array} request_json
|
|
507
|
+
* @returns {Uint8Array}
|
|
640
508
|
*/
|
|
641
|
-
export function
|
|
642
|
-
const
|
|
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);
|
|
509
|
+
export function processProtoJson(request_json) {
|
|
510
|
+
const ret = wasm.processProtoJson(request_json);
|
|
647
511
|
if (ret[2]) {
|
|
648
512
|
throw takeFromExternrefTable0(ret[1]);
|
|
649
513
|
}
|
|
650
514
|
return takeFromExternrefTable0(ret[0]);
|
|
651
515
|
}
|
|
652
516
|
|
|
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
517
|
/**
|
|
684
518
|
* Fail closed when a codec name is not in the supported table.
|
|
685
519
|
* @param {string} codec_name
|
|
686
520
|
*/
|
|
687
521
|
export function requireSupportedMulticodec(codec_name) {
|
|
688
|
-
const
|
|
689
|
-
const len0 = WASM_VECTOR_LEN;
|
|
690
|
-
const ret = wasm.requireSupportedMulticodec(ptr0, len0);
|
|
522
|
+
const ret = wasm.requireSupportedMulticodec(codec_name);
|
|
691
523
|
if (ret[1]) {
|
|
692
524
|
throw takeFromExternrefTable0(ret[0]);
|
|
693
525
|
}
|
|
@@ -699,10 +531,11 @@ export function requireSupportedMulticodec(codec_name) {
|
|
|
699
531
|
* @returns {any}
|
|
700
532
|
*/
|
|
701
533
|
export function tryParseCid(cid) {
|
|
702
|
-
const
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
534
|
+
const ret = wasm.tryParseCid(cid);
|
|
535
|
+
if (ret[2]) {
|
|
536
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
537
|
+
}
|
|
538
|
+
return takeFromExternrefTable0(ret[0]);
|
|
706
539
|
}
|
|
707
540
|
|
|
708
541
|
/**
|
|
@@ -712,13 +545,7 @@ export function tryParseCid(cid) {
|
|
|
712
545
|
* @param {string} multikey
|
|
713
546
|
*/
|
|
714
547
|
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);
|
|
548
|
+
const ret = wasm.validateKeyBinding(binding_type, isLikeNone(algorithm) ? 0 : addToExternrefTable0(algorithm), multikey);
|
|
722
549
|
if (ret[1]) {
|
|
723
550
|
throw takeFromExternrefTable0(ret[0]);
|
|
724
551
|
}
|
|
@@ -726,9 +553,25 @@ export function validateKeyBinding(binding_type, algorithm, multikey) {
|
|
|
726
553
|
function __wbg_get_imports() {
|
|
727
554
|
const import0 = {
|
|
728
555
|
__proto__: null,
|
|
556
|
+
__wbg___wbindgen_string_get_b0ca35b86a603356: function(arg0, arg1) {
|
|
557
|
+
const obj = arg1;
|
|
558
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
559
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
560
|
+
var len1 = WASM_VECTOR_LEN;
|
|
561
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
562
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
563
|
+
},
|
|
729
564
|
__wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
|
|
730
565
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
731
566
|
},
|
|
567
|
+
__wbg_fill_5663f5c647107cce: function(arg0, arg1, arg2, arg3) {
|
|
568
|
+
const ret = arg0.fill(arg1, arg2 >>> 0, arg3 >>> 0);
|
|
569
|
+
return ret;
|
|
570
|
+
},
|
|
571
|
+
__wbg_length_02c64e687322fa34: function(arg0) {
|
|
572
|
+
const ret = arg0.length;
|
|
573
|
+
return ret;
|
|
574
|
+
},
|
|
732
575
|
__wbg_length_1f0964f4a5e2c6d8: function(arg0) {
|
|
733
576
|
const ret = arg0.length;
|
|
734
577
|
return ret;
|
|
@@ -745,6 +588,10 @@ function __wbg_get_imports() {
|
|
|
745
588
|
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
746
589
|
return ret;
|
|
747
590
|
},
|
|
591
|
+
__wbg_new_with_length_e6785c33c8e4cce8: function(arg0) {
|
|
592
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
593
|
+
return ret;
|
|
594
|
+
},
|
|
748
595
|
__wbg_prototypesetcall_4770620bbe4688a0: function(arg0, arg1, arg2) {
|
|
749
596
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
750
597
|
},
|
|
@@ -752,10 +599,17 @@ function __wbg_get_imports() {
|
|
|
752
599
|
const ret = arg0.push(arg1);
|
|
753
600
|
return ret;
|
|
754
601
|
},
|
|
602
|
+
__wbg_set_61e45ae8061eca11: function(arg0, arg1, arg2) {
|
|
603
|
+
arg0.set(arg1, arg2 >>> 0);
|
|
604
|
+
},
|
|
755
605
|
__wbg_set_8535240470bf2500: function() { return handleError(function (arg0, arg1, arg2) {
|
|
756
606
|
const ret = Reflect.set(arg0, arg1, arg2);
|
|
757
607
|
return ret;
|
|
758
608
|
}, arguments); },
|
|
609
|
+
__wbg_subarray_3ed232c8a6baee09: function(arg0, arg1, arg2) {
|
|
610
|
+
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
611
|
+
return ret;
|
|
612
|
+
},
|
|
759
613
|
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
760
614
|
// Cast intrinsic for `F64 -> Externref`.
|
|
761
615
|
const ret = arg0;
|
|
@@ -793,6 +647,14 @@ function getArrayU8FromWasm0(ptr, len) {
|
|
|
793
647
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
794
648
|
}
|
|
795
649
|
|
|
650
|
+
let cachedDataViewMemory0 = null;
|
|
651
|
+
function getDataViewMemory0() {
|
|
652
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
653
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
654
|
+
}
|
|
655
|
+
return cachedDataViewMemory0;
|
|
656
|
+
}
|
|
657
|
+
|
|
796
658
|
function getStringFromWasm0(ptr, len) {
|
|
797
659
|
return decodeText(ptr >>> 0, len);
|
|
798
660
|
}
|
|
@@ -895,6 +757,7 @@ function __wbg_finalize_init(instance, module) {
|
|
|
895
757
|
wasmInstance = instance;
|
|
896
758
|
wasm = instance.exports;
|
|
897
759
|
wasmModule = module;
|
|
760
|
+
cachedDataViewMemory0 = null;
|
|
898
761
|
cachedUint8ArrayMemory0 = null;
|
|
899
762
|
wasm.__wbindgen_start();
|
|
900
763
|
return wasm;
|