@dxos/hypercore 0.3.9-main.f27ec14 → 0.3.9-next.35264cb
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/dist/lib/browser/index.mjs +202 -103
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +55 -37
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/package.json +14 -14
|
@@ -21,6 +21,9 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
21
21
|
return require.apply(this, arguments);
|
|
22
22
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
23
23
|
});
|
|
24
|
+
var __esm = (fn, res) => function __init() {
|
|
25
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
26
|
+
};
|
|
24
27
|
var __commonJS = (cb, mod) => function __require2() {
|
|
25
28
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
26
29
|
};
|
|
@@ -41,9 +44,21 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
41
44
|
mod
|
|
42
45
|
));
|
|
43
46
|
|
|
47
|
+
// inject-globals:@inject-globals
|
|
48
|
+
import {
|
|
49
|
+
global,
|
|
50
|
+
Buffer as Buffer2,
|
|
51
|
+
process
|
|
52
|
+
} from "@dxos/node-std/inject-globals";
|
|
53
|
+
var init_inject_globals = __esm({
|
|
54
|
+
"inject-globals:@inject-globals"() {
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
44
58
|
// node_modules/.pnpm/last-one-wins@1.0.4/node_modules/last-one-wins/index.js
|
|
45
59
|
var require_last_one_wins = __commonJS({
|
|
46
60
|
"node_modules/.pnpm/last-one-wins@1.0.4/node_modules/last-one-wins/index.js"(exports, module) {
|
|
61
|
+
init_inject_globals();
|
|
47
62
|
module.exports = function(work) {
|
|
48
63
|
var pending = null;
|
|
49
64
|
var callback = null;
|
|
@@ -90,6 +105,7 @@ var require_last_one_wins = __commonJS({
|
|
|
90
105
|
// node_modules/.pnpm/unordered-array-remove@1.0.2/node_modules/unordered-array-remove/index.js
|
|
91
106
|
var require_unordered_array_remove = __commonJS({
|
|
92
107
|
"node_modules/.pnpm/unordered-array-remove@1.0.2/node_modules/unordered-array-remove/index.js"(exports, module) {
|
|
108
|
+
init_inject_globals();
|
|
93
109
|
module.exports = remove;
|
|
94
110
|
function remove(arr, i) {
|
|
95
111
|
if (i >= arr.length || i < 0)
|
|
@@ -108,6 +124,7 @@ var require_unordered_array_remove = __commonJS({
|
|
|
108
124
|
// node_modules/.pnpm/unordered-set@2.0.1/node_modules/unordered-set/index.js
|
|
109
125
|
var require_unordered_set = __commonJS({
|
|
110
126
|
"node_modules/.pnpm/unordered-set@2.0.1/node_modules/unordered-set/index.js"(exports) {
|
|
127
|
+
init_inject_globals();
|
|
111
128
|
exports.add = add;
|
|
112
129
|
exports.has = has;
|
|
113
130
|
exports.remove = remove;
|
|
@@ -147,6 +164,7 @@ var require_unordered_set = __commonJS({
|
|
|
147
164
|
// node_modules/.pnpm/flat-tree@1.9.0/node_modules/flat-tree/index.js
|
|
148
165
|
var require_flat_tree = __commonJS({
|
|
149
166
|
"node_modules/.pnpm/flat-tree@1.9.0/node_modules/flat-tree/index.js"(exports) {
|
|
167
|
+
init_inject_globals();
|
|
150
168
|
exports.fullRoots = function(index, result) {
|
|
151
169
|
if (index & 1)
|
|
152
170
|
throw new Error("You can only look up roots for depth(0) blocks");
|
|
@@ -385,6 +403,7 @@ var require_flat_tree = __commonJS({
|
|
|
385
403
|
// node_modules/.pnpm/merkle-tree-stream@4.0.0/node_modules/merkle-tree-stream/generator.js
|
|
386
404
|
var require_generator = __commonJS({
|
|
387
405
|
"node_modules/.pnpm/merkle-tree-stream@4.0.0/node_modules/merkle-tree-stream/generator.js"(exports, module) {
|
|
406
|
+
init_inject_globals();
|
|
388
407
|
var flat = require_flat_tree();
|
|
389
408
|
module.exports = class MerkleGenerator {
|
|
390
409
|
constructor(opts, roots) {
|
|
@@ -401,8 +420,8 @@ var require_generator = __commonJS({
|
|
|
401
420
|
this._parent = opts.parent;
|
|
402
421
|
}
|
|
403
422
|
next(data, nodes) {
|
|
404
|
-
if (!
|
|
405
|
-
data =
|
|
423
|
+
if (!Buffer2.isBuffer(data))
|
|
424
|
+
data = Buffer2.from(data);
|
|
406
425
|
if (!nodes)
|
|
407
426
|
nodes = [];
|
|
408
427
|
var index = 2 * this.blocks++;
|
|
@@ -440,6 +459,7 @@ var require_generator = __commonJS({
|
|
|
440
459
|
// node_modules/.pnpm/codecs@2.2.0/node_modules/codecs/index.js
|
|
441
460
|
var require_codecs = __commonJS({
|
|
442
461
|
"node_modules/.pnpm/codecs@2.2.0/node_modules/codecs/index.js"(exports, module) {
|
|
462
|
+
init_inject_globals();
|
|
443
463
|
module.exports = codecs;
|
|
444
464
|
codecs.ascii = createString("ascii");
|
|
445
465
|
codecs.utf8 = createString("utf-8");
|
|
@@ -452,10 +472,10 @@ var require_codecs = __commonJS({
|
|
|
452
472
|
codecs.binary = {
|
|
453
473
|
name: "binary",
|
|
454
474
|
encode: function encodeBinary(obj) {
|
|
455
|
-
return typeof obj === "string" ?
|
|
475
|
+
return typeof obj === "string" ? Buffer2.from(obj, "utf-8") : Buffer2.isBuffer(obj) ? obj : Buffer2.from(obj.buffer, obj.byteOffset, obj.byteLength);
|
|
456
476
|
},
|
|
457
477
|
decode: function decodeBinary(buf) {
|
|
458
|
-
return
|
|
478
|
+
return Buffer2.isBuffer(buf) ? buf : Buffer2.from(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
459
479
|
}
|
|
460
480
|
};
|
|
461
481
|
function codecs(fmt, fallback) {
|
|
@@ -493,10 +513,10 @@ var require_codecs = __commonJS({
|
|
|
493
513
|
}
|
|
494
514
|
};
|
|
495
515
|
function encodeJSON(val2) {
|
|
496
|
-
return
|
|
516
|
+
return Buffer2.from(JSON.stringify(val2));
|
|
497
517
|
}
|
|
498
518
|
function encodeNDJSON(val2) {
|
|
499
|
-
return
|
|
519
|
+
return Buffer2.from(JSON.stringify(val2) + "\n");
|
|
500
520
|
}
|
|
501
521
|
}
|
|
502
522
|
function createString(type) {
|
|
@@ -505,7 +525,7 @@ var require_codecs = __commonJS({
|
|
|
505
525
|
encode: function encodeString(val2) {
|
|
506
526
|
if (typeof val2 !== "string")
|
|
507
527
|
val2 = val2.toString();
|
|
508
|
-
return
|
|
528
|
+
return Buffer2.from(val2, type);
|
|
509
529
|
},
|
|
510
530
|
decode: function decodeString(buf) {
|
|
511
531
|
return buf.toString(type);
|
|
@@ -518,6 +538,7 @@ var require_codecs = __commonJS({
|
|
|
518
538
|
// node_modules/.pnpm/atomic-batcher@1.0.2/node_modules/atomic-batcher/index.js
|
|
519
539
|
var require_atomic_batcher = __commonJS({
|
|
520
540
|
"node_modules/.pnpm/atomic-batcher@1.0.2/node_modules/atomic-batcher/index.js"(exports, module) {
|
|
541
|
+
init_inject_globals();
|
|
521
542
|
module.exports = batcher;
|
|
522
543
|
function batcher(run) {
|
|
523
544
|
var running = false;
|
|
@@ -581,6 +602,7 @@ var require_atomic_batcher = __commonJS({
|
|
|
581
602
|
// node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js
|
|
582
603
|
var require_inherits_browser = __commonJS({
|
|
583
604
|
"node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js"(exports, module) {
|
|
605
|
+
init_inject_globals();
|
|
584
606
|
if (typeof Object.create === "function") {
|
|
585
607
|
module.exports = function inherits(ctor, superCtor) {
|
|
586
608
|
if (superCtor) {
|
|
@@ -613,6 +635,7 @@ var require_inherits_browser = __commonJS({
|
|
|
613
635
|
// node_modules/.pnpm/varint@4.0.1/node_modules/varint/encode.js
|
|
614
636
|
var require_encode = __commonJS({
|
|
615
637
|
"node_modules/.pnpm/varint@4.0.1/node_modules/varint/encode.js"(exports, module) {
|
|
638
|
+
init_inject_globals();
|
|
616
639
|
module.exports = encode;
|
|
617
640
|
var MSB = 128;
|
|
618
641
|
var REST = 127;
|
|
@@ -640,6 +663,7 @@ var require_encode = __commonJS({
|
|
|
640
663
|
// node_modules/.pnpm/varint@4.0.1/node_modules/varint/decode.js
|
|
641
664
|
var require_decode = __commonJS({
|
|
642
665
|
"node_modules/.pnpm/varint@4.0.1/node_modules/varint/decode.js"(exports, module) {
|
|
666
|
+
init_inject_globals();
|
|
643
667
|
module.exports = read;
|
|
644
668
|
var MSB = 128;
|
|
645
669
|
var REST = 127;
|
|
@@ -664,6 +688,7 @@ var require_decode = __commonJS({
|
|
|
664
688
|
// node_modules/.pnpm/varint@4.0.1/node_modules/varint/length.js
|
|
665
689
|
var require_length = __commonJS({
|
|
666
690
|
"node_modules/.pnpm/varint@4.0.1/node_modules/varint/length.js"(exports, module) {
|
|
691
|
+
init_inject_globals();
|
|
667
692
|
var N1 = Math.pow(2, 7);
|
|
668
693
|
var N2 = Math.pow(2, 14);
|
|
669
694
|
var N3 = Math.pow(2, 21);
|
|
@@ -682,6 +707,7 @@ var require_length = __commonJS({
|
|
|
682
707
|
// node_modules/.pnpm/varint@4.0.1/node_modules/varint/index.js
|
|
683
708
|
var require_varint = __commonJS({
|
|
684
709
|
"node_modules/.pnpm/varint@4.0.1/node_modules/varint/index.js"(exports, module) {
|
|
710
|
+
init_inject_globals();
|
|
685
711
|
module.exports = {
|
|
686
712
|
encode: require_encode(),
|
|
687
713
|
decode: require_decode(),
|
|
@@ -693,6 +719,7 @@ var require_varint = __commonJS({
|
|
|
693
719
|
// node_modules/.pnpm/buffer-alloc-unsafe@1.1.0/node_modules/buffer-alloc-unsafe/index.js
|
|
694
720
|
var require_buffer_alloc_unsafe = __commonJS({
|
|
695
721
|
"node_modules/.pnpm/buffer-alloc-unsafe@1.1.0/node_modules/buffer-alloc-unsafe/index.js"(exports, module) {
|
|
722
|
+
init_inject_globals();
|
|
696
723
|
function allocUnsafe(size) {
|
|
697
724
|
if (typeof size !== "number") {
|
|
698
725
|
throw new TypeError('"size" argument must be a number');
|
|
@@ -700,10 +727,10 @@ var require_buffer_alloc_unsafe = __commonJS({
|
|
|
700
727
|
if (size < 0) {
|
|
701
728
|
throw new RangeError('"size" argument must not be negative');
|
|
702
729
|
}
|
|
703
|
-
if (
|
|
704
|
-
return
|
|
730
|
+
if (Buffer2.allocUnsafe) {
|
|
731
|
+
return Buffer2.allocUnsafe(size);
|
|
705
732
|
} else {
|
|
706
|
-
return new
|
|
733
|
+
return new Buffer2(size);
|
|
707
734
|
}
|
|
708
735
|
}
|
|
709
736
|
module.exports = allocUnsafe;
|
|
@@ -713,6 +740,7 @@ var require_buffer_alloc_unsafe = __commonJS({
|
|
|
713
740
|
// node_modules/.pnpm/bitfield-rle@2.2.1/node_modules/bitfield-rle/index.js
|
|
714
741
|
var require_bitfield_rle = __commonJS({
|
|
715
742
|
"node_modules/.pnpm/bitfield-rle@2.2.1/node_modules/bitfield-rle/index.js"(exports, module) {
|
|
743
|
+
init_inject_globals();
|
|
716
744
|
var varint = require_varint();
|
|
717
745
|
var alloc = require_buffer_alloc_unsafe();
|
|
718
746
|
module.exports = align(1);
|
|
@@ -857,6 +885,7 @@ var require_bitfield_rle = __commonJS({
|
|
|
857
885
|
// node_modules/.pnpm/memory-pager@1.5.0/node_modules/memory-pager/index.js
|
|
858
886
|
var require_memory_pager = __commonJS({
|
|
859
887
|
"node_modules/.pnpm/memory-pager@1.5.0/node_modules/memory-pager/index.js"(exports, module) {
|
|
888
|
+
init_inject_globals();
|
|
860
889
|
module.exports = Pager;
|
|
861
890
|
function Pager(pageSize, opts) {
|
|
862
891
|
if (!(this instanceof Pager))
|
|
@@ -957,7 +986,7 @@ var require_memory_pager = __commonJS({
|
|
|
957
986
|
list[ptr++] = arr && arr[i] ? arr[i].buffer : empty;
|
|
958
987
|
}
|
|
959
988
|
}
|
|
960
|
-
return
|
|
989
|
+
return Buffer2.concat(list);
|
|
961
990
|
};
|
|
962
991
|
function grow(pager, index) {
|
|
963
992
|
while (pager.maxPages < index) {
|
|
@@ -978,14 +1007,14 @@ var require_memory_pager = __commonJS({
|
|
|
978
1007
|
return cpy;
|
|
979
1008
|
}
|
|
980
1009
|
function alloc(size) {
|
|
981
|
-
if (
|
|
982
|
-
return
|
|
983
|
-
var buf = new
|
|
1010
|
+
if (Buffer2.alloc)
|
|
1011
|
+
return Buffer2.alloc(size);
|
|
1012
|
+
var buf = new Buffer2(size);
|
|
984
1013
|
buf.fill(0);
|
|
985
1014
|
return buf;
|
|
986
1015
|
}
|
|
987
1016
|
function copy(buf) {
|
|
988
|
-
var cpy =
|
|
1017
|
+
var cpy = Buffer2.allocUnsafe ? Buffer2.allocUnsafe(buf.length) : new Buffer2(buf.length);
|
|
989
1018
|
buf.copy(cpy);
|
|
990
1019
|
return cpy;
|
|
991
1020
|
}
|
|
@@ -1006,6 +1035,7 @@ var require_memory_pager = __commonJS({
|
|
|
1006
1035
|
// node_modules/.pnpm/sparse-bitfield@3.0.3/node_modules/sparse-bitfield/index.js
|
|
1007
1036
|
var require_sparse_bitfield = __commonJS({
|
|
1008
1037
|
"node_modules/.pnpm/sparse-bitfield@3.0.3/node_modules/sparse-bitfield/index.js"(exports, module) {
|
|
1038
|
+
init_inject_globals();
|
|
1009
1039
|
var pager = require_memory_pager();
|
|
1010
1040
|
module.exports = Bitfield;
|
|
1011
1041
|
function Bitfield(opts) {
|
|
@@ -1013,7 +1043,7 @@ var require_sparse_bitfield = __commonJS({
|
|
|
1013
1043
|
return new Bitfield(opts);
|
|
1014
1044
|
if (!opts)
|
|
1015
1045
|
opts = {};
|
|
1016
|
-
if (
|
|
1046
|
+
if (Buffer2.isBuffer(opts))
|
|
1017
1047
|
opts = { buffer: opts };
|
|
1018
1048
|
this.pageOffset = opts.pageOffset || 0;
|
|
1019
1049
|
this.pageSize = opts.pageSize || 1024;
|
|
@@ -1076,9 +1106,9 @@ var require_sparse_bitfield = __commonJS({
|
|
|
1076
1106
|
return true;
|
|
1077
1107
|
};
|
|
1078
1108
|
function alloc(n) {
|
|
1079
|
-
if (
|
|
1080
|
-
return
|
|
1081
|
-
var b = new
|
|
1109
|
+
if (Buffer2.alloc)
|
|
1110
|
+
return Buffer2.alloc(n);
|
|
1111
|
+
var b = new Buffer2(n);
|
|
1082
1112
|
b.fill(0);
|
|
1083
1113
|
return b;
|
|
1084
1114
|
}
|
|
@@ -1091,6 +1121,7 @@ var require_sparse_bitfield = __commonJS({
|
|
|
1091
1121
|
// node_modules/.pnpm/hypercore@9.12.0/node_modules/hypercore/lib/bitfield.js
|
|
1092
1122
|
var require_bitfield = __commonJS({
|
|
1093
1123
|
"node_modules/.pnpm/hypercore@9.12.0/node_modules/hypercore/lib/bitfield.js"(exports, module) {
|
|
1124
|
+
init_inject_globals();
|
|
1094
1125
|
var flat = require_flat_tree();
|
|
1095
1126
|
var rle = require_bitfield_rle();
|
|
1096
1127
|
var pager = require_memory_pager();
|
|
@@ -1124,7 +1155,7 @@ var require_bitfield = __commonJS({
|
|
|
1124
1155
|
return new Bitfield(pageSize, pages);
|
|
1125
1156
|
if (!pageSize)
|
|
1126
1157
|
pageSize = 2048 + 1024 + 512;
|
|
1127
|
-
var deduplicate =
|
|
1158
|
+
var deduplicate = Buffer2.allocUnsafe(pageSize);
|
|
1128
1159
|
deduplicate.fill(255);
|
|
1129
1160
|
this.indexSize = pageSize - 2048 - 1024;
|
|
1130
1161
|
this.pages = pager(pageSize, { deduplicate });
|
|
@@ -1199,7 +1230,7 @@ var require_bitfield = __commonJS({
|
|
|
1199
1230
|
return rle.encode(this.data.toBuffer());
|
|
1200
1231
|
if (start + length > this.length)
|
|
1201
1232
|
length = Math.max(1, this.length - start);
|
|
1202
|
-
var buf =
|
|
1233
|
+
var buf = Buffer2.alloc(Math.ceil(length / 8));
|
|
1203
1234
|
var p = start / this.data.pageSize / 8;
|
|
1204
1235
|
var end = p + length / this.data.pageSize / 8;
|
|
1205
1236
|
var offset = p * this.data.pageSize;
|
|
@@ -1379,6 +1410,7 @@ var require_bitfield = __commonJS({
|
|
|
1379
1410
|
// node_modules/.pnpm/hypercore@9.12.0/node_modules/hypercore/lib/tree-index.js
|
|
1380
1411
|
var require_tree_index = __commonJS({
|
|
1381
1412
|
"node_modules/.pnpm/hypercore@9.12.0/node_modules/hypercore/lib/tree-index.js"(exports, module) {
|
|
1413
|
+
init_inject_globals();
|
|
1382
1414
|
var flat = require_flat_tree();
|
|
1383
1415
|
var bitfield = require_sparse_bitfield();
|
|
1384
1416
|
module.exports = TreeIndex;
|
|
@@ -1546,12 +1578,13 @@ var require_tree_index = __commonJS({
|
|
|
1546
1578
|
// node_modules/.pnpm/buffer-fill@1.0.0/node_modules/buffer-fill/index.js
|
|
1547
1579
|
var require_buffer_fill = __commonJS({
|
|
1548
1580
|
"node_modules/.pnpm/buffer-fill@1.0.0/node_modules/buffer-fill/index.js"(exports, module) {
|
|
1581
|
+
init_inject_globals();
|
|
1549
1582
|
var hasFullSupport = function() {
|
|
1550
1583
|
try {
|
|
1551
|
-
if (!
|
|
1584
|
+
if (!Buffer2.isEncoding("latin1")) {
|
|
1552
1585
|
return false;
|
|
1553
1586
|
}
|
|
1554
|
-
var buf =
|
|
1587
|
+
var buf = Buffer2.alloc ? Buffer2.alloc(4) : new Buffer2(4);
|
|
1555
1588
|
buf.fill("ab", "ucs2");
|
|
1556
1589
|
return buf.toString("hex") === "61006200";
|
|
1557
1590
|
} catch (_) {
|
|
@@ -1614,7 +1647,7 @@ var require_buffer_fill = __commonJS({
|
|
|
1614
1647
|
if (encoding === "latin1") {
|
|
1615
1648
|
encoding = "binary";
|
|
1616
1649
|
}
|
|
1617
|
-
if (typeof encoding === "string" && !
|
|
1650
|
+
if (typeof encoding === "string" && !Buffer2.isEncoding(encoding)) {
|
|
1618
1651
|
throw new TypeError("Unknown encoding: " + encoding);
|
|
1619
1652
|
}
|
|
1620
1653
|
if (val2 === "") {
|
|
@@ -1623,9 +1656,9 @@ var require_buffer_fill = __commonJS({
|
|
|
1623
1656
|
if (isSingleByte(val2)) {
|
|
1624
1657
|
return fillWithNumber(buffer, val2.charCodeAt(0), start, end);
|
|
1625
1658
|
}
|
|
1626
|
-
val2 = new
|
|
1659
|
+
val2 = new Buffer2(val2, encoding);
|
|
1627
1660
|
}
|
|
1628
|
-
if (
|
|
1661
|
+
if (Buffer2.isBuffer(val2)) {
|
|
1629
1662
|
return fillWithBuffer(buffer, val2, start, end);
|
|
1630
1663
|
}
|
|
1631
1664
|
return fillWithNumber(buffer, 0, start, end);
|
|
@@ -1637,6 +1670,7 @@ var require_buffer_fill = __commonJS({
|
|
|
1637
1670
|
// node_modules/.pnpm/buffer-alloc@1.2.0/node_modules/buffer-alloc/index.js
|
|
1638
1671
|
var require_buffer_alloc = __commonJS({
|
|
1639
1672
|
"node_modules/.pnpm/buffer-alloc@1.2.0/node_modules/buffer-alloc/index.js"(exports, module) {
|
|
1673
|
+
init_inject_globals();
|
|
1640
1674
|
var bufferFill = require_buffer_fill();
|
|
1641
1675
|
var allocUnsafe = require_buffer_alloc_unsafe();
|
|
1642
1676
|
module.exports = function alloc(size, fill, encoding) {
|
|
@@ -1646,8 +1680,8 @@ var require_buffer_alloc = __commonJS({
|
|
|
1646
1680
|
if (size < 0) {
|
|
1647
1681
|
throw new RangeError('"size" argument must not be negative');
|
|
1648
1682
|
}
|
|
1649
|
-
if (
|
|
1650
|
-
return
|
|
1683
|
+
if (Buffer2.alloc) {
|
|
1684
|
+
return Buffer2.alloc(size, fill, encoding);
|
|
1651
1685
|
}
|
|
1652
1686
|
var buffer = allocUnsafe(size);
|
|
1653
1687
|
if (size === 0) {
|
|
@@ -1667,6 +1701,7 @@ var require_buffer_alloc = __commonJS({
|
|
|
1667
1701
|
// node_modules/.pnpm/uint64be@2.0.2/node_modules/uint64be/index.js
|
|
1668
1702
|
var require_uint64be = __commonJS({
|
|
1669
1703
|
"node_modules/.pnpm/uint64be@2.0.2/node_modules/uint64be/index.js"(exports) {
|
|
1704
|
+
init_inject_globals();
|
|
1670
1705
|
var bufferAlloc = require_buffer_alloc();
|
|
1671
1706
|
var UINT_32_MAX = Math.pow(2, 32);
|
|
1672
1707
|
exports.encodingLength = function() {
|
|
@@ -1698,6 +1733,7 @@ var require_uint64be = __commonJS({
|
|
|
1698
1733
|
// node_modules/.pnpm/hypercore-cache@1.0.2/node_modules/hypercore-cache/index.js
|
|
1699
1734
|
var require_hypercore_cache = __commonJS({
|
|
1700
1735
|
"node_modules/.pnpm/hypercore-cache@1.0.2/node_modules/hypercore-cache/index.js"(exports, module) {
|
|
1736
|
+
init_inject_globals();
|
|
1701
1737
|
var DEFAULT_MAX_BYTE_SIZE = 1024 * 1024 * 16;
|
|
1702
1738
|
var NamespacedCache = class {
|
|
1703
1739
|
constructor(parent, name) {
|
|
@@ -1802,6 +1838,7 @@ var require_hypercore_cache = __commonJS({
|
|
|
1802
1838
|
// node_modules/.pnpm/hypercore@9.12.0/node_modules/hypercore/lib/cache.js
|
|
1803
1839
|
var require_cache = __commonJS({
|
|
1804
1840
|
"node_modules/.pnpm/hypercore@9.12.0/node_modules/hypercore/lib/cache.js"(exports, module) {
|
|
1841
|
+
init_inject_globals();
|
|
1805
1842
|
var HypercoreCache = require_hypercore_cache();
|
|
1806
1843
|
var DEFAULT_TREE_CACHE_SIZE = 65536 * 40;
|
|
1807
1844
|
function createCache(opts) {
|
|
@@ -1832,6 +1869,7 @@ var require_cache = __commonJS({
|
|
|
1832
1869
|
// node_modules/.pnpm/hypercore@9.12.0/node_modules/hypercore/lib/storage.js
|
|
1833
1870
|
var require_storage = __commonJS({
|
|
1834
1871
|
"node_modules/.pnpm/hypercore@9.12.0/node_modules/hypercore/lib/storage.js"(exports, module) {
|
|
1872
|
+
init_inject_globals();
|
|
1835
1873
|
var uint64be = require_uint64be();
|
|
1836
1874
|
var flat = require_flat_tree();
|
|
1837
1875
|
var createCache = require_cache();
|
|
@@ -2008,7 +2046,7 @@ var require_storage = __commonJS({
|
|
|
2008
2046
|
Storage.prototype.putNodeBatch = function(index, nodes, cb) {
|
|
2009
2047
|
if (!cb)
|
|
2010
2048
|
cb = noop;
|
|
2011
|
-
var buf =
|
|
2049
|
+
var buf = Buffer2.alloc(nodes.length * 40);
|
|
2012
2050
|
for (var i = 0; i < nodes.length; i++) {
|
|
2013
2051
|
var offset = i * 40;
|
|
2014
2052
|
var node = nodes[i];
|
|
@@ -2022,7 +2060,7 @@ var require_storage = __commonJS({
|
|
|
2022
2060
|
Storage.prototype.putNode = function(index, node, cb) {
|
|
2023
2061
|
if (!cb)
|
|
2024
2062
|
cb = noop;
|
|
2025
|
-
var buf =
|
|
2063
|
+
var buf = Buffer2.allocUnsafe(40);
|
|
2026
2064
|
node.hash.copy(buf, 0);
|
|
2027
2065
|
uint64be.encode(node.size, buf, 32);
|
|
2028
2066
|
this.tree.write(32 + 40 * index, buf, cb);
|
|
@@ -2144,12 +2182,12 @@ var require_storage = __commonJS({
|
|
|
2144
2182
|
function copyMaybe(buf, maxSize) {
|
|
2145
2183
|
if (buf.buffer.byteLength <= maxSize)
|
|
2146
2184
|
return buf;
|
|
2147
|
-
const cpy =
|
|
2185
|
+
const cpy = Buffer2.alloc(buf.byteLength);
|
|
2148
2186
|
buf.copy(cpy);
|
|
2149
2187
|
return cpy;
|
|
2150
2188
|
}
|
|
2151
2189
|
function header(type, size, name) {
|
|
2152
|
-
var buf =
|
|
2190
|
+
var buf = Buffer2.alloc(32);
|
|
2153
2191
|
buf[0] = 5;
|
|
2154
2192
|
buf[1] = 2;
|
|
2155
2193
|
buf[2] = 87;
|
|
@@ -2233,13 +2271,14 @@ var require_storage = __commonJS({
|
|
|
2233
2271
|
// node_modules/.pnpm/uint64be@3.0.0/node_modules/uint64be/index.js
|
|
2234
2272
|
var require_uint64be2 = __commonJS({
|
|
2235
2273
|
"node_modules/.pnpm/uint64be@3.0.0/node_modules/uint64be/index.js"(exports) {
|
|
2274
|
+
init_inject_globals();
|
|
2236
2275
|
var UINT_32_MAX = Math.pow(2, 32);
|
|
2237
2276
|
exports.encodingLength = function() {
|
|
2238
2277
|
return 8;
|
|
2239
2278
|
};
|
|
2240
2279
|
exports.encode = function(num, buf, offset) {
|
|
2241
2280
|
if (!buf)
|
|
2242
|
-
buf =
|
|
2281
|
+
buf = Buffer2.allocUnsafe(8);
|
|
2243
2282
|
if (!offset)
|
|
2244
2283
|
offset = 0;
|
|
2245
2284
|
const top = Math.floor(num / UINT_32_MAX);
|
|
@@ -2263,18 +2302,19 @@ var require_uint64be2 = __commonJS({
|
|
|
2263
2302
|
// node_modules/.pnpm/hypercore-crypto@2.3.2/node_modules/hypercore-crypto/index.js
|
|
2264
2303
|
var require_hypercore_crypto = __commonJS({
|
|
2265
2304
|
"node_modules/.pnpm/hypercore-crypto@2.3.2/node_modules/hypercore-crypto/index.js"(exports) {
|
|
2305
|
+
init_inject_globals();
|
|
2266
2306
|
var sodium = import$sodium_universal;
|
|
2267
2307
|
var uint64be = require_uint64be2();
|
|
2268
|
-
var LEAF_TYPE =
|
|
2269
|
-
var PARENT_TYPE =
|
|
2270
|
-
var ROOT_TYPE =
|
|
2271
|
-
var CAP_TYPE =
|
|
2272
|
-
var HYPERCORE =
|
|
2273
|
-
var HYPERCORE_CAP =
|
|
2308
|
+
var LEAF_TYPE = Buffer2.from([0]);
|
|
2309
|
+
var PARENT_TYPE = Buffer2.from([1]);
|
|
2310
|
+
var ROOT_TYPE = Buffer2.from([2]);
|
|
2311
|
+
var CAP_TYPE = Buffer2.from([3]);
|
|
2312
|
+
var HYPERCORE = Buffer2.from("hypercore");
|
|
2313
|
+
var HYPERCORE_CAP = Buffer2.from("hypercore capability");
|
|
2274
2314
|
exports.writerCapability = function(key, secretKey, split) {
|
|
2275
2315
|
if (!split)
|
|
2276
2316
|
return null;
|
|
2277
|
-
const out =
|
|
2317
|
+
const out = Buffer2.allocUnsafe(32);
|
|
2278
2318
|
sodium.crypto_generichash_batch(out, [
|
|
2279
2319
|
CAP_TYPE,
|
|
2280
2320
|
HYPERCORE_CAP,
|
|
@@ -2286,7 +2326,7 @@ var require_hypercore_crypto = __commonJS({
|
|
|
2286
2326
|
exports.verifyRemoteWriterCapability = function(key, cap, split) {
|
|
2287
2327
|
if (!split)
|
|
2288
2328
|
return null;
|
|
2289
|
-
const out =
|
|
2329
|
+
const out = Buffer2.allocUnsafe(32);
|
|
2290
2330
|
sodium.crypto_generichash_batch(out, [
|
|
2291
2331
|
CAP_TYPE,
|
|
2292
2332
|
HYPERCORE_CAP,
|
|
@@ -2298,7 +2338,7 @@ var require_hypercore_crypto = __commonJS({
|
|
|
2298
2338
|
exports.capability = function(key, split) {
|
|
2299
2339
|
if (!split)
|
|
2300
2340
|
return null;
|
|
2301
|
-
const out =
|
|
2341
|
+
const out = Buffer2.allocUnsafe(32);
|
|
2302
2342
|
sodium.crypto_generichash_batch(out, [
|
|
2303
2343
|
HYPERCORE_CAP,
|
|
2304
2344
|
split.tx.slice(0, 32),
|
|
@@ -2309,7 +2349,7 @@ var require_hypercore_crypto = __commonJS({
|
|
|
2309
2349
|
exports.remoteCapability = function(key, split) {
|
|
2310
2350
|
if (!split)
|
|
2311
2351
|
return null;
|
|
2312
|
-
const out =
|
|
2352
|
+
const out = Buffer2.allocUnsafe(32);
|
|
2313
2353
|
sodium.crypto_generichash_batch(out, [
|
|
2314
2354
|
HYPERCORE_CAP,
|
|
2315
2355
|
split.rx.slice(0, 32),
|
|
@@ -2318,8 +2358,8 @@ var require_hypercore_crypto = __commonJS({
|
|
|
2318
2358
|
return out;
|
|
2319
2359
|
};
|
|
2320
2360
|
exports.keyPair = function(seed) {
|
|
2321
|
-
const publicKey =
|
|
2322
|
-
const secretKey =
|
|
2361
|
+
const publicKey = Buffer2.allocUnsafe(sodium.crypto_sign_PUBLICKEYBYTES);
|
|
2362
|
+
const secretKey = Buffer2.allocUnsafe(sodium.crypto_sign_SECRETKEYBYTES);
|
|
2323
2363
|
if (seed)
|
|
2324
2364
|
sodium.crypto_sign_seed_keypair(publicKey, secretKey, seed);
|
|
2325
2365
|
else
|
|
@@ -2330,12 +2370,12 @@ var require_hypercore_crypto = __commonJS({
|
|
|
2330
2370
|
};
|
|
2331
2371
|
};
|
|
2332
2372
|
exports.validateKeyPair = function(keyPair) {
|
|
2333
|
-
const pk =
|
|
2373
|
+
const pk = Buffer2.allocUnsafe(sodium.crypto_sign_PUBLICKEYBYTES);
|
|
2334
2374
|
sodium.crypto_sign_ed25519_sk_to_pk(pk, keyPair.secretKey);
|
|
2335
2375
|
return pk.equals(keyPair.publicKey);
|
|
2336
2376
|
};
|
|
2337
2377
|
exports.sign = function(message, secretKey) {
|
|
2338
|
-
const signature =
|
|
2378
|
+
const signature = Buffer2.allocUnsafe(sodium.crypto_sign_BYTES);
|
|
2339
2379
|
sodium.crypto_sign_detached(signature, message, secretKey);
|
|
2340
2380
|
return signature;
|
|
2341
2381
|
};
|
|
@@ -2343,7 +2383,7 @@ var require_hypercore_crypto = __commonJS({
|
|
|
2343
2383
|
return sodium.crypto_sign_verify_detached(signature, message, publicKey);
|
|
2344
2384
|
};
|
|
2345
2385
|
exports.data = function(data) {
|
|
2346
|
-
const out =
|
|
2386
|
+
const out = Buffer2.allocUnsafe(32);
|
|
2347
2387
|
sodium.crypto_generichash_batch(out, [
|
|
2348
2388
|
LEAF_TYPE,
|
|
2349
2389
|
encodeUInt64(data.length),
|
|
@@ -2360,7 +2400,7 @@ var require_hypercore_crypto = __commonJS({
|
|
|
2360
2400
|
a = b;
|
|
2361
2401
|
b = tmp;
|
|
2362
2402
|
}
|
|
2363
|
-
const out =
|
|
2403
|
+
const out = Buffer2.allocUnsafe(32);
|
|
2364
2404
|
sodium.crypto_generichash_batch(out, [
|
|
2365
2405
|
PARENT_TYPE,
|
|
2366
2406
|
encodeUInt64(a.size + b.size),
|
|
@@ -2380,13 +2420,13 @@ var require_hypercore_crypto = __commonJS({
|
|
|
2380
2420
|
buffers[j++] = encodeUInt64(r.size);
|
|
2381
2421
|
}
|
|
2382
2422
|
if (!out)
|
|
2383
|
-
out =
|
|
2423
|
+
out = Buffer2.allocUnsafe(32);
|
|
2384
2424
|
sodium.crypto_generichash_batch(out, buffers);
|
|
2385
2425
|
return out;
|
|
2386
2426
|
};
|
|
2387
2427
|
exports.signable = function(roots, length) {
|
|
2388
|
-
const out =
|
|
2389
|
-
if (
|
|
2428
|
+
const out = Buffer2.allocUnsafe(40);
|
|
2429
|
+
if (Buffer2.isBuffer(roots))
|
|
2390
2430
|
roots.copy(out);
|
|
2391
2431
|
else
|
|
2392
2432
|
exports.tree(roots, out.slice(0, 32));
|
|
@@ -2394,12 +2434,12 @@ var require_hypercore_crypto = __commonJS({
|
|
|
2394
2434
|
return out;
|
|
2395
2435
|
};
|
|
2396
2436
|
exports.randomBytes = function(n) {
|
|
2397
|
-
const buf =
|
|
2437
|
+
const buf = Buffer2.allocUnsafe(n);
|
|
2398
2438
|
sodium.randombytes_buf(buf);
|
|
2399
2439
|
return buf;
|
|
2400
2440
|
};
|
|
2401
2441
|
exports.discoveryKey = function(publicKey) {
|
|
2402
|
-
const digest =
|
|
2442
|
+
const digest = Buffer2.allocUnsafe(32);
|
|
2403
2443
|
sodium.crypto_generichash(digest, HYPERCORE, publicKey);
|
|
2404
2444
|
return digest;
|
|
2405
2445
|
};
|
|
@@ -2413,7 +2453,7 @@ var require_hypercore_crypto = __commonJS({
|
|
|
2413
2453
|
};
|
|
2414
2454
|
}
|
|
2415
2455
|
function encodeUInt64(n) {
|
|
2416
|
-
return uint64be.encode(n,
|
|
2456
|
+
return uint64be.encode(n, Buffer2.allocUnsafe(8));
|
|
2417
2457
|
}
|
|
2418
2458
|
}
|
|
2419
2459
|
});
|
|
@@ -2421,6 +2461,7 @@ var require_hypercore_crypto = __commonJS({
|
|
|
2421
2461
|
// node_modules/.pnpm/inspect-custom-symbol@1.1.1/node_modules/inspect-custom-symbol/browser.js
|
|
2422
2462
|
var require_browser = __commonJS({
|
|
2423
2463
|
"node_modules/.pnpm/inspect-custom-symbol@1.1.1/node_modules/inspect-custom-symbol/browser.js"(exports, module) {
|
|
2464
|
+
init_inject_globals();
|
|
2424
2465
|
module.exports = Symbol.for("nodejs.util.inspect.custom");
|
|
2425
2466
|
}
|
|
2426
2467
|
});
|
|
@@ -2428,8 +2469,9 @@ var require_browser = __commonJS({
|
|
|
2428
2469
|
// node_modules/.pnpm/pretty-hash@1.0.1/node_modules/pretty-hash/index.js
|
|
2429
2470
|
var require_pretty_hash = __commonJS({
|
|
2430
2471
|
"node_modules/.pnpm/pretty-hash@1.0.1/node_modules/pretty-hash/index.js"(exports, module) {
|
|
2472
|
+
init_inject_globals();
|
|
2431
2473
|
module.exports = function prettyHash(buf) {
|
|
2432
|
-
if (
|
|
2474
|
+
if (Buffer2.isBuffer(buf))
|
|
2433
2475
|
buf = buf.toString("hex");
|
|
2434
2476
|
if (typeof buf === "string" && buf.length > 8) {
|
|
2435
2477
|
return buf.slice(0, 6) + ".." + buf.slice(-2);
|
|
@@ -2442,6 +2484,7 @@ var require_pretty_hash = __commonJS({
|
|
|
2442
2484
|
// node_modules/.pnpm/nanoguard@1.3.0/node_modules/nanoguard/index.js
|
|
2443
2485
|
var require_nanoguard = __commonJS({
|
|
2444
2486
|
"node_modules/.pnpm/nanoguard@1.3.0/node_modules/nanoguard/index.js"(exports, module) {
|
|
2487
|
+
init_inject_globals();
|
|
2445
2488
|
module.exports = class Nanoguard {
|
|
2446
2489
|
constructor() {
|
|
2447
2490
|
this._tick = 0;
|
|
@@ -2516,12 +2559,13 @@ var require_nanoguard = __commonJS({
|
|
|
2516
2559
|
// node_modules/.pnpm/hypercore@9.12.0/node_modules/hypercore/lib/safe-buffer-equals.js
|
|
2517
2560
|
var require_safe_buffer_equals = __commonJS({
|
|
2518
2561
|
"node_modules/.pnpm/hypercore@9.12.0/node_modules/hypercore/lib/safe-buffer-equals.js"(exports, module) {
|
|
2562
|
+
init_inject_globals();
|
|
2519
2563
|
module.exports = function safeBufferEquals(a, b) {
|
|
2520
2564
|
if (!a)
|
|
2521
2565
|
return !b;
|
|
2522
2566
|
if (!b)
|
|
2523
2567
|
return !a;
|
|
2524
|
-
return
|
|
2568
|
+
return Buffer2.compare(a, b) === 0;
|
|
2525
2569
|
};
|
|
2526
2570
|
}
|
|
2527
2571
|
});
|
|
@@ -2529,6 +2573,7 @@ var require_safe_buffer_equals = __commonJS({
|
|
|
2529
2573
|
// node_modules/.pnpm/nanoassert@2.0.0/node_modules/nanoassert/index.js
|
|
2530
2574
|
var require_nanoassert = __commonJS({
|
|
2531
2575
|
"node_modules/.pnpm/nanoassert@2.0.0/node_modules/nanoassert/index.js"(exports, module) {
|
|
2576
|
+
init_inject_globals();
|
|
2532
2577
|
module.exports = assert;
|
|
2533
2578
|
var AssertionError = class extends Error {
|
|
2534
2579
|
};
|
|
@@ -2547,6 +2592,7 @@ var require_nanoassert = __commonJS({
|
|
|
2547
2592
|
// node_modules/.pnpm/clone@2.1.2/node_modules/clone/clone.js
|
|
2548
2593
|
var require_clone = __commonJS({
|
|
2549
2594
|
"node_modules/.pnpm/clone@2.1.2/node_modules/clone/clone.js"(exports, module) {
|
|
2595
|
+
init_inject_globals();
|
|
2550
2596
|
var clone = function() {
|
|
2551
2597
|
"use strict";
|
|
2552
2598
|
function _instanceof(obj, type) {
|
|
@@ -2582,7 +2628,7 @@ var require_clone = __commonJS({
|
|
|
2582
2628
|
}
|
|
2583
2629
|
var allParents = [];
|
|
2584
2630
|
var allChildren = [];
|
|
2585
|
-
var useBuffer = typeof
|
|
2631
|
+
var useBuffer = typeof Buffer2 != "undefined";
|
|
2586
2632
|
if (typeof circular == "undefined")
|
|
2587
2633
|
circular = true;
|
|
2588
2634
|
if (typeof depth == "undefined")
|
|
@@ -2617,11 +2663,11 @@ var require_clone = __commonJS({
|
|
|
2617
2663
|
child.lastIndex = parent2.lastIndex;
|
|
2618
2664
|
} else if (clone2.__isDate(parent2)) {
|
|
2619
2665
|
child = new Date(parent2.getTime());
|
|
2620
|
-
} else if (useBuffer &&
|
|
2621
|
-
if (
|
|
2622
|
-
child =
|
|
2666
|
+
} else if (useBuffer && Buffer2.isBuffer(parent2)) {
|
|
2667
|
+
if (Buffer2.allocUnsafe) {
|
|
2668
|
+
child = Buffer2.allocUnsafe(parent2.length);
|
|
2623
2669
|
} else {
|
|
2624
|
-
child = new
|
|
2670
|
+
child = new Buffer2(parent2.length);
|
|
2625
2671
|
}
|
|
2626
2672
|
parent2.copy(child);
|
|
2627
2673
|
return child;
|
|
@@ -2747,6 +2793,7 @@ var require_clone = __commonJS({
|
|
|
2747
2793
|
// node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/cipher.js
|
|
2748
2794
|
var require_cipher = __commonJS({
|
|
2749
2795
|
"node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/cipher.js"(exports, module) {
|
|
2796
|
+
init_inject_globals();
|
|
2750
2797
|
var { sodium_malloc, sodium_memzero } = import$sodium_universal_memory;
|
|
2751
2798
|
var {
|
|
2752
2799
|
crypto_aead_chacha20poly1305_ietf_KEYBYTES,
|
|
@@ -2821,6 +2868,7 @@ var require_cipher = __commonJS({
|
|
|
2821
2868
|
// node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/cipher-state.js
|
|
2822
2869
|
var require_cipher_state = __commonJS({
|
|
2823
2870
|
"node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/cipher-state.js"(exports, module) {
|
|
2871
|
+
init_inject_globals();
|
|
2824
2872
|
var { sodium_memzero } = import$sodium_universal_memory;
|
|
2825
2873
|
var { sodium_increment, sodium_memcmp, sodium_is_zero } = import$sodium_universal_helpers;
|
|
2826
2874
|
var assert = require_nanoassert();
|
|
@@ -2933,6 +2981,7 @@ var require_cipher_state = __commonJS({
|
|
|
2933
2981
|
// node_modules/.pnpm/nanoassert@1.1.0/node_modules/nanoassert/index.js
|
|
2934
2982
|
var require_nanoassert2 = __commonJS({
|
|
2935
2983
|
"node_modules/.pnpm/nanoassert@1.1.0/node_modules/nanoassert/index.js"(exports, module) {
|
|
2984
|
+
init_inject_globals();
|
|
2936
2985
|
assert.notEqual = notEqual;
|
|
2937
2986
|
assert.notOk = notOk;
|
|
2938
2987
|
assert.equal = equal;
|
|
@@ -2957,6 +3006,7 @@ var require_nanoassert2 = __commonJS({
|
|
|
2957
3006
|
// node_modules/.pnpm/hmac-blake2b@2.0.0/node_modules/hmac-blake2b/index.js
|
|
2958
3007
|
var require_hmac_blake2b = __commonJS({
|
|
2959
3008
|
"node_modules/.pnpm/hmac-blake2b@2.0.0/node_modules/hmac-blake2b/index.js"(exports, module) {
|
|
3009
|
+
init_inject_globals();
|
|
2960
3010
|
var { sodium_malloc, sodium_memzero } = import$sodium_universal_memory;
|
|
2961
3011
|
var { crypto_generichash, crypto_generichash_batch } = import$sodium_universal_crypto_generichash;
|
|
2962
3012
|
var assert = require_nanoassert2();
|
|
@@ -2995,6 +3045,7 @@ var require_hmac_blake2b = __commonJS({
|
|
|
2995
3045
|
// node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/dh.js
|
|
2996
3046
|
var require_dh = __commonJS({
|
|
2997
3047
|
"node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/dh.js"(exports, module) {
|
|
3048
|
+
init_inject_globals();
|
|
2998
3049
|
var { crypto_kx_SEEDBYTES, crypto_kx_keypair, crypto_kx_seed_keypair } = import$sodium_universal_crypto_kx;
|
|
2999
3050
|
var { crypto_scalarmult_BYTES, crypto_scalarmult_SCALARBYTES, crypto_scalarmult } = import$sodium_universal_crypto_scalarmult;
|
|
3000
3051
|
var assert = require_nanoassert();
|
|
@@ -3038,6 +3089,7 @@ var require_dh = __commonJS({
|
|
|
3038
3089
|
// node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/hash.js
|
|
3039
3090
|
var require_hash = __commonJS({
|
|
3040
3091
|
"node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/hash.js"(exports, module) {
|
|
3092
|
+
init_inject_globals();
|
|
3041
3093
|
var { sodium_malloc, sodium_memzero } = import$sodium_universal_memory;
|
|
3042
3094
|
var { crypto_generichash_batch } = import$sodium_universal_crypto_generichash;
|
|
3043
3095
|
var assert = require_nanoassert();
|
|
@@ -3086,6 +3138,7 @@ var require_hash = __commonJS({
|
|
|
3086
3138
|
// node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/symmetric-state.js
|
|
3087
3139
|
var require_symmetric_state = __commonJS({
|
|
3088
3140
|
"node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/symmetric-state.js"(exports, module) {
|
|
3141
|
+
init_inject_globals();
|
|
3089
3142
|
var { sodium_malloc, sodium_memzero } = import$sodium_universal_memory;
|
|
3090
3143
|
var assert = require_nanoassert();
|
|
3091
3144
|
var cipherState = require_cipher_state();
|
|
@@ -3215,6 +3268,7 @@ var require_symmetric_state = __commonJS({
|
|
|
3215
3268
|
// node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/handshake-state.js
|
|
3216
3269
|
var require_handshake_state = __commonJS({
|
|
3217
3270
|
"node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/handshake-state.js"(exports, module) {
|
|
3271
|
+
init_inject_globals();
|
|
3218
3272
|
var { sodium_malloc, sodium_memzero, sodium_free } = import$sodium_universal_memory;
|
|
3219
3273
|
var assert = require_nanoassert();
|
|
3220
3274
|
var clone = require_clone();
|
|
@@ -3644,6 +3698,7 @@ var require_handshake_state = __commonJS({
|
|
|
3644
3698
|
// node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/index.js
|
|
3645
3699
|
var require_noise_protocol = __commonJS({
|
|
3646
3700
|
"node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/index.js"(exports, module) {
|
|
3701
|
+
init_inject_globals();
|
|
3647
3702
|
module.exports = require_handshake_state();
|
|
3648
3703
|
}
|
|
3649
3704
|
});
|
|
@@ -3651,11 +3706,12 @@ var require_noise_protocol = __commonJS({
|
|
|
3651
3706
|
// node_modules/.pnpm/simple-handshake@3.0.0/node_modules/simple-handshake/index.js
|
|
3652
3707
|
var require_simple_handshake = __commonJS({
|
|
3653
3708
|
"node_modules/.pnpm/simple-handshake@3.0.0/node_modules/simple-handshake/index.js"(exports, module) {
|
|
3709
|
+
init_inject_globals();
|
|
3654
3710
|
var noise = require_noise_protocol();
|
|
3655
3711
|
var NoiseSymmetricState = require_symmetric_state();
|
|
3656
3712
|
var NoiseHash = require_hash();
|
|
3657
3713
|
var assert = require_nanoassert();
|
|
3658
|
-
var EMPTY =
|
|
3714
|
+
var EMPTY = Buffer2.alloc(0);
|
|
3659
3715
|
function SimpleHandshake(isInitiator, opts) {
|
|
3660
3716
|
if (!(this instanceof SimpleHandshake))
|
|
3661
3717
|
return new SimpleHandshake(isInitiator, opts);
|
|
@@ -3684,8 +3740,8 @@ var require_simple_handshake = __commonJS({
|
|
|
3684
3740
|
this.waiting = isInitiator === false;
|
|
3685
3741
|
this.finished = false;
|
|
3686
3742
|
this.split = null;
|
|
3687
|
-
this._tx =
|
|
3688
|
-
this._rx =
|
|
3743
|
+
this._tx = Buffer2.alloc(65535);
|
|
3744
|
+
this._rx = Buffer2.alloc(65535);
|
|
3689
3745
|
}
|
|
3690
3746
|
SimpleHandshake.prototype.recv = function recv(data, cb) {
|
|
3691
3747
|
var self = this;
|
|
@@ -3751,7 +3807,7 @@ var require_simple_handshake = __commonJS({
|
|
|
3751
3807
|
self.finished = true;
|
|
3752
3808
|
self.waiting = false;
|
|
3753
3809
|
if (self.split) {
|
|
3754
|
-
self.handshakeHash =
|
|
3810
|
+
self.handshakeHash = Buffer2.alloc(NoiseHash.HASHLEN);
|
|
3755
3811
|
NoiseSymmetricState.getHandshakeHash(self.state.symmetricState, self.handshakeHash);
|
|
3756
3812
|
}
|
|
3757
3813
|
if (err)
|
|
@@ -3773,6 +3829,7 @@ var require_simple_handshake = __commonJS({
|
|
|
3773
3829
|
// node_modules/.pnpm/varint@5.0.2/node_modules/varint/encode.js
|
|
3774
3830
|
var require_encode2 = __commonJS({
|
|
3775
3831
|
"node_modules/.pnpm/varint@5.0.2/node_modules/varint/encode.js"(exports, module) {
|
|
3832
|
+
init_inject_globals();
|
|
3776
3833
|
module.exports = encode;
|
|
3777
3834
|
var MSB = 128;
|
|
3778
3835
|
var REST = 127;
|
|
@@ -3800,6 +3857,7 @@ var require_encode2 = __commonJS({
|
|
|
3800
3857
|
// node_modules/.pnpm/varint@5.0.2/node_modules/varint/decode.js
|
|
3801
3858
|
var require_decode2 = __commonJS({
|
|
3802
3859
|
"node_modules/.pnpm/varint@5.0.2/node_modules/varint/decode.js"(exports, module) {
|
|
3860
|
+
init_inject_globals();
|
|
3803
3861
|
module.exports = read;
|
|
3804
3862
|
var MSB = 128;
|
|
3805
3863
|
var REST = 127;
|
|
@@ -3823,6 +3881,7 @@ var require_decode2 = __commonJS({
|
|
|
3823
3881
|
// node_modules/.pnpm/varint@5.0.2/node_modules/varint/length.js
|
|
3824
3882
|
var require_length2 = __commonJS({
|
|
3825
3883
|
"node_modules/.pnpm/varint@5.0.2/node_modules/varint/length.js"(exports, module) {
|
|
3884
|
+
init_inject_globals();
|
|
3826
3885
|
var N1 = Math.pow(2, 7);
|
|
3827
3886
|
var N2 = Math.pow(2, 14);
|
|
3828
3887
|
var N3 = Math.pow(2, 21);
|
|
@@ -3841,6 +3900,7 @@ var require_length2 = __commonJS({
|
|
|
3841
3900
|
// node_modules/.pnpm/varint@5.0.2/node_modules/varint/index.js
|
|
3842
3901
|
var require_varint2 = __commonJS({
|
|
3843
3902
|
"node_modules/.pnpm/varint@5.0.2/node_modules/varint/index.js"(exports, module) {
|
|
3903
|
+
init_inject_globals();
|
|
3844
3904
|
module.exports = {
|
|
3845
3905
|
encode: require_encode2(),
|
|
3846
3906
|
decode: require_decode2(),
|
|
@@ -3852,6 +3912,7 @@ var require_varint2 = __commonJS({
|
|
|
3852
3912
|
// node_modules/.pnpm/simple-hypercore-protocol@2.1.2/node_modules/simple-hypercore-protocol/lib/handshake.js
|
|
3853
3913
|
var require_handshake = __commonJS({
|
|
3854
3914
|
"node_modules/.pnpm/simple-hypercore-protocol@2.1.2/node_modules/simple-hypercore-protocol/lib/handshake.js"(exports, module) {
|
|
3915
|
+
init_inject_globals();
|
|
3855
3916
|
var SH = require_simple_handshake();
|
|
3856
3917
|
var DH = require_dh();
|
|
3857
3918
|
var crypto = require_hypercore_crypto();
|
|
@@ -3887,7 +3948,7 @@ var require_handshake = __commonJS({
|
|
|
3887
3948
|
if (this.destroyed)
|
|
3888
3949
|
return;
|
|
3889
3950
|
if (this.buffer)
|
|
3890
|
-
this.buffer =
|
|
3951
|
+
this.buffer = Buffer2.concat([this.buffer, data]);
|
|
3891
3952
|
else
|
|
3892
3953
|
this.buffer = data;
|
|
3893
3954
|
while (!this.destroyed && !this.noise.finished) {
|
|
@@ -3918,8 +3979,8 @@ var require_handshake = __commonJS({
|
|
|
3918
3979
|
const obj = {
|
|
3919
3980
|
// suboptimal but to reduce secure memory overhead on linux with default settings
|
|
3920
3981
|
// better fix is to batch mallocs in noise-protocol
|
|
3921
|
-
publicKey:
|
|
3922
|
-
secretKey:
|
|
3982
|
+
publicKey: Buffer2.alloc(DH.PKLEN),
|
|
3983
|
+
secretKey: Buffer2.alloc(DH.SKLEN)
|
|
3923
3984
|
};
|
|
3924
3985
|
if (seed)
|
|
3925
3986
|
DH.generateSeedKeypair(obj.publicKey, obj.secretKey, seed);
|
|
@@ -3932,7 +3993,7 @@ var require_handshake = __commonJS({
|
|
|
3932
3993
|
if (self.destroyed)
|
|
3933
3994
|
return;
|
|
3934
3995
|
self.destroyed = true;
|
|
3935
|
-
const split = { rx:
|
|
3996
|
+
const split = { rx: Buffer2.from(self.noise.split.rx), tx: Buffer2.from(self.noise.split.tx) };
|
|
3936
3997
|
crypto.free(self.noise.split.rx);
|
|
3937
3998
|
crypto.free(self.noise.split.tx);
|
|
3938
3999
|
self.ondone(null, self.remotePayload, split, self.buffer, self.remotePublicKey, self.noise.handshakeHash);
|
|
@@ -3945,7 +4006,7 @@ var require_handshake = __commonJS({
|
|
|
3945
4006
|
function onsend(err, data) {
|
|
3946
4007
|
if (err)
|
|
3947
4008
|
return this.destroy(err);
|
|
3948
|
-
const buf =
|
|
4009
|
+
const buf = Buffer2.allocUnsafe(varint.encodingLength(data.length) + data.length);
|
|
3949
4010
|
varint.encode(data.length, buf, 0);
|
|
3950
4011
|
data.copy(buf, varint.encode.bytes);
|
|
3951
4012
|
this.options.send(buf);
|
|
@@ -3954,7 +4015,7 @@ var require_handshake = __commonJS({
|
|
|
3954
4015
|
if (err)
|
|
3955
4016
|
return this.destroy(err);
|
|
3956
4017
|
if (data && data.length)
|
|
3957
|
-
this.remotePayload =
|
|
4018
|
+
this.remotePayload = Buffer2.from(data);
|
|
3958
4019
|
if (this.destroyed || this.noise.finished)
|
|
3959
4020
|
return;
|
|
3960
4021
|
if (this.noise.waiting === false) {
|
|
@@ -3962,7 +4023,7 @@ var require_handshake = __commonJS({
|
|
|
3962
4023
|
}
|
|
3963
4024
|
}
|
|
3964
4025
|
function onstatickey(remoteKey, done) {
|
|
3965
|
-
this.remotePublicKey =
|
|
4026
|
+
this.remotePublicKey = Buffer2.from(remoteKey);
|
|
3966
4027
|
if (this.options.onauthenticate)
|
|
3967
4028
|
this.options.onauthenticate(this.remotePublicKey, done);
|
|
3968
4029
|
else
|
|
@@ -3974,6 +4035,7 @@ var require_handshake = __commonJS({
|
|
|
3974
4035
|
// node_modules/.pnpm/varint@5.0.0/node_modules/varint/encode.js
|
|
3975
4036
|
var require_encode3 = __commonJS({
|
|
3976
4037
|
"node_modules/.pnpm/varint@5.0.0/node_modules/varint/encode.js"(exports, module) {
|
|
4038
|
+
init_inject_globals();
|
|
3977
4039
|
module.exports = encode;
|
|
3978
4040
|
var MSB = 128;
|
|
3979
4041
|
var REST = 127;
|
|
@@ -4001,6 +4063,7 @@ var require_encode3 = __commonJS({
|
|
|
4001
4063
|
// node_modules/.pnpm/varint@5.0.0/node_modules/varint/decode.js
|
|
4002
4064
|
var require_decode3 = __commonJS({
|
|
4003
4065
|
"node_modules/.pnpm/varint@5.0.0/node_modules/varint/decode.js"(exports, module) {
|
|
4066
|
+
init_inject_globals();
|
|
4004
4067
|
module.exports = read;
|
|
4005
4068
|
var MSB = 128;
|
|
4006
4069
|
var REST = 127;
|
|
@@ -4024,6 +4087,7 @@ var require_decode3 = __commonJS({
|
|
|
4024
4087
|
// node_modules/.pnpm/varint@5.0.0/node_modules/varint/length.js
|
|
4025
4088
|
var require_length3 = __commonJS({
|
|
4026
4089
|
"node_modules/.pnpm/varint@5.0.0/node_modules/varint/length.js"(exports, module) {
|
|
4090
|
+
init_inject_globals();
|
|
4027
4091
|
var N1 = Math.pow(2, 7);
|
|
4028
4092
|
var N2 = Math.pow(2, 14);
|
|
4029
4093
|
var N3 = Math.pow(2, 21);
|
|
@@ -4042,6 +4106,7 @@ var require_length3 = __commonJS({
|
|
|
4042
4106
|
// node_modules/.pnpm/varint@5.0.0/node_modules/varint/index.js
|
|
4043
4107
|
var require_varint3 = __commonJS({
|
|
4044
4108
|
"node_modules/.pnpm/varint@5.0.0/node_modules/varint/index.js"(exports, module) {
|
|
4109
|
+
init_inject_globals();
|
|
4045
4110
|
module.exports = {
|
|
4046
4111
|
encode: require_encode3(),
|
|
4047
4112
|
decode: require_decode3(),
|
|
@@ -4053,6 +4118,7 @@ var require_varint3 = __commonJS({
|
|
|
4053
4118
|
// node_modules/.pnpm/signed-varint@2.0.1/node_modules/signed-varint/index.js
|
|
4054
4119
|
var require_signed_varint = __commonJS({
|
|
4055
4120
|
"node_modules/.pnpm/signed-varint@2.0.1/node_modules/signed-varint/index.js"(exports) {
|
|
4121
|
+
init_inject_globals();
|
|
4056
4122
|
var varint = require_varint2();
|
|
4057
4123
|
exports.encode = function encode(v, b, o) {
|
|
4058
4124
|
v = v >= 0 ? v * 2 : v * -2 - 1;
|
|
@@ -4074,6 +4140,7 @@ var require_signed_varint = __commonJS({
|
|
|
4074
4140
|
// node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/lib/ascii.js
|
|
4075
4141
|
var require_ascii = __commonJS({
|
|
4076
4142
|
"node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/lib/ascii.js"(exports, module) {
|
|
4143
|
+
init_inject_globals();
|
|
4077
4144
|
function byteLength(string) {
|
|
4078
4145
|
return string.length;
|
|
4079
4146
|
}
|
|
@@ -4103,6 +4170,7 @@ var require_ascii = __commonJS({
|
|
|
4103
4170
|
// node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/lib/base64.js
|
|
4104
4171
|
var require_base64 = __commonJS({
|
|
4105
4172
|
"node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/lib/base64.js"(exports, module) {
|
|
4173
|
+
init_inject_globals();
|
|
4106
4174
|
var alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
4107
4175
|
var codes = new Uint8Array(256);
|
|
4108
4176
|
for (let i = 0; i < alphabet.length; i++) {
|
|
@@ -4161,6 +4229,7 @@ var require_base64 = __commonJS({
|
|
|
4161
4229
|
// node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/lib/hex.js
|
|
4162
4230
|
var require_hex = __commonJS({
|
|
4163
4231
|
"node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/lib/hex.js"(exports, module) {
|
|
4232
|
+
init_inject_globals();
|
|
4164
4233
|
function byteLength(string) {
|
|
4165
4234
|
return string.length >>> 1;
|
|
4166
4235
|
}
|
|
@@ -4208,6 +4277,7 @@ var require_hex = __commonJS({
|
|
|
4208
4277
|
// node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/lib/utf8.js
|
|
4209
4278
|
var require_utf8 = __commonJS({
|
|
4210
4279
|
"node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/lib/utf8.js"(exports, module) {
|
|
4280
|
+
init_inject_globals();
|
|
4211
4281
|
function byteLength(string) {
|
|
4212
4282
|
let length = 0;
|
|
4213
4283
|
for (let i = 0, n = string.length; i < n; i++) {
|
|
@@ -4331,6 +4401,7 @@ var require_utf8 = __commonJS({
|
|
|
4331
4401
|
// node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/lib/utf16le.js
|
|
4332
4402
|
var require_utf16le = __commonJS({
|
|
4333
4403
|
"node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/lib/utf16le.js"(exports, module) {
|
|
4404
|
+
init_inject_globals();
|
|
4334
4405
|
function byteLength(string) {
|
|
4335
4406
|
return string.length * 2;
|
|
4336
4407
|
}
|
|
@@ -4367,6 +4438,7 @@ var require_utf16le = __commonJS({
|
|
|
4367
4438
|
// node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/browser.js
|
|
4368
4439
|
var require_browser2 = __commonJS({
|
|
4369
4440
|
"node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/browser.js"(exports, module) {
|
|
4441
|
+
init_inject_globals();
|
|
4370
4442
|
var ascii = require_ascii();
|
|
4371
4443
|
var base64 = require_base64();
|
|
4372
4444
|
var hex = require_hex();
|
|
@@ -4813,6 +4885,7 @@ var require_browser2 = __commonJS({
|
|
|
4813
4885
|
// node_modules/.pnpm/protocol-buffers-encodings@1.2.0/node_modules/protocol-buffers-encodings/index.js
|
|
4814
4886
|
var require_protocol_buffers_encodings = __commonJS({
|
|
4815
4887
|
"node_modules/.pnpm/protocol-buffers-encodings@1.2.0/node_modules/protocol-buffers-encodings/index.js"(exports) {
|
|
4888
|
+
init_inject_globals();
|
|
4816
4889
|
var varint = require_varint3();
|
|
4817
4890
|
var svarint = require_signed_varint();
|
|
4818
4891
|
var b4a = require_browser2();
|
|
@@ -5081,6 +5154,7 @@ var require_protocol_buffers_encodings = __commonJS({
|
|
|
5081
5154
|
// node_modules/.pnpm/simple-hypercore-protocol@2.1.2/node_modules/simple-hypercore-protocol/messages.js
|
|
5082
5155
|
var require_messages = __commonJS({
|
|
5083
5156
|
"node_modules/.pnpm/simple-hypercore-protocol@2.1.2/node_modules/simple-hypercore-protocol/messages.js"(exports) {
|
|
5157
|
+
init_inject_globals();
|
|
5084
5158
|
var encodings = require_protocol_buffers_encodings();
|
|
5085
5159
|
var varint = encodings.varint;
|
|
5086
5160
|
var skip = encodings.skip;
|
|
@@ -5187,7 +5261,7 @@ var require_messages = __commonJS({
|
|
|
5187
5261
|
if (!offset)
|
|
5188
5262
|
offset = 0;
|
|
5189
5263
|
if (!buf)
|
|
5190
|
-
buf =
|
|
5264
|
+
buf = Buffer2.allocUnsafe(encodingLength(obj));
|
|
5191
5265
|
var oldOffset = offset;
|
|
5192
5266
|
if (!defined(obj.nonce))
|
|
5193
5267
|
throw new Error("nonce is required");
|
|
@@ -5254,7 +5328,7 @@ var require_messages = __commonJS({
|
|
|
5254
5328
|
if (!offset)
|
|
5255
5329
|
offset = 0;
|
|
5256
5330
|
if (!buf)
|
|
5257
|
-
buf =
|
|
5331
|
+
buf = Buffer2.allocUnsafe(encodingLength(obj));
|
|
5258
5332
|
var oldOffset = offset;
|
|
5259
5333
|
if (!defined(obj.discoveryKey))
|
|
5260
5334
|
throw new Error("discoveryKey is required");
|
|
@@ -5336,7 +5410,7 @@ var require_messages = __commonJS({
|
|
|
5336
5410
|
if (!offset)
|
|
5337
5411
|
offset = 0;
|
|
5338
5412
|
if (!buf)
|
|
5339
|
-
buf =
|
|
5413
|
+
buf = Buffer2.allocUnsafe(encodingLength(obj));
|
|
5340
5414
|
var oldOffset = offset;
|
|
5341
5415
|
if (defined(obj.extensions)) {
|
|
5342
5416
|
for (var i = 0; i < obj.extensions.length; i++) {
|
|
@@ -5413,7 +5487,7 @@ var require_messages = __commonJS({
|
|
|
5413
5487
|
if (!offset)
|
|
5414
5488
|
offset = 0;
|
|
5415
5489
|
if (!buf)
|
|
5416
|
-
buf =
|
|
5490
|
+
buf = Buffer2.allocUnsafe(encodingLength(obj));
|
|
5417
5491
|
var oldOffset = offset;
|
|
5418
5492
|
if (defined(obj.uploading)) {
|
|
5419
5493
|
buf[offset++] = 8;
|
|
@@ -5496,7 +5570,7 @@ var require_messages = __commonJS({
|
|
|
5496
5570
|
if (!offset)
|
|
5497
5571
|
offset = 0;
|
|
5498
5572
|
if (!buf)
|
|
5499
|
-
buf =
|
|
5573
|
+
buf = Buffer2.allocUnsafe(encodingLength(obj));
|
|
5500
5574
|
var oldOffset = offset;
|
|
5501
5575
|
if (!defined(obj.start))
|
|
5502
5576
|
throw new Error("start is required");
|
|
@@ -5593,7 +5667,7 @@ var require_messages = __commonJS({
|
|
|
5593
5667
|
if (!offset)
|
|
5594
5668
|
offset = 0;
|
|
5595
5669
|
if (!buf)
|
|
5596
|
-
buf =
|
|
5670
|
+
buf = Buffer2.allocUnsafe(encodingLength(obj));
|
|
5597
5671
|
var oldOffset = offset;
|
|
5598
5672
|
if (!defined(obj.start))
|
|
5599
5673
|
throw new Error("start is required");
|
|
@@ -5670,7 +5744,7 @@ var require_messages = __commonJS({
|
|
|
5670
5744
|
if (!offset)
|
|
5671
5745
|
offset = 0;
|
|
5672
5746
|
if (!buf)
|
|
5673
|
-
buf =
|
|
5747
|
+
buf = Buffer2.allocUnsafe(encodingLength(obj));
|
|
5674
5748
|
var oldOffset = offset;
|
|
5675
5749
|
if (!defined(obj.start))
|
|
5676
5750
|
throw new Error("start is required");
|
|
@@ -5747,7 +5821,7 @@ var require_messages = __commonJS({
|
|
|
5747
5821
|
if (!offset)
|
|
5748
5822
|
offset = 0;
|
|
5749
5823
|
if (!buf)
|
|
5750
|
-
buf =
|
|
5824
|
+
buf = Buffer2.allocUnsafe(encodingLength(obj));
|
|
5751
5825
|
var oldOffset = offset;
|
|
5752
5826
|
if (!defined(obj.start))
|
|
5753
5827
|
throw new Error("start is required");
|
|
@@ -5833,7 +5907,7 @@ var require_messages = __commonJS({
|
|
|
5833
5907
|
if (!offset)
|
|
5834
5908
|
offset = 0;
|
|
5835
5909
|
if (!buf)
|
|
5836
|
-
buf =
|
|
5910
|
+
buf = Buffer2.allocUnsafe(encodingLength(obj));
|
|
5837
5911
|
var oldOffset = offset;
|
|
5838
5912
|
if (!defined(obj.index))
|
|
5839
5913
|
throw new Error("index is required");
|
|
@@ -5935,7 +6009,7 @@ var require_messages = __commonJS({
|
|
|
5935
6009
|
if (!offset)
|
|
5936
6010
|
offset = 0;
|
|
5937
6011
|
if (!buf)
|
|
5938
|
-
buf =
|
|
6012
|
+
buf = Buffer2.allocUnsafe(encodingLength(obj));
|
|
5939
6013
|
var oldOffset = offset;
|
|
5940
6014
|
if (!defined(obj.index))
|
|
5941
6015
|
throw new Error("index is required");
|
|
@@ -6035,7 +6109,7 @@ var require_messages = __commonJS({
|
|
|
6035
6109
|
if (!offset)
|
|
6036
6110
|
offset = 0;
|
|
6037
6111
|
if (!buf)
|
|
6038
|
-
buf =
|
|
6112
|
+
buf = Buffer2.allocUnsafe(encodingLength2(obj));
|
|
6039
6113
|
var oldOffset = offset;
|
|
6040
6114
|
if (!defined(obj.index))
|
|
6041
6115
|
throw new Error("index is required");
|
|
@@ -6140,7 +6214,7 @@ var require_messages = __commonJS({
|
|
|
6140
6214
|
if (!offset)
|
|
6141
6215
|
offset = 0;
|
|
6142
6216
|
if (!buf)
|
|
6143
|
-
buf =
|
|
6217
|
+
buf = Buffer2.allocUnsafe(encodingLength(obj));
|
|
6144
6218
|
var oldOffset = offset;
|
|
6145
6219
|
if (!defined(obj.index))
|
|
6146
6220
|
throw new Error("index is required");
|
|
@@ -6241,7 +6315,7 @@ var require_messages = __commonJS({
|
|
|
6241
6315
|
if (!offset)
|
|
6242
6316
|
offset = 0;
|
|
6243
6317
|
if (!buf)
|
|
6244
|
-
buf =
|
|
6318
|
+
buf = Buffer2.allocUnsafe(encodingLength(obj));
|
|
6245
6319
|
var oldOffset = offset;
|
|
6246
6320
|
if (defined(obj.discoveryKey)) {
|
|
6247
6321
|
buf[offset++] = 10;
|
|
@@ -6290,6 +6364,7 @@ var require_messages = __commonJS({
|
|
|
6290
6364
|
// node_modules/.pnpm/xsalsa20@1.2.0/node_modules/xsalsa20/xsalsa20.js
|
|
6291
6365
|
var require_xsalsa20 = __commonJS({
|
|
6292
6366
|
"node_modules/.pnpm/xsalsa20@1.2.0/node_modules/xsalsa20/xsalsa20.js"(exports, module) {
|
|
6367
|
+
init_inject_globals();
|
|
6293
6368
|
var __commonJS2 = (cb, mod) => function __require2() {
|
|
6294
6369
|
return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
6295
6370
|
};
|
|
@@ -6326,6 +6401,7 @@ var require_xsalsa20 = __commonJS({
|
|
|
6326
6401
|
// node_modules/.pnpm/xsalsa20@1.2.0/node_modules/xsalsa20/index.js
|
|
6327
6402
|
var require_xsalsa202 = __commonJS({
|
|
6328
6403
|
"node_modules/.pnpm/xsalsa20@1.2.0/node_modules/xsalsa20/index.js"(exports, module) {
|
|
6404
|
+
init_inject_globals();
|
|
6329
6405
|
var xsalsa20 = typeof WebAssembly !== "undefined" && require_xsalsa20()();
|
|
6330
6406
|
var SIGMA = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
|
|
6331
6407
|
var head = 144;
|
|
@@ -6695,6 +6771,7 @@ var require_xsalsa202 = __commonJS({
|
|
|
6695
6771
|
// node_modules/.pnpm/xsalsa20-universal@1.0.0/node_modules/xsalsa20-universal/browser.js
|
|
6696
6772
|
var require_browser3 = __commonJS({
|
|
6697
6773
|
"node_modules/.pnpm/xsalsa20-universal@1.0.0/node_modules/xsalsa20-universal/browser.js"(exports, module) {
|
|
6774
|
+
init_inject_globals();
|
|
6698
6775
|
var xsalsa20 = require_xsalsa202();
|
|
6699
6776
|
module.exports = class XORJS {
|
|
6700
6777
|
constructor(nonce, key) {
|
|
@@ -6713,6 +6790,7 @@ var require_browser3 = __commonJS({
|
|
|
6713
6790
|
// node_modules/.pnpm/simple-hypercore-protocol@2.1.2/node_modules/simple-hypercore-protocol/lib/xor.js
|
|
6714
6791
|
var require_xor = __commonJS({
|
|
6715
6792
|
"node_modules/.pnpm/simple-hypercore-protocol@2.1.2/node_modules/simple-hypercore-protocol/lib/xor.js"(exports, module) {
|
|
6793
|
+
init_inject_globals();
|
|
6716
6794
|
var XSalsa20 = require_browser3();
|
|
6717
6795
|
var crypto = require_hypercore_crypto();
|
|
6718
6796
|
module.exports = class XOR {
|
|
@@ -6744,6 +6822,7 @@ var require_xor = __commonJS({
|
|
|
6744
6822
|
// node_modules/.pnpm/simple-message-channels@1.2.1/node_modules/simple-message-channels/index.js
|
|
6745
6823
|
var require_simple_message_channels = __commonJS({
|
|
6746
6824
|
"node_modules/.pnpm/simple-message-channels@1.2.1/node_modules/simple-message-channels/index.js"(exports, module) {
|
|
6825
|
+
init_inject_globals();
|
|
6747
6826
|
var varint = require_varint2();
|
|
6748
6827
|
module.exports = class SimpleMessageChannels {
|
|
6749
6828
|
constructor({ maxSize = 8 * 1024 * 1024, context = null, onmessage = null, onmissing = null, types = null } = {}) {
|
|
@@ -6797,7 +6876,7 @@ var require_simple_message_channels = __commonJS({
|
|
|
6797
6876
|
return this._nextState(data, offset += this._length) ? offset : data.length;
|
|
6798
6877
|
}
|
|
6799
6878
|
if (!this._message)
|
|
6800
|
-
this._message =
|
|
6879
|
+
this._message = Buffer2.allocUnsafe(this._length);
|
|
6801
6880
|
data.copy(this._message, this._message.length - this._length, offset);
|
|
6802
6881
|
this._length -= free;
|
|
6803
6882
|
return data.length;
|
|
@@ -6868,7 +6947,7 @@ var require_simple_message_channels = __commonJS({
|
|
|
6868
6947
|
send(channel, type, message) {
|
|
6869
6948
|
const header = channel << 4 | type;
|
|
6870
6949
|
const length = this._encodingLength(type, message) + varint.encodingLength(header);
|
|
6871
|
-
const payload =
|
|
6950
|
+
const payload = Buffer2.allocUnsafe(varint.encodingLength(length) + length);
|
|
6872
6951
|
varint.encode(length, payload, 0);
|
|
6873
6952
|
const offset = varint.encode.bytes;
|
|
6874
6953
|
varint.encode(header, payload, offset);
|
|
@@ -6881,7 +6960,7 @@ var require_simple_message_channels = __commonJS({
|
|
|
6881
6960
|
for (const { type, message } of messages) {
|
|
6882
6961
|
length += 16 + this._encodingLength(type, message);
|
|
6883
6962
|
}
|
|
6884
|
-
const payload =
|
|
6963
|
+
const payload = Buffer2.allocUnsafe(length);
|
|
6885
6964
|
for (const { channel, type, message } of messages) {
|
|
6886
6965
|
const header = channel << 4 | type;
|
|
6887
6966
|
const length2 = this._encodingLength(type, message) + varint.encodingLength(header);
|
|
@@ -6914,6 +6993,7 @@ var require_simple_message_channels = __commonJS({
|
|
|
6914
6993
|
// node_modules/.pnpm/simple-hypercore-protocol@2.1.2/node_modules/simple-hypercore-protocol/index.js
|
|
6915
6994
|
var require_simple_hypercore_protocol = __commonJS({
|
|
6916
6995
|
"node_modules/.pnpm/simple-hypercore-protocol@2.1.2/node_modules/simple-hypercore-protocol/index.js"(exports, module) {
|
|
6996
|
+
init_inject_globals();
|
|
6917
6997
|
var Handshake = require_handshake();
|
|
6918
6998
|
var messages = require_messages();
|
|
6919
6999
|
var XOR = require_xor();
|
|
@@ -7015,7 +7095,7 @@ var require_simple_hypercore_protocol = __commonJS({
|
|
|
7015
7095
|
return this._send(ch, 10, message || {});
|
|
7016
7096
|
}
|
|
7017
7097
|
extension(ch, id, message) {
|
|
7018
|
-
const buf =
|
|
7098
|
+
const buf = Buffer2.allocUnsafe(varint.encodingLength(id) + message.length);
|
|
7019
7099
|
varint.encode(id, buf, 0);
|
|
7020
7100
|
message.copy(buf, varint.encode.bytes);
|
|
7021
7101
|
return this._send(ch, 15, buf);
|
|
@@ -7023,7 +7103,7 @@ var require_simple_hypercore_protocol = __commonJS({
|
|
|
7023
7103
|
ping() {
|
|
7024
7104
|
if (this._handshaking || this._pending.length)
|
|
7025
7105
|
return;
|
|
7026
|
-
let ping =
|
|
7106
|
+
let ping = Buffer2.from([0]);
|
|
7027
7107
|
if (this._encryption !== null) {
|
|
7028
7108
|
ping = this._encryption.encrypt(ping);
|
|
7029
7109
|
}
|
|
@@ -7177,6 +7257,7 @@ var require_simple_hypercore_protocol = __commonJS({
|
|
|
7177
7257
|
// node_modules/.pnpm/timeout-refresh@1.0.3/node_modules/timeout-refresh/browser.js
|
|
7178
7258
|
var require_browser4 = __commonJS({
|
|
7179
7259
|
"node_modules/.pnpm/timeout-refresh@1.0.3/node_modules/timeout-refresh/browser.js"(exports, module) {
|
|
7260
|
+
init_inject_globals();
|
|
7180
7261
|
module.exports = Timeout;
|
|
7181
7262
|
function Timeout(ms, fn, ctx) {
|
|
7182
7263
|
if (!(this instanceof Timeout))
|
|
@@ -7207,6 +7288,7 @@ var require_browser4 = __commonJS({
|
|
|
7207
7288
|
// node_modules/.pnpm/abstract-extension@3.1.1/node_modules/abstract-extension/index.js
|
|
7208
7289
|
var require_abstract_extension = __commonJS({
|
|
7209
7290
|
"node_modules/.pnpm/abstract-extension@3.1.1/node_modules/abstract-extension/index.js"(exports, module) {
|
|
7291
|
+
init_inject_globals();
|
|
7210
7292
|
var codecs = require_codecs();
|
|
7211
7293
|
var AbstractExtension = class {
|
|
7212
7294
|
constructor(local, name, handlers = {}) {
|
|
@@ -7359,6 +7441,7 @@ var require_abstract_extension = __commonJS({
|
|
|
7359
7441
|
// node_modules/.pnpm/ms@2.1.2/node_modules/ms/index.js
|
|
7360
7442
|
var require_ms = __commonJS({
|
|
7361
7443
|
"node_modules/.pnpm/ms@2.1.2/node_modules/ms/index.js"(exports, module) {
|
|
7444
|
+
init_inject_globals();
|
|
7362
7445
|
var s = 1e3;
|
|
7363
7446
|
var m = s * 60;
|
|
7364
7447
|
var h = m * 60;
|
|
@@ -7472,9 +7555,10 @@ var require_ms = __commonJS({
|
|
|
7472
7555
|
}
|
|
7473
7556
|
});
|
|
7474
7557
|
|
|
7475
|
-
// node_modules/.pnpm/debug@4.3.4_supports-color@
|
|
7558
|
+
// node_modules/.pnpm/debug@4.3.4_supports-color@8.1.1/node_modules/debug/src/common.js
|
|
7476
7559
|
var require_common = __commonJS({
|
|
7477
|
-
"node_modules/.pnpm/debug@4.3.4_supports-color@
|
|
7560
|
+
"node_modules/.pnpm/debug@4.3.4_supports-color@8.1.1/node_modules/debug/src/common.js"(exports, module) {
|
|
7561
|
+
init_inject_globals();
|
|
7478
7562
|
function setup(env) {
|
|
7479
7563
|
createDebug.debug = createDebug;
|
|
7480
7564
|
createDebug.default = createDebug;
|
|
@@ -7635,9 +7719,10 @@ var require_common = __commonJS({
|
|
|
7635
7719
|
}
|
|
7636
7720
|
});
|
|
7637
7721
|
|
|
7638
|
-
// node_modules/.pnpm/debug@4.3.4_supports-color@
|
|
7722
|
+
// node_modules/.pnpm/debug@4.3.4_supports-color@8.1.1/node_modules/debug/src/browser.js
|
|
7639
7723
|
var require_browser5 = __commonJS({
|
|
7640
|
-
"node_modules/.pnpm/debug@4.3.4_supports-color@
|
|
7724
|
+
"node_modules/.pnpm/debug@4.3.4_supports-color@8.1.1/node_modules/debug/src/browser.js"(exports, module) {
|
|
7725
|
+
init_inject_globals();
|
|
7641
7726
|
exports.formatArgs = formatArgs;
|
|
7642
7727
|
exports.save = save;
|
|
7643
7728
|
exports.load = load;
|
|
@@ -7807,6 +7892,7 @@ var require_browser5 = __commonJS({
|
|
|
7807
7892
|
// node_modules/.pnpm/hypercore-protocol@8.0.7/node_modules/hypercore-protocol/index.js
|
|
7808
7893
|
var require_hypercore_protocol = __commonJS({
|
|
7809
7894
|
"node_modules/.pnpm/hypercore-protocol@8.0.7/node_modules/hypercore-protocol/index.js"(exports, module) {
|
|
7895
|
+
init_inject_globals();
|
|
7810
7896
|
var SHP = require_simple_hypercore_protocol();
|
|
7811
7897
|
var crypto = require_hypercore_crypto();
|
|
7812
7898
|
var timeout = require_browser4();
|
|
@@ -8303,6 +8389,7 @@ var require_hypercore_protocol = __commonJS({
|
|
|
8303
8389
|
// node_modules/.pnpm/count-trailing-zeros@1.0.1/node_modules/count-trailing-zeros/ctz.js
|
|
8304
8390
|
var require_ctz = __commonJS({
|
|
8305
8391
|
"node_modules/.pnpm/count-trailing-zeros@1.0.1/node_modules/count-trailing-zeros/ctz.js"(exports, module) {
|
|
8392
|
+
init_inject_globals();
|
|
8306
8393
|
module.exports = function(v) {
|
|
8307
8394
|
var c = 32;
|
|
8308
8395
|
v &= -v;
|
|
@@ -8327,6 +8414,7 @@ var require_ctz = __commonJS({
|
|
|
8327
8414
|
var require_fast_bitfield = __commonJS({
|
|
8328
8415
|
"node_modules/.pnpm/fast-bitfield@1.2.2/node_modules/fast-bitfield/index.js"(exports, module) {
|
|
8329
8416
|
"use strict";
|
|
8417
|
+
init_inject_globals();
|
|
8330
8418
|
var ctz = require_ctz();
|
|
8331
8419
|
module.exports = () => new Bitfield();
|
|
8332
8420
|
var Page = class {
|
|
@@ -8688,6 +8776,7 @@ var require_fast_bitfield = __commonJS({
|
|
|
8688
8776
|
// node_modules/.pnpm/hypercore@9.12.0/node_modules/hypercore/lib/replicate.js
|
|
8689
8777
|
var require_replicate = __commonJS({
|
|
8690
8778
|
"node_modules/.pnpm/hypercore@9.12.0/node_modules/hypercore/lib/replicate.js"(exports, module) {
|
|
8779
|
+
init_inject_globals();
|
|
8691
8780
|
var Protocol = require_hypercore_protocol();
|
|
8692
8781
|
var timeout = require_browser4();
|
|
8693
8782
|
var bitfield = require_fast_bitfield();
|
|
@@ -9428,6 +9517,7 @@ var require_replicate = __commonJS({
|
|
|
9428
9517
|
// node_modules/.pnpm/nanoresource@1.3.0/node_modules/nanoresource/emitter.js
|
|
9429
9518
|
var require_emitter = __commonJS({
|
|
9430
9519
|
"node_modules/.pnpm/nanoresource@1.3.0/node_modules/nanoresource/emitter.js"(exports, module) {
|
|
9520
|
+
init_inject_globals();
|
|
9431
9521
|
var events = import$_dxos_node_std_events;
|
|
9432
9522
|
var inherits = require_inherits_browser();
|
|
9433
9523
|
var opening = Symbol("opening queue");
|
|
@@ -9566,6 +9656,7 @@ var require_emitter = __commonJS({
|
|
|
9566
9656
|
// packages/common/hypercore/src/empty.ts
|
|
9567
9657
|
var require_empty = __commonJS({
|
|
9568
9658
|
"packages/common/hypercore/src/empty.ts"(exports, module) {
|
|
9659
|
+
init_inject_globals();
|
|
9569
9660
|
module.exports = new Proxy({}, {
|
|
9570
9661
|
get: (target, prop) => {
|
|
9571
9662
|
throw new Error("Package has been stripped");
|
|
@@ -9577,6 +9668,7 @@ var require_empty = __commonJS({
|
|
|
9577
9668
|
// node_modules/.pnpm/hypercore-streams@1.0.1/node_modules/hypercore-streams/index.js
|
|
9578
9669
|
var require_hypercore_streams = __commonJS({
|
|
9579
9670
|
"node_modules/.pnpm/hypercore-streams@1.0.1/node_modules/hypercore-streams/index.js"(exports, module) {
|
|
9671
|
+
init_inject_globals();
|
|
9580
9672
|
var { Writable, Readable: Readable2 } = import$streamx;
|
|
9581
9673
|
var WriteStream = class extends Writable {
|
|
9582
9674
|
constructor(feed, opts) {
|
|
@@ -9655,6 +9747,7 @@ var require_hypercore_streams = __commonJS({
|
|
|
9655
9747
|
// node_modules/.pnpm/hypercore@9.12.0/node_modules/hypercore/index.js
|
|
9656
9748
|
var require_hypercore = __commonJS({
|
|
9657
9749
|
"node_modules/.pnpm/hypercore@9.12.0/node_modules/hypercore/index.js"(exports, module) {
|
|
9750
|
+
init_inject_globals();
|
|
9658
9751
|
var low = require_last_one_wins();
|
|
9659
9752
|
var remove = require_unordered_array_remove();
|
|
9660
9753
|
var set = require_unordered_set();
|
|
@@ -9711,8 +9804,8 @@ var require_hypercore = __commonJS({
|
|
|
9711
9804
|
if (typeof createStorage2 !== "function")
|
|
9712
9805
|
throw new Error("Storage should be a function or string");
|
|
9713
9806
|
if (typeof key === "string")
|
|
9714
|
-
key =
|
|
9715
|
-
if (!
|
|
9807
|
+
key = Buffer2.from(key, "hex");
|
|
9808
|
+
if (!Buffer2.isBuffer(key) && !opts) {
|
|
9716
9809
|
opts = key;
|
|
9717
9810
|
key = null;
|
|
9718
9811
|
}
|
|
@@ -9721,7 +9814,7 @@ var require_hypercore = __commonJS({
|
|
|
9721
9814
|
var self = this;
|
|
9722
9815
|
var secretKey = opts.secretKey || null;
|
|
9723
9816
|
if (typeof secretKey === "string")
|
|
9724
|
-
secretKey =
|
|
9817
|
+
secretKey = Buffer2.from(secretKey, "hex");
|
|
9725
9818
|
this.noiseKeyPair = opts.noiseKeyPair || Protocol.keyPair();
|
|
9726
9819
|
this.live = opts.live !== false;
|
|
9727
9820
|
this.sparse = !!opts.sparse;
|
|
@@ -10073,7 +10166,7 @@ var require_hypercore = __commonJS({
|
|
|
10073
10166
|
if (!state.key && state.bitfield.length) {
|
|
10074
10167
|
self._overwrite = true;
|
|
10075
10168
|
}
|
|
10076
|
-
if (self._force && state.key && self.key &&
|
|
10169
|
+
if (self._force && state.key && self.key && Buffer2.compare(state.key, self.key) !== 0) {
|
|
10077
10170
|
self._overwrite = true;
|
|
10078
10171
|
}
|
|
10079
10172
|
if (self._overwrite) {
|
|
@@ -10084,7 +10177,7 @@ var require_hypercore = __commonJS({
|
|
|
10084
10177
|
self.tree = treeIndex(self.bitfield.tree);
|
|
10085
10178
|
self.length = self.tree.blocks();
|
|
10086
10179
|
self._seq = self.length;
|
|
10087
|
-
if (state.key && self.key &&
|
|
10180
|
+
if (state.key && self.key && Buffer2.compare(state.key, self.key) !== 0) {
|
|
10088
10181
|
return self._forceClose(cb, new Error("Another hypercore is stored here"));
|
|
10089
10182
|
}
|
|
10090
10183
|
if (state.key)
|
|
@@ -10719,7 +10812,7 @@ var require_hypercore = __commonJS({
|
|
|
10719
10812
|
write();
|
|
10720
10813
|
});
|
|
10721
10814
|
} else {
|
|
10722
|
-
if (
|
|
10815
|
+
if (Buffer2.compare(checksum.slice(0, 32), self.key) !== 0) {
|
|
10723
10816
|
return cb(new Error("Remote checksum failed"));
|
|
10724
10817
|
}
|
|
10725
10818
|
write();
|
|
@@ -11061,7 +11154,7 @@ var require_hypercore = __commonJS({
|
|
|
11061
11154
|
if (dataBatch.length === 1)
|
|
11062
11155
|
this._storage.data.write(this.byteLength, dataBatch[0], done);
|
|
11063
11156
|
else
|
|
11064
|
-
this._storage.data.write(this.byteLength,
|
|
11157
|
+
this._storage.data.write(this.byteLength, Buffer2.concat(dataBatch), done);
|
|
11065
11158
|
}
|
|
11066
11159
|
this._storage.putNodeBatch(nodeOffset, nodeBatch, done);
|
|
11067
11160
|
function done(err) {
|
|
@@ -11211,7 +11304,7 @@ var require_hypercore = __commonJS({
|
|
|
11211
11304
|
function noop() {
|
|
11212
11305
|
}
|
|
11213
11306
|
function verifyNode(trusted, node) {
|
|
11214
|
-
return trusted && trusted.index === node.index &&
|
|
11307
|
+
return trusted && trusted.index === node.index && Buffer2.compare(trusted.hash, node.hash) === 0;
|
|
11215
11308
|
}
|
|
11216
11309
|
function addSize(size, node) {
|
|
11217
11310
|
return size + node.size;
|
|
@@ -11282,9 +11375,11 @@ var require_hypercore = __commonJS({
|
|
|
11282
11375
|
});
|
|
11283
11376
|
|
|
11284
11377
|
// packages/common/hypercore/src/index.ts
|
|
11378
|
+
init_inject_globals();
|
|
11285
11379
|
var import_hypercore2 = __toESM(require_hypercore());
|
|
11286
11380
|
|
|
11287
11381
|
// packages/common/hypercore/src/crypto.ts
|
|
11382
|
+
init_inject_globals();
|
|
11288
11383
|
import { callbackify } from "@dxos/node-std/util";
|
|
11289
11384
|
import { verifySignature } from "@dxos/crypto";
|
|
11290
11385
|
import { invariant } from "@dxos/invariant";
|
|
@@ -11330,6 +11425,7 @@ var createCrypto = (signer, publicKey) => {
|
|
|
11330
11425
|
};
|
|
11331
11426
|
|
|
11332
11427
|
// packages/common/hypercore/src/defaults.ts
|
|
11428
|
+
init_inject_globals();
|
|
11333
11429
|
var defaultFeedOptions = {
|
|
11334
11430
|
createIfMissing: true,
|
|
11335
11431
|
valueEncoding: "binary"
|
|
@@ -11357,11 +11453,13 @@ var defaultReplicateOptions = {
|
|
|
11357
11453
|
};
|
|
11358
11454
|
|
|
11359
11455
|
// packages/common/hypercore/src/hypercore-factory.ts
|
|
11456
|
+
init_inject_globals();
|
|
11360
11457
|
var import_hypercore = __toESM(require_hypercore());
|
|
11361
11458
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
11362
11459
|
import { createStorage, StorageType } from "@dxos/random-access-storage";
|
|
11363
11460
|
|
|
11364
11461
|
// packages/common/hypercore/src/util.ts
|
|
11462
|
+
init_inject_globals();
|
|
11365
11463
|
import util from "@dxos/node-std/util";
|
|
11366
11464
|
var py = (obj, fn) => util.promisify(fn.bind(obj));
|
|
11367
11465
|
|
|
@@ -11404,6 +11502,7 @@ var HypercoreFactory = class {
|
|
|
11404
11502
|
};
|
|
11405
11503
|
|
|
11406
11504
|
// packages/common/hypercore/src/iterator.ts
|
|
11505
|
+
init_inject_globals();
|
|
11407
11506
|
import { Readable } from "readable-stream";
|
|
11408
11507
|
var createReadable = (stream) => {
|
|
11409
11508
|
return new Readable({
|