simple-hpke 0.0.8 → 0.0.11

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.
@@ -0,0 +1,1751 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ var __export = (target, all) => {
4
+ for (var name2 in all)
5
+ __defProp(target, name2, { get: all[name2], enumerable: true });
6
+ };
7
+
8
+ // node_modules/uint8arrays/dist/src/alloc.js
9
+ function allocUnsafe(size = 0) {
10
+ return new Uint8Array(size);
11
+ }
12
+ __name(allocUnsafe, "allocUnsafe");
13
+
14
+ // node_modules/multiformats/dist/src/bases/base10.js
15
+ var base10_exports = {};
16
+ __export(base10_exports, {
17
+ base10: () => base10
18
+ });
19
+
20
+ // node_modules/multiformats/dist/src/bytes.js
21
+ var empty = new Uint8Array(0);
22
+ function equals(aa, bb) {
23
+ if (aa === bb) {
24
+ return true;
25
+ }
26
+ if (aa.byteLength !== bb.byteLength) {
27
+ return false;
28
+ }
29
+ for (let ii = 0; ii < aa.byteLength; ii++) {
30
+ if (aa[ii] !== bb[ii]) {
31
+ return false;
32
+ }
33
+ }
34
+ return true;
35
+ }
36
+ __name(equals, "equals");
37
+ function coerce(o) {
38
+ if (o instanceof Uint8Array && o.constructor.name === "Uint8Array") {
39
+ return o;
40
+ }
41
+ if (o instanceof ArrayBuffer) {
42
+ return new Uint8Array(o);
43
+ }
44
+ if (ArrayBuffer.isView(o)) {
45
+ return new Uint8Array(o.buffer, o.byteOffset, o.byteLength);
46
+ }
47
+ throw new Error("Unknown type, must be binary type");
48
+ }
49
+ __name(coerce, "coerce");
50
+ function fromString(str) {
51
+ return new TextEncoder().encode(str);
52
+ }
53
+ __name(fromString, "fromString");
54
+ function toString(b) {
55
+ return new TextDecoder().decode(b);
56
+ }
57
+ __name(toString, "toString");
58
+
59
+ // node_modules/multiformats/dist/src/vendor/base-x.js
60
+ function base(ALPHABET, name2) {
61
+ if (ALPHABET.length >= 255) {
62
+ throw new TypeError("Alphabet too long");
63
+ }
64
+ var BASE_MAP = new Uint8Array(256);
65
+ for (var j = 0; j < BASE_MAP.length; j++) {
66
+ BASE_MAP[j] = 255;
67
+ }
68
+ for (var i = 0; i < ALPHABET.length; i++) {
69
+ var x = ALPHABET.charAt(i);
70
+ var xc = x.charCodeAt(0);
71
+ if (BASE_MAP[xc] !== 255) {
72
+ throw new TypeError(x + " is ambiguous");
73
+ }
74
+ BASE_MAP[xc] = i;
75
+ }
76
+ var BASE = ALPHABET.length;
77
+ var LEADER = ALPHABET.charAt(0);
78
+ var FACTOR = Math.log(BASE) / Math.log(256);
79
+ var iFACTOR = Math.log(256) / Math.log(BASE);
80
+ function encode5(source) {
81
+ if (source instanceof Uint8Array)
82
+ ;
83
+ else if (ArrayBuffer.isView(source)) {
84
+ source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
85
+ } else if (Array.isArray(source)) {
86
+ source = Uint8Array.from(source);
87
+ }
88
+ if (!(source instanceof Uint8Array)) {
89
+ throw new TypeError("Expected Uint8Array");
90
+ }
91
+ if (source.length === 0) {
92
+ return "";
93
+ }
94
+ var zeroes = 0;
95
+ var length2 = 0;
96
+ var pbegin = 0;
97
+ var pend = source.length;
98
+ while (pbegin !== pend && source[pbegin] === 0) {
99
+ pbegin++;
100
+ zeroes++;
101
+ }
102
+ var size = (pend - pbegin) * iFACTOR + 1 >>> 0;
103
+ var b58 = new Uint8Array(size);
104
+ while (pbegin !== pend) {
105
+ var carry = source[pbegin];
106
+ var i2 = 0;
107
+ for (var it1 = size - 1; (carry !== 0 || i2 < length2) && it1 !== -1; it1--, i2++) {
108
+ carry += 256 * b58[it1] >>> 0;
109
+ b58[it1] = carry % BASE >>> 0;
110
+ carry = carry / BASE >>> 0;
111
+ }
112
+ if (carry !== 0) {
113
+ throw new Error("Non-zero carry");
114
+ }
115
+ length2 = i2;
116
+ pbegin++;
117
+ }
118
+ var it2 = size - length2;
119
+ while (it2 !== size && b58[it2] === 0) {
120
+ it2++;
121
+ }
122
+ var str = LEADER.repeat(zeroes);
123
+ for (; it2 < size; ++it2) {
124
+ str += ALPHABET.charAt(b58[it2]);
125
+ }
126
+ return str;
127
+ }
128
+ __name(encode5, "encode");
129
+ function decodeUnsafe(source) {
130
+ if (typeof source !== "string") {
131
+ throw new TypeError("Expected String");
132
+ }
133
+ if (source.length === 0) {
134
+ return new Uint8Array();
135
+ }
136
+ var psz = 0;
137
+ if (source[psz] === " ") {
138
+ return;
139
+ }
140
+ var zeroes = 0;
141
+ var length2 = 0;
142
+ while (source[psz] === LEADER) {
143
+ zeroes++;
144
+ psz++;
145
+ }
146
+ var size = (source.length - psz) * FACTOR + 1 >>> 0;
147
+ var b256 = new Uint8Array(size);
148
+ while (source[psz]) {
149
+ var carry = BASE_MAP[source.charCodeAt(psz)];
150
+ if (carry === 255) {
151
+ return;
152
+ }
153
+ var i2 = 0;
154
+ for (var it3 = size - 1; (carry !== 0 || i2 < length2) && it3 !== -1; it3--, i2++) {
155
+ carry += BASE * b256[it3] >>> 0;
156
+ b256[it3] = carry % 256 >>> 0;
157
+ carry = carry / 256 >>> 0;
158
+ }
159
+ if (carry !== 0) {
160
+ throw new Error("Non-zero carry");
161
+ }
162
+ length2 = i2;
163
+ psz++;
164
+ }
165
+ if (source[psz] === " ") {
166
+ return;
167
+ }
168
+ var it4 = size - length2;
169
+ while (it4 !== size && b256[it4] === 0) {
170
+ it4++;
171
+ }
172
+ var vch = new Uint8Array(zeroes + (size - it4));
173
+ var j2 = zeroes;
174
+ while (it4 !== size) {
175
+ vch[j2++] = b256[it4++];
176
+ }
177
+ return vch;
178
+ }
179
+ __name(decodeUnsafe, "decodeUnsafe");
180
+ function decode6(string2) {
181
+ var buffer = decodeUnsafe(string2);
182
+ if (buffer) {
183
+ return buffer;
184
+ }
185
+ throw new Error(`Non-${name2} character`);
186
+ }
187
+ __name(decode6, "decode");
188
+ return {
189
+ encode: encode5,
190
+ decodeUnsafe,
191
+ decode: decode6
192
+ };
193
+ }
194
+ __name(base, "base");
195
+ var src = base;
196
+ var _brrp__multiformats_scope_baseX = src;
197
+ var base_x_default = _brrp__multiformats_scope_baseX;
198
+
199
+ // node_modules/multiformats/dist/src/bases/base.js
200
+ var Encoder = class {
201
+ static {
202
+ __name(this, "Encoder");
203
+ }
204
+ name;
205
+ prefix;
206
+ baseEncode;
207
+ constructor(name2, prefix, baseEncode) {
208
+ this.name = name2;
209
+ this.prefix = prefix;
210
+ this.baseEncode = baseEncode;
211
+ }
212
+ encode(bytes) {
213
+ if (bytes instanceof Uint8Array) {
214
+ return `${this.prefix}${this.baseEncode(bytes)}`;
215
+ } else {
216
+ throw Error("Unknown type, must be binary type");
217
+ }
218
+ }
219
+ };
220
+ var Decoder = class {
221
+ static {
222
+ __name(this, "Decoder");
223
+ }
224
+ name;
225
+ prefix;
226
+ baseDecode;
227
+ prefixCodePoint;
228
+ constructor(name2, prefix, baseDecode) {
229
+ this.name = name2;
230
+ this.prefix = prefix;
231
+ const prefixCodePoint = prefix.codePointAt(0);
232
+ if (prefixCodePoint === void 0) {
233
+ throw new Error("Invalid prefix character");
234
+ }
235
+ this.prefixCodePoint = prefixCodePoint;
236
+ this.baseDecode = baseDecode;
237
+ }
238
+ decode(text) {
239
+ if (typeof text === "string") {
240
+ if (text.codePointAt(0) !== this.prefixCodePoint) {
241
+ throw Error(`Unable to decode multibase string ${JSON.stringify(text)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);
242
+ }
243
+ return this.baseDecode(text.slice(this.prefix.length));
244
+ } else {
245
+ throw Error("Can only multibase decode strings");
246
+ }
247
+ }
248
+ or(decoder) {
249
+ return or(this, decoder);
250
+ }
251
+ };
252
+ var ComposedDecoder = class {
253
+ static {
254
+ __name(this, "ComposedDecoder");
255
+ }
256
+ decoders;
257
+ constructor(decoders) {
258
+ this.decoders = decoders;
259
+ }
260
+ or(decoder) {
261
+ return or(this, decoder);
262
+ }
263
+ decode(input) {
264
+ const prefix = input[0];
265
+ const decoder = this.decoders[prefix];
266
+ if (decoder != null) {
267
+ return decoder.decode(input);
268
+ } else {
269
+ throw RangeError(`Unable to decode multibase string ${JSON.stringify(input)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`);
270
+ }
271
+ }
272
+ };
273
+ function or(left, right) {
274
+ return new ComposedDecoder({
275
+ ...left.decoders ?? { [left.prefix]: left },
276
+ ...right.decoders ?? { [right.prefix]: right }
277
+ });
278
+ }
279
+ __name(or, "or");
280
+ var Codec = class {
281
+ static {
282
+ __name(this, "Codec");
283
+ }
284
+ name;
285
+ prefix;
286
+ baseEncode;
287
+ baseDecode;
288
+ encoder;
289
+ decoder;
290
+ constructor(name2, prefix, baseEncode, baseDecode) {
291
+ this.name = name2;
292
+ this.prefix = prefix;
293
+ this.baseEncode = baseEncode;
294
+ this.baseDecode = baseDecode;
295
+ this.encoder = new Encoder(name2, prefix, baseEncode);
296
+ this.decoder = new Decoder(name2, prefix, baseDecode);
297
+ }
298
+ encode(input) {
299
+ return this.encoder.encode(input);
300
+ }
301
+ decode(input) {
302
+ return this.decoder.decode(input);
303
+ }
304
+ };
305
+ function from({ name: name2, prefix, encode: encode5, decode: decode6 }) {
306
+ return new Codec(name2, prefix, encode5, decode6);
307
+ }
308
+ __name(from, "from");
309
+ function baseX({ name: name2, prefix, alphabet: alphabet2 }) {
310
+ const { encode: encode5, decode: decode6 } = base_x_default(alphabet2, name2);
311
+ return from({
312
+ prefix,
313
+ name: name2,
314
+ encode: encode5,
315
+ decode: /* @__PURE__ */ __name((text) => coerce(decode6(text)), "decode")
316
+ });
317
+ }
318
+ __name(baseX, "baseX");
319
+ function decode(string2, alphabetIdx, bitsPerChar, name2) {
320
+ let end = string2.length;
321
+ while (string2[end - 1] === "=") {
322
+ --end;
323
+ }
324
+ const out = new Uint8Array(end * bitsPerChar / 8 | 0);
325
+ let bits = 0;
326
+ let buffer = 0;
327
+ let written = 0;
328
+ for (let i = 0; i < end; ++i) {
329
+ const value = alphabetIdx[string2[i]];
330
+ if (value === void 0) {
331
+ throw new SyntaxError(`Non-${name2} character`);
332
+ }
333
+ buffer = buffer << bitsPerChar | value;
334
+ bits += bitsPerChar;
335
+ if (bits >= 8) {
336
+ bits -= 8;
337
+ out[written++] = 255 & buffer >> bits;
338
+ }
339
+ }
340
+ if (bits >= bitsPerChar || (255 & buffer << 8 - bits) !== 0) {
341
+ throw new SyntaxError("Unexpected end of data");
342
+ }
343
+ return out;
344
+ }
345
+ __name(decode, "decode");
346
+ function encode(data, alphabet2, bitsPerChar) {
347
+ const pad = alphabet2[alphabet2.length - 1] === "=";
348
+ const mask = (1 << bitsPerChar) - 1;
349
+ let out = "";
350
+ let bits = 0;
351
+ let buffer = 0;
352
+ for (let i = 0; i < data.length; ++i) {
353
+ buffer = buffer << 8 | data[i];
354
+ bits += 8;
355
+ while (bits > bitsPerChar) {
356
+ bits -= bitsPerChar;
357
+ out += alphabet2[mask & buffer >> bits];
358
+ }
359
+ }
360
+ if (bits !== 0) {
361
+ out += alphabet2[mask & buffer << bitsPerChar - bits];
362
+ }
363
+ if (pad) {
364
+ while ((out.length * bitsPerChar & 7) !== 0) {
365
+ out += "=";
366
+ }
367
+ }
368
+ return out;
369
+ }
370
+ __name(encode, "encode");
371
+ function createAlphabetIdx(alphabet2) {
372
+ const alphabetIdx = {};
373
+ for (let i = 0; i < alphabet2.length; ++i) {
374
+ alphabetIdx[alphabet2[i]] = i;
375
+ }
376
+ return alphabetIdx;
377
+ }
378
+ __name(createAlphabetIdx, "createAlphabetIdx");
379
+ function rfc4648({ name: name2, prefix, bitsPerChar, alphabet: alphabet2 }) {
380
+ const alphabetIdx = createAlphabetIdx(alphabet2);
381
+ return from({
382
+ prefix,
383
+ name: name2,
384
+ encode(input) {
385
+ return encode(input, alphabet2, bitsPerChar);
386
+ },
387
+ decode(input) {
388
+ return decode(input, alphabetIdx, bitsPerChar, name2);
389
+ }
390
+ });
391
+ }
392
+ __name(rfc4648, "rfc4648");
393
+
394
+ // node_modules/multiformats/dist/src/bases/base10.js
395
+ var base10 = baseX({
396
+ prefix: "9",
397
+ name: "base10",
398
+ alphabet: "0123456789"
399
+ });
400
+
401
+ // node_modules/multiformats/dist/src/bases/base16.js
402
+ var base16_exports = {};
403
+ __export(base16_exports, {
404
+ base16: () => base16,
405
+ base16upper: () => base16upper
406
+ });
407
+ var base16 = rfc4648({
408
+ prefix: "f",
409
+ name: "base16",
410
+ alphabet: "0123456789abcdef",
411
+ bitsPerChar: 4
412
+ });
413
+ var base16upper = rfc4648({
414
+ prefix: "F",
415
+ name: "base16upper",
416
+ alphabet: "0123456789ABCDEF",
417
+ bitsPerChar: 4
418
+ });
419
+
420
+ // node_modules/multiformats/dist/src/bases/base2.js
421
+ var base2_exports = {};
422
+ __export(base2_exports, {
423
+ base2: () => base2
424
+ });
425
+ var base2 = rfc4648({
426
+ prefix: "0",
427
+ name: "base2",
428
+ alphabet: "01",
429
+ bitsPerChar: 1
430
+ });
431
+
432
+ // node_modules/multiformats/dist/src/bases/base256emoji.js
433
+ var base256emoji_exports = {};
434
+ __export(base256emoji_exports, {
435
+ base256emoji: () => base256emoji
436
+ });
437
+ var alphabet = Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}");
438
+ var alphabetBytesToChars = alphabet.reduce((p, c, i) => {
439
+ p[i] = c;
440
+ return p;
441
+ }, []);
442
+ var alphabetCharsToBytes = alphabet.reduce((p, c, i) => {
443
+ const codePoint = c.codePointAt(0);
444
+ if (codePoint == null) {
445
+ throw new Error(`Invalid character: ${c}`);
446
+ }
447
+ p[codePoint] = i;
448
+ return p;
449
+ }, []);
450
+ function encode2(data) {
451
+ return data.reduce((p, c) => {
452
+ p += alphabetBytesToChars[c];
453
+ return p;
454
+ }, "");
455
+ }
456
+ __name(encode2, "encode");
457
+ function decode2(str) {
458
+ const byts = [];
459
+ for (const char of str) {
460
+ const codePoint = char.codePointAt(0);
461
+ if (codePoint == null) {
462
+ throw new Error(`Invalid character: ${char}`);
463
+ }
464
+ const byt = alphabetCharsToBytes[codePoint];
465
+ if (byt == null) {
466
+ throw new Error(`Non-base256emoji character: ${char}`);
467
+ }
468
+ byts.push(byt);
469
+ }
470
+ return new Uint8Array(byts);
471
+ }
472
+ __name(decode2, "decode");
473
+ var base256emoji = from({
474
+ prefix: "\u{1F680}",
475
+ name: "base256emoji",
476
+ encode: encode2,
477
+ decode: decode2
478
+ });
479
+
480
+ // node_modules/multiformats/dist/src/bases/base32.js
481
+ var base32_exports = {};
482
+ __export(base32_exports, {
483
+ base32: () => base32,
484
+ base32hex: () => base32hex,
485
+ base32hexpad: () => base32hexpad,
486
+ base32hexpadupper: () => base32hexpadupper,
487
+ base32hexupper: () => base32hexupper,
488
+ base32pad: () => base32pad,
489
+ base32padupper: () => base32padupper,
490
+ base32upper: () => base32upper,
491
+ base32z: () => base32z
492
+ });
493
+ var base32 = rfc4648({
494
+ prefix: "b",
495
+ name: "base32",
496
+ alphabet: "abcdefghijklmnopqrstuvwxyz234567",
497
+ bitsPerChar: 5
498
+ });
499
+ var base32upper = rfc4648({
500
+ prefix: "B",
501
+ name: "base32upper",
502
+ alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",
503
+ bitsPerChar: 5
504
+ });
505
+ var base32pad = rfc4648({
506
+ prefix: "c",
507
+ name: "base32pad",
508
+ alphabet: "abcdefghijklmnopqrstuvwxyz234567=",
509
+ bitsPerChar: 5
510
+ });
511
+ var base32padupper = rfc4648({
512
+ prefix: "C",
513
+ name: "base32padupper",
514
+ alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",
515
+ bitsPerChar: 5
516
+ });
517
+ var base32hex = rfc4648({
518
+ prefix: "v",
519
+ name: "base32hex",
520
+ alphabet: "0123456789abcdefghijklmnopqrstuv",
521
+ bitsPerChar: 5
522
+ });
523
+ var base32hexupper = rfc4648({
524
+ prefix: "V",
525
+ name: "base32hexupper",
526
+ alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV",
527
+ bitsPerChar: 5
528
+ });
529
+ var base32hexpad = rfc4648({
530
+ prefix: "t",
531
+ name: "base32hexpad",
532
+ alphabet: "0123456789abcdefghijklmnopqrstuv=",
533
+ bitsPerChar: 5
534
+ });
535
+ var base32hexpadupper = rfc4648({
536
+ prefix: "T",
537
+ name: "base32hexpadupper",
538
+ alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV=",
539
+ bitsPerChar: 5
540
+ });
541
+ var base32z = rfc4648({
542
+ prefix: "h",
543
+ name: "base32z",
544
+ alphabet: "ybndrfg8ejkmcpqxot1uwisza345h769",
545
+ bitsPerChar: 5
546
+ });
547
+
548
+ // node_modules/multiformats/dist/src/bases/base36.js
549
+ var base36_exports = {};
550
+ __export(base36_exports, {
551
+ base36: () => base36,
552
+ base36upper: () => base36upper
553
+ });
554
+ var base36 = baseX({
555
+ prefix: "k",
556
+ name: "base36",
557
+ alphabet: "0123456789abcdefghijklmnopqrstuvwxyz"
558
+ });
559
+ var base36upper = baseX({
560
+ prefix: "K",
561
+ name: "base36upper",
562
+ alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
563
+ });
564
+
565
+ // node_modules/multiformats/dist/src/bases/base58.js
566
+ var base58_exports = {};
567
+ __export(base58_exports, {
568
+ base58btc: () => base58btc,
569
+ base58flickr: () => base58flickr
570
+ });
571
+ var base58btc = baseX({
572
+ name: "base58btc",
573
+ prefix: "z",
574
+ alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
575
+ });
576
+ var base58flickr = baseX({
577
+ name: "base58flickr",
578
+ prefix: "Z",
579
+ alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"
580
+ });
581
+
582
+ // node_modules/multiformats/dist/src/bases/base64.js
583
+ var base64_exports = {};
584
+ __export(base64_exports, {
585
+ base64: () => base64,
586
+ base64pad: () => base64pad,
587
+ base64url: () => base64url,
588
+ base64urlpad: () => base64urlpad
589
+ });
590
+ var base64 = rfc4648({
591
+ prefix: "m",
592
+ name: "base64",
593
+ alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
594
+ bitsPerChar: 6
595
+ });
596
+ var base64pad = rfc4648({
597
+ prefix: "M",
598
+ name: "base64pad",
599
+ alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
600
+ bitsPerChar: 6
601
+ });
602
+ var base64url = rfc4648({
603
+ prefix: "u",
604
+ name: "base64url",
605
+ alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",
606
+ bitsPerChar: 6
607
+ });
608
+ var base64urlpad = rfc4648({
609
+ prefix: "U",
610
+ name: "base64urlpad",
611
+ alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",
612
+ bitsPerChar: 6
613
+ });
614
+
615
+ // node_modules/multiformats/dist/src/bases/base8.js
616
+ var base8_exports = {};
617
+ __export(base8_exports, {
618
+ base8: () => base8
619
+ });
620
+ var base8 = rfc4648({
621
+ prefix: "7",
622
+ name: "base8",
623
+ alphabet: "01234567",
624
+ bitsPerChar: 3
625
+ });
626
+
627
+ // node_modules/multiformats/dist/src/bases/identity.js
628
+ var identity_exports = {};
629
+ __export(identity_exports, {
630
+ identity: () => identity
631
+ });
632
+ var identity = from({
633
+ prefix: "\0",
634
+ name: "identity",
635
+ encode: /* @__PURE__ */ __name((buf) => toString(buf), "encode"),
636
+ decode: /* @__PURE__ */ __name((str) => fromString(str), "decode")
637
+ });
638
+
639
+ // node_modules/multiformats/dist/src/codecs/json.js
640
+ var textEncoder = new TextEncoder();
641
+ var textDecoder = new TextDecoder();
642
+
643
+ // node_modules/multiformats/dist/src/hashes/identity.js
644
+ var identity_exports2 = {};
645
+ __export(identity_exports2, {
646
+ identity: () => identity2
647
+ });
648
+
649
+ // node_modules/multiformats/dist/src/vendor/varint.js
650
+ var encode_1 = encode3;
651
+ var MSB = 128;
652
+ var REST = 127;
653
+ var MSBALL = ~REST;
654
+ var INT = Math.pow(2, 31);
655
+ function encode3(num, out, offset) {
656
+ out = out || [];
657
+ offset = offset || 0;
658
+ var oldOffset = offset;
659
+ while (num >= INT) {
660
+ out[offset++] = num & 255 | MSB;
661
+ num /= 128;
662
+ }
663
+ while (num & MSBALL) {
664
+ out[offset++] = num & 255 | MSB;
665
+ num >>>= 7;
666
+ }
667
+ out[offset] = num | 0;
668
+ encode3.bytes = offset - oldOffset + 1;
669
+ return out;
670
+ }
671
+ __name(encode3, "encode");
672
+ var decode3 = read;
673
+ var MSB$1 = 128;
674
+ var REST$1 = 127;
675
+ function read(buf, offset) {
676
+ var res = 0, offset = offset || 0, shift = 0, counter = offset, b, l = buf.length;
677
+ do {
678
+ if (counter >= l) {
679
+ read.bytes = 0;
680
+ throw new RangeError("Could not decode varint");
681
+ }
682
+ b = buf[counter++];
683
+ res += shift < 28 ? (b & REST$1) << shift : (b & REST$1) * Math.pow(2, shift);
684
+ shift += 7;
685
+ } while (b >= MSB$1);
686
+ read.bytes = counter - offset;
687
+ return res;
688
+ }
689
+ __name(read, "read");
690
+ var N1 = Math.pow(2, 7);
691
+ var N2 = Math.pow(2, 14);
692
+ var N3 = Math.pow(2, 21);
693
+ var N4 = Math.pow(2, 28);
694
+ var N5 = Math.pow(2, 35);
695
+ var N6 = Math.pow(2, 42);
696
+ var N7 = Math.pow(2, 49);
697
+ var N8 = Math.pow(2, 56);
698
+ var N9 = Math.pow(2, 63);
699
+ var length = /* @__PURE__ */ __name(function(value) {
700
+ return value < N1 ? 1 : value < N2 ? 2 : value < N3 ? 3 : value < N4 ? 4 : value < N5 ? 5 : value < N6 ? 6 : value < N7 ? 7 : value < N8 ? 8 : value < N9 ? 9 : 10;
701
+ }, "length");
702
+ var varint = {
703
+ encode: encode_1,
704
+ decode: decode3,
705
+ encodingLength: length
706
+ };
707
+ var _brrp_varint = varint;
708
+ var varint_default = _brrp_varint;
709
+
710
+ // node_modules/multiformats/dist/src/varint.js
711
+ function decode4(data, offset = 0) {
712
+ const code2 = varint_default.decode(data, offset);
713
+ return [code2, varint_default.decode.bytes];
714
+ }
715
+ __name(decode4, "decode");
716
+ function encodeTo(int, target, offset = 0) {
717
+ varint_default.encode(int, target, offset);
718
+ return target;
719
+ }
720
+ __name(encodeTo, "encodeTo");
721
+ function encodingLength(int) {
722
+ return varint_default.encodingLength(int);
723
+ }
724
+ __name(encodingLength, "encodingLength");
725
+
726
+ // node_modules/multiformats/dist/src/hashes/digest.js
727
+ function create(code2, digest2) {
728
+ const size = digest2.byteLength;
729
+ const sizeOffset = encodingLength(code2);
730
+ const digestOffset = sizeOffset + encodingLength(size);
731
+ const bytes = new Uint8Array(digestOffset + size);
732
+ encodeTo(code2, bytes, 0);
733
+ encodeTo(size, bytes, sizeOffset);
734
+ bytes.set(digest2, digestOffset);
735
+ return new Digest(code2, size, digest2, bytes);
736
+ }
737
+ __name(create, "create");
738
+ function decode5(multihash) {
739
+ const bytes = coerce(multihash);
740
+ const [code2, sizeOffset] = decode4(bytes);
741
+ const [size, digestOffset] = decode4(bytes.subarray(sizeOffset));
742
+ const digest2 = bytes.subarray(sizeOffset + digestOffset);
743
+ if (digest2.byteLength !== size) {
744
+ throw new Error("Incorrect length");
745
+ }
746
+ return new Digest(code2, size, digest2, bytes);
747
+ }
748
+ __name(decode5, "decode");
749
+ function equals2(a, b) {
750
+ if (a === b) {
751
+ return true;
752
+ } else {
753
+ const data = b;
754
+ return a.code === data.code && a.size === data.size && data.bytes instanceof Uint8Array && equals(a.bytes, data.bytes);
755
+ }
756
+ }
757
+ __name(equals2, "equals");
758
+ var Digest = class {
759
+ static {
760
+ __name(this, "Digest");
761
+ }
762
+ code;
763
+ size;
764
+ digest;
765
+ bytes;
766
+ /**
767
+ * Creates a multihash digest.
768
+ */
769
+ constructor(code2, size, digest2, bytes) {
770
+ this.code = code2;
771
+ this.size = size;
772
+ this.digest = digest2;
773
+ this.bytes = bytes;
774
+ }
775
+ };
776
+
777
+ // node_modules/multiformats/dist/src/hashes/identity.js
778
+ var code = 0;
779
+ var name = "identity";
780
+ var encode4 = coerce;
781
+ function digest(input, options) {
782
+ if (options?.truncate != null && options.truncate !== input.byteLength) {
783
+ if (options.truncate < 0 || options.truncate > input.byteLength) {
784
+ throw new Error(`Invalid truncate option, must be less than or equal to ${input.byteLength}`);
785
+ }
786
+ input = input.subarray(0, options.truncate);
787
+ }
788
+ return create(code, encode4(input));
789
+ }
790
+ __name(digest, "digest");
791
+ var identity2 = { code, name, encode: encode4, digest };
792
+
793
+ // node_modules/multiformats/dist/src/hashes/sha2-browser.js
794
+ var sha2_browser_exports = {};
795
+ __export(sha2_browser_exports, {
796
+ sha256: () => sha256,
797
+ sha512: () => sha512
798
+ });
799
+
800
+ // node_modules/multiformats/dist/src/hashes/hasher.js
801
+ var DEFAULT_MIN_DIGEST_LENGTH = 20;
802
+ function from2({ name: name2, code: code2, encode: encode5, minDigestLength, maxDigestLength }) {
803
+ return new Hasher(name2, code2, encode5, minDigestLength, maxDigestLength);
804
+ }
805
+ __name(from2, "from");
806
+ var Hasher = class {
807
+ static {
808
+ __name(this, "Hasher");
809
+ }
810
+ name;
811
+ code;
812
+ encode;
813
+ minDigestLength;
814
+ maxDigestLength;
815
+ constructor(name2, code2, encode5, minDigestLength, maxDigestLength) {
816
+ this.name = name2;
817
+ this.code = code2;
818
+ this.encode = encode5;
819
+ this.minDigestLength = minDigestLength ?? DEFAULT_MIN_DIGEST_LENGTH;
820
+ this.maxDigestLength = maxDigestLength;
821
+ }
822
+ digest(input, options) {
823
+ if (options?.truncate != null) {
824
+ if (options.truncate < this.minDigestLength) {
825
+ throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);
826
+ }
827
+ if (this.maxDigestLength != null && options.truncate > this.maxDigestLength) {
828
+ throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`);
829
+ }
830
+ }
831
+ if (input instanceof Uint8Array) {
832
+ const result = this.encode(input);
833
+ if (result instanceof Uint8Array) {
834
+ return createDigest(result, this.code, options?.truncate);
835
+ }
836
+ return result.then((digest2) => createDigest(digest2, this.code, options?.truncate));
837
+ } else {
838
+ throw Error("Unknown type, must be binary type");
839
+ }
840
+ }
841
+ };
842
+ function createDigest(digest2, code2, truncate) {
843
+ if (truncate != null && truncate !== digest2.byteLength) {
844
+ if (truncate > digest2.byteLength) {
845
+ throw new Error(`Invalid truncate option, must be less than or equal to ${digest2.byteLength}`);
846
+ }
847
+ digest2 = digest2.subarray(0, truncate);
848
+ }
849
+ return create(code2, digest2);
850
+ }
851
+ __name(createDigest, "createDigest");
852
+
853
+ // node_modules/multiformats/dist/src/hashes/sha2-browser.js
854
+ function sha(name2) {
855
+ return async (data) => new Uint8Array(await crypto.subtle.digest(name2, data));
856
+ }
857
+ __name(sha, "sha");
858
+ var sha256 = from2({
859
+ name: "sha2-256",
860
+ code: 18,
861
+ encode: sha("SHA-256")
862
+ });
863
+ var sha512 = from2({
864
+ name: "sha2-512",
865
+ code: 19,
866
+ encode: sha("SHA-512")
867
+ });
868
+
869
+ // node_modules/multiformats/dist/src/cid.js
870
+ function format(link, base3) {
871
+ const { bytes, version } = link;
872
+ switch (version) {
873
+ case 0:
874
+ return toStringV0(bytes, baseCache(link), base3 ?? base58btc.encoder);
875
+ default:
876
+ return toStringV1(bytes, baseCache(link), base3 ?? base32.encoder);
877
+ }
878
+ }
879
+ __name(format, "format");
880
+ var cache = /* @__PURE__ */ new WeakMap();
881
+ function baseCache(cid) {
882
+ const baseCache2 = cache.get(cid);
883
+ if (baseCache2 == null) {
884
+ const baseCache3 = /* @__PURE__ */ new Map();
885
+ cache.set(cid, baseCache3);
886
+ return baseCache3;
887
+ }
888
+ return baseCache2;
889
+ }
890
+ __name(baseCache, "baseCache");
891
+ var CID = class _CID {
892
+ static {
893
+ __name(this, "CID");
894
+ }
895
+ code;
896
+ version;
897
+ multihash;
898
+ bytes;
899
+ "/";
900
+ /**
901
+ * @param version - Version of the CID
902
+ * @param code - Code of the codec content is encoded in, see https://github.com/multiformats/multicodec/blob/master/table.csv
903
+ * @param multihash - (Multi)hash of the of the content.
904
+ */
905
+ constructor(version, code2, multihash, bytes) {
906
+ this.code = code2;
907
+ this.version = version;
908
+ this.multihash = multihash;
909
+ this.bytes = bytes;
910
+ this["/"] = bytes;
911
+ }
912
+ /**
913
+ * Signalling `cid.asCID === cid` has been replaced with `cid['/'] === cid.bytes`
914
+ * please either use `CID.asCID(cid)` or switch to new signalling mechanism
915
+ *
916
+ * @deprecated
917
+ */
918
+ get asCID() {
919
+ return this;
920
+ }
921
+ // ArrayBufferView
922
+ get byteOffset() {
923
+ return this.bytes.byteOffset;
924
+ }
925
+ // ArrayBufferView
926
+ get byteLength() {
927
+ return this.bytes.byteLength;
928
+ }
929
+ toV0() {
930
+ switch (this.version) {
931
+ case 0: {
932
+ return this;
933
+ }
934
+ case 1: {
935
+ const { code: code2, multihash } = this;
936
+ if (code2 !== DAG_PB_CODE) {
937
+ throw new Error("Cannot convert a non dag-pb CID to CIDv0");
938
+ }
939
+ if (multihash.code !== SHA_256_CODE) {
940
+ throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");
941
+ }
942
+ return _CID.createV0(multihash);
943
+ }
944
+ default: {
945
+ throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`);
946
+ }
947
+ }
948
+ }
949
+ toV1() {
950
+ switch (this.version) {
951
+ case 0: {
952
+ const { code: code2, digest: digest2 } = this.multihash;
953
+ const multihash = create(code2, digest2);
954
+ return _CID.createV1(this.code, multihash);
955
+ }
956
+ case 1: {
957
+ return this;
958
+ }
959
+ default: {
960
+ throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`);
961
+ }
962
+ }
963
+ }
964
+ equals(other) {
965
+ return _CID.equals(this, other);
966
+ }
967
+ static equals(self, other) {
968
+ const unknown = other;
969
+ return unknown != null && self.code === unknown.code && self.version === unknown.version && equals2(self.multihash, unknown.multihash);
970
+ }
971
+ toString(base3) {
972
+ return format(this, base3);
973
+ }
974
+ toJSON() {
975
+ return { "/": format(this) };
976
+ }
977
+ link() {
978
+ return this;
979
+ }
980
+ [Symbol.toStringTag] = "CID";
981
+ // Legacy
982
+ [/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")]() {
983
+ return `CID(${this.toString()})`;
984
+ }
985
+ /**
986
+ * Takes any input `value` and returns a `CID` instance if it was
987
+ * a `CID` otherwise returns `null`. If `value` is instanceof `CID`
988
+ * it will return value back. If `value` is not instance of this CID
989
+ * class, but is compatible CID it will return new instance of this
990
+ * `CID` class. Otherwise returns null.
991
+ *
992
+ * This allows two different incompatible versions of CID library to
993
+ * co-exist and interop as long as binary interface is compatible.
994
+ */
995
+ static asCID(input) {
996
+ if (input == null) {
997
+ return null;
998
+ }
999
+ const value = input;
1000
+ if (value instanceof _CID) {
1001
+ return value;
1002
+ } else if (value["/"] != null && value["/"] === value.bytes || value.asCID === value) {
1003
+ const { version, code: code2, multihash, bytes } = value;
1004
+ return new _CID(version, code2, multihash, bytes ?? encodeCID(version, code2, multihash.bytes));
1005
+ } else if (value[cidSymbol] === true) {
1006
+ const { version, multihash, code: code2 } = value;
1007
+ const digest2 = decode5(multihash);
1008
+ return _CID.create(version, code2, digest2);
1009
+ } else {
1010
+ return null;
1011
+ }
1012
+ }
1013
+ /**
1014
+ * @param version - Version of the CID
1015
+ * @param code - Code of the codec content is encoded in, see https://github.com/multiformats/multicodec/blob/master/table.csv
1016
+ * @param digest - (Multi)hash of the of the content.
1017
+ */
1018
+ static create(version, code2, digest2) {
1019
+ if (typeof code2 !== "number") {
1020
+ throw new Error("String codecs are no longer supported");
1021
+ }
1022
+ if (!(digest2.bytes instanceof Uint8Array)) {
1023
+ throw new Error("Invalid digest");
1024
+ }
1025
+ switch (version) {
1026
+ case 0: {
1027
+ if (code2 !== DAG_PB_CODE) {
1028
+ throw new Error(`Version 0 CID must use dag-pb (code: ${DAG_PB_CODE}) block encoding`);
1029
+ } else {
1030
+ return new _CID(version, code2, digest2, digest2.bytes);
1031
+ }
1032
+ }
1033
+ case 1: {
1034
+ const bytes = encodeCID(version, code2, digest2.bytes);
1035
+ return new _CID(version, code2, digest2, bytes);
1036
+ }
1037
+ default: {
1038
+ throw new Error("Invalid version");
1039
+ }
1040
+ }
1041
+ }
1042
+ /**
1043
+ * Simplified version of `create` for CIDv0.
1044
+ */
1045
+ static createV0(digest2) {
1046
+ return _CID.create(0, DAG_PB_CODE, digest2);
1047
+ }
1048
+ /**
1049
+ * Simplified version of `create` for CIDv1.
1050
+ *
1051
+ * @param code - Content encoding format code.
1052
+ * @param digest - Multihash of the content.
1053
+ */
1054
+ static createV1(code2, digest2) {
1055
+ return _CID.create(1, code2, digest2);
1056
+ }
1057
+ /**
1058
+ * Decoded a CID from its binary representation. The byte array must contain
1059
+ * only the CID with no additional bytes.
1060
+ *
1061
+ * An error will be thrown if the bytes provided do not contain a valid
1062
+ * binary representation of a CID.
1063
+ */
1064
+ static decode(bytes) {
1065
+ const [cid, remainder] = _CID.decodeFirst(bytes);
1066
+ if (remainder.length !== 0) {
1067
+ throw new Error("Incorrect length");
1068
+ }
1069
+ return cid;
1070
+ }
1071
+ /**
1072
+ * Decoded a CID from its binary representation at the beginning of a byte
1073
+ * array.
1074
+ *
1075
+ * Returns an array with the first element containing the CID and the second
1076
+ * element containing the remainder of the original byte array. The remainder
1077
+ * will be a zero-length byte array if the provided bytes only contained a
1078
+ * binary CID representation.
1079
+ */
1080
+ static decodeFirst(bytes) {
1081
+ const specs = _CID.inspectBytes(bytes);
1082
+ const prefixSize = specs.size - specs.multihashSize;
1083
+ const multihashBytes = coerce(bytes.subarray(prefixSize, prefixSize + specs.multihashSize));
1084
+ if (multihashBytes.byteLength !== specs.multihashSize) {
1085
+ throw new Error("Incorrect length");
1086
+ }
1087
+ const digestBytes = multihashBytes.subarray(specs.multihashSize - specs.digestSize);
1088
+ const digest2 = new Digest(specs.multihashCode, specs.digestSize, digestBytes, multihashBytes);
1089
+ const cid = specs.version === 0 ? _CID.createV0(digest2) : _CID.createV1(specs.codec, digest2);
1090
+ return [cid, bytes.subarray(specs.size)];
1091
+ }
1092
+ /**
1093
+ * Inspect the initial bytes of a CID to determine its properties.
1094
+ *
1095
+ * Involves decoding up to 4 varints. Typically this will require only 4 to 6
1096
+ * bytes but for larger multicodec code values and larger multihash digest
1097
+ * lengths these varints can be quite large. It is recommended that at least
1098
+ * 10 bytes be made available in the `initialBytes` argument for a complete
1099
+ * inspection.
1100
+ */
1101
+ static inspectBytes(initialBytes) {
1102
+ let offset = 0;
1103
+ const next = /* @__PURE__ */ __name(() => {
1104
+ const [i, length2] = decode4(initialBytes.subarray(offset));
1105
+ offset += length2;
1106
+ return i;
1107
+ }, "next");
1108
+ let version = next();
1109
+ let codec = DAG_PB_CODE;
1110
+ if (version === 18) {
1111
+ version = 0;
1112
+ offset = 0;
1113
+ } else {
1114
+ codec = next();
1115
+ }
1116
+ if (version !== 0 && version !== 1) {
1117
+ throw new RangeError(`Invalid CID version ${version}`);
1118
+ }
1119
+ const prefixSize = offset;
1120
+ const multihashCode = next();
1121
+ const digestSize = next();
1122
+ const size = offset + digestSize;
1123
+ const multihashSize = size - prefixSize;
1124
+ return { version, codec, multihashCode, digestSize, multihashSize, size };
1125
+ }
1126
+ /**
1127
+ * Takes cid in a string representation and creates an instance. If `base`
1128
+ * decoder is not provided will use a default from the configuration. It will
1129
+ * throw an error if encoding of the CID is not compatible with supplied (or
1130
+ * a default decoder).
1131
+ */
1132
+ static parse(source, base3) {
1133
+ const [prefix, bytes] = parseCIDtoBytes(source, base3);
1134
+ const cid = _CID.decode(bytes);
1135
+ if (cid.version === 0 && source[0] !== "Q") {
1136
+ throw Error("Version 0 CID string must not include multibase prefix");
1137
+ }
1138
+ baseCache(cid).set(prefix, source);
1139
+ return cid;
1140
+ }
1141
+ };
1142
+ function parseCIDtoBytes(source, base3) {
1143
+ switch (source[0]) {
1144
+ // CIDv0 is parsed differently
1145
+ case "Q": {
1146
+ const decoder = base3 ?? base58btc;
1147
+ return [
1148
+ base58btc.prefix,
1149
+ decoder.decode(`${base58btc.prefix}${source}`)
1150
+ ];
1151
+ }
1152
+ case base58btc.prefix: {
1153
+ const decoder = base3 ?? base58btc;
1154
+ return [base58btc.prefix, decoder.decode(source)];
1155
+ }
1156
+ case base32.prefix: {
1157
+ const decoder = base3 ?? base32;
1158
+ return [base32.prefix, decoder.decode(source)];
1159
+ }
1160
+ case base36.prefix: {
1161
+ const decoder = base3 ?? base36;
1162
+ return [base36.prefix, decoder.decode(source)];
1163
+ }
1164
+ default: {
1165
+ if (base3 == null) {
1166
+ throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");
1167
+ }
1168
+ return [source[0], base3.decode(source)];
1169
+ }
1170
+ }
1171
+ }
1172
+ __name(parseCIDtoBytes, "parseCIDtoBytes");
1173
+ function toStringV0(bytes, cache2, base3) {
1174
+ const { prefix } = base3;
1175
+ if (prefix !== base58btc.prefix) {
1176
+ throw Error(`Cannot string encode V0 in ${base3.name} encoding`);
1177
+ }
1178
+ const cid = cache2.get(prefix);
1179
+ if (cid == null) {
1180
+ const cid2 = base3.encode(bytes).slice(1);
1181
+ cache2.set(prefix, cid2);
1182
+ return cid2;
1183
+ } else {
1184
+ return cid;
1185
+ }
1186
+ }
1187
+ __name(toStringV0, "toStringV0");
1188
+ function toStringV1(bytes, cache2, base3) {
1189
+ const { prefix } = base3;
1190
+ const cid = cache2.get(prefix);
1191
+ if (cid == null) {
1192
+ const cid2 = base3.encode(bytes);
1193
+ cache2.set(prefix, cid2);
1194
+ return cid2;
1195
+ } else {
1196
+ return cid;
1197
+ }
1198
+ }
1199
+ __name(toStringV1, "toStringV1");
1200
+ var DAG_PB_CODE = 112;
1201
+ var SHA_256_CODE = 18;
1202
+ function encodeCID(version, code2, multihash) {
1203
+ const codeOffset = encodingLength(version);
1204
+ const hashOffset = codeOffset + encodingLength(code2);
1205
+ const bytes = new Uint8Array(hashOffset + multihash.byteLength);
1206
+ encodeTo(version, bytes, 0);
1207
+ encodeTo(code2, bytes, codeOffset);
1208
+ bytes.set(multihash, hashOffset);
1209
+ return bytes;
1210
+ }
1211
+ __name(encodeCID, "encodeCID");
1212
+ var cidSymbol = /* @__PURE__ */ Symbol.for("@ipld/js-cid/CID");
1213
+
1214
+ // node_modules/multiformats/dist/src/basics.js
1215
+ var bases = { ...identity_exports, ...base2_exports, ...base8_exports, ...base10_exports, ...base16_exports, ...base32_exports, ...base36_exports, ...base58_exports, ...base64_exports, ...base256emoji_exports };
1216
+ var hashes = { ...sha2_browser_exports, ...identity_exports2 };
1217
+
1218
+ // node_modules/uint8arrays/dist/src/util/bases.js
1219
+ function createCodec(name2, prefix, encode5, decode6) {
1220
+ return {
1221
+ name: name2,
1222
+ prefix,
1223
+ encoder: {
1224
+ name: name2,
1225
+ prefix,
1226
+ encode: encode5
1227
+ },
1228
+ decoder: {
1229
+ decode: decode6
1230
+ }
1231
+ };
1232
+ }
1233
+ __name(createCodec, "createCodec");
1234
+ var string = createCodec("utf8", "u", (buf) => {
1235
+ const decoder = new TextDecoder("utf8");
1236
+ return "u" + decoder.decode(buf);
1237
+ }, (str) => {
1238
+ const encoder = new TextEncoder();
1239
+ return encoder.encode(str.substring(1));
1240
+ });
1241
+ var ascii = createCodec("ascii", "a", (buf) => {
1242
+ let string2 = "a";
1243
+ for (let i = 0; i < buf.length; i++) {
1244
+ string2 += String.fromCharCode(buf[i]);
1245
+ }
1246
+ return string2;
1247
+ }, (str) => {
1248
+ str = str.substring(1);
1249
+ const buf = allocUnsafe(str.length);
1250
+ for (let i = 0; i < str.length; i++) {
1251
+ buf[i] = str.charCodeAt(i);
1252
+ }
1253
+ return buf;
1254
+ });
1255
+ var BASES = {
1256
+ utf8: string,
1257
+ "utf-8": string,
1258
+ hex: bases.base16,
1259
+ latin1: ascii,
1260
+ ascii,
1261
+ binary: ascii,
1262
+ ...bases
1263
+ };
1264
+ var bases_default = BASES;
1265
+
1266
+ // node_modules/uint8arrays/dist/src/from-string.js
1267
+ function fromString2(string2, encoding = "utf8") {
1268
+ const base3 = bases_default[encoding];
1269
+ if (base3 == null) {
1270
+ throw new Error(`Unsupported encoding "${encoding}"`);
1271
+ }
1272
+ return base3.decoder.decode(`${base3.prefix}${string2}`);
1273
+ }
1274
+ __name(fromString2, "fromString");
1275
+
1276
+ // node_modules/uint8arrays/dist/src/to-string.js
1277
+ function toString2(array, encoding = "utf8") {
1278
+ const base3 = bases_default[encoding];
1279
+ if (base3 == null) {
1280
+ throw new Error(`Unsupported encoding "${encoding}"`);
1281
+ }
1282
+ return base3.encoder.encode(array).substring(1);
1283
+ }
1284
+ __name(toString2, "toString");
1285
+
1286
+ // src/index.ts
1287
+ var subtle = globalThis.crypto.subtle;
1288
+ async function seal(recipient, aesKey, opts) {
1289
+ const info = normalizeInfo(opts?.info);
1290
+ let keyBytes;
1291
+ if (aesKey instanceof Uint8Array) {
1292
+ validateRawKeyBytes(aesKey);
1293
+ keyBytes = aesKey;
1294
+ } else if (aesKey) {
1295
+ keyBytes = await exportAesKeyBytes(aesKey);
1296
+ validateRawKeyBytes(keyBytes);
1297
+ } else {
1298
+ const keysize = opts?.keysize ?? 256;
1299
+ validateKeysize(keysize);
1300
+ keyBytes = globalThis.crypto.getRandomValues(
1301
+ new Uint8Array(keysize / 8)
1302
+ );
1303
+ }
1304
+ const publicKey = await resolveRecipientPublicKey(recipient);
1305
+ const { sharedSecret, enc } = await encap(publicKey);
1306
+ const { key, baseNonce } = await keySchedule(sharedSecret, info);
1307
+ const ciphertext = await aeadSeal(key, baseNonce, keyBytes);
1308
+ const wrapped = concat2(enc, ciphertext);
1309
+ const aesGcmKey = await importAesKey(keyBytes);
1310
+ return { wrapped, key: aesGcmKey };
1311
+ }
1312
+ __name(seal, "seal");
1313
+ var open = Object.assign(openBytes, {
1314
+ raw: openRawBytes
1315
+ });
1316
+ async function openBytes(keypair, wrapped, opts) {
1317
+ const keyBytes = await openRawBytes(keypair, wrapped, opts);
1318
+ return importAesKey(keyBytes);
1319
+ }
1320
+ __name(openBytes, "openBytes");
1321
+ async function openRawBytes(keypair, wrapped, opts) {
1322
+ if (wrapped.byteLength < ENC_LENGTH + AEAD_TAG_LENGTH) {
1323
+ throw new Error("malformed envelope: too short");
1324
+ }
1325
+ const info = normalizeInfo(opts?.info);
1326
+ const enc = wrapped.slice(0, ENC_LENGTH);
1327
+ const ciphertext = wrapped.slice(ENC_LENGTH);
1328
+ const sharedSecret = await decap(enc, keypair);
1329
+ const { key, baseNonce } = await keySchedule(sharedSecret, info);
1330
+ return aeadOpen(key, baseNonce, ciphertext);
1331
+ }
1332
+ __name(openRawBytes, "openRawBytes");
1333
+ var encrypt = Object.assign(encryptBytes, {
1334
+ asString: encryptToString
1335
+ });
1336
+ var decrypt = Object.assign(decryptBytes, {
1337
+ asString: decryptToString,
1338
+ fromString: decryptFromString
1339
+ });
1340
+ async function decryptBytes(keypair, message, opts) {
1341
+ if (message.byteLength < WRAPPED_LEN_PREFIX) {
1342
+ throw new Error("malformed message: too short");
1343
+ }
1344
+ const wrappedLen = message[0] << 8 | message[1];
1345
+ const ivStart = WRAPPED_LEN_PREFIX + wrappedLen;
1346
+ const ctStart = ivStart + NN;
1347
+ if (message.byteLength < ctStart + AEAD_TAG_LENGTH) {
1348
+ throw new Error("malformed message: too short");
1349
+ }
1350
+ const wrapped = message.slice(WRAPPED_LEN_PREFIX, ivStart);
1351
+ const iv = message.slice(ivStart, ctStart);
1352
+ const ciphertext = message.slice(ctStart);
1353
+ const keyBytes = await openRawBytes(
1354
+ keypair,
1355
+ wrapped,
1356
+ opts?.info !== void 0 ? { info: opts.info } : void 0
1357
+ );
1358
+ const key = await importAesKeyDecryptOnly(keyBytes);
1359
+ const pt = await subtle.decrypt(
1360
+ { name: "AES-GCM", iv },
1361
+ key,
1362
+ ciphertext
1363
+ );
1364
+ return new Uint8Array(pt);
1365
+ }
1366
+ __name(decryptBytes, "decryptBytes");
1367
+ async function decryptToString(keypair, message, opts) {
1368
+ const bytes = await decryptBytes(keypair, message, opts);
1369
+ return new TextDecoder().decode(bytes);
1370
+ }
1371
+ __name(decryptToString, "decryptToString");
1372
+ async function decryptFromString(keypair, message, opts) {
1373
+ const bytes = fromString2(message, "base64url");
1374
+ const plaintext = await decryptBytes(
1375
+ keypair,
1376
+ bytes,
1377
+ opts?.info !== void 0 ? { info: opts.info } : void 0
1378
+ );
1379
+ return opts?.buffer ? plaintext : new TextDecoder().decode(plaintext);
1380
+ }
1381
+ __name(decryptFromString, "decryptFromString");
1382
+ function validateKeysize(keysize) {
1383
+ if (keysize !== 128 && keysize !== 256) {
1384
+ throw new Error(
1385
+ `invalid keysize: ${keysize} (expected 128 or 256)`
1386
+ );
1387
+ }
1388
+ }
1389
+ __name(validateKeysize, "validateKeysize");
1390
+ function validateRawKeyBytes(raw) {
1391
+ if (raw.length !== 16 && raw.length !== 32) {
1392
+ throw new Error(
1393
+ `invalid aesKey length: ${raw.length} bytes (expected 16 or 32)`
1394
+ );
1395
+ }
1396
+ }
1397
+ __name(validateRawKeyBytes, "validateRawKeyBytes");
1398
+ function normalizeInfo(info) {
1399
+ if (info === void 0 || info === null) return new Uint8Array(0);
1400
+ if (typeof info === "string") return new TextEncoder().encode(info);
1401
+ return info;
1402
+ }
1403
+ __name(normalizeInfo, "normalizeInfo");
1404
+ async function exportAesKeyBytes(key) {
1405
+ if (!key.extractable) {
1406
+ throw new Error(
1407
+ "aesKey must be extractable: its raw bytes are what get sealed"
1408
+ );
1409
+ }
1410
+ return new Uint8Array(await subtle.exportKey("raw", key));
1411
+ }
1412
+ __name(exportAesKeyBytes, "exportAesKeyBytes");
1413
+ async function importAesKey(raw) {
1414
+ return subtle.importKey(
1415
+ "raw",
1416
+ raw,
1417
+ { name: "AES-GCM" },
1418
+ true,
1419
+ ["encrypt", "decrypt"]
1420
+ );
1421
+ }
1422
+ __name(importAesKey, "importAesKey");
1423
+ async function importAesKeyDecryptOnly(raw) {
1424
+ return subtle.importKey(
1425
+ "raw",
1426
+ raw,
1427
+ { name: "AES-GCM" },
1428
+ false,
1429
+ ["decrypt"]
1430
+ );
1431
+ }
1432
+ __name(importAesKeyDecryptOnly, "importAesKeyDecryptOnly");
1433
+ async function keySchedule(sharedSecret, info) {
1434
+ const empty2 = new Uint8Array(0);
1435
+ const pskIdHash = await labeledExtract(
1436
+ HPKE_SUITE_ID,
1437
+ empty2,
1438
+ "psk_id_hash",
1439
+ empty2
1440
+ );
1441
+ const infoHash = await labeledExtract(
1442
+ HPKE_SUITE_ID,
1443
+ empty2,
1444
+ "info_hash",
1445
+ info
1446
+ );
1447
+ const ksContext = concat2(new Uint8Array([MODE_BASE]), pskIdHash, infoHash);
1448
+ const secret = await labeledExtract(
1449
+ HPKE_SUITE_ID,
1450
+ sharedSecret,
1451
+ "secret",
1452
+ empty2
1453
+ );
1454
+ const key = await labeledExpand(
1455
+ HPKE_SUITE_ID,
1456
+ secret,
1457
+ "key",
1458
+ ksContext,
1459
+ NK
1460
+ );
1461
+ const baseNonce = await labeledExpand(
1462
+ HPKE_SUITE_ID,
1463
+ secret,
1464
+ "base_nonce",
1465
+ ksContext,
1466
+ NN
1467
+ );
1468
+ return { key, baseNonce };
1469
+ }
1470
+ __name(keySchedule, "keySchedule");
1471
+
1472
+ // src/util.ts
1473
+ var subtle2 = globalThis.crypto.subtle;
1474
+ async function aeadSeal(key, nonce, plaintext) {
1475
+ const k = await subtle2.importKey(
1476
+ "raw",
1477
+ key,
1478
+ { name: "AES-GCM" },
1479
+ false,
1480
+ ["encrypt"]
1481
+ );
1482
+ const ct = await subtle2.encrypt(
1483
+ { name: "AES-GCM", iv: nonce },
1484
+ k,
1485
+ plaintext
1486
+ );
1487
+ return new Uint8Array(ct);
1488
+ }
1489
+ __name(aeadSeal, "aeadSeal");
1490
+ async function aeadOpen(key, nonce, ciphertext) {
1491
+ const k = await subtle2.importKey(
1492
+ "raw",
1493
+ key,
1494
+ { name: "AES-GCM" },
1495
+ false,
1496
+ ["decrypt"]
1497
+ );
1498
+ const pt = await subtle2.decrypt(
1499
+ { name: "AES-GCM", iv: nonce },
1500
+ k,
1501
+ ciphertext
1502
+ );
1503
+ return new Uint8Array(pt);
1504
+ }
1505
+ __name(aeadOpen, "aeadOpen");
1506
+ async function encryptBytes(recipient, message, aesKey, opts) {
1507
+ const plaintext = typeof message === "string" ? new TextEncoder().encode(message) : message;
1508
+ const { wrapped, key } = await seal(recipient, aesKey, opts);
1509
+ const iv = globalThis.crypto.getRandomValues(new Uint8Array(NN));
1510
+ const ct = new Uint8Array(await subtle2.encrypt(
1511
+ { name: "AES-GCM", iv },
1512
+ key,
1513
+ plaintext
1514
+ ));
1515
+ return concat2(i2osp(wrapped.length, WRAPPED_LEN_PREFIX), wrapped, iv, ct);
1516
+ }
1517
+ __name(encryptBytes, "encryptBytes");
1518
+ async function encryptToString(recipient, message, aesKey, opts) {
1519
+ const envelope = await encryptBytes(recipient, message, aesKey, opts);
1520
+ return toString2(envelope, opts?.encoding ?? "base64url");
1521
+ }
1522
+ __name(encryptToString, "encryptToString");
1523
+ async function hmac(key, data) {
1524
+ const k = await subtle2.importKey(
1525
+ "raw",
1526
+ key,
1527
+ { name: "HMAC", hash: "SHA-256" },
1528
+ false,
1529
+ ["sign"]
1530
+ );
1531
+ return new Uint8Array(await subtle2.sign("HMAC", k, data));
1532
+ }
1533
+ __name(hmac, "hmac");
1534
+ async function extract(salt, ikm) {
1535
+ const key = salt.length === 0 ? new Uint8Array(NSECRET) : salt;
1536
+ return hmac(key, ikm);
1537
+ }
1538
+ __name(extract, "extract");
1539
+ async function expand(prk, info, length2) {
1540
+ const out = new Uint8Array(length2);
1541
+ let t = new Uint8Array(0);
1542
+ let offset = 0;
1543
+ let counter = 1;
1544
+ while (offset < length2) {
1545
+ t = await hmac(prk, concat2(t, info, i2osp(counter, 1)));
1546
+ const take = Math.min(t.length, length2 - offset);
1547
+ out.set(t.subarray(0, take), offset);
1548
+ offset += take;
1549
+ counter++;
1550
+ }
1551
+ return out;
1552
+ }
1553
+ __name(expand, "expand");
1554
+ async function labeledExtract(suiteId, salt, label, ikm) {
1555
+ const labeledIkm = concat2(
1556
+ HPKE_V1,
1557
+ suiteId,
1558
+ new TextEncoder().encode(label),
1559
+ ikm
1560
+ );
1561
+ return extract(salt, labeledIkm);
1562
+ }
1563
+ __name(labeledExtract, "labeledExtract");
1564
+ async function labeledExpand(suiteId, prk, label, info, length2) {
1565
+ const labeledInfo = concat2(
1566
+ i2osp(length2, 2),
1567
+ HPKE_V1,
1568
+ suiteId,
1569
+ new TextEncoder().encode(label),
1570
+ info
1571
+ );
1572
+ return expand(prk, labeledInfo, length2);
1573
+ }
1574
+ __name(labeledExpand, "labeledExpand");
1575
+ async function exportRawPublic(key) {
1576
+ return new Uint8Array(await subtle2.exportKey("raw", key));
1577
+ }
1578
+ __name(exportRawPublic, "exportRawPublic");
1579
+ async function importRawPublic(raw) {
1580
+ if (raw.length !== ENC_LENGTH) {
1581
+ throw new Error(
1582
+ `invalid public key length: ${raw.length} bytes (expected ${ENC_LENGTH})`
1583
+ );
1584
+ }
1585
+ return subtle2.importKey(
1586
+ "raw",
1587
+ raw,
1588
+ { name: "X25519" },
1589
+ true,
1590
+ []
1591
+ );
1592
+ }
1593
+ __name(importRawPublic, "importRawPublic");
1594
+ async function resolveRecipientPublicKey(recipient) {
1595
+ if (recipient instanceof Uint8Array) {
1596
+ return importRawPublic(recipient);
1597
+ }
1598
+ if (recipient instanceof CryptoKey) {
1599
+ if (recipient.type !== "public") {
1600
+ throw new Error("recipient CryptoKey must be a public key");
1601
+ }
1602
+ assertX25519Algorithm(recipient, "recipient CryptoKey");
1603
+ return recipient;
1604
+ }
1605
+ if (typeof recipient.publicKey === "string") {
1606
+ const { publicKey, encoding } = recipient;
1607
+ return importRawPublic(fromString2(publicKey, encoding ?? "base64url"));
1608
+ }
1609
+ const pair = recipient;
1610
+ if (pair.publicKey instanceof CryptoKey) {
1611
+ if (pair.publicKey.type !== "public") {
1612
+ throw new Error("recipient keypair publicKey must be a public key");
1613
+ }
1614
+ assertX25519Algorithm(pair.publicKey, "recipient keypair publicKey");
1615
+ return pair.publicKey;
1616
+ }
1617
+ throw new Error("unrecognized recipient key form");
1618
+ }
1619
+ __name(resolveRecipientPublicKey, "resolveRecipientPublicKey");
1620
+ function assertX25519Algorithm(key, context) {
1621
+ if (key.algorithm.name !== "X25519") {
1622
+ throw new Error(
1623
+ `${context} must be an X25519 key (got ${key.algorithm.name})`
1624
+ );
1625
+ }
1626
+ }
1627
+ __name(assertX25519Algorithm, "assertX25519Algorithm");
1628
+ async function dh(priv, pub) {
1629
+ const bits = await subtle2.deriveBits(
1630
+ { name: "X25519", public: pub },
1631
+ priv,
1632
+ 256
1633
+ );
1634
+ const bytes = new Uint8Array(bits);
1635
+ if (bytes.every((b) => b === 0)) {
1636
+ throw new Error(
1637
+ "X25519 shared secret is all-zero (small-order public key?)"
1638
+ );
1639
+ }
1640
+ return bytes;
1641
+ }
1642
+ __name(dh, "dh");
1643
+ async function extractAndExpand(dhBytes, kemContext) {
1644
+ const eaePrk = await labeledExtract(
1645
+ KEM_SUITE_ID,
1646
+ new Uint8Array(0),
1647
+ "eae_prk",
1648
+ dhBytes
1649
+ );
1650
+ return labeledExpand(
1651
+ KEM_SUITE_ID,
1652
+ eaePrk,
1653
+ "shared_secret",
1654
+ kemContext,
1655
+ NSECRET
1656
+ );
1657
+ }
1658
+ __name(extractAndExpand, "extractAndExpand");
1659
+ async function encap(pkR) {
1660
+ const eph = await subtle2.generateKey(
1661
+ { name: "X25519" },
1662
+ false,
1663
+ ["deriveBits"]
1664
+ );
1665
+ const dhBytes = await dh(eph.privateKey, pkR);
1666
+ const enc = await exportRawPublic(eph.publicKey);
1667
+ const pkRm = await exportRawPublic(pkR);
1668
+ const kemContext = concat2(enc, pkRm);
1669
+ const sharedSecret = await extractAndExpand(dhBytes, kemContext);
1670
+ return { sharedSecret, enc };
1671
+ }
1672
+ __name(encap, "encap");
1673
+ async function decap(enc, keypair) {
1674
+ if (keypair.privateKey.type !== "private") {
1675
+ throw new Error("keypair.privateKey must be a private key");
1676
+ }
1677
+ assertX25519Algorithm(keypair.privateKey, "keypair.privateKey");
1678
+ const pkE = await subtle2.importKey(
1679
+ "raw",
1680
+ enc,
1681
+ { name: "X25519" },
1682
+ false,
1683
+ []
1684
+ );
1685
+ const dhBytes = await dh(keypair.privateKey, pkE);
1686
+ const pkRm = await exportRawPublic(keypair.publicKey);
1687
+ const kemContext = concat2(enc, pkRm);
1688
+ return extractAndExpand(dhBytes, kemContext);
1689
+ }
1690
+ __name(decap, "decap");
1691
+ function i2osp(n, len) {
1692
+ const out = new Uint8Array(len);
1693
+ let v = n;
1694
+ for (let i = len - 1; i >= 0; i--) {
1695
+ out[i] = v & 255;
1696
+ v = Math.floor(v / 256);
1697
+ }
1698
+ return out;
1699
+ }
1700
+ __name(i2osp, "i2osp");
1701
+ function concat2(...arrays) {
1702
+ let total = 0;
1703
+ for (const a of arrays) total += a.length;
1704
+ const out = new Uint8Array(total);
1705
+ let offset = 0;
1706
+ for (const a of arrays) {
1707
+ out.set(a, offset);
1708
+ offset += a.length;
1709
+ }
1710
+ return out;
1711
+ }
1712
+ __name(concat2, "concat");
1713
+
1714
+ // src/constants.ts
1715
+ var KEM_ID = 32;
1716
+ var KDF_ID = 1;
1717
+ var AEAD_ID = 2;
1718
+ var NSECRET = 32;
1719
+ var NK = 32;
1720
+ var NN = 12;
1721
+ var ENC_LENGTH = 32;
1722
+ var AEAD_TAG_LENGTH = 16;
1723
+ var MODE_BASE = 0;
1724
+ var HPKE_V1 = new TextEncoder().encode("HPKE-v1");
1725
+ var WRAPPED_LEN_PREFIX = 2;
1726
+ var KEM_SUITE_ID = concat2(
1727
+ new TextEncoder().encode("KEM"),
1728
+ i2osp(KEM_ID, 2)
1729
+ );
1730
+ var HPKE_SUITE_ID = concat2(
1731
+ new TextEncoder().encode("HPKE"),
1732
+ i2osp(KEM_ID, 2),
1733
+ i2osp(KDF_ID, 2),
1734
+ i2osp(AEAD_ID, 2)
1735
+ );
1736
+ export {
1737
+ AEAD_ID,
1738
+ AEAD_TAG_LENGTH,
1739
+ ENC_LENGTH,
1740
+ HPKE_SUITE_ID,
1741
+ HPKE_V1,
1742
+ KDF_ID,
1743
+ KEM_ID,
1744
+ KEM_SUITE_ID,
1745
+ MODE_BASE,
1746
+ NK,
1747
+ NN,
1748
+ NSECRET,
1749
+ WRAPPED_LEN_PREFIX
1750
+ };
1751
+ //# sourceMappingURL=constants.js.map