@dxos/hypercore 0.6.13 → 0.6.14-main.69511f5
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 +96 -195
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +27 -41
- package/dist/lib/node/index.cjs.map +2 -2
- package/dist/lib/node-esm/index.mjs +9944 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/package.json +18 -19
- package/src/hypercore-factory.test.ts +1 -2
- package/src/hypercore-protocol.test.ts +1 -2
- package/src/hypercore.test.ts +1 -2
- package/src/iterator.test.ts +1 -1
- package/src/replicate.test.ts +123 -126
- package/src/streams.test.ts +1 -1
|
@@ -20,9 +20,6 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
20
20
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
21
21
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
22
22
|
});
|
|
23
|
-
var __esm = (fn, res) => function __init() {
|
|
24
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
25
|
-
};
|
|
26
23
|
var __commonJS = (cb, mod) => function __require2() {
|
|
27
24
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
28
25
|
};
|
|
@@ -43,21 +40,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
43
40
|
mod
|
|
44
41
|
));
|
|
45
42
|
|
|
46
|
-
// inject-globals:@inject-globals
|
|
47
|
-
import {
|
|
48
|
-
global,
|
|
49
|
-
Buffer as Buffer2,
|
|
50
|
-
process
|
|
51
|
-
} from "@dxos/node-std/inject-globals";
|
|
52
|
-
var init_inject_globals = __esm({
|
|
53
|
-
"inject-globals:@inject-globals"() {
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
|
|
57
43
|
// node_modules/.pnpm/last-one-wins@1.0.4/node_modules/last-one-wins/index.js
|
|
58
44
|
var require_last_one_wins = __commonJS({
|
|
59
45
|
"node_modules/.pnpm/last-one-wins@1.0.4/node_modules/last-one-wins/index.js"(exports, module) {
|
|
60
|
-
init_inject_globals();
|
|
61
46
|
module.exports = function(work) {
|
|
62
47
|
var pending = null;
|
|
63
48
|
var callback = null;
|
|
@@ -102,7 +87,6 @@ var require_last_one_wins = __commonJS({
|
|
|
102
87
|
// node_modules/.pnpm/unordered-array-remove@1.0.2/node_modules/unordered-array-remove/index.js
|
|
103
88
|
var require_unordered_array_remove = __commonJS({
|
|
104
89
|
"node_modules/.pnpm/unordered-array-remove@1.0.2/node_modules/unordered-array-remove/index.js"(exports, module) {
|
|
105
|
-
init_inject_globals();
|
|
106
90
|
module.exports = remove;
|
|
107
91
|
function remove(arr, i) {
|
|
108
92
|
if (i >= arr.length || i < 0) return;
|
|
@@ -120,7 +104,6 @@ var require_unordered_array_remove = __commonJS({
|
|
|
120
104
|
// node_modules/.pnpm/unordered-set@2.0.1/node_modules/unordered-set/index.js
|
|
121
105
|
var require_unordered_set = __commonJS({
|
|
122
106
|
"node_modules/.pnpm/unordered-set@2.0.1/node_modules/unordered-set/index.js"(exports) {
|
|
123
|
-
init_inject_globals();
|
|
124
107
|
exports.add = add;
|
|
125
108
|
exports.has = has;
|
|
126
109
|
exports.remove = remove;
|
|
@@ -157,7 +140,6 @@ var require_unordered_set = __commonJS({
|
|
|
157
140
|
// node_modules/.pnpm/flat-tree@1.9.0/node_modules/flat-tree/index.js
|
|
158
141
|
var require_flat_tree = __commonJS({
|
|
159
142
|
"node_modules/.pnpm/flat-tree@1.9.0/node_modules/flat-tree/index.js"(exports) {
|
|
160
|
-
init_inject_globals();
|
|
161
143
|
exports.fullRoots = function(index, result) {
|
|
162
144
|
if (index & 1) throw new Error("You can only look up roots for depth(0) blocks");
|
|
163
145
|
if (!result) result = [];
|
|
@@ -369,7 +351,6 @@ var require_flat_tree = __commonJS({
|
|
|
369
351
|
// node_modules/.pnpm/merkle-tree-stream@4.0.0/node_modules/merkle-tree-stream/generator.js
|
|
370
352
|
var require_generator = __commonJS({
|
|
371
353
|
"node_modules/.pnpm/merkle-tree-stream@4.0.0/node_modules/merkle-tree-stream/generator.js"(exports, module) {
|
|
372
|
-
init_inject_globals();
|
|
373
354
|
var flat = require_flat_tree();
|
|
374
355
|
module.exports = class MerkleGenerator {
|
|
375
356
|
constructor(opts, roots) {
|
|
@@ -384,7 +365,7 @@ var require_generator = __commonJS({
|
|
|
384
365
|
this._parent = opts.parent;
|
|
385
366
|
}
|
|
386
367
|
next(data, nodes) {
|
|
387
|
-
if (!
|
|
368
|
+
if (!Buffer.isBuffer(data)) data = Buffer.from(data);
|
|
388
369
|
if (!nodes) nodes = [];
|
|
389
370
|
var index = 2 * this.blocks++;
|
|
390
371
|
var leaf = {
|
|
@@ -420,7 +401,6 @@ var require_generator = __commonJS({
|
|
|
420
401
|
// node_modules/.pnpm/codecs@2.2.0/node_modules/codecs/index.js
|
|
421
402
|
var require_codecs = __commonJS({
|
|
422
403
|
"node_modules/.pnpm/codecs@2.2.0/node_modules/codecs/index.js"(exports, module) {
|
|
423
|
-
init_inject_globals();
|
|
424
404
|
module.exports = codecs;
|
|
425
405
|
codecs.ascii = createString("ascii");
|
|
426
406
|
codecs.utf8 = createString("utf-8");
|
|
@@ -433,10 +413,10 @@ var require_codecs = __commonJS({
|
|
|
433
413
|
codecs.binary = {
|
|
434
414
|
name: "binary",
|
|
435
415
|
encode: function encodeBinary(obj) {
|
|
436
|
-
return typeof obj === "string" ?
|
|
416
|
+
return typeof obj === "string" ? Buffer.from(obj, "utf-8") : Buffer.isBuffer(obj) ? obj : Buffer.from(obj.buffer, obj.byteOffset, obj.byteLength);
|
|
437
417
|
},
|
|
438
418
|
decode: function decodeBinary(buf) {
|
|
439
|
-
return
|
|
419
|
+
return Buffer.isBuffer(buf) ? buf : Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
440
420
|
}
|
|
441
421
|
};
|
|
442
422
|
function codecs(fmt, fallback) {
|
|
@@ -473,10 +453,10 @@ var require_codecs = __commonJS({
|
|
|
473
453
|
}
|
|
474
454
|
};
|
|
475
455
|
function encodeJSON(val2) {
|
|
476
|
-
return
|
|
456
|
+
return Buffer.from(JSON.stringify(val2));
|
|
477
457
|
}
|
|
478
458
|
function encodeNDJSON(val2) {
|
|
479
|
-
return
|
|
459
|
+
return Buffer.from(JSON.stringify(val2) + "\n");
|
|
480
460
|
}
|
|
481
461
|
}
|
|
482
462
|
function createString(type) {
|
|
@@ -484,7 +464,7 @@ var require_codecs = __commonJS({
|
|
|
484
464
|
name: type,
|
|
485
465
|
encode: function encodeString(val2) {
|
|
486
466
|
if (typeof val2 !== "string") val2 = val2.toString();
|
|
487
|
-
return
|
|
467
|
+
return Buffer.from(val2, type);
|
|
488
468
|
},
|
|
489
469
|
decode: function decodeString(buf) {
|
|
490
470
|
return buf.toString(type);
|
|
@@ -497,7 +477,6 @@ var require_codecs = __commonJS({
|
|
|
497
477
|
// node_modules/.pnpm/atomic-batcher@1.0.2/node_modules/atomic-batcher/index.js
|
|
498
478
|
var require_atomic_batcher = __commonJS({
|
|
499
479
|
"node_modules/.pnpm/atomic-batcher@1.0.2/node_modules/atomic-batcher/index.js"(exports, module) {
|
|
500
|
-
init_inject_globals();
|
|
501
480
|
module.exports = batcher;
|
|
502
481
|
function batcher(run) {
|
|
503
482
|
var running = false;
|
|
@@ -553,7 +532,6 @@ var require_atomic_batcher = __commonJS({
|
|
|
553
532
|
// node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js
|
|
554
533
|
var require_inherits_browser = __commonJS({
|
|
555
534
|
"node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js"(exports, module) {
|
|
556
|
-
init_inject_globals();
|
|
557
535
|
if (typeof Object.create === "function") {
|
|
558
536
|
module.exports = function inherits(ctor, superCtor) {
|
|
559
537
|
if (superCtor) {
|
|
@@ -586,7 +564,6 @@ var require_inherits_browser = __commonJS({
|
|
|
586
564
|
// node_modules/.pnpm/varint@4.0.1/node_modules/varint/encode.js
|
|
587
565
|
var require_encode = __commonJS({
|
|
588
566
|
"node_modules/.pnpm/varint@4.0.1/node_modules/varint/encode.js"(exports, module) {
|
|
589
|
-
init_inject_globals();
|
|
590
567
|
module.exports = encode;
|
|
591
568
|
var MSB = 128;
|
|
592
569
|
var REST = 127;
|
|
@@ -614,7 +591,6 @@ var require_encode = __commonJS({
|
|
|
614
591
|
// node_modules/.pnpm/varint@4.0.1/node_modules/varint/decode.js
|
|
615
592
|
var require_decode = __commonJS({
|
|
616
593
|
"node_modules/.pnpm/varint@4.0.1/node_modules/varint/decode.js"(exports, module) {
|
|
617
|
-
init_inject_globals();
|
|
618
594
|
module.exports = read;
|
|
619
595
|
var MSB = 128;
|
|
620
596
|
var REST = 127;
|
|
@@ -639,7 +615,6 @@ var require_decode = __commonJS({
|
|
|
639
615
|
// node_modules/.pnpm/varint@4.0.1/node_modules/varint/length.js
|
|
640
616
|
var require_length = __commonJS({
|
|
641
617
|
"node_modules/.pnpm/varint@4.0.1/node_modules/varint/length.js"(exports, module) {
|
|
642
|
-
init_inject_globals();
|
|
643
618
|
var N1 = Math.pow(2, 7);
|
|
644
619
|
var N2 = Math.pow(2, 14);
|
|
645
620
|
var N3 = Math.pow(2, 21);
|
|
@@ -658,7 +633,6 @@ var require_length = __commonJS({
|
|
|
658
633
|
// node_modules/.pnpm/varint@4.0.1/node_modules/varint/index.js
|
|
659
634
|
var require_varint = __commonJS({
|
|
660
635
|
"node_modules/.pnpm/varint@4.0.1/node_modules/varint/index.js"(exports, module) {
|
|
661
|
-
init_inject_globals();
|
|
662
636
|
module.exports = {
|
|
663
637
|
encode: require_encode(),
|
|
664
638
|
decode: require_decode(),
|
|
@@ -670,7 +644,6 @@ var require_varint = __commonJS({
|
|
|
670
644
|
// node_modules/.pnpm/buffer-alloc-unsafe@1.1.0/node_modules/buffer-alloc-unsafe/index.js
|
|
671
645
|
var require_buffer_alloc_unsafe = __commonJS({
|
|
672
646
|
"node_modules/.pnpm/buffer-alloc-unsafe@1.1.0/node_modules/buffer-alloc-unsafe/index.js"(exports, module) {
|
|
673
|
-
init_inject_globals();
|
|
674
647
|
function allocUnsafe(size) {
|
|
675
648
|
if (typeof size !== "number") {
|
|
676
649
|
throw new TypeError('"size" argument must be a number');
|
|
@@ -678,10 +651,10 @@ var require_buffer_alloc_unsafe = __commonJS({
|
|
|
678
651
|
if (size < 0) {
|
|
679
652
|
throw new RangeError('"size" argument must not be negative');
|
|
680
653
|
}
|
|
681
|
-
if (
|
|
682
|
-
return
|
|
654
|
+
if (Buffer.allocUnsafe) {
|
|
655
|
+
return Buffer.allocUnsafe(size);
|
|
683
656
|
} else {
|
|
684
|
-
return new
|
|
657
|
+
return new Buffer(size);
|
|
685
658
|
}
|
|
686
659
|
}
|
|
687
660
|
module.exports = allocUnsafe;
|
|
@@ -691,7 +664,6 @@ var require_buffer_alloc_unsafe = __commonJS({
|
|
|
691
664
|
// node_modules/.pnpm/bitfield-rle@2.2.1/node_modules/bitfield-rle/index.js
|
|
692
665
|
var require_bitfield_rle = __commonJS({
|
|
693
666
|
"node_modules/.pnpm/bitfield-rle@2.2.1/node_modules/bitfield-rle/index.js"(exports, module) {
|
|
694
|
-
init_inject_globals();
|
|
695
667
|
var varint = require_varint();
|
|
696
668
|
var alloc = require_buffer_alloc_unsafe();
|
|
697
669
|
module.exports = align(1);
|
|
@@ -823,7 +795,6 @@ var require_bitfield_rle = __commonJS({
|
|
|
823
795
|
// node_modules/.pnpm/memory-pager@1.5.0/node_modules/memory-pager/index.js
|
|
824
796
|
var require_memory_pager = __commonJS({
|
|
825
797
|
"node_modules/.pnpm/memory-pager@1.5.0/node_modules/memory-pager/index.js"(exports, module) {
|
|
826
|
-
init_inject_globals();
|
|
827
798
|
module.exports = Pager;
|
|
828
799
|
function Pager(pageSize, opts) {
|
|
829
800
|
if (!(this instanceof Pager)) return new Pager(pageSize, opts);
|
|
@@ -914,7 +885,7 @@ var require_memory_pager = __commonJS({
|
|
|
914
885
|
list[ptr++] = arr && arr[i] ? arr[i].buffer : empty;
|
|
915
886
|
}
|
|
916
887
|
}
|
|
917
|
-
return
|
|
888
|
+
return Buffer.concat(list);
|
|
918
889
|
};
|
|
919
890
|
function grow(pager, index) {
|
|
920
891
|
while (pager.maxPages < index) {
|
|
@@ -933,13 +904,13 @@ var require_memory_pager = __commonJS({
|
|
|
933
904
|
return cpy;
|
|
934
905
|
}
|
|
935
906
|
function alloc(size) {
|
|
936
|
-
if (
|
|
937
|
-
var buf = new
|
|
907
|
+
if (Buffer.alloc) return Buffer.alloc(size);
|
|
908
|
+
var buf = new Buffer(size);
|
|
938
909
|
buf.fill(0);
|
|
939
910
|
return buf;
|
|
940
911
|
}
|
|
941
912
|
function copy(buf) {
|
|
942
|
-
var cpy =
|
|
913
|
+
var cpy = Buffer.allocUnsafe ? Buffer.allocUnsafe(buf.length) : new Buffer(buf.length);
|
|
943
914
|
buf.copy(cpy);
|
|
944
915
|
return cpy;
|
|
945
916
|
}
|
|
@@ -960,13 +931,12 @@ var require_memory_pager = __commonJS({
|
|
|
960
931
|
// node_modules/.pnpm/sparse-bitfield@3.0.3/node_modules/sparse-bitfield/index.js
|
|
961
932
|
var require_sparse_bitfield = __commonJS({
|
|
962
933
|
"node_modules/.pnpm/sparse-bitfield@3.0.3/node_modules/sparse-bitfield/index.js"(exports, module) {
|
|
963
|
-
init_inject_globals();
|
|
964
934
|
var pager = require_memory_pager();
|
|
965
935
|
module.exports = Bitfield;
|
|
966
936
|
function Bitfield(opts) {
|
|
967
937
|
if (!(this instanceof Bitfield)) return new Bitfield(opts);
|
|
968
938
|
if (!opts) opts = {};
|
|
969
|
-
if (
|
|
939
|
+
if (Buffer.isBuffer(opts)) opts = { buffer: opts };
|
|
970
940
|
this.pageOffset = opts.pageOffset || 0;
|
|
971
941
|
this.pageSize = opts.pageSize || 1024;
|
|
972
942
|
this.pages = opts.pages || pager(this.pageSize);
|
|
@@ -1024,8 +994,8 @@ var require_sparse_bitfield = __commonJS({
|
|
|
1024
994
|
return true;
|
|
1025
995
|
};
|
|
1026
996
|
function alloc(n) {
|
|
1027
|
-
if (
|
|
1028
|
-
var b = new
|
|
997
|
+
if (Buffer.alloc) return Buffer.alloc(n);
|
|
998
|
+
var b = new Buffer(n);
|
|
1029
999
|
b.fill(0);
|
|
1030
1000
|
return b;
|
|
1031
1001
|
}
|
|
@@ -1038,7 +1008,6 @@ var require_sparse_bitfield = __commonJS({
|
|
|
1038
1008
|
// node_modules/.pnpm/hypercore@9.12.0/node_modules/hypercore/lib/bitfield.js
|
|
1039
1009
|
var require_bitfield = __commonJS({
|
|
1040
1010
|
"node_modules/.pnpm/hypercore@9.12.0/node_modules/hypercore/lib/bitfield.js"(exports, module) {
|
|
1041
|
-
init_inject_globals();
|
|
1042
1011
|
var flat = require_flat_tree();
|
|
1043
1012
|
var rle = require_bitfield_rle();
|
|
1044
1013
|
var pager = require_memory_pager();
|
|
@@ -1070,7 +1039,7 @@ var require_bitfield = __commonJS({
|
|
|
1070
1039
|
function Bitfield(pageSize, pages) {
|
|
1071
1040
|
if (!(this instanceof Bitfield)) return new Bitfield(pageSize, pages);
|
|
1072
1041
|
if (!pageSize) pageSize = 2048 + 1024 + 512;
|
|
1073
|
-
var deduplicate =
|
|
1042
|
+
var deduplicate = Buffer.allocUnsafe(pageSize);
|
|
1074
1043
|
deduplicate.fill(255);
|
|
1075
1044
|
this.indexSize = pageSize - 2048 - 1024;
|
|
1076
1045
|
this.pages = pager(pageSize, { deduplicate });
|
|
@@ -1139,7 +1108,7 @@ var require_bitfield = __commonJS({
|
|
|
1139
1108
|
Bitfield.prototype.compress = function(start, length) {
|
|
1140
1109
|
if (!start && !length) return rle.encode(this.data.toBuffer());
|
|
1141
1110
|
if (start + length > this.length) length = Math.max(1, this.length - start);
|
|
1142
|
-
var buf =
|
|
1111
|
+
var buf = Buffer.alloc(Math.ceil(length / 8));
|
|
1143
1112
|
var p = start / this.data.pageSize / 8;
|
|
1144
1113
|
var end = p + length / this.data.pageSize / 8;
|
|
1145
1114
|
var offset = p * this.data.pageSize;
|
|
@@ -1307,7 +1276,6 @@ var require_bitfield = __commonJS({
|
|
|
1307
1276
|
// node_modules/.pnpm/hypercore@9.12.0/node_modules/hypercore/lib/tree-index.js
|
|
1308
1277
|
var require_tree_index = __commonJS({
|
|
1309
1278
|
"node_modules/.pnpm/hypercore@9.12.0/node_modules/hypercore/lib/tree-index.js"(exports, module) {
|
|
1310
|
-
init_inject_globals();
|
|
1311
1279
|
var flat = require_flat_tree();
|
|
1312
1280
|
var bitfield = require_sparse_bitfield();
|
|
1313
1281
|
module.exports = TreeIndex;
|
|
@@ -1455,13 +1423,12 @@ var require_tree_index = __commonJS({
|
|
|
1455
1423
|
// node_modules/.pnpm/buffer-fill@1.0.0/node_modules/buffer-fill/index.js
|
|
1456
1424
|
var require_buffer_fill = __commonJS({
|
|
1457
1425
|
"node_modules/.pnpm/buffer-fill@1.0.0/node_modules/buffer-fill/index.js"(exports, module) {
|
|
1458
|
-
init_inject_globals();
|
|
1459
1426
|
var hasFullSupport = function() {
|
|
1460
1427
|
try {
|
|
1461
|
-
if (!
|
|
1428
|
+
if (!Buffer.isEncoding("latin1")) {
|
|
1462
1429
|
return false;
|
|
1463
1430
|
}
|
|
1464
|
-
var buf =
|
|
1431
|
+
var buf = Buffer.alloc ? Buffer.alloc(4) : new Buffer(4);
|
|
1465
1432
|
buf.fill("ab", "ucs2");
|
|
1466
1433
|
return buf.toString("hex") === "61006200";
|
|
1467
1434
|
} catch (_) {
|
|
@@ -1524,7 +1491,7 @@ var require_buffer_fill = __commonJS({
|
|
|
1524
1491
|
if (encoding === "latin1") {
|
|
1525
1492
|
encoding = "binary";
|
|
1526
1493
|
}
|
|
1527
|
-
if (typeof encoding === "string" && !
|
|
1494
|
+
if (typeof encoding === "string" && !Buffer.isEncoding(encoding)) {
|
|
1528
1495
|
throw new TypeError("Unknown encoding: " + encoding);
|
|
1529
1496
|
}
|
|
1530
1497
|
if (val2 === "") {
|
|
@@ -1533,9 +1500,9 @@ var require_buffer_fill = __commonJS({
|
|
|
1533
1500
|
if (isSingleByte(val2)) {
|
|
1534
1501
|
return fillWithNumber(buffer, val2.charCodeAt(0), start, end);
|
|
1535
1502
|
}
|
|
1536
|
-
val2 = new
|
|
1503
|
+
val2 = new Buffer(val2, encoding);
|
|
1537
1504
|
}
|
|
1538
|
-
if (
|
|
1505
|
+
if (Buffer.isBuffer(val2)) {
|
|
1539
1506
|
return fillWithBuffer(buffer, val2, start, end);
|
|
1540
1507
|
}
|
|
1541
1508
|
return fillWithNumber(buffer, 0, start, end);
|
|
@@ -1547,7 +1514,6 @@ var require_buffer_fill = __commonJS({
|
|
|
1547
1514
|
// node_modules/.pnpm/buffer-alloc@1.2.0/node_modules/buffer-alloc/index.js
|
|
1548
1515
|
var require_buffer_alloc = __commonJS({
|
|
1549
1516
|
"node_modules/.pnpm/buffer-alloc@1.2.0/node_modules/buffer-alloc/index.js"(exports, module) {
|
|
1550
|
-
init_inject_globals();
|
|
1551
1517
|
var bufferFill = require_buffer_fill();
|
|
1552
1518
|
var allocUnsafe = require_buffer_alloc_unsafe();
|
|
1553
1519
|
module.exports = function alloc(size, fill, encoding) {
|
|
@@ -1557,8 +1523,8 @@ var require_buffer_alloc = __commonJS({
|
|
|
1557
1523
|
if (size < 0) {
|
|
1558
1524
|
throw new RangeError('"size" argument must not be negative');
|
|
1559
1525
|
}
|
|
1560
|
-
if (
|
|
1561
|
-
return
|
|
1526
|
+
if (Buffer.alloc) {
|
|
1527
|
+
return Buffer.alloc(size, fill, encoding);
|
|
1562
1528
|
}
|
|
1563
1529
|
var buffer = allocUnsafe(size);
|
|
1564
1530
|
if (size === 0) {
|
|
@@ -1578,7 +1544,6 @@ var require_buffer_alloc = __commonJS({
|
|
|
1578
1544
|
// node_modules/.pnpm/uint64be@2.0.2/node_modules/uint64be/index.js
|
|
1579
1545
|
var require_uint64be = __commonJS({
|
|
1580
1546
|
"node_modules/.pnpm/uint64be@2.0.2/node_modules/uint64be/index.js"(exports) {
|
|
1581
|
-
init_inject_globals();
|
|
1582
1547
|
var bufferAlloc = require_buffer_alloc();
|
|
1583
1548
|
var UINT_32_MAX = Math.pow(2, 32);
|
|
1584
1549
|
exports.encodingLength = function() {
|
|
@@ -1607,7 +1572,6 @@ var require_uint64be = __commonJS({
|
|
|
1607
1572
|
// node_modules/.pnpm/hypercore-cache@1.0.2/node_modules/hypercore-cache/index.js
|
|
1608
1573
|
var require_hypercore_cache = __commonJS({
|
|
1609
1574
|
"node_modules/.pnpm/hypercore-cache@1.0.2/node_modules/hypercore-cache/index.js"(exports, module) {
|
|
1610
|
-
init_inject_globals();
|
|
1611
1575
|
var DEFAULT_MAX_BYTE_SIZE = 1024 * 1024 * 16;
|
|
1612
1576
|
var NamespacedCache = class {
|
|
1613
1577
|
constructor(parent, name) {
|
|
@@ -1710,7 +1674,6 @@ var require_hypercore_cache = __commonJS({
|
|
|
1710
1674
|
// node_modules/.pnpm/hypercore@9.12.0/node_modules/hypercore/lib/cache.js
|
|
1711
1675
|
var require_cache = __commonJS({
|
|
1712
1676
|
"node_modules/.pnpm/hypercore@9.12.0/node_modules/hypercore/lib/cache.js"(exports, module) {
|
|
1713
|
-
init_inject_globals();
|
|
1714
1677
|
var HypercoreCache = require_hypercore_cache();
|
|
1715
1678
|
var DEFAULT_TREE_CACHE_SIZE = 65536 * 40;
|
|
1716
1679
|
function createCache(opts) {
|
|
@@ -1739,7 +1702,6 @@ var require_cache = __commonJS({
|
|
|
1739
1702
|
// node_modules/.pnpm/hypercore@9.12.0/node_modules/hypercore/lib/storage.js
|
|
1740
1703
|
var require_storage = __commonJS({
|
|
1741
1704
|
"node_modules/.pnpm/hypercore@9.12.0/node_modules/hypercore/lib/storage.js"(exports, module) {
|
|
1742
|
-
init_inject_globals();
|
|
1743
1705
|
var uint64be = require_uint64be();
|
|
1744
1706
|
var flat = require_flat_tree();
|
|
1745
1707
|
var createCache = require_cache();
|
|
@@ -1885,7 +1847,7 @@ var require_storage = __commonJS({
|
|
|
1885
1847
|
};
|
|
1886
1848
|
Storage.prototype.putNodeBatch = function(index, nodes, cb) {
|
|
1887
1849
|
if (!cb) cb = noop;
|
|
1888
|
-
var buf =
|
|
1850
|
+
var buf = Buffer.alloc(nodes.length * 40);
|
|
1889
1851
|
for (var i = 0; i < nodes.length; i++) {
|
|
1890
1852
|
var offset = i * 40;
|
|
1891
1853
|
var node = nodes[i];
|
|
@@ -1897,7 +1859,7 @@ var require_storage = __commonJS({
|
|
|
1897
1859
|
};
|
|
1898
1860
|
Storage.prototype.putNode = function(index, node, cb) {
|
|
1899
1861
|
if (!cb) cb = noop;
|
|
1900
|
-
var buf =
|
|
1862
|
+
var buf = Buffer.allocUnsafe(40);
|
|
1901
1863
|
node.hash.copy(buf, 0);
|
|
1902
1864
|
uint64be.encode(node.size, buf, 32);
|
|
1903
1865
|
this.tree.write(32 + 40 * index, buf, cb);
|
|
@@ -1993,12 +1955,12 @@ var require_storage = __commonJS({
|
|
|
1993
1955
|
}
|
|
1994
1956
|
function copyMaybe(buf, maxSize) {
|
|
1995
1957
|
if (buf.buffer.byteLength <= maxSize) return buf;
|
|
1996
|
-
const cpy =
|
|
1958
|
+
const cpy = Buffer.alloc(buf.byteLength);
|
|
1997
1959
|
buf.copy(cpy);
|
|
1998
1960
|
return cpy;
|
|
1999
1961
|
}
|
|
2000
1962
|
function header(type, size, name) {
|
|
2001
|
-
var buf =
|
|
1963
|
+
var buf = Buffer.alloc(32);
|
|
2002
1964
|
buf[0] = 5;
|
|
2003
1965
|
buf[1] = 2;
|
|
2004
1966
|
buf[2] = 87;
|
|
@@ -2071,13 +2033,12 @@ var require_storage = __commonJS({
|
|
|
2071
2033
|
// node_modules/.pnpm/uint64be@3.0.0/node_modules/uint64be/index.js
|
|
2072
2034
|
var require_uint64be2 = __commonJS({
|
|
2073
2035
|
"node_modules/.pnpm/uint64be@3.0.0/node_modules/uint64be/index.js"(exports) {
|
|
2074
|
-
init_inject_globals();
|
|
2075
2036
|
var UINT_32_MAX = Math.pow(2, 32);
|
|
2076
2037
|
exports.encodingLength = function() {
|
|
2077
2038
|
return 8;
|
|
2078
2039
|
};
|
|
2079
2040
|
exports.encode = function(num, buf, offset) {
|
|
2080
|
-
if (!buf) buf =
|
|
2041
|
+
if (!buf) buf = Buffer.allocUnsafe(8);
|
|
2081
2042
|
if (!offset) offset = 0;
|
|
2082
2043
|
const top = Math.floor(num / UINT_32_MAX);
|
|
2083
2044
|
const rem = num - top * UINT_32_MAX;
|
|
@@ -2099,18 +2060,17 @@ var require_uint64be2 = __commonJS({
|
|
|
2099
2060
|
// node_modules/.pnpm/hypercore-crypto@2.3.2/node_modules/hypercore-crypto/index.js
|
|
2100
2061
|
var require_hypercore_crypto = __commonJS({
|
|
2101
2062
|
"node_modules/.pnpm/hypercore-crypto@2.3.2/node_modules/hypercore-crypto/index.js"(exports) {
|
|
2102
|
-
init_inject_globals();
|
|
2103
2063
|
var sodium = import$sodium_universal;
|
|
2104
2064
|
var uint64be = require_uint64be2();
|
|
2105
|
-
var LEAF_TYPE =
|
|
2106
|
-
var PARENT_TYPE =
|
|
2107
|
-
var ROOT_TYPE =
|
|
2108
|
-
var CAP_TYPE =
|
|
2109
|
-
var HYPERCORE =
|
|
2110
|
-
var HYPERCORE_CAP =
|
|
2065
|
+
var LEAF_TYPE = Buffer.from([0]);
|
|
2066
|
+
var PARENT_TYPE = Buffer.from([1]);
|
|
2067
|
+
var ROOT_TYPE = Buffer.from([2]);
|
|
2068
|
+
var CAP_TYPE = Buffer.from([3]);
|
|
2069
|
+
var HYPERCORE = Buffer.from("hypercore");
|
|
2070
|
+
var HYPERCORE_CAP = Buffer.from("hypercore capability");
|
|
2111
2071
|
exports.writerCapability = function(key, secretKey, split) {
|
|
2112
2072
|
if (!split) return null;
|
|
2113
|
-
const out =
|
|
2073
|
+
const out = Buffer.allocUnsafe(32);
|
|
2114
2074
|
sodium.crypto_generichash_batch(out, [
|
|
2115
2075
|
CAP_TYPE,
|
|
2116
2076
|
HYPERCORE_CAP,
|
|
@@ -2121,7 +2081,7 @@ var require_hypercore_crypto = __commonJS({
|
|
|
2121
2081
|
};
|
|
2122
2082
|
exports.verifyRemoteWriterCapability = function(key, cap, split) {
|
|
2123
2083
|
if (!split) return null;
|
|
2124
|
-
const out =
|
|
2084
|
+
const out = Buffer.allocUnsafe(32);
|
|
2125
2085
|
sodium.crypto_generichash_batch(out, [
|
|
2126
2086
|
CAP_TYPE,
|
|
2127
2087
|
HYPERCORE_CAP,
|
|
@@ -2132,7 +2092,7 @@ var require_hypercore_crypto = __commonJS({
|
|
|
2132
2092
|
};
|
|
2133
2093
|
exports.capability = function(key, split) {
|
|
2134
2094
|
if (!split) return null;
|
|
2135
|
-
const out =
|
|
2095
|
+
const out = Buffer.allocUnsafe(32);
|
|
2136
2096
|
sodium.crypto_generichash_batch(out, [
|
|
2137
2097
|
HYPERCORE_CAP,
|
|
2138
2098
|
split.tx.slice(0, 32),
|
|
@@ -2142,7 +2102,7 @@ var require_hypercore_crypto = __commonJS({
|
|
|
2142
2102
|
};
|
|
2143
2103
|
exports.remoteCapability = function(key, split) {
|
|
2144
2104
|
if (!split) return null;
|
|
2145
|
-
const out =
|
|
2105
|
+
const out = Buffer.allocUnsafe(32);
|
|
2146
2106
|
sodium.crypto_generichash_batch(out, [
|
|
2147
2107
|
HYPERCORE_CAP,
|
|
2148
2108
|
split.rx.slice(0, 32),
|
|
@@ -2151,8 +2111,8 @@ var require_hypercore_crypto = __commonJS({
|
|
|
2151
2111
|
return out;
|
|
2152
2112
|
};
|
|
2153
2113
|
exports.keyPair = function(seed) {
|
|
2154
|
-
const publicKey =
|
|
2155
|
-
const secretKey =
|
|
2114
|
+
const publicKey = Buffer.allocUnsafe(sodium.crypto_sign_PUBLICKEYBYTES);
|
|
2115
|
+
const secretKey = Buffer.allocUnsafe(sodium.crypto_sign_SECRETKEYBYTES);
|
|
2156
2116
|
if (seed) sodium.crypto_sign_seed_keypair(publicKey, secretKey, seed);
|
|
2157
2117
|
else sodium.crypto_sign_keypair(publicKey, secretKey);
|
|
2158
2118
|
return {
|
|
@@ -2161,12 +2121,12 @@ var require_hypercore_crypto = __commonJS({
|
|
|
2161
2121
|
};
|
|
2162
2122
|
};
|
|
2163
2123
|
exports.validateKeyPair = function(keyPair) {
|
|
2164
|
-
const pk =
|
|
2124
|
+
const pk = Buffer.allocUnsafe(sodium.crypto_sign_PUBLICKEYBYTES);
|
|
2165
2125
|
sodium.crypto_sign_ed25519_sk_to_pk(pk, keyPair.secretKey);
|
|
2166
2126
|
return pk.equals(keyPair.publicKey);
|
|
2167
2127
|
};
|
|
2168
2128
|
exports.sign = function(message, secretKey) {
|
|
2169
|
-
const signature =
|
|
2129
|
+
const signature = Buffer.allocUnsafe(sodium.crypto_sign_BYTES);
|
|
2170
2130
|
sodium.crypto_sign_detached(signature, message, secretKey);
|
|
2171
2131
|
return signature;
|
|
2172
2132
|
};
|
|
@@ -2174,7 +2134,7 @@ var require_hypercore_crypto = __commonJS({
|
|
|
2174
2134
|
return sodium.crypto_sign_verify_detached(signature, message, publicKey);
|
|
2175
2135
|
};
|
|
2176
2136
|
exports.data = function(data) {
|
|
2177
|
-
const out =
|
|
2137
|
+
const out = Buffer.allocUnsafe(32);
|
|
2178
2138
|
sodium.crypto_generichash_batch(out, [
|
|
2179
2139
|
LEAF_TYPE,
|
|
2180
2140
|
encodeUInt64(data.length),
|
|
@@ -2191,7 +2151,7 @@ var require_hypercore_crypto = __commonJS({
|
|
|
2191
2151
|
a = b;
|
|
2192
2152
|
b = tmp;
|
|
2193
2153
|
}
|
|
2194
|
-
const out =
|
|
2154
|
+
const out = Buffer.allocUnsafe(32);
|
|
2195
2155
|
sodium.crypto_generichash_batch(out, [
|
|
2196
2156
|
PARENT_TYPE,
|
|
2197
2157
|
encodeUInt64(a.size + b.size),
|
|
@@ -2210,24 +2170,24 @@ var require_hypercore_crypto = __commonJS({
|
|
|
2210
2170
|
buffers[j++] = encodeUInt64(r.index);
|
|
2211
2171
|
buffers[j++] = encodeUInt64(r.size);
|
|
2212
2172
|
}
|
|
2213
|
-
if (!out) out =
|
|
2173
|
+
if (!out) out = Buffer.allocUnsafe(32);
|
|
2214
2174
|
sodium.crypto_generichash_batch(out, buffers);
|
|
2215
2175
|
return out;
|
|
2216
2176
|
};
|
|
2217
2177
|
exports.signable = function(roots, length) {
|
|
2218
|
-
const out =
|
|
2219
|
-
if (
|
|
2178
|
+
const out = Buffer.allocUnsafe(40);
|
|
2179
|
+
if (Buffer.isBuffer(roots)) roots.copy(out);
|
|
2220
2180
|
else exports.tree(roots, out.slice(0, 32));
|
|
2221
2181
|
uint64be.encode(length, out.slice(32));
|
|
2222
2182
|
return out;
|
|
2223
2183
|
};
|
|
2224
2184
|
exports.randomBytes = function(n) {
|
|
2225
|
-
const buf =
|
|
2185
|
+
const buf = Buffer.allocUnsafe(n);
|
|
2226
2186
|
sodium.randombytes_buf(buf);
|
|
2227
2187
|
return buf;
|
|
2228
2188
|
};
|
|
2229
2189
|
exports.discoveryKey = function(publicKey) {
|
|
2230
|
-
const digest =
|
|
2190
|
+
const digest = Buffer.allocUnsafe(32);
|
|
2231
2191
|
sodium.crypto_generichash(digest, HYPERCORE, publicKey);
|
|
2232
2192
|
return digest;
|
|
2233
2193
|
};
|
|
@@ -2240,7 +2200,7 @@ var require_hypercore_crypto = __commonJS({
|
|
|
2240
2200
|
};
|
|
2241
2201
|
}
|
|
2242
2202
|
function encodeUInt64(n) {
|
|
2243
|
-
return uint64be.encode(n,
|
|
2203
|
+
return uint64be.encode(n, Buffer.allocUnsafe(8));
|
|
2244
2204
|
}
|
|
2245
2205
|
}
|
|
2246
2206
|
});
|
|
@@ -2248,7 +2208,6 @@ var require_hypercore_crypto = __commonJS({
|
|
|
2248
2208
|
// node_modules/.pnpm/inspect-custom-symbol@1.1.1/node_modules/inspect-custom-symbol/browser.js
|
|
2249
2209
|
var require_browser = __commonJS({
|
|
2250
2210
|
"node_modules/.pnpm/inspect-custom-symbol@1.1.1/node_modules/inspect-custom-symbol/browser.js"(exports, module) {
|
|
2251
|
-
init_inject_globals();
|
|
2252
2211
|
module.exports = Symbol.for("nodejs.util.inspect.custom");
|
|
2253
2212
|
}
|
|
2254
2213
|
});
|
|
@@ -2256,9 +2215,8 @@ var require_browser = __commonJS({
|
|
|
2256
2215
|
// node_modules/.pnpm/pretty-hash@1.0.1/node_modules/pretty-hash/index.js
|
|
2257
2216
|
var require_pretty_hash = __commonJS({
|
|
2258
2217
|
"node_modules/.pnpm/pretty-hash@1.0.1/node_modules/pretty-hash/index.js"(exports, module) {
|
|
2259
|
-
init_inject_globals();
|
|
2260
2218
|
module.exports = function prettyHash(buf) {
|
|
2261
|
-
if (
|
|
2219
|
+
if (Buffer.isBuffer(buf)) buf = buf.toString("hex");
|
|
2262
2220
|
if (typeof buf === "string" && buf.length > 8) {
|
|
2263
2221
|
return buf.slice(0, 6) + ".." + buf.slice(-2);
|
|
2264
2222
|
}
|
|
@@ -2270,7 +2228,6 @@ var require_pretty_hash = __commonJS({
|
|
|
2270
2228
|
// node_modules/.pnpm/nanoguard@1.3.0/node_modules/nanoguard/index.js
|
|
2271
2229
|
var require_nanoguard = __commonJS({
|
|
2272
2230
|
"node_modules/.pnpm/nanoguard@1.3.0/node_modules/nanoguard/index.js"(exports, module) {
|
|
2273
|
-
init_inject_globals();
|
|
2274
2231
|
module.exports = class Nanoguard {
|
|
2275
2232
|
constructor() {
|
|
2276
2233
|
this._tick = 0;
|
|
@@ -2331,11 +2288,10 @@ var require_nanoguard = __commonJS({
|
|
|
2331
2288
|
// node_modules/.pnpm/hypercore@9.12.0/node_modules/hypercore/lib/safe-buffer-equals.js
|
|
2332
2289
|
var require_safe_buffer_equals = __commonJS({
|
|
2333
2290
|
"node_modules/.pnpm/hypercore@9.12.0/node_modules/hypercore/lib/safe-buffer-equals.js"(exports, module) {
|
|
2334
|
-
init_inject_globals();
|
|
2335
2291
|
module.exports = function safeBufferEquals(a, b) {
|
|
2336
2292
|
if (!a) return !b;
|
|
2337
2293
|
if (!b) return !a;
|
|
2338
|
-
return
|
|
2294
|
+
return Buffer.compare(a, b) === 0;
|
|
2339
2295
|
};
|
|
2340
2296
|
}
|
|
2341
2297
|
});
|
|
@@ -2343,7 +2299,6 @@ var require_safe_buffer_equals = __commonJS({
|
|
|
2343
2299
|
// node_modules/.pnpm/nanoassert@2.0.0/node_modules/nanoassert/index.js
|
|
2344
2300
|
var require_nanoassert = __commonJS({
|
|
2345
2301
|
"node_modules/.pnpm/nanoassert@2.0.0/node_modules/nanoassert/index.js"(exports, module) {
|
|
2346
|
-
init_inject_globals();
|
|
2347
2302
|
module.exports = assert;
|
|
2348
2303
|
var AssertionError = class extends Error {
|
|
2349
2304
|
};
|
|
@@ -2361,7 +2316,6 @@ var require_nanoassert = __commonJS({
|
|
|
2361
2316
|
// node_modules/.pnpm/clone@2.1.2/node_modules/clone/clone.js
|
|
2362
2317
|
var require_clone = __commonJS({
|
|
2363
2318
|
"node_modules/.pnpm/clone@2.1.2/node_modules/clone/clone.js"(exports, module) {
|
|
2364
|
-
init_inject_globals();
|
|
2365
2319
|
var clone = function() {
|
|
2366
2320
|
"use strict";
|
|
2367
2321
|
function _instanceof(obj, type) {
|
|
@@ -2397,7 +2351,7 @@ var require_clone = __commonJS({
|
|
|
2397
2351
|
}
|
|
2398
2352
|
var allParents = [];
|
|
2399
2353
|
var allChildren = [];
|
|
2400
|
-
var useBuffer = typeof
|
|
2354
|
+
var useBuffer = typeof Buffer != "undefined";
|
|
2401
2355
|
if (typeof circular == "undefined")
|
|
2402
2356
|
circular = true;
|
|
2403
2357
|
if (typeof depth == "undefined")
|
|
@@ -2431,11 +2385,11 @@ var require_clone = __commonJS({
|
|
|
2431
2385
|
if (parent2.lastIndex) child.lastIndex = parent2.lastIndex;
|
|
2432
2386
|
} else if (clone2.__isDate(parent2)) {
|
|
2433
2387
|
child = new Date(parent2.getTime());
|
|
2434
|
-
} else if (useBuffer &&
|
|
2435
|
-
if (
|
|
2436
|
-
child =
|
|
2388
|
+
} else if (useBuffer && Buffer.isBuffer(parent2)) {
|
|
2389
|
+
if (Buffer.allocUnsafe) {
|
|
2390
|
+
child = Buffer.allocUnsafe(parent2.length);
|
|
2437
2391
|
} else {
|
|
2438
|
-
child = new
|
|
2392
|
+
child = new Buffer(parent2.length);
|
|
2439
2393
|
}
|
|
2440
2394
|
parent2.copy(child);
|
|
2441
2395
|
return child;
|
|
@@ -2558,7 +2512,6 @@ var require_clone = __commonJS({
|
|
|
2558
2512
|
// node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/cipher.js
|
|
2559
2513
|
var require_cipher = __commonJS({
|
|
2560
2514
|
"node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/cipher.js"(exports, module) {
|
|
2561
|
-
init_inject_globals();
|
|
2562
2515
|
var { sodium_malloc, sodium_memzero } = import$sodium_universal_memory;
|
|
2563
2516
|
var {
|
|
2564
2517
|
crypto_aead_chacha20poly1305_ietf_KEYBYTES,
|
|
@@ -2633,7 +2586,6 @@ var require_cipher = __commonJS({
|
|
|
2633
2586
|
// node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/cipher-state.js
|
|
2634
2587
|
var require_cipher_state = __commonJS({
|
|
2635
2588
|
"node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/cipher-state.js"(exports, module) {
|
|
2636
|
-
init_inject_globals();
|
|
2637
2589
|
var { sodium_memzero } = import$sodium_universal_memory;
|
|
2638
2590
|
var { sodium_increment, sodium_memcmp, sodium_is_zero } = import$sodium_universal_helpers;
|
|
2639
2591
|
var assert = require_nanoassert();
|
|
@@ -2744,7 +2696,6 @@ var require_cipher_state = __commonJS({
|
|
|
2744
2696
|
// node_modules/.pnpm/nanoassert@1.1.0/node_modules/nanoassert/index.js
|
|
2745
2697
|
var require_nanoassert2 = __commonJS({
|
|
2746
2698
|
"node_modules/.pnpm/nanoassert@1.1.0/node_modules/nanoassert/index.js"(exports, module) {
|
|
2747
|
-
init_inject_globals();
|
|
2748
2699
|
assert.notEqual = notEqual;
|
|
2749
2700
|
assert.notOk = notOk;
|
|
2750
2701
|
assert.equal = equal;
|
|
@@ -2768,7 +2719,6 @@ var require_nanoassert2 = __commonJS({
|
|
|
2768
2719
|
// node_modules/.pnpm/hmac-blake2b@2.0.0/node_modules/hmac-blake2b/index.js
|
|
2769
2720
|
var require_hmac_blake2b = __commonJS({
|
|
2770
2721
|
"node_modules/.pnpm/hmac-blake2b@2.0.0/node_modules/hmac-blake2b/index.js"(exports, module) {
|
|
2771
|
-
init_inject_globals();
|
|
2772
2722
|
var { sodium_malloc, sodium_memzero } = import$sodium_universal_memory;
|
|
2773
2723
|
var { crypto_generichash, crypto_generichash_batch } = import$sodium_universal_crypto_generichash;
|
|
2774
2724
|
var assert = require_nanoassert2();
|
|
@@ -2807,7 +2757,6 @@ var require_hmac_blake2b = __commonJS({
|
|
|
2807
2757
|
// node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/dh.js
|
|
2808
2758
|
var require_dh = __commonJS({
|
|
2809
2759
|
"node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/dh.js"(exports, module) {
|
|
2810
|
-
init_inject_globals();
|
|
2811
2760
|
var { crypto_kx_SEEDBYTES, crypto_kx_keypair, crypto_kx_seed_keypair } = import$sodium_universal_crypto_kx;
|
|
2812
2761
|
var { crypto_scalarmult_BYTES, crypto_scalarmult_SCALARBYTES, crypto_scalarmult } = import$sodium_universal_crypto_scalarmult;
|
|
2813
2762
|
var assert = require_nanoassert();
|
|
@@ -2851,7 +2800,6 @@ var require_dh = __commonJS({
|
|
|
2851
2800
|
// node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/hash.js
|
|
2852
2801
|
var require_hash = __commonJS({
|
|
2853
2802
|
"node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/hash.js"(exports, module) {
|
|
2854
|
-
init_inject_globals();
|
|
2855
2803
|
var { sodium_malloc, sodium_memzero } = import$sodium_universal_memory;
|
|
2856
2804
|
var { crypto_generichash_batch } = import$sodium_universal_crypto_generichash;
|
|
2857
2805
|
var assert = require_nanoassert();
|
|
@@ -2900,7 +2848,6 @@ var require_hash = __commonJS({
|
|
|
2900
2848
|
// node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/symmetric-state.js
|
|
2901
2849
|
var require_symmetric_state = __commonJS({
|
|
2902
2850
|
"node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/symmetric-state.js"(exports, module) {
|
|
2903
|
-
init_inject_globals();
|
|
2904
2851
|
var { sodium_malloc, sodium_memzero } = import$sodium_universal_memory;
|
|
2905
2852
|
var assert = require_nanoassert();
|
|
2906
2853
|
var cipherState = require_cipher_state();
|
|
@@ -3028,7 +2975,6 @@ var require_symmetric_state = __commonJS({
|
|
|
3028
2975
|
// node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/handshake-state.js
|
|
3029
2976
|
var require_handshake_state = __commonJS({
|
|
3030
2977
|
"node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/handshake-state.js"(exports, module) {
|
|
3031
|
-
init_inject_globals();
|
|
3032
2978
|
var { sodium_malloc, sodium_memzero, sodium_free } = import$sodium_universal_memory;
|
|
3033
2979
|
var assert = require_nanoassert();
|
|
3034
2980
|
var clone = require_clone();
|
|
@@ -3449,7 +3395,6 @@ var require_handshake_state = __commonJS({
|
|
|
3449
3395
|
// node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/index.js
|
|
3450
3396
|
var require_noise_protocol = __commonJS({
|
|
3451
3397
|
"node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/index.js"(exports, module) {
|
|
3452
|
-
init_inject_globals();
|
|
3453
3398
|
module.exports = require_handshake_state();
|
|
3454
3399
|
}
|
|
3455
3400
|
});
|
|
@@ -3457,12 +3402,11 @@ var require_noise_protocol = __commonJS({
|
|
|
3457
3402
|
// node_modules/.pnpm/simple-handshake@3.0.0/node_modules/simple-handshake/index.js
|
|
3458
3403
|
var require_simple_handshake = __commonJS({
|
|
3459
3404
|
"node_modules/.pnpm/simple-handshake@3.0.0/node_modules/simple-handshake/index.js"(exports, module) {
|
|
3460
|
-
init_inject_globals();
|
|
3461
3405
|
var noise = require_noise_protocol();
|
|
3462
3406
|
var NoiseSymmetricState = require_symmetric_state();
|
|
3463
3407
|
var NoiseHash = require_hash();
|
|
3464
3408
|
var assert = require_nanoassert();
|
|
3465
|
-
var EMPTY =
|
|
3409
|
+
var EMPTY = Buffer.alloc(0);
|
|
3466
3410
|
function SimpleHandshake(isInitiator, opts) {
|
|
3467
3411
|
if (!(this instanceof SimpleHandshake)) return new SimpleHandshake(isInitiator, opts);
|
|
3468
3412
|
opts = opts || {};
|
|
@@ -3490,8 +3434,8 @@ var require_simple_handshake = __commonJS({
|
|
|
3490
3434
|
this.waiting = isInitiator === false;
|
|
3491
3435
|
this.finished = false;
|
|
3492
3436
|
this.split = null;
|
|
3493
|
-
this._tx =
|
|
3494
|
-
this._rx =
|
|
3437
|
+
this._tx = Buffer.alloc(65535);
|
|
3438
|
+
this._rx = Buffer.alloc(65535);
|
|
3495
3439
|
}
|
|
3496
3440
|
SimpleHandshake.prototype.recv = function recv(data, cb) {
|
|
3497
3441
|
var self = this;
|
|
@@ -3553,7 +3497,7 @@ var require_simple_handshake = __commonJS({
|
|
|
3553
3497
|
self.finished = true;
|
|
3554
3498
|
self.waiting = false;
|
|
3555
3499
|
if (self.split) {
|
|
3556
|
-
self.handshakeHash =
|
|
3500
|
+
self.handshakeHash = Buffer.alloc(NoiseHash.HASHLEN);
|
|
3557
3501
|
NoiseSymmetricState.getHandshakeHash(self.state.symmetricState, self.handshakeHash);
|
|
3558
3502
|
}
|
|
3559
3503
|
if (err) return ondone(err);
|
|
@@ -3574,7 +3518,6 @@ var require_simple_handshake = __commonJS({
|
|
|
3574
3518
|
// node_modules/.pnpm/varint@5.0.2/node_modules/varint/encode.js
|
|
3575
3519
|
var require_encode2 = __commonJS({
|
|
3576
3520
|
"node_modules/.pnpm/varint@5.0.2/node_modules/varint/encode.js"(exports, module) {
|
|
3577
|
-
init_inject_globals();
|
|
3578
3521
|
module.exports = encode;
|
|
3579
3522
|
var MSB = 128;
|
|
3580
3523
|
var REST = 127;
|
|
@@ -3602,7 +3545,6 @@ var require_encode2 = __commonJS({
|
|
|
3602
3545
|
// node_modules/.pnpm/varint@5.0.2/node_modules/varint/decode.js
|
|
3603
3546
|
var require_decode2 = __commonJS({
|
|
3604
3547
|
"node_modules/.pnpm/varint@5.0.2/node_modules/varint/decode.js"(exports, module) {
|
|
3605
|
-
init_inject_globals();
|
|
3606
3548
|
module.exports = read;
|
|
3607
3549
|
var MSB = 128;
|
|
3608
3550
|
var REST = 127;
|
|
@@ -3626,7 +3568,6 @@ var require_decode2 = __commonJS({
|
|
|
3626
3568
|
// node_modules/.pnpm/varint@5.0.2/node_modules/varint/length.js
|
|
3627
3569
|
var require_length2 = __commonJS({
|
|
3628
3570
|
"node_modules/.pnpm/varint@5.0.2/node_modules/varint/length.js"(exports, module) {
|
|
3629
|
-
init_inject_globals();
|
|
3630
3571
|
var N1 = Math.pow(2, 7);
|
|
3631
3572
|
var N2 = Math.pow(2, 14);
|
|
3632
3573
|
var N3 = Math.pow(2, 21);
|
|
@@ -3645,7 +3586,6 @@ var require_length2 = __commonJS({
|
|
|
3645
3586
|
// node_modules/.pnpm/varint@5.0.2/node_modules/varint/index.js
|
|
3646
3587
|
var require_varint2 = __commonJS({
|
|
3647
3588
|
"node_modules/.pnpm/varint@5.0.2/node_modules/varint/index.js"(exports, module) {
|
|
3648
|
-
init_inject_globals();
|
|
3649
3589
|
module.exports = {
|
|
3650
3590
|
encode: require_encode2(),
|
|
3651
3591
|
decode: require_decode2(),
|
|
@@ -3657,7 +3597,6 @@ var require_varint2 = __commonJS({
|
|
|
3657
3597
|
// node_modules/.pnpm/simple-hypercore-protocol@2.1.2/node_modules/simple-hypercore-protocol/lib/handshake.js
|
|
3658
3598
|
var require_handshake = __commonJS({
|
|
3659
3599
|
"node_modules/.pnpm/simple-hypercore-protocol@2.1.2/node_modules/simple-hypercore-protocol/lib/handshake.js"(exports, module) {
|
|
3660
|
-
init_inject_globals();
|
|
3661
3600
|
var SH = require_simple_handshake();
|
|
3662
3601
|
var DH = require_dh();
|
|
3663
3602
|
var crypto = require_hypercore_crypto();
|
|
@@ -3690,7 +3629,7 @@ var require_handshake = __commonJS({
|
|
|
3690
3629
|
}
|
|
3691
3630
|
recv(data) {
|
|
3692
3631
|
if (this.destroyed) return;
|
|
3693
|
-
if (this.buffer) this.buffer =
|
|
3632
|
+
if (this.buffer) this.buffer = Buffer.concat([this.buffer, data]);
|
|
3694
3633
|
else this.buffer = data;
|
|
3695
3634
|
while (!this.destroyed && !this.noise.finished) {
|
|
3696
3635
|
if (!this.buffer || this.buffer.length < 3) return;
|
|
@@ -3716,8 +3655,8 @@ var require_handshake = __commonJS({
|
|
|
3716
3655
|
const obj = {
|
|
3717
3656
|
// suboptimal but to reduce secure memory overhead on linux with default settings
|
|
3718
3657
|
// better fix is to batch mallocs in noise-protocol
|
|
3719
|
-
publicKey:
|
|
3720
|
-
secretKey:
|
|
3658
|
+
publicKey: Buffer.alloc(DH.PKLEN),
|
|
3659
|
+
secretKey: Buffer.alloc(DH.SKLEN)
|
|
3721
3660
|
};
|
|
3722
3661
|
if (seed) DH.generateSeedKeypair(obj.publicKey, obj.secretKey, seed);
|
|
3723
3662
|
else DH.generateKeypair(obj.publicKey, obj.secretKey);
|
|
@@ -3727,7 +3666,7 @@ var require_handshake = __commonJS({
|
|
|
3727
3666
|
function finish(self) {
|
|
3728
3667
|
if (self.destroyed) return;
|
|
3729
3668
|
self.destroyed = true;
|
|
3730
|
-
const split = { rx:
|
|
3669
|
+
const split = { rx: Buffer.from(self.noise.split.rx), tx: Buffer.from(self.noise.split.tx) };
|
|
3731
3670
|
crypto.free(self.noise.split.rx);
|
|
3732
3671
|
crypto.free(self.noise.split.tx);
|
|
3733
3672
|
self.ondone(null, self.remotePayload, split, self.buffer, self.remotePublicKey, self.noise.handshakeHash);
|
|
@@ -3738,21 +3677,21 @@ var require_handshake = __commonJS({
|
|
|
3738
3677
|
}
|
|
3739
3678
|
function onsend(err, data) {
|
|
3740
3679
|
if (err) return this.destroy(err);
|
|
3741
|
-
const buf =
|
|
3680
|
+
const buf = Buffer.allocUnsafe(varint.encodingLength(data.length) + data.length);
|
|
3742
3681
|
varint.encode(data.length, buf, 0);
|
|
3743
3682
|
data.copy(buf, varint.encode.bytes);
|
|
3744
3683
|
this.options.send(buf);
|
|
3745
3684
|
}
|
|
3746
3685
|
function onrecv(err, data) {
|
|
3747
3686
|
if (err) return this.destroy(err);
|
|
3748
|
-
if (data && data.length) this.remotePayload =
|
|
3687
|
+
if (data && data.length) this.remotePayload = Buffer.from(data);
|
|
3749
3688
|
if (this.destroyed || this.noise.finished) return;
|
|
3750
3689
|
if (this.noise.waiting === false) {
|
|
3751
3690
|
this.noise.send(this.payload, this.onsend);
|
|
3752
3691
|
}
|
|
3753
3692
|
}
|
|
3754
3693
|
function onstatickey(remoteKey, done) {
|
|
3755
|
-
this.remotePublicKey =
|
|
3694
|
+
this.remotePublicKey = Buffer.from(remoteKey);
|
|
3756
3695
|
if (this.options.onauthenticate) this.options.onauthenticate(this.remotePublicKey, done);
|
|
3757
3696
|
else done(null);
|
|
3758
3697
|
}
|
|
@@ -3762,7 +3701,6 @@ var require_handshake = __commonJS({
|
|
|
3762
3701
|
// node_modules/.pnpm/varint@5.0.0/node_modules/varint/encode.js
|
|
3763
3702
|
var require_encode3 = __commonJS({
|
|
3764
3703
|
"node_modules/.pnpm/varint@5.0.0/node_modules/varint/encode.js"(exports, module) {
|
|
3765
|
-
init_inject_globals();
|
|
3766
3704
|
module.exports = encode;
|
|
3767
3705
|
var MSB = 128;
|
|
3768
3706
|
var REST = 127;
|
|
@@ -3790,7 +3728,6 @@ var require_encode3 = __commonJS({
|
|
|
3790
3728
|
// node_modules/.pnpm/varint@5.0.0/node_modules/varint/decode.js
|
|
3791
3729
|
var require_decode3 = __commonJS({
|
|
3792
3730
|
"node_modules/.pnpm/varint@5.0.0/node_modules/varint/decode.js"(exports, module) {
|
|
3793
|
-
init_inject_globals();
|
|
3794
3731
|
module.exports = read;
|
|
3795
3732
|
var MSB = 128;
|
|
3796
3733
|
var REST = 127;
|
|
@@ -3814,7 +3751,6 @@ var require_decode3 = __commonJS({
|
|
|
3814
3751
|
// node_modules/.pnpm/varint@5.0.0/node_modules/varint/length.js
|
|
3815
3752
|
var require_length3 = __commonJS({
|
|
3816
3753
|
"node_modules/.pnpm/varint@5.0.0/node_modules/varint/length.js"(exports, module) {
|
|
3817
|
-
init_inject_globals();
|
|
3818
3754
|
var N1 = Math.pow(2, 7);
|
|
3819
3755
|
var N2 = Math.pow(2, 14);
|
|
3820
3756
|
var N3 = Math.pow(2, 21);
|
|
@@ -3833,7 +3769,6 @@ var require_length3 = __commonJS({
|
|
|
3833
3769
|
// node_modules/.pnpm/varint@5.0.0/node_modules/varint/index.js
|
|
3834
3770
|
var require_varint3 = __commonJS({
|
|
3835
3771
|
"node_modules/.pnpm/varint@5.0.0/node_modules/varint/index.js"(exports, module) {
|
|
3836
|
-
init_inject_globals();
|
|
3837
3772
|
module.exports = {
|
|
3838
3773
|
encode: require_encode3(),
|
|
3839
3774
|
decode: require_decode3(),
|
|
@@ -3845,7 +3780,6 @@ var require_varint3 = __commonJS({
|
|
|
3845
3780
|
// node_modules/.pnpm/signed-varint@2.0.1/node_modules/signed-varint/index.js
|
|
3846
3781
|
var require_signed_varint = __commonJS({
|
|
3847
3782
|
"node_modules/.pnpm/signed-varint@2.0.1/node_modules/signed-varint/index.js"(exports) {
|
|
3848
|
-
init_inject_globals();
|
|
3849
3783
|
var varint = require_varint2();
|
|
3850
3784
|
exports.encode = function encode(v, b, o) {
|
|
3851
3785
|
v = v >= 0 ? v * 2 : v * -2 - 1;
|
|
@@ -3867,7 +3801,6 @@ var require_signed_varint = __commonJS({
|
|
|
3867
3801
|
// node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/lib/ascii.js
|
|
3868
3802
|
var require_ascii = __commonJS({
|
|
3869
3803
|
"node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/lib/ascii.js"(exports, module) {
|
|
3870
|
-
init_inject_globals();
|
|
3871
3804
|
function byteLength(string) {
|
|
3872
3805
|
return string.length;
|
|
3873
3806
|
}
|
|
@@ -3897,7 +3830,6 @@ var require_ascii = __commonJS({
|
|
|
3897
3830
|
// node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/lib/base64.js
|
|
3898
3831
|
var require_base64 = __commonJS({
|
|
3899
3832
|
"node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/lib/base64.js"(exports, module) {
|
|
3900
|
-
init_inject_globals();
|
|
3901
3833
|
var alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
3902
3834
|
var codes = new Uint8Array(256);
|
|
3903
3835
|
for (let i = 0; i < alphabet.length; i++) {
|
|
@@ -3954,7 +3886,6 @@ var require_base64 = __commonJS({
|
|
|
3954
3886
|
// node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/lib/hex.js
|
|
3955
3887
|
var require_hex = __commonJS({
|
|
3956
3888
|
"node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/lib/hex.js"(exports, module) {
|
|
3957
|
-
init_inject_globals();
|
|
3958
3889
|
function byteLength(string) {
|
|
3959
3890
|
return string.length >>> 1;
|
|
3960
3891
|
}
|
|
@@ -3999,7 +3930,6 @@ var require_hex = __commonJS({
|
|
|
3999
3930
|
// node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/lib/utf8.js
|
|
4000
3931
|
var require_utf8 = __commonJS({
|
|
4001
3932
|
"node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/lib/utf8.js"(exports, module) {
|
|
4002
|
-
init_inject_globals();
|
|
4003
3933
|
function byteLength(string) {
|
|
4004
3934
|
let length = 0;
|
|
4005
3935
|
for (let i = 0, n = string.length; i < n; i++) {
|
|
@@ -4120,7 +4050,6 @@ var require_utf8 = __commonJS({
|
|
|
4120
4050
|
// node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/lib/utf16le.js
|
|
4121
4051
|
var require_utf16le = __commonJS({
|
|
4122
4052
|
"node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/lib/utf16le.js"(exports, module) {
|
|
4123
|
-
init_inject_globals();
|
|
4124
4053
|
function byteLength(string) {
|
|
4125
4054
|
return string.length * 2;
|
|
4126
4055
|
}
|
|
@@ -4156,7 +4085,6 @@ var require_utf16le = __commonJS({
|
|
|
4156
4085
|
// node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/browser.js
|
|
4157
4086
|
var require_browser2 = __commonJS({
|
|
4158
4087
|
"node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/browser.js"(exports, module) {
|
|
4159
|
-
init_inject_globals();
|
|
4160
4088
|
var ascii = require_ascii();
|
|
4161
4089
|
var base64 = require_base64();
|
|
4162
4090
|
var hex = require_hex();
|
|
@@ -4552,7 +4480,6 @@ var require_browser2 = __commonJS({
|
|
|
4552
4480
|
// node_modules/.pnpm/protocol-buffers-encodings@1.2.0/node_modules/protocol-buffers-encodings/index.js
|
|
4553
4481
|
var require_protocol_buffers_encodings = __commonJS({
|
|
4554
4482
|
"node_modules/.pnpm/protocol-buffers-encodings@1.2.0/node_modules/protocol-buffers-encodings/index.js"(exports) {
|
|
4555
|
-
init_inject_globals();
|
|
4556
4483
|
var varint = require_varint3();
|
|
4557
4484
|
var svarint = require_signed_varint();
|
|
4558
4485
|
var b4a = require_browser2();
|
|
@@ -4817,7 +4744,6 @@ var require_protocol_buffers_encodings = __commonJS({
|
|
|
4817
4744
|
// node_modules/.pnpm/simple-hypercore-protocol@2.1.2/node_modules/simple-hypercore-protocol/messages.js
|
|
4818
4745
|
var require_messages = __commonJS({
|
|
4819
4746
|
"node_modules/.pnpm/simple-hypercore-protocol@2.1.2/node_modules/simple-hypercore-protocol/messages.js"(exports) {
|
|
4820
|
-
init_inject_globals();
|
|
4821
4747
|
var encodings = require_protocol_buffers_encodings();
|
|
4822
4748
|
var varint = encodings.varint;
|
|
4823
4749
|
var skip = encodings.skip;
|
|
@@ -4921,7 +4847,7 @@ var require_messages = __commonJS({
|
|
|
4921
4847
|
}
|
|
4922
4848
|
function encode(obj, buf, offset) {
|
|
4923
4849
|
if (!offset) offset = 0;
|
|
4924
|
-
if (!buf) buf =
|
|
4850
|
+
if (!buf) buf = Buffer.allocUnsafe(encodingLength(obj));
|
|
4925
4851
|
var oldOffset = offset;
|
|
4926
4852
|
if (!defined(obj.nonce)) throw new Error("nonce is required");
|
|
4927
4853
|
buf[offset++] = 10;
|
|
@@ -4980,7 +4906,7 @@ var require_messages = __commonJS({
|
|
|
4980
4906
|
}
|
|
4981
4907
|
function encode(obj, buf, offset) {
|
|
4982
4908
|
if (!offset) offset = 0;
|
|
4983
|
-
if (!buf) buf =
|
|
4909
|
+
if (!buf) buf = Buffer.allocUnsafe(encodingLength(obj));
|
|
4984
4910
|
var oldOffset = offset;
|
|
4985
4911
|
if (!defined(obj.discoveryKey)) throw new Error("discoveryKey is required");
|
|
4986
4912
|
buf[offset++] = 10;
|
|
@@ -5054,7 +4980,7 @@ var require_messages = __commonJS({
|
|
|
5054
4980
|
}
|
|
5055
4981
|
function encode(obj, buf, offset) {
|
|
5056
4982
|
if (!offset) offset = 0;
|
|
5057
|
-
if (!buf) buf =
|
|
4983
|
+
if (!buf) buf = Buffer.allocUnsafe(encodingLength(obj));
|
|
5058
4984
|
var oldOffset = offset;
|
|
5059
4985
|
if (defined(obj.extensions)) {
|
|
5060
4986
|
for (var i = 0; i < obj.extensions.length; i++) {
|
|
@@ -5125,7 +5051,7 @@ var require_messages = __commonJS({
|
|
|
5125
5051
|
}
|
|
5126
5052
|
function encode(obj, buf, offset) {
|
|
5127
5053
|
if (!offset) offset = 0;
|
|
5128
|
-
if (!buf) buf =
|
|
5054
|
+
if (!buf) buf = Buffer.allocUnsafe(encodingLength(obj));
|
|
5129
5055
|
var oldOffset = offset;
|
|
5130
5056
|
if (defined(obj.uploading)) {
|
|
5131
5057
|
buf[offset++] = 8;
|
|
@@ -5202,7 +5128,7 @@ var require_messages = __commonJS({
|
|
|
5202
5128
|
}
|
|
5203
5129
|
function encode(obj, buf, offset) {
|
|
5204
5130
|
if (!offset) offset = 0;
|
|
5205
|
-
if (!buf) buf =
|
|
5131
|
+
if (!buf) buf = Buffer.allocUnsafe(encodingLength(obj));
|
|
5206
5132
|
var oldOffset = offset;
|
|
5207
5133
|
if (!defined(obj.start)) throw new Error("start is required");
|
|
5208
5134
|
buf[offset++] = 8;
|
|
@@ -5291,7 +5217,7 @@ var require_messages = __commonJS({
|
|
|
5291
5217
|
}
|
|
5292
5218
|
function encode(obj, buf, offset) {
|
|
5293
5219
|
if (!offset) offset = 0;
|
|
5294
|
-
if (!buf) buf =
|
|
5220
|
+
if (!buf) buf = Buffer.allocUnsafe(encodingLength(obj));
|
|
5295
5221
|
var oldOffset = offset;
|
|
5296
5222
|
if (!defined(obj.start)) throw new Error("start is required");
|
|
5297
5223
|
buf[offset++] = 8;
|
|
@@ -5360,7 +5286,7 @@ var require_messages = __commonJS({
|
|
|
5360
5286
|
}
|
|
5361
5287
|
function encode(obj, buf, offset) {
|
|
5362
5288
|
if (!offset) offset = 0;
|
|
5363
|
-
if (!buf) buf =
|
|
5289
|
+
if (!buf) buf = Buffer.allocUnsafe(encodingLength(obj));
|
|
5364
5290
|
var oldOffset = offset;
|
|
5365
5291
|
if (!defined(obj.start)) throw new Error("start is required");
|
|
5366
5292
|
buf[offset++] = 8;
|
|
@@ -5429,7 +5355,7 @@ var require_messages = __commonJS({
|
|
|
5429
5355
|
}
|
|
5430
5356
|
function encode(obj, buf, offset) {
|
|
5431
5357
|
if (!offset) offset = 0;
|
|
5432
|
-
if (!buf) buf =
|
|
5358
|
+
if (!buf) buf = Buffer.allocUnsafe(encodingLength(obj));
|
|
5433
5359
|
var oldOffset = offset;
|
|
5434
5360
|
if (!defined(obj.start)) throw new Error("start is required");
|
|
5435
5361
|
buf[offset++] = 8;
|
|
@@ -5507,7 +5433,7 @@ var require_messages = __commonJS({
|
|
|
5507
5433
|
}
|
|
5508
5434
|
function encode(obj, buf, offset) {
|
|
5509
5435
|
if (!offset) offset = 0;
|
|
5510
|
-
if (!buf) buf =
|
|
5436
|
+
if (!buf) buf = Buffer.allocUnsafe(encodingLength(obj));
|
|
5511
5437
|
var oldOffset = offset;
|
|
5512
5438
|
if (!defined(obj.index)) throw new Error("index is required");
|
|
5513
5439
|
buf[offset++] = 8;
|
|
@@ -5601,7 +5527,7 @@ var require_messages = __commonJS({
|
|
|
5601
5527
|
}
|
|
5602
5528
|
function encode(obj, buf, offset) {
|
|
5603
5529
|
if (!offset) offset = 0;
|
|
5604
|
-
if (!buf) buf =
|
|
5530
|
+
if (!buf) buf = Buffer.allocUnsafe(encodingLength(obj));
|
|
5605
5531
|
var oldOffset = offset;
|
|
5606
5532
|
if (!defined(obj.index)) throw new Error("index is required");
|
|
5607
5533
|
buf[offset++] = 8;
|
|
@@ -5691,7 +5617,7 @@ var require_messages = __commonJS({
|
|
|
5691
5617
|
}
|
|
5692
5618
|
function encode2(obj, buf, offset) {
|
|
5693
5619
|
if (!offset) offset = 0;
|
|
5694
|
-
if (!buf) buf =
|
|
5620
|
+
if (!buf) buf = Buffer.allocUnsafe(encodingLength2(obj));
|
|
5695
5621
|
var oldOffset = offset;
|
|
5696
5622
|
if (!defined(obj.index)) throw new Error("index is required");
|
|
5697
5623
|
buf[offset++] = 8;
|
|
@@ -5785,7 +5711,7 @@ var require_messages = __commonJS({
|
|
|
5785
5711
|
}
|
|
5786
5712
|
function encode(obj, buf, offset) {
|
|
5787
5713
|
if (!offset) offset = 0;
|
|
5788
|
-
if (!buf) buf =
|
|
5714
|
+
if (!buf) buf = Buffer.allocUnsafe(encodingLength(obj));
|
|
5789
5715
|
var oldOffset = offset;
|
|
5790
5716
|
if (!defined(obj.index)) throw new Error("index is required");
|
|
5791
5717
|
buf[offset++] = 8;
|
|
@@ -5878,7 +5804,7 @@ var require_messages = __commonJS({
|
|
|
5878
5804
|
}
|
|
5879
5805
|
function encode(obj, buf, offset) {
|
|
5880
5806
|
if (!offset) offset = 0;
|
|
5881
|
-
if (!buf) buf =
|
|
5807
|
+
if (!buf) buf = Buffer.allocUnsafe(encodingLength(obj));
|
|
5882
5808
|
var oldOffset = offset;
|
|
5883
5809
|
if (defined(obj.discoveryKey)) {
|
|
5884
5810
|
buf[offset++] = 10;
|
|
@@ -5924,7 +5850,6 @@ var require_messages = __commonJS({
|
|
|
5924
5850
|
// node_modules/.pnpm/xsalsa20@1.2.0/node_modules/xsalsa20/xsalsa20.js
|
|
5925
5851
|
var require_xsalsa20 = __commonJS({
|
|
5926
5852
|
"node_modules/.pnpm/xsalsa20@1.2.0/node_modules/xsalsa20/xsalsa20.js"(exports, module) {
|
|
5927
|
-
init_inject_globals();
|
|
5928
5853
|
var __commonJS2 = (cb, mod) => function __require2() {
|
|
5929
5854
|
return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
5930
5855
|
};
|
|
@@ -5961,7 +5886,6 @@ var require_xsalsa20 = __commonJS({
|
|
|
5961
5886
|
// node_modules/.pnpm/xsalsa20@1.2.0/node_modules/xsalsa20/index.js
|
|
5962
5887
|
var require_xsalsa202 = __commonJS({
|
|
5963
5888
|
"node_modules/.pnpm/xsalsa20@1.2.0/node_modules/xsalsa20/index.js"(exports, module) {
|
|
5964
|
-
init_inject_globals();
|
|
5965
5889
|
var xsalsa20 = typeof WebAssembly !== "undefined" && require_xsalsa20()();
|
|
5966
5890
|
var SIGMA = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
|
|
5967
5891
|
var head = 144;
|
|
@@ -6321,7 +6245,6 @@ var require_xsalsa202 = __commonJS({
|
|
|
6321
6245
|
// node_modules/.pnpm/xsalsa20-universal@1.0.0/node_modules/xsalsa20-universal/browser.js
|
|
6322
6246
|
var require_browser3 = __commonJS({
|
|
6323
6247
|
"node_modules/.pnpm/xsalsa20-universal@1.0.0/node_modules/xsalsa20-universal/browser.js"(exports, module) {
|
|
6324
|
-
init_inject_globals();
|
|
6325
6248
|
var xsalsa20 = require_xsalsa202();
|
|
6326
6249
|
module.exports = class XORJS {
|
|
6327
6250
|
constructor(nonce, key) {
|
|
@@ -6340,7 +6263,6 @@ var require_browser3 = __commonJS({
|
|
|
6340
6263
|
// node_modules/.pnpm/simple-hypercore-protocol@2.1.2/node_modules/simple-hypercore-protocol/lib/xor.js
|
|
6341
6264
|
var require_xor = __commonJS({
|
|
6342
6265
|
"node_modules/.pnpm/simple-hypercore-protocol@2.1.2/node_modules/simple-hypercore-protocol/lib/xor.js"(exports, module) {
|
|
6343
|
-
init_inject_globals();
|
|
6344
6266
|
var XSalsa20 = require_browser3();
|
|
6345
6267
|
var crypto = require_hypercore_crypto();
|
|
6346
6268
|
module.exports = class XOR {
|
|
@@ -6372,7 +6294,6 @@ var require_xor = __commonJS({
|
|
|
6372
6294
|
// node_modules/.pnpm/simple-message-channels@1.2.1/node_modules/simple-message-channels/index.js
|
|
6373
6295
|
var require_simple_message_channels = __commonJS({
|
|
6374
6296
|
"node_modules/.pnpm/simple-message-channels@1.2.1/node_modules/simple-message-channels/index.js"(exports, module) {
|
|
6375
|
-
init_inject_globals();
|
|
6376
6297
|
var varint = require_varint2();
|
|
6377
6298
|
module.exports = class SimpleMessageChannels {
|
|
6378
6299
|
constructor({ maxSize = 8 * 1024 * 1024, context = null, onmessage = null, onmissing = null, types = null } = {}) {
|
|
@@ -6421,7 +6342,7 @@ var require_simple_message_channels = __commonJS({
|
|
|
6421
6342
|
}
|
|
6422
6343
|
return this._nextState(data, offset += this._length) ? offset : data.length;
|
|
6423
6344
|
}
|
|
6424
|
-
if (!this._message) this._message =
|
|
6345
|
+
if (!this._message) this._message = Buffer.allocUnsafe(this._length);
|
|
6425
6346
|
data.copy(this._message, this._message.length - this._length, offset);
|
|
6426
6347
|
this._length -= free;
|
|
6427
6348
|
return data.length;
|
|
@@ -6487,7 +6408,7 @@ var require_simple_message_channels = __commonJS({
|
|
|
6487
6408
|
send(channel, type, message) {
|
|
6488
6409
|
const header = channel << 4 | type;
|
|
6489
6410
|
const length = this._encodingLength(type, message) + varint.encodingLength(header);
|
|
6490
|
-
const payload =
|
|
6411
|
+
const payload = Buffer.allocUnsafe(varint.encodingLength(length) + length);
|
|
6491
6412
|
varint.encode(length, payload, 0);
|
|
6492
6413
|
const offset = varint.encode.bytes;
|
|
6493
6414
|
varint.encode(header, payload, offset);
|
|
@@ -6500,7 +6421,7 @@ var require_simple_message_channels = __commonJS({
|
|
|
6500
6421
|
for (const { type, message } of messages) {
|
|
6501
6422
|
length += 16 + this._encodingLength(type, message);
|
|
6502
6423
|
}
|
|
6503
|
-
const payload =
|
|
6424
|
+
const payload = Buffer.allocUnsafe(length);
|
|
6504
6425
|
for (const { channel, type, message } of messages) {
|
|
6505
6426
|
const header = channel << 4 | type;
|
|
6506
6427
|
const length2 = this._encodingLength(type, message) + varint.encodingLength(header);
|
|
@@ -6532,7 +6453,6 @@ var require_simple_message_channels = __commonJS({
|
|
|
6532
6453
|
// node_modules/.pnpm/simple-hypercore-protocol@2.1.2/node_modules/simple-hypercore-protocol/index.js
|
|
6533
6454
|
var require_simple_hypercore_protocol = __commonJS({
|
|
6534
6455
|
"node_modules/.pnpm/simple-hypercore-protocol@2.1.2/node_modules/simple-hypercore-protocol/index.js"(exports, module) {
|
|
6535
|
-
init_inject_globals();
|
|
6536
6456
|
var Handshake = require_handshake();
|
|
6537
6457
|
var messages = require_messages();
|
|
6538
6458
|
var XOR = require_xor();
|
|
@@ -6631,14 +6551,14 @@ var require_simple_hypercore_protocol = __commonJS({
|
|
|
6631
6551
|
return this._send(ch, 10, message || {});
|
|
6632
6552
|
}
|
|
6633
6553
|
extension(ch, id, message) {
|
|
6634
|
-
const buf =
|
|
6554
|
+
const buf = Buffer.allocUnsafe(varint.encodingLength(id) + message.length);
|
|
6635
6555
|
varint.encode(id, buf, 0);
|
|
6636
6556
|
message.copy(buf, varint.encode.bytes);
|
|
6637
6557
|
return this._send(ch, 15, buf);
|
|
6638
6558
|
}
|
|
6639
6559
|
ping() {
|
|
6640
6560
|
if (this._handshaking || this._pending.length) return;
|
|
6641
|
-
let ping =
|
|
6561
|
+
let ping = Buffer.from([0]);
|
|
6642
6562
|
if (this._encryption !== null) {
|
|
6643
6563
|
ping = this._encryption.encrypt(ping);
|
|
6644
6564
|
}
|
|
@@ -6766,7 +6686,6 @@ var require_simple_hypercore_protocol = __commonJS({
|
|
|
6766
6686
|
// node_modules/.pnpm/timeout-refresh@1.0.3/node_modules/timeout-refresh/browser.js
|
|
6767
6687
|
var require_browser4 = __commonJS({
|
|
6768
6688
|
"node_modules/.pnpm/timeout-refresh@1.0.3/node_modules/timeout-refresh/browser.js"(exports, module) {
|
|
6769
|
-
init_inject_globals();
|
|
6770
6689
|
module.exports = Timeout;
|
|
6771
6690
|
function Timeout(ms, fn, ctx) {
|
|
6772
6691
|
if (!(this instanceof Timeout)) return new Timeout(ms, fn, ctx);
|
|
@@ -6795,7 +6714,6 @@ var require_browser4 = __commonJS({
|
|
|
6795
6714
|
// node_modules/.pnpm/abstract-extension@3.1.1/node_modules/abstract-extension/index.js
|
|
6796
6715
|
var require_abstract_extension = __commonJS({
|
|
6797
6716
|
"node_modules/.pnpm/abstract-extension@3.1.1/node_modules/abstract-extension/index.js"(exports, module) {
|
|
6798
|
-
init_inject_globals();
|
|
6799
6717
|
var codecs = require_codecs();
|
|
6800
6718
|
var AbstractExtension = class {
|
|
6801
6719
|
constructor(local, name, handlers = {}) {
|
|
@@ -6938,7 +6856,6 @@ var require_abstract_extension = __commonJS({
|
|
|
6938
6856
|
// node_modules/.pnpm/ms@2.1.2/node_modules/ms/index.js
|
|
6939
6857
|
var require_ms = __commonJS({
|
|
6940
6858
|
"node_modules/.pnpm/ms@2.1.2/node_modules/ms/index.js"(exports, module) {
|
|
6941
|
-
init_inject_globals();
|
|
6942
6859
|
var s = 1e3;
|
|
6943
6860
|
var m = s * 60;
|
|
6944
6861
|
var h = m * 60;
|
|
@@ -7055,7 +6972,6 @@ var require_ms = __commonJS({
|
|
|
7055
6972
|
// node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/common.js
|
|
7056
6973
|
var require_common = __commonJS({
|
|
7057
6974
|
"node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/common.js"(exports, module) {
|
|
7058
|
-
init_inject_globals();
|
|
7059
6975
|
function setup(env) {
|
|
7060
6976
|
createDebug.debug = createDebug;
|
|
7061
6977
|
createDebug.default = createDebug;
|
|
@@ -7219,7 +7135,6 @@ var require_common = __commonJS({
|
|
|
7219
7135
|
// node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/browser.js
|
|
7220
7136
|
var require_browser5 = __commonJS({
|
|
7221
7137
|
"node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/browser.js"(exports, module) {
|
|
7222
|
-
init_inject_globals();
|
|
7223
7138
|
exports.formatArgs = formatArgs;
|
|
7224
7139
|
exports.save = save;
|
|
7225
7140
|
exports.load = load;
|
|
@@ -7389,7 +7304,6 @@ var require_browser5 = __commonJS({
|
|
|
7389
7304
|
// node_modules/.pnpm/hypercore-protocol@8.0.7/node_modules/hypercore-protocol/index.js
|
|
7390
7305
|
var require_hypercore_protocol = __commonJS({
|
|
7391
7306
|
"node_modules/.pnpm/hypercore-protocol@8.0.7/node_modules/hypercore-protocol/index.js"(exports, module) {
|
|
7392
|
-
init_inject_globals();
|
|
7393
7307
|
var SHP = require_simple_hypercore_protocol();
|
|
7394
7308
|
var crypto = require_hypercore_crypto();
|
|
7395
7309
|
var timeout = require_browser4();
|
|
@@ -7838,7 +7752,6 @@ var require_hypercore_protocol = __commonJS({
|
|
|
7838
7752
|
// node_modules/.pnpm/count-trailing-zeros@1.0.1/node_modules/count-trailing-zeros/ctz.js
|
|
7839
7753
|
var require_ctz = __commonJS({
|
|
7840
7754
|
"node_modules/.pnpm/count-trailing-zeros@1.0.1/node_modules/count-trailing-zeros/ctz.js"(exports, module) {
|
|
7841
|
-
init_inject_globals();
|
|
7842
7755
|
module.exports = function(v) {
|
|
7843
7756
|
var c = 32;
|
|
7844
7757
|
v &= -v;
|
|
@@ -7857,7 +7770,6 @@ var require_ctz = __commonJS({
|
|
|
7857
7770
|
var require_fast_bitfield = __commonJS({
|
|
7858
7771
|
"node_modules/.pnpm/fast-bitfield@1.2.2/node_modules/fast-bitfield/index.js"(exports, module) {
|
|
7859
7772
|
"use strict";
|
|
7860
|
-
init_inject_globals();
|
|
7861
7773
|
var ctz = require_ctz();
|
|
7862
7774
|
module.exports = () => new Bitfield();
|
|
7863
7775
|
var Page = class {
|
|
@@ -8194,7 +8106,6 @@ var require_fast_bitfield = __commonJS({
|
|
|
8194
8106
|
// node_modules/.pnpm/hypercore@9.12.0/node_modules/hypercore/lib/replicate.js
|
|
8195
8107
|
var require_replicate = __commonJS({
|
|
8196
8108
|
"node_modules/.pnpm/hypercore@9.12.0/node_modules/hypercore/lib/replicate.js"(exports, module) {
|
|
8197
|
-
init_inject_globals();
|
|
8198
8109
|
var Protocol = require_hypercore_protocol();
|
|
8199
8110
|
var timeout = require_browser4();
|
|
8200
8111
|
var bitfield = require_fast_bitfield();
|
|
@@ -8858,7 +8769,6 @@ var require_replicate = __commonJS({
|
|
|
8858
8769
|
// node_modules/.pnpm/nanoresource@1.3.0/node_modules/nanoresource/emitter.js
|
|
8859
8770
|
var require_emitter = __commonJS({
|
|
8860
8771
|
"node_modules/.pnpm/nanoresource@1.3.0/node_modules/nanoresource/emitter.js"(exports, module) {
|
|
8861
|
-
init_inject_globals();
|
|
8862
8772
|
var events = import$_dxos_node_std_events;
|
|
8863
8773
|
var inherits = require_inherits_browser();
|
|
8864
8774
|
var opening = Symbol("opening queue");
|
|
@@ -8977,7 +8887,6 @@ var require_emitter = __commonJS({
|
|
|
8977
8887
|
// packages/common/hypercore/src/empty.ts
|
|
8978
8888
|
var require_empty = __commonJS({
|
|
8979
8889
|
"packages/common/hypercore/src/empty.ts"(exports, module) {
|
|
8980
|
-
init_inject_globals();
|
|
8981
8890
|
module.exports = new Proxy({}, {
|
|
8982
8891
|
get: (target, prop) => {
|
|
8983
8892
|
throw new Error("Package has been stripped");
|
|
@@ -8989,7 +8898,6 @@ var require_empty = __commonJS({
|
|
|
8989
8898
|
// node_modules/.pnpm/hypercore-streams@1.0.1/node_modules/hypercore-streams/index.js
|
|
8990
8899
|
var require_hypercore_streams = __commonJS({
|
|
8991
8900
|
"node_modules/.pnpm/hypercore-streams@1.0.1/node_modules/hypercore-streams/index.js"(exports, module) {
|
|
8992
|
-
init_inject_globals();
|
|
8993
8901
|
var { Writable, Readable: Readable2 } = import$streamx;
|
|
8994
8902
|
var WriteStream = class extends Writable {
|
|
8995
8903
|
constructor(feed, opts) {
|
|
@@ -9061,7 +8969,6 @@ var require_hypercore_streams = __commonJS({
|
|
|
9061
8969
|
// node_modules/.pnpm/hypercore@9.12.0/node_modules/hypercore/index.js
|
|
9062
8970
|
var require_hypercore = __commonJS({
|
|
9063
8971
|
"node_modules/.pnpm/hypercore@9.12.0/node_modules/hypercore/index.js"(exports, module) {
|
|
9064
|
-
init_inject_globals();
|
|
9065
8972
|
var low = require_last_one_wins();
|
|
9066
8973
|
var remove = require_unordered_array_remove();
|
|
9067
8974
|
var set = require_unordered_set();
|
|
@@ -9114,15 +9021,15 @@ var require_hypercore = __commonJS({
|
|
|
9114
9021
|
Nanoresource.call(this);
|
|
9115
9022
|
if (typeof createStorage2 === "string") createStorage2 = defaultStorageDir(createStorage2);
|
|
9116
9023
|
if (typeof createStorage2 !== "function") throw new Error("Storage should be a function or string");
|
|
9117
|
-
if (typeof key === "string") key =
|
|
9118
|
-
if (!
|
|
9024
|
+
if (typeof key === "string") key = Buffer.from(key, "hex");
|
|
9025
|
+
if (!Buffer.isBuffer(key) && !opts) {
|
|
9119
9026
|
opts = key;
|
|
9120
9027
|
key = null;
|
|
9121
9028
|
}
|
|
9122
9029
|
if (!opts) opts = {};
|
|
9123
9030
|
var self = this;
|
|
9124
9031
|
var secretKey = opts.secretKey || null;
|
|
9125
|
-
if (typeof secretKey === "string") secretKey =
|
|
9032
|
+
if (typeof secretKey === "string") secretKey = Buffer.from(secretKey, "hex");
|
|
9126
9033
|
this.noiseKeyPair = opts.noiseKeyPair || Protocol.keyPair();
|
|
9127
9034
|
this.live = opts.live !== false;
|
|
9128
9035
|
this.sparse = !!opts.sparse;
|
|
@@ -9424,7 +9331,7 @@ var require_hypercore = __commonJS({
|
|
|
9424
9331
|
if (!state.key && state.bitfield.length) {
|
|
9425
9332
|
self._overwrite = true;
|
|
9426
9333
|
}
|
|
9427
|
-
if (self._force && state.key && self.key &&
|
|
9334
|
+
if (self._force && state.key && self.key && Buffer.compare(state.key, self.key) !== 0) {
|
|
9428
9335
|
self._overwrite = true;
|
|
9429
9336
|
}
|
|
9430
9337
|
if (self._overwrite) {
|
|
@@ -9435,7 +9342,7 @@ var require_hypercore = __commonJS({
|
|
|
9435
9342
|
self.tree = treeIndex(self.bitfield.tree);
|
|
9436
9343
|
self.length = self.tree.blocks();
|
|
9437
9344
|
self._seq = self.length;
|
|
9438
|
-
if (state.key && self.key &&
|
|
9345
|
+
if (state.key && self.key && Buffer.compare(state.key, self.key) !== 0) {
|
|
9439
9346
|
return self._forceClose(cb, new Error("Another hypercore is stored here"));
|
|
9440
9347
|
}
|
|
9441
9348
|
if (state.key) self.key = state.key;
|
|
@@ -9963,7 +9870,7 @@ var require_hypercore = __commonJS({
|
|
|
9963
9870
|
write();
|
|
9964
9871
|
});
|
|
9965
9872
|
} else {
|
|
9966
|
-
if (
|
|
9873
|
+
if (Buffer.compare(checksum.slice(0, 32), self.key) !== 0) {
|
|
9967
9874
|
return cb(new Error("Remote checksum failed"));
|
|
9968
9875
|
}
|
|
9969
9876
|
write();
|
|
@@ -10250,7 +10157,7 @@ var require_hypercore = __commonJS({
|
|
|
10250
10157
|
if (!this._indexing) {
|
|
10251
10158
|
pending++;
|
|
10252
10159
|
if (dataBatch.length === 1) this._storage.data.write(this.byteLength, dataBatch[0], done);
|
|
10253
|
-
else this._storage.data.write(this.byteLength,
|
|
10160
|
+
else this._storage.data.write(this.byteLength, Buffer.concat(dataBatch), done);
|
|
10254
10161
|
}
|
|
10255
10162
|
this._storage.putNodeBatch(nodeOffset, nodeBatch, done);
|
|
10256
10163
|
function done(err) {
|
|
@@ -10377,7 +10284,7 @@ var require_hypercore = __commonJS({
|
|
|
10377
10284
|
function noop() {
|
|
10378
10285
|
}
|
|
10379
10286
|
function verifyNode(trusted, node) {
|
|
10380
|
-
return trusted && trusted.index === node.index &&
|
|
10287
|
+
return trusted && trusted.index === node.index && Buffer.compare(trusted.hash, node.hash) === 0;
|
|
10381
10288
|
}
|
|
10382
10289
|
function addSize(size, node) {
|
|
10383
10290
|
return size + node.size;
|
|
@@ -10445,11 +10352,9 @@ var require_hypercore = __commonJS({
|
|
|
10445
10352
|
});
|
|
10446
10353
|
|
|
10447
10354
|
// packages/common/hypercore/src/index.ts
|
|
10448
|
-
init_inject_globals();
|
|
10449
10355
|
var import_hypercore2 = __toESM(require_hypercore());
|
|
10450
10356
|
|
|
10451
10357
|
// packages/common/hypercore/src/crypto.ts
|
|
10452
|
-
init_inject_globals();
|
|
10453
10358
|
import { callbackify } from "@dxos/node-std/util";
|
|
10454
10359
|
import { verifySignature } from "@dxos/crypto";
|
|
10455
10360
|
import { invariant } from "@dxos/invariant";
|
|
@@ -10495,7 +10400,6 @@ var createCrypto = (signer, publicKey) => {
|
|
|
10495
10400
|
};
|
|
10496
10401
|
|
|
10497
10402
|
// packages/common/hypercore/src/defaults.ts
|
|
10498
|
-
init_inject_globals();
|
|
10499
10403
|
var defaultFeedOptions = {
|
|
10500
10404
|
createIfMissing: true,
|
|
10501
10405
|
valueEncoding: "binary"
|
|
@@ -10523,13 +10427,11 @@ var defaultReplicateOptions = {
|
|
|
10523
10427
|
};
|
|
10524
10428
|
|
|
10525
10429
|
// packages/common/hypercore/src/hypercore-factory.ts
|
|
10526
|
-
init_inject_globals();
|
|
10527
10430
|
var import_hypercore = __toESM(require_hypercore());
|
|
10528
10431
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
10529
10432
|
import { createStorage, StorageType } from "@dxos/random-access-storage";
|
|
10530
10433
|
|
|
10531
10434
|
// packages/common/hypercore/src/util.ts
|
|
10532
|
-
init_inject_globals();
|
|
10533
10435
|
import util from "@dxos/node-std/util";
|
|
10534
10436
|
var py = (obj, fn) => util.promisify(fn.bind(obj));
|
|
10535
10437
|
|
|
@@ -10572,7 +10474,6 @@ var HypercoreFactory = class {
|
|
|
10572
10474
|
};
|
|
10573
10475
|
|
|
10574
10476
|
// packages/common/hypercore/src/iterator.ts
|
|
10575
|
-
init_inject_globals();
|
|
10576
10477
|
import { Readable } from "readable-stream";
|
|
10577
10478
|
var createReadable = (stream) => {
|
|
10578
10479
|
return new Readable({
|