@leofcoin/peernet 1.2.21 → 1.2.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/exports/browser/{browser-FVp_QbaL.js → browser-DEjI2nFg.js} +1 -1
- package/exports/browser/{browser-8BFql6K9.js → browser-tK3uOLQV.js} +1 -1
- package/exports/browser/{client-lPe0SUWx.js → client-Ba1cHcxF.js} +19 -14
- package/exports/browser/{identity-BeVZQ2Dp.js → identity-CjBX8cWv.js} +1805 -1805
- package/exports/browser/identity.js +1 -1
- package/exports/browser/{index-D6qd-AUn.js → index-DIhxISkU.js} +1 -1
- package/exports/browser/{messages-BfDvXW-x.js → messages-BX59GgBQ.js} +2 -2
- package/exports/browser/{peernet-DFiLLjUD.js → peernet-D3z5pEBD.js} +154 -82
- package/exports/browser/peernet.js +2 -2
- package/exports/peernet.js +5 -1
- package/exports/store.js +3 -0
- package/exports/types/peernet.d.ts +2 -0
- package/package.json +4 -3
- package/src/peernet.ts +5 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { I as default } from './identity-
|
|
1
|
+
export { I as default } from './identity-CjBX8cWv.js';
|
|
2
2
|
import 'crypto';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as index$2, b as base, a as base58$1, c as index$3, d as index$4, e as index$5, f as createSHA512, g as createSHA384, h as createSHA256, j as createSHA224, k as createSHA1, I as Identity } from './identity-CjBX8cWv.js';
|
|
2
2
|
import { K as KeyPath, a as KeyValue } from './value-C3vAp-wb.js';
|
|
3
3
|
|
|
4
4
|
const getTargets = () => Array.from([]);
|
|
@@ -126,7 +126,7 @@ var isHex = string => /^[A-F0-9]+$/i.test(
|
|
|
126
126
|
string
|
|
127
127
|
);
|
|
128
128
|
|
|
129
|
-
/*! pako 2.
|
|
129
|
+
/*! pako 2.2.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */
|
|
130
130
|
// (C) 1995-2013 Jean-loup Gailly and Mark Adler
|
|
131
131
|
// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
|
|
132
132
|
//
|
|
@@ -1548,7 +1548,7 @@ const { _tr_init, _tr_stored_block, _tr_flush_block, _tr_tally, _tr_align } = tr
|
|
|
1548
1548
|
|
|
1549
1549
|
const {
|
|
1550
1550
|
Z_NO_FLUSH: Z_NO_FLUSH$2, Z_PARTIAL_FLUSH, Z_FULL_FLUSH: Z_FULL_FLUSH$1, Z_FINISH: Z_FINISH$3, Z_BLOCK: Z_BLOCK$1,
|
|
1551
|
-
Z_OK: Z_OK$3, Z_STREAM_END: Z_STREAM_END$3, Z_STREAM_ERROR: Z_STREAM_ERROR$2, Z_DATA_ERROR: Z_DATA_ERROR$2, Z_BUF_ERROR: Z_BUF_ERROR$
|
|
1551
|
+
Z_OK: Z_OK$3, Z_STREAM_END: Z_STREAM_END$3, Z_STREAM_ERROR: Z_STREAM_ERROR$2, Z_DATA_ERROR: Z_DATA_ERROR$2, Z_BUF_ERROR: Z_BUF_ERROR$2,
|
|
1552
1552
|
Z_DEFAULT_COMPRESSION: Z_DEFAULT_COMPRESSION$1,
|
|
1553
1553
|
Z_FILTERED, Z_HUFFMAN_ONLY, Z_RLE, Z_FIXED, Z_DEFAULT_STRATEGY: Z_DEFAULT_STRATEGY$1,
|
|
1554
1554
|
Z_UNKNOWN,
|
|
@@ -1647,11 +1647,35 @@ const slide_hash = (s) => {
|
|
|
1647
1647
|
};
|
|
1648
1648
|
|
|
1649
1649
|
/* eslint-disable new-cap */
|
|
1650
|
-
let
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1650
|
+
let HASH = (s, prev, data) => ((prev << s.hash_shift) ^ data) & s.hash_mask;
|
|
1651
|
+
|
|
1652
|
+
|
|
1653
|
+
/* ===========================================================================
|
|
1654
|
+
* Insert string str in the dictionary and set match_head to the previous head
|
|
1655
|
+
* of the hash chain (the most recent string with same hash key). Return
|
|
1656
|
+
* the previous length of the hash chain.
|
|
1657
|
+
* IN assertion: all calls to INSERT_STRING are made with consecutive input
|
|
1658
|
+
* characters and the first MIN_MATCH bytes of str are valid (except for
|
|
1659
|
+
* the last MIN_MATCH-1 bytes of the input file).
|
|
1660
|
+
*/
|
|
1661
|
+
const INSERT_STRING = (s, str) => {
|
|
1662
|
+
let h;
|
|
1663
|
+
if (s.legacy_hash) {
|
|
1664
|
+
/* UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]); */
|
|
1665
|
+
h = s.ins_h = HASH(s, s.ins_h, s.window[str + MIN_MATCH - 1]);
|
|
1666
|
+
} else {
|
|
1667
|
+
// ANZAC++ hash: reads 4 bytes, matches node.js zlib output (legacyHash
|
|
1668
|
+
// restores classic zlib hash). Faster, with fewer collisions.
|
|
1669
|
+
const w = s.window;
|
|
1670
|
+
// Read 4 bytes little-endian. Math.imul reproduces C uint32 overflow in
|
|
1671
|
+
// `(value * 66521 + 66521) >> 16` exactly.
|
|
1672
|
+
const value = w[str] | (w[str + 1] << 8) | (w[str + 2] << 16) | (w[str + 3] << 24);
|
|
1673
|
+
h = s.ins_h = ((Math.imul(value, 66521) + 66521) >>> 16) & s.hash_mask;
|
|
1674
|
+
}
|
|
1675
|
+
const hash_head = s.prev[str & s.w_mask] = s.head[h];
|
|
1676
|
+
s.head[h] = str;
|
|
1677
|
+
return hash_head;
|
|
1678
|
+
};
|
|
1655
1679
|
|
|
1656
1680
|
|
|
1657
1681
|
/* =========================================================================
|
|
@@ -1925,7 +1949,20 @@ const fill_window = (s) => {
|
|
|
1925
1949
|
s.lookahead += n;
|
|
1926
1950
|
|
|
1927
1951
|
/* Initialize the hash value now that we have some input: */
|
|
1928
|
-
if (s.
|
|
1952
|
+
if (!s.legacy_hash) {
|
|
1953
|
+
/* The 4-byte hash reads one extra byte, so it needs one more available. */
|
|
1954
|
+
if (s.lookahead + s.insert > MIN_MATCH) {
|
|
1955
|
+
str = s.strstart - s.insert;
|
|
1956
|
+
while (s.insert) {
|
|
1957
|
+
INSERT_STRING(s, str);
|
|
1958
|
+
str++;
|
|
1959
|
+
s.insert--;
|
|
1960
|
+
if (s.lookahead + s.insert <= MIN_MATCH) {
|
|
1961
|
+
break;
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
} else if (s.lookahead + s.insert >= MIN_MATCH) {
|
|
1929
1966
|
str = s.strstart - s.insert;
|
|
1930
1967
|
s.ins_h = s.window[str];
|
|
1931
1968
|
|
|
@@ -1935,11 +1972,7 @@ const fill_window = (s) => {
|
|
|
1935
1972
|
// Call update_hash() MIN_MATCH-3 more times
|
|
1936
1973
|
//#endif
|
|
1937
1974
|
while (s.insert) {
|
|
1938
|
-
|
|
1939
|
-
s.ins_h = HASH(s, s.ins_h, s.window[str + MIN_MATCH - 1]);
|
|
1940
|
-
|
|
1941
|
-
s.prev[str & s.w_mask] = s.head[s.ins_h];
|
|
1942
|
-
s.head[s.ins_h] = str;
|
|
1975
|
+
INSERT_STRING(s, str);
|
|
1943
1976
|
str++;
|
|
1944
1977
|
s.insert--;
|
|
1945
1978
|
if (s.lookahead + s.insert < MIN_MATCH) {
|
|
@@ -2237,11 +2270,7 @@ const deflate_fast = (s, flush) => {
|
|
|
2237
2270
|
*/
|
|
2238
2271
|
hash_head = 0/*NIL*/;
|
|
2239
2272
|
if (s.lookahead >= MIN_MATCH) {
|
|
2240
|
-
|
|
2241
|
-
s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]);
|
|
2242
|
-
hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
|
|
2243
|
-
s.head[s.ins_h] = s.strstart;
|
|
2244
|
-
/***/
|
|
2273
|
+
hash_head = INSERT_STRING(s, s.strstart);
|
|
2245
2274
|
}
|
|
2246
2275
|
|
|
2247
2276
|
/* Find the longest match, discarding those <= prev_length.
|
|
@@ -2271,11 +2300,7 @@ const deflate_fast = (s, flush) => {
|
|
|
2271
2300
|
s.match_length--; /* string at strstart already in table */
|
|
2272
2301
|
do {
|
|
2273
2302
|
s.strstart++;
|
|
2274
|
-
|
|
2275
|
-
s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]);
|
|
2276
|
-
hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
|
|
2277
|
-
s.head[s.ins_h] = s.strstart;
|
|
2278
|
-
/***/
|
|
2303
|
+
hash_head = INSERT_STRING(s, s.strstart);
|
|
2279
2304
|
/* strstart never exceeds WSIZE-MAX_MATCH, so there are
|
|
2280
2305
|
* always MIN_MATCH bytes ahead.
|
|
2281
2306
|
*/
|
|
@@ -2285,16 +2310,18 @@ const deflate_fast = (s, flush) => {
|
|
|
2285
2310
|
{
|
|
2286
2311
|
s.strstart += s.match_length;
|
|
2287
2312
|
s.match_length = 0;
|
|
2288
|
-
s.
|
|
2289
|
-
|
|
2290
|
-
|
|
2313
|
+
if (s.legacy_hash) {
|
|
2314
|
+
s.ins_h = s.window[s.strstart];
|
|
2315
|
+
/* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */
|
|
2316
|
+
s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + 1]);
|
|
2291
2317
|
|
|
2292
2318
|
//#if MIN_MATCH != 3
|
|
2293
2319
|
// Call UPDATE_HASH() MIN_MATCH-3 more times
|
|
2294
2320
|
//#endif
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2321
|
+
/* If lookahead < MIN_MATCH, ins_h is garbage, but it does not
|
|
2322
|
+
* matter since it will be recomputed at next deflate call.
|
|
2323
|
+
*/
|
|
2324
|
+
}
|
|
2298
2325
|
}
|
|
2299
2326
|
} else {
|
|
2300
2327
|
/* No match, output a literal byte */
|
|
@@ -2367,11 +2394,7 @@ const deflate_slow = (s, flush) => {
|
|
|
2367
2394
|
*/
|
|
2368
2395
|
hash_head = 0/*NIL*/;
|
|
2369
2396
|
if (s.lookahead >= MIN_MATCH) {
|
|
2370
|
-
|
|
2371
|
-
s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]);
|
|
2372
|
-
hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
|
|
2373
|
-
s.head[s.ins_h] = s.strstart;
|
|
2374
|
-
/***/
|
|
2397
|
+
hash_head = INSERT_STRING(s, s.strstart);
|
|
2375
2398
|
}
|
|
2376
2399
|
|
|
2377
2400
|
/* Find the longest match, discarding those <= prev_length.
|
|
@@ -2419,11 +2442,7 @@ const deflate_slow = (s, flush) => {
|
|
|
2419
2442
|
s.prev_length -= 2;
|
|
2420
2443
|
do {
|
|
2421
2444
|
if (++s.strstart <= max_insert) {
|
|
2422
|
-
|
|
2423
|
-
s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]);
|
|
2424
|
-
hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
|
|
2425
|
-
s.head[s.ins_h] = s.strstart;
|
|
2426
|
-
/***/
|
|
2445
|
+
hash_head = INSERT_STRING(s, s.strstart);
|
|
2427
2446
|
}
|
|
2428
2447
|
} while (--s.prev_length !== 0);
|
|
2429
2448
|
s.match_available = 0;
|
|
@@ -2748,6 +2767,7 @@ function DeflateState() {
|
|
|
2748
2767
|
this.head = null; /* Heads of the hash chains or NIL. */
|
|
2749
2768
|
|
|
2750
2769
|
this.ins_h = 0; /* hash index of string to be inserted */
|
|
2770
|
+
this.legacy_hash = 0; /* use classic zlib hash instead of default ANZAC++ */
|
|
2751
2771
|
this.hash_size = 0; /* number of elements in hash table */
|
|
2752
2772
|
this.hash_bits = 0; /* log2(hash_size) */
|
|
2753
2773
|
this.hash_mask = 0; /* hash_size-1 */
|
|
@@ -2970,7 +2990,7 @@ const deflateSetHeader = (strm, head) => {
|
|
|
2970
2990
|
};
|
|
2971
2991
|
|
|
2972
2992
|
|
|
2973
|
-
const deflateInit2 = (strm, level, method, windowBits, memLevel, strategy) => {
|
|
2993
|
+
const deflateInit2 = (strm, level, method, windowBits, memLevel, strategy, legacyHash) => {
|
|
2974
2994
|
|
|
2975
2995
|
if (!strm) { // === Z_NULL
|
|
2976
2996
|
return Z_STREAM_ERROR$2;
|
|
@@ -3016,7 +3036,13 @@ const deflateInit2 = (strm, level, method, windowBits, memLevel, strategy) => {
|
|
|
3016
3036
|
s.w_size = 1 << s.w_bits;
|
|
3017
3037
|
s.w_mask = s.w_size - 1;
|
|
3018
3038
|
|
|
3039
|
+
s.legacy_hash = legacyHash ? 1 : 0;
|
|
3040
|
+
|
|
3019
3041
|
s.hash_bits = memLevel + 7;
|
|
3042
|
+
/* ANZAC++ hash needs >= 15 hash bits to span its 4 read bytes. */
|
|
3043
|
+
if (!s.legacy_hash && s.hash_bits < 15) {
|
|
3044
|
+
s.hash_bits = 15;
|
|
3045
|
+
}
|
|
3020
3046
|
s.hash_size = 1 << s.hash_bits;
|
|
3021
3047
|
s.hash_mask = s.hash_size - 1;
|
|
3022
3048
|
s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);
|
|
@@ -3108,7 +3134,7 @@ const deflate$2 = (strm, flush) => {
|
|
|
3108
3134
|
if (!strm.output ||
|
|
3109
3135
|
(strm.avail_in !== 0 && !strm.input) ||
|
|
3110
3136
|
(s.status === FINISH_STATE && flush !== Z_FINISH$3)) {
|
|
3111
|
-
return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR$
|
|
3137
|
+
return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR$2 : Z_STREAM_ERROR$2);
|
|
3112
3138
|
}
|
|
3113
3139
|
|
|
3114
3140
|
const old_flush = s.last_flush;
|
|
@@ -3134,12 +3160,12 @@ const deflate$2 = (strm, flush) => {
|
|
|
3134
3160
|
*/
|
|
3135
3161
|
} else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&
|
|
3136
3162
|
flush !== Z_FINISH$3) {
|
|
3137
|
-
return err(strm, Z_BUF_ERROR$
|
|
3163
|
+
return err(strm, Z_BUF_ERROR$2);
|
|
3138
3164
|
}
|
|
3139
3165
|
|
|
3140
3166
|
/* User must not provide more input after the first FINISH: */
|
|
3141
3167
|
if (s.status === FINISH_STATE && strm.avail_in !== 0) {
|
|
3142
|
-
return err(strm, Z_BUF_ERROR$
|
|
3168
|
+
return err(strm, Z_BUF_ERROR$2);
|
|
3143
3169
|
}
|
|
3144
3170
|
|
|
3145
3171
|
/* Write the header */
|
|
@@ -3520,12 +3546,7 @@ const deflateSetDictionary = (strm, dictionary) => {
|
|
|
3520
3546
|
let str = s.strstart;
|
|
3521
3547
|
let n = s.lookahead - (MIN_MATCH - 1);
|
|
3522
3548
|
do {
|
|
3523
|
-
|
|
3524
|
-
s.ins_h = HASH(s, s.ins_h, s.window[str + MIN_MATCH - 1]);
|
|
3525
|
-
|
|
3526
|
-
s.prev[str & s.w_mask] = s.head[s.ins_h];
|
|
3527
|
-
|
|
3528
|
-
s.head[s.ins_h] = str;
|
|
3549
|
+
INSERT_STRING(s, str);
|
|
3529
3550
|
str++;
|
|
3530
3551
|
} while (--n);
|
|
3531
3552
|
s.strstart = str;
|
|
@@ -3649,7 +3670,7 @@ const _utf8len = new Uint8Array(256);
|
|
|
3649
3670
|
for (let q = 0; q < 256; q++) {
|
|
3650
3671
|
_utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);
|
|
3651
3672
|
}
|
|
3652
|
-
_utf8len[254] = _utf8len[
|
|
3673
|
+
_utf8len[254] = _utf8len[255] = 1; // Invalid sequence start
|
|
3653
3674
|
|
|
3654
3675
|
|
|
3655
3676
|
// convert string to array (typed, when possible)
|
|
@@ -3870,6 +3891,15 @@ const {
|
|
|
3870
3891
|
|
|
3871
3892
|
/* ===========================================================================*/
|
|
3872
3893
|
|
|
3894
|
+
const defaultOptions$1 = {
|
|
3895
|
+
level: Z_DEFAULT_COMPRESSION,
|
|
3896
|
+
method: Z_DEFLATED$1,
|
|
3897
|
+
chunkSize: 16384,
|
|
3898
|
+
windowBits: 15,
|
|
3899
|
+
memLevel: 8,
|
|
3900
|
+
strategy: Z_DEFAULT_STRATEGY,
|
|
3901
|
+
legacyHash: true
|
|
3902
|
+
};
|
|
3873
3903
|
|
|
3874
3904
|
/**
|
|
3875
3905
|
* class Deflate
|
|
@@ -3925,6 +3955,10 @@ const {
|
|
|
3925
3955
|
* [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)
|
|
3926
3956
|
* for more information on these.
|
|
3927
3957
|
*
|
|
3958
|
+
* - `legacyHash` (Boolean) - use the classic zlib hash (default), which matches
|
|
3959
|
+
* canonical zlib output byte-for-byte. Set to `false` to use the faster
|
|
3960
|
+
* ANZAC++ hash, which matches recent (chromium) node.js output instead.
|
|
3961
|
+
*
|
|
3928
3962
|
* Additional options, for internal needs:
|
|
3929
3963
|
*
|
|
3930
3964
|
* - `chunkSize` - size of generated data chunks (16K by default)
|
|
@@ -3957,14 +3991,7 @@ const {
|
|
|
3957
3991
|
* ```
|
|
3958
3992
|
**/
|
|
3959
3993
|
function Deflate$1(options) {
|
|
3960
|
-
this.options = common.assign({
|
|
3961
|
-
level: Z_DEFAULT_COMPRESSION,
|
|
3962
|
-
method: Z_DEFLATED$1,
|
|
3963
|
-
chunkSize: 16384,
|
|
3964
|
-
windowBits: 15,
|
|
3965
|
-
memLevel: 8,
|
|
3966
|
-
strategy: Z_DEFAULT_STRATEGY
|
|
3967
|
-
}, options || {});
|
|
3994
|
+
this.options = common.assign({}, defaultOptions$1, options || {});
|
|
3968
3995
|
|
|
3969
3996
|
let opt = this.options;
|
|
3970
3997
|
|
|
@@ -3990,7 +4017,8 @@ function Deflate$1(options) {
|
|
|
3990
4017
|
opt.method,
|
|
3991
4018
|
opt.windowBits,
|
|
3992
4019
|
opt.memLevel,
|
|
3993
|
-
opt.strategy
|
|
4020
|
+
opt.strategy,
|
|
4021
|
+
opt.legacyHash
|
|
3994
4022
|
);
|
|
3995
4023
|
|
|
3996
4024
|
if (status !== Z_OK$2) {
|
|
@@ -4610,7 +4638,7 @@ const lbase = new Uint16Array([ /* Length codes 257..285 base */
|
|
|
4610
4638
|
|
|
4611
4639
|
const lext = new Uint8Array([ /* Length codes 257..285 extra */
|
|
4612
4640
|
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
|
|
4613
|
-
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16,
|
|
4641
|
+
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 199, 75
|
|
4614
4642
|
]);
|
|
4615
4643
|
|
|
4616
4644
|
const dbase = new Uint16Array([ /* Distance codes 0..29 base */
|
|
@@ -4947,7 +4975,7 @@ const DISTS = 2;
|
|
|
4947
4975
|
|
|
4948
4976
|
const {
|
|
4949
4977
|
Z_FINISH: Z_FINISH$1, Z_BLOCK, Z_TREES,
|
|
4950
|
-
Z_OK: Z_OK$1, Z_STREAM_END: Z_STREAM_END$1, Z_NEED_DICT: Z_NEED_DICT$1, Z_STREAM_ERROR: Z_STREAM_ERROR$1, Z_DATA_ERROR: Z_DATA_ERROR$1, Z_MEM_ERROR: Z_MEM_ERROR$1, Z_BUF_ERROR,
|
|
4978
|
+
Z_OK: Z_OK$1, Z_STREAM_END: Z_STREAM_END$1, Z_NEED_DICT: Z_NEED_DICT$1, Z_STREAM_ERROR: Z_STREAM_ERROR$1, Z_DATA_ERROR: Z_DATA_ERROR$1, Z_MEM_ERROR: Z_MEM_ERROR$1, Z_BUF_ERROR: Z_BUF_ERROR$1,
|
|
4951
4979
|
Z_DEFLATED
|
|
4952
4980
|
} = constants$2;
|
|
4953
4981
|
|
|
@@ -5257,11 +5285,14 @@ const updatewindow = (strm, src, end, copy) => {
|
|
|
5257
5285
|
|
|
5258
5286
|
/* if it hasn't been done already, allocate space for the window */
|
|
5259
5287
|
if (state.window === null) {
|
|
5288
|
+
state.window = new Uint8Array(1 << state.wbits);
|
|
5289
|
+
}
|
|
5290
|
+
|
|
5291
|
+
/* if window not in use yet, initialize */
|
|
5292
|
+
if (state.wsize === 0) {
|
|
5260
5293
|
state.wsize = 1 << state.wbits;
|
|
5261
5294
|
state.wnext = 0;
|
|
5262
5295
|
state.whave = 0;
|
|
5263
|
-
|
|
5264
|
-
state.window = new Uint8Array(state.wsize);
|
|
5265
5296
|
}
|
|
5266
5297
|
|
|
5267
5298
|
/* copy state->wsize or less output bytes into the circular window */
|
|
@@ -6387,7 +6418,7 @@ const inflate$2 = (strm, flush) => {
|
|
|
6387
6418
|
(state.mode === TYPE ? 128 : 0) +
|
|
6388
6419
|
(state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);
|
|
6389
6420
|
if (((_in === 0 && _out === 0) || flush === Z_FINISH$1) && ret === Z_OK$1) {
|
|
6390
|
-
ret = Z_BUF_ERROR;
|
|
6421
|
+
ret = Z_BUF_ERROR$1;
|
|
6391
6422
|
}
|
|
6392
6423
|
return ret;
|
|
6393
6424
|
};
|
|
@@ -6559,11 +6590,16 @@ const toString$2 = Object.prototype.toString;
|
|
|
6559
6590
|
|
|
6560
6591
|
const {
|
|
6561
6592
|
Z_NO_FLUSH, Z_FINISH,
|
|
6562
|
-
Z_OK, Z_STREAM_END, Z_NEED_DICT, Z_STREAM_ERROR, Z_DATA_ERROR, Z_MEM_ERROR
|
|
6593
|
+
Z_OK, Z_STREAM_END, Z_NEED_DICT, Z_STREAM_ERROR, Z_DATA_ERROR, Z_MEM_ERROR, Z_BUF_ERROR
|
|
6563
6594
|
} = constants$2;
|
|
6564
6595
|
|
|
6565
6596
|
/* ===========================================================================*/
|
|
6566
6597
|
|
|
6598
|
+
const defaultOptions$2 = {
|
|
6599
|
+
chunkSize: 1024 * 64,
|
|
6600
|
+
windowBits: 15,
|
|
6601
|
+
to: ''
|
|
6602
|
+
};
|
|
6567
6603
|
|
|
6568
6604
|
/**
|
|
6569
6605
|
* class Inflate
|
|
@@ -6643,11 +6679,7 @@ const {
|
|
|
6643
6679
|
* ```
|
|
6644
6680
|
**/
|
|
6645
6681
|
function Inflate$1(options) {
|
|
6646
|
-
this.options = common.assign({
|
|
6647
|
-
chunkSize: 1024 * 64,
|
|
6648
|
-
windowBits: 15,
|
|
6649
|
-
to: ''
|
|
6650
|
-
}, options || {});
|
|
6682
|
+
this.options = common.assign({}, defaultOptions$2, options || {});
|
|
6651
6683
|
|
|
6652
6684
|
const opt = this.options;
|
|
6653
6685
|
|
|
@@ -6778,11 +6810,19 @@ Inflate$1.prototype.push = function (data, flush_mode) {
|
|
|
6778
6810
|
}
|
|
6779
6811
|
}
|
|
6780
6812
|
|
|
6781
|
-
//
|
|
6813
|
+
// Only the gzip format defines concatenated members (RFC 1952: a gzip file
|
|
6814
|
+
// is "a series of members"). A zlib stream (RFC 1950) ends after its
|
|
6815
|
+
// ADLER32, and a raw DEFLATE stream (RFC 1951) ends after its final block -
|
|
6816
|
+
// neither format allows anything to follow, so bytes after the end are not
|
|
6817
|
+
// ours to interpret and must be left in the input. Restart decoding only
|
|
6818
|
+
// for a gzip member: `state.flags` is non-zero only once a gzip header has
|
|
6819
|
+
// actually been decoded (it stays 0 for a zlib member, even when the format
|
|
6820
|
+
// was auto-detected and the gzip bit of `wrap` is set). A trailing zero
|
|
6821
|
+
// byte is padding, not the start of a member (no member can begin with 0).
|
|
6782
6822
|
while (strm.avail_in > 0 &&
|
|
6783
6823
|
status === Z_STREAM_END &&
|
|
6784
|
-
strm.state.wrap
|
|
6785
|
-
|
|
6824
|
+
(strm.state.wrap & 2) && strm.state.flags !== 0 &&
|
|
6825
|
+
strm.input[strm.next_in] !== 0)
|
|
6786
6826
|
{
|
|
6787
6827
|
inflate_1$2.inflateReset(strm);
|
|
6788
6828
|
status = inflate_1$2.inflate(strm, _flush_mode);
|
|
@@ -6803,7 +6843,9 @@ Inflate$1.prototype.push = function (data, flush_mode) {
|
|
|
6803
6843
|
last_avail_out = strm.avail_out;
|
|
6804
6844
|
|
|
6805
6845
|
if (strm.next_out) {
|
|
6806
|
-
if
|
|
6846
|
+
// Flush output if buffer is full, stream ended, or an explicit flush was
|
|
6847
|
+
// requested (e.g. Z_SYNC_FLUSH) - to push out the tail, same as node's zlib.
|
|
6848
|
+
if (strm.avail_out === 0 || status === Z_STREAM_END || _flush_mode > 0) {
|
|
6807
6849
|
|
|
6808
6850
|
if (this.options.to === 'string') {
|
|
6809
6851
|
|
|
@@ -6821,12 +6863,22 @@ Inflate$1.prototype.push = function (data, flush_mode) {
|
|
|
6821
6863
|
|
|
6822
6864
|
} else {
|
|
6823
6865
|
this.onData(strm.output.length === strm.next_out ? strm.output : strm.output.subarray(0, strm.next_out));
|
|
6866
|
+
|
|
6867
|
+
// Force a fresh output buffer on next iteration / next push, so the
|
|
6868
|
+
// already emitted tail is not sent again.
|
|
6869
|
+
strm.avail_out = 0;
|
|
6870
|
+
strm.next_out = 0;
|
|
6824
6871
|
}
|
|
6825
6872
|
}
|
|
6826
6873
|
}
|
|
6827
6874
|
|
|
6828
|
-
//
|
|
6829
|
-
|
|
6875
|
+
// A full output buffer means there may be more to produce - allocate a new
|
|
6876
|
+
// one and call inflate again. The status depends on the flush mode: with
|
|
6877
|
+
// Z_NO_FLUSH a full buffer is reported as Z_OK, but with Z_FINISH the same
|
|
6878
|
+
// situation is reported as Z_BUF_ERROR ("could not make progress now",
|
|
6879
|
+
// non-fatal) even though output is still pending. Both must continue; the
|
|
6880
|
+
// distinction that matters is purely "was the output buffer exhausted".
|
|
6881
|
+
if ((status === Z_OK || status === Z_BUF_ERROR) && last_avail_out === 0) continue;
|
|
6830
6882
|
|
|
6831
6883
|
// Finalize if end of stream reached.
|
|
6832
6884
|
if (status === Z_STREAM_END) {
|
|
@@ -6836,7 +6888,23 @@ Inflate$1.prototype.push = function (data, flush_mode) {
|
|
|
6836
6888
|
return true;
|
|
6837
6889
|
}
|
|
6838
6890
|
|
|
6839
|
-
if (strm.avail_in === 0)
|
|
6891
|
+
if (strm.avail_in === 0) {
|
|
6892
|
+
// Input is exhausted. If the caller declared this the end of the stream
|
|
6893
|
+
// (Z_FINISH) but we never saw Z_STREAM_END, the compressed data ended
|
|
6894
|
+
// before its terminating marker - i.e. it is truncated/incomplete. That
|
|
6895
|
+
// is an error: returning the partial output as success would be
|
|
6896
|
+
// indistinguishable from a complete decode, hiding the data loss. Report
|
|
6897
|
+
// it via Z_BUF_ERROR. (Reached only when the output buffer still had room
|
|
6898
|
+
// - a full buffer is handled by the `continue` above - so this genuinely
|
|
6899
|
+
// means "ran out of input", not "ran out of output".)
|
|
6900
|
+
if (_flush_mode === Z_FINISH) {
|
|
6901
|
+
status = inflate_1$2.inflateEnd(this.strm);
|
|
6902
|
+
this.onEnd(status === Z_OK ? Z_BUF_ERROR : status);
|
|
6903
|
+
this.ended = true;
|
|
6904
|
+
return false;
|
|
6905
|
+
}
|
|
6906
|
+
break;
|
|
6907
|
+
}
|
|
6840
6908
|
}
|
|
6841
6909
|
|
|
6842
6910
|
return true;
|
|
@@ -6922,7 +6990,7 @@ Inflate$1.prototype.onEnd = function (status) {
|
|
|
6922
6990
|
function inflate$1(input, options) {
|
|
6923
6991
|
const inflator = new Inflate$1(options);
|
|
6924
6992
|
|
|
6925
|
-
inflator.push(input);
|
|
6993
|
+
inflator.push(input, true);
|
|
6926
6994
|
|
|
6927
6995
|
// That will never happens, if you don't cheat with options :)
|
|
6928
6996
|
if (inflator.err) throw inflator.msg || messages[inflator.err];
|
|
@@ -8417,6 +8485,7 @@ class Peernet {
|
|
|
8417
8485
|
client;
|
|
8418
8486
|
network;
|
|
8419
8487
|
stars;
|
|
8488
|
+
transport;
|
|
8420
8489
|
networkVersion;
|
|
8421
8490
|
bw;
|
|
8422
8491
|
hasDaemon = false;
|
|
@@ -8438,6 +8507,7 @@ class Peernet {
|
|
|
8438
8507
|
* @param {String} options.root - path to root directory
|
|
8439
8508
|
* @param {String} options.version - path to root directory
|
|
8440
8509
|
* @param {String} options.storePrefix - prefix for datatores (lfc)
|
|
8510
|
+
* @param {Object} options.transport - transport selection and fallback options passed to @netpeer/swarm
|
|
8441
8511
|
*
|
|
8442
8512
|
* @return {Promise} instance of Peernet
|
|
8443
8513
|
*
|
|
@@ -8451,6 +8521,7 @@ class Peernet {
|
|
|
8451
8521
|
this.network = options.network || 'leofcoin';
|
|
8452
8522
|
this.autoStart = options.autoStart === undefined ? true : options.autoStart;
|
|
8453
8523
|
this.stars = options.stars;
|
|
8524
|
+
this.transport = options.transport;
|
|
8454
8525
|
this.version = options.version;
|
|
8455
8526
|
const parts = this.network.split(':');
|
|
8456
8527
|
this.networkVersion = options.networkVersion || parts.length > 1 ? parts[1] : 'mainnet';
|
|
@@ -8544,7 +8615,7 @@ class Peernet {
|
|
|
8544
8615
|
await getAddress();
|
|
8545
8616
|
this.storePrefix = options.storePrefix;
|
|
8546
8617
|
this.root = options.root;
|
|
8547
|
-
const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile } = await import(/* webpackChunkName: "messages" */ './messages-
|
|
8618
|
+
const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile } = await import(/* webpackChunkName: "messages" */ './messages-BX59GgBQ.js');
|
|
8548
8619
|
/**
|
|
8549
8620
|
* proto Object containing protos
|
|
8550
8621
|
* @type {Object}
|
|
@@ -8591,7 +8662,7 @@ class Peernet {
|
|
|
8591
8662
|
if (this.#starting || this.#started)
|
|
8592
8663
|
return;
|
|
8593
8664
|
this.#starting = true;
|
|
8594
|
-
const importee = await import('./client-
|
|
8665
|
+
const importee = await import('./client-Ba1cHcxF.js');
|
|
8595
8666
|
/**
|
|
8596
8667
|
* @access public
|
|
8597
8668
|
* @type {PeernetClient}
|
|
@@ -8601,7 +8672,8 @@ class Peernet {
|
|
|
8601
8672
|
peerId: this.id,
|
|
8602
8673
|
networkVersion: this.networkVersion,
|
|
8603
8674
|
version: this.version,
|
|
8604
|
-
stars: this.stars
|
|
8675
|
+
stars: this.stars,
|
|
8676
|
+
transport: this.transport
|
|
8605
8677
|
});
|
|
8606
8678
|
this.#started = true;
|
|
8607
8679
|
this.#starting = false;
|
package/exports/peernet.js
CHANGED
|
@@ -326,6 +326,7 @@ class Peernet {
|
|
|
326
326
|
client;
|
|
327
327
|
network;
|
|
328
328
|
stars;
|
|
329
|
+
transport;
|
|
329
330
|
networkVersion;
|
|
330
331
|
bw;
|
|
331
332
|
hasDaemon = false;
|
|
@@ -347,6 +348,7 @@ class Peernet {
|
|
|
347
348
|
* @param {String} options.root - path to root directory
|
|
348
349
|
* @param {String} options.version - path to root directory
|
|
349
350
|
* @param {String} options.storePrefix - prefix for datatores (lfc)
|
|
351
|
+
* @param {Object} options.transport - transport selection and fallback options passed to @netpeer/swarm
|
|
350
352
|
*
|
|
351
353
|
* @return {Promise} instance of Peernet
|
|
352
354
|
*
|
|
@@ -360,6 +362,7 @@ class Peernet {
|
|
|
360
362
|
this.network = options.network || 'leofcoin';
|
|
361
363
|
this.autoStart = options.autoStart === undefined ? true : options.autoStart;
|
|
362
364
|
this.stars = options.stars;
|
|
365
|
+
this.transport = options.transport;
|
|
363
366
|
this.version = options.version;
|
|
364
367
|
const parts = this.network.split(':');
|
|
365
368
|
this.networkVersion = options.networkVersion || parts.length > 1 ? parts[1] : 'mainnet';
|
|
@@ -510,7 +513,8 @@ class Peernet {
|
|
|
510
513
|
peerId: this.id,
|
|
511
514
|
networkVersion: this.networkVersion,
|
|
512
515
|
version: this.version,
|
|
513
|
-
stars: this.stars
|
|
516
|
+
stars: this.stars,
|
|
517
|
+
transport: this.transport
|
|
514
518
|
});
|
|
515
519
|
this.#started = true;
|
|
516
520
|
this.#starting = false;
|
package/exports/store.js
CHANGED
|
@@ -102,6 +102,9 @@ class Store {
|
|
|
102
102
|
this.root = await init(root, homedir);
|
|
103
103
|
this.version = version;
|
|
104
104
|
this.db = new ClassicLevel(join(this.root, this.name), { valueEncoding: 'view' });
|
|
105
|
+
if (typeof this.db.open === 'function') {
|
|
106
|
+
await this.db.open();
|
|
107
|
+
}
|
|
105
108
|
}
|
|
106
109
|
toKeyPath(key) {
|
|
107
110
|
if (!key.isKeyPath())
|
|
@@ -39,6 +39,7 @@ export default class Peernet {
|
|
|
39
39
|
client: swarm;
|
|
40
40
|
network: string;
|
|
41
41
|
stars: string[];
|
|
42
|
+
transport: any;
|
|
42
43
|
networkVersion: string;
|
|
43
44
|
bw: {
|
|
44
45
|
up: number;
|
|
@@ -60,6 +61,7 @@ export default class Peernet {
|
|
|
60
61
|
* @param {String} options.root - path to root directory
|
|
61
62
|
* @param {String} options.version - path to root directory
|
|
62
63
|
* @param {String} options.storePrefix - prefix for datatores (lfc)
|
|
64
|
+
* @param {Object} options.transport - transport selection and fallback options passed to @netpeer/swarm
|
|
63
65
|
*
|
|
64
66
|
* @return {Promise} instance of Peernet
|
|
65
67
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leofcoin/peernet",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.22",
|
|
4
4
|
"description": "",
|
|
5
5
|
"browser": "./exports/browser/peernet.js",
|
|
6
6
|
"exports": {
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"@leofcoin/multi-wallet": "^3.1.8",
|
|
108
108
|
"@leofcoin/storage": "^3.5.38",
|
|
109
109
|
"@mapbox/node-pre-gyp": "^2.0.3",
|
|
110
|
-
"@netpeer/swarm": "^0.9.
|
|
110
|
+
"@netpeer/swarm": "^0.9.8",
|
|
111
111
|
"@vandeurenglenn/base58": "^1.1.9",
|
|
112
112
|
"@vandeurenglenn/debug": "^1.4.0",
|
|
113
113
|
"@vandeurenglenn/little-pubsub": "^1.5.2",
|
|
@@ -125,6 +125,7 @@
|
|
|
125
125
|
"@types/node": "^25.9.1",
|
|
126
126
|
"@types/qrcode": "^1.5.6",
|
|
127
127
|
"rollup": "^4.60.4",
|
|
128
|
-
"tslib": "^2.8.1"
|
|
128
|
+
"tslib": "^2.8.1",
|
|
129
|
+
"typescript": "^6.0.2"
|
|
129
130
|
}
|
|
130
131
|
}
|
package/src/peernet.ts
CHANGED
|
@@ -52,6 +52,7 @@ export default class Peernet {
|
|
|
52
52
|
client: swarm
|
|
53
53
|
network: string
|
|
54
54
|
stars: string[]
|
|
55
|
+
transport
|
|
55
56
|
networkVersion: string
|
|
56
57
|
bw: {
|
|
57
58
|
up: number
|
|
@@ -77,6 +78,7 @@ export default class Peernet {
|
|
|
77
78
|
* @param {String} options.root - path to root directory
|
|
78
79
|
* @param {String} options.version - path to root directory
|
|
79
80
|
* @param {String} options.storePrefix - prefix for datatores (lfc)
|
|
81
|
+
* @param {Object} options.transport - transport selection and fallback options passed to @netpeer/swarm
|
|
80
82
|
*
|
|
81
83
|
* @return {Promise} instance of Peernet
|
|
82
84
|
*
|
|
@@ -90,6 +92,7 @@ export default class Peernet {
|
|
|
90
92
|
this.network = options.network || 'leofcoin'
|
|
91
93
|
this.autoStart = options.autoStart === undefined ? true : options.autoStart
|
|
92
94
|
this.stars = options.stars
|
|
95
|
+
this.transport = options.transport
|
|
93
96
|
this.version = options.version
|
|
94
97
|
const parts = this.network.split(':')
|
|
95
98
|
this.networkVersion = options.networkVersion || parts.length > 1 ? parts[1] : 'mainnet'
|
|
@@ -281,7 +284,8 @@ export default class Peernet {
|
|
|
281
284
|
peerId: this.id,
|
|
282
285
|
networkVersion: this.networkVersion,
|
|
283
286
|
version: this.version,
|
|
284
|
-
stars: this.stars
|
|
287
|
+
stars: this.stars,
|
|
288
|
+
transport: this.transport
|
|
285
289
|
})
|
|
286
290
|
this.#started = true
|
|
287
291
|
this.#starting = false
|