@fireproof/core 0.5.8 → 0.5.9
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/src/fireproof.js +121 -151
- package/dist/src/fireproof.js.map +1 -1
- package/dist/src/fireproof.mjs +121 -151
- package/dist/src/fireproof.mjs.map +1 -1
- package/package.json +1 -1
- package/src/fireproof.js +2 -2
- package/src/sync.js +5 -1
package/dist/src/fireproof.mjs
CHANGED
@@ -32,17 +32,9 @@ function getAugmentedNamespace(n) {
|
|
32
32
|
return a;
|
33
33
|
}
|
34
34
|
|
35
|
-
var
|
36
|
-
var browser$d = {
|
37
|
-
get exports(){ return browserExports$1; },
|
38
|
-
set exports(v){ browserExports$1 = v; },
|
39
|
-
};
|
35
|
+
var browser$d = {exports: {}};
|
40
36
|
|
41
|
-
var
|
42
|
-
var safeBuffer$1 = {
|
43
|
-
get exports(){ return safeBufferExports; },
|
44
|
-
set exports(v){ safeBufferExports = v; },
|
45
|
-
};
|
37
|
+
var safeBuffer$1 = {exports: {}};
|
46
38
|
|
47
39
|
var global$1 = (typeof global !== "undefined" ? global :
|
48
40
|
typeof self !== "undefined" ? self :
|
@@ -2107,8 +2099,10 @@ var require$$6$1 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_buffer);
|
|
2107
2099
|
throw new TypeError('Argument must be a number')
|
2108
2100
|
}
|
2109
2101
|
return buffer.SlowBuffer(size)
|
2110
|
-
};
|
2111
|
-
} (safeBuffer$1,
|
2102
|
+
};
|
2103
|
+
} (safeBuffer$1, safeBuffer$1.exports));
|
2104
|
+
|
2105
|
+
var safeBufferExports = safeBuffer$1.exports;
|
2112
2106
|
|
2113
2107
|
// limit of Crypto.getRandomValues()
|
2114
2108
|
// https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues
|
@@ -2159,6 +2153,9 @@ function randomBytes$2 (size, cb) {
|
|
2159
2153
|
return bytes
|
2160
2154
|
}
|
2161
2155
|
|
2156
|
+
var browserExports$1 = browser$d.exports;
|
2157
|
+
var randomBytes$3 = /*@__PURE__*/getDefaultExportFromCjs(browserExports$1);
|
2158
|
+
|
2162
2159
|
var encode_1$2 = encode$9;
|
2163
2160
|
|
2164
2161
|
var MSB$4 = 0x80
|
@@ -2241,13 +2238,13 @@ var length$2 = function (value) {
|
|
2241
2238
|
)
|
2242
2239
|
};
|
2243
2240
|
|
2244
|
-
var varint$
|
2241
|
+
var varint$3 = {
|
2245
2242
|
encode: encode_1$2
|
2246
2243
|
, decode: decode$d
|
2247
2244
|
, encodingLength: length$2
|
2248
2245
|
};
|
2249
2246
|
|
2250
|
-
var _brrp_varint$1 = varint$
|
2247
|
+
var _brrp_varint$1 = varint$3;
|
2251
2248
|
|
2252
2249
|
/**
|
2253
2250
|
* @param {Uint8Array} data
|
@@ -7076,6 +7073,8 @@ var varint$1 = {
|
|
7076
7073
|
, encodingLength: length$1
|
7077
7074
|
};
|
7078
7075
|
|
7076
|
+
var varint$2 = /*@__PURE__*/getDefaultExportFromCjs(varint$1);
|
7077
|
+
|
7079
7078
|
const CIDV0_BYTES = {
|
7080
7079
|
SHA2_256: 0x12,
|
7081
7080
|
LENGTH: 0x20,
|
@@ -7100,8 +7099,8 @@ function decodeVarint (bytes, seeker) {
|
|
7100
7099
|
if (!bytes.length) {
|
7101
7100
|
throw new Error('Unexpected end of data')
|
7102
7101
|
}
|
7103
|
-
const i = varint$
|
7104
|
-
seeker.seek(/** @type {number} */(varint$
|
7102
|
+
const i = varint$2.decode(bytes);
|
7103
|
+
seeker.seek(/** @type {number} */(varint$2.decode.bytes));
|
7105
7104
|
return i
|
7106
7105
|
/* c8 ignore next 2 */
|
7107
7106
|
// Node.js 12 c8 bug
|
@@ -7152,10 +7151,10 @@ function getMultihashLength (bytes) {
|
|
7152
7151
|
// where both code and length are varints, so we have to decode
|
7153
7152
|
// them first before we can know total length
|
7154
7153
|
|
7155
|
-
varint$
|
7156
|
-
const codeLength = /** @type {number} */(varint$
|
7157
|
-
const length = varint$
|
7158
|
-
const lengthLength = /** @type {number} */(varint$
|
7154
|
+
varint$2.decode(bytes); // code
|
7155
|
+
const codeLength = /** @type {number} */(varint$2.decode.bytes);
|
7156
|
+
const length = varint$2.decode(bytes.subarray(varint$2.decode.bytes));
|
7157
|
+
const lengthLength = /** @type {number} */(varint$2.decode.bytes);
|
7159
7158
|
const mhLength = codeLength + lengthLength + length;
|
7160
7159
|
|
7161
7160
|
return mhLength
|
@@ -7863,7 +7862,7 @@ const addRoot = (writer, root, options = {}) => {
|
|
7863
7862
|
*/
|
7864
7863
|
const blockLength = ({ cid, bytes }) => {
|
7865
7864
|
const size = cid.bytes.byteLength + bytes.byteLength;
|
7866
|
-
return varint$
|
7865
|
+
return varint$2.encodingLength(size) + size
|
7867
7866
|
};
|
7868
7867
|
|
7869
7868
|
/**
|
@@ -7872,7 +7871,7 @@ const blockLength = ({ cid, bytes }) => {
|
|
7872
7871
|
*/
|
7873
7872
|
const addBlock = (writer, { cid, bytes }) => {
|
7874
7873
|
const byteLength = cid.bytes.byteLength + bytes.byteLength;
|
7875
|
-
const size = varint$
|
7874
|
+
const size = varint$2.encode(byteLength);
|
7876
7875
|
if (writer.byteOffset + size.length + byteLength > writer.bytes.byteLength) {
|
7877
7876
|
throw new RangeError('Buffer has no capacity for this block')
|
7878
7877
|
} else {
|
@@ -7892,7 +7891,7 @@ const close = (writer, options = {}) => {
|
|
7892
7891
|
const { roots, bytes, byteOffset, headerSize } = writer;
|
7893
7892
|
|
7894
7893
|
const headerBytes = encode$5({ version: 1, roots });
|
7895
|
-
const varintBytes = varint$
|
7894
|
+
const varintBytes = varint$2.encode(headerBytes.length);
|
7896
7895
|
|
7897
7896
|
const size = varintBytes.length + headerBytes.byteLength;
|
7898
7897
|
const offset = headerSize - size;
|
@@ -7969,7 +7968,7 @@ const calculateHeaderLength = (rootLengths) => {
|
|
7969
7968
|
tokens.push(new Token(Type.bytes, { length: rootLength + 1 }));
|
7970
7969
|
}
|
7971
7970
|
const length = tokensToLength(tokens); // no options needed here because we have simple tokens
|
7972
|
-
return varint$
|
7971
|
+
return varint$2.encodingLength(length) + length
|
7973
7972
|
};
|
7974
7973
|
|
7975
7974
|
/**
|
@@ -8312,23 +8311,11 @@ replaceTraps((oldTraps) => ({
|
|
8312
8311
|
has: (target, prop) => !!getMethod(target, prop) || oldTraps.has(target, prop),
|
8313
8312
|
}));
|
8314
8313
|
|
8315
|
-
var
|
8316
|
-
var cargoQueue$1 = {
|
8317
|
-
get exports(){ return cargoQueueExports; },
|
8318
|
-
set exports(v){ cargoQueueExports = v; },
|
8319
|
-
};
|
8314
|
+
var cargoQueue$1 = {exports: {}};
|
8320
8315
|
|
8321
|
-
var
|
8322
|
-
var queue$1 = {
|
8323
|
-
get exports(){ return queueExports; },
|
8324
|
-
set exports(v){ queueExports = v; },
|
8325
|
-
};
|
8316
|
+
var queue$1 = {exports: {}};
|
8326
8317
|
|
8327
|
-
var
|
8328
|
-
var onlyOnce = {
|
8329
|
-
get exports(){ return onlyOnceExports; },
|
8330
|
-
set exports(v){ onlyOnceExports = v; },
|
8331
|
-
};
|
8318
|
+
var onlyOnce = {exports: {}};
|
8332
8319
|
|
8333
8320
|
(function (module, exports) {
|
8334
8321
|
|
@@ -8344,8 +8331,10 @@ var onlyOnce = {
|
|
8344
8331
|
callFn.apply(this, args);
|
8345
8332
|
};
|
8346
8333
|
}
|
8347
|
-
module.exports = exports["default"];
|
8348
|
-
} (onlyOnce,
|
8334
|
+
module.exports = exports["default"];
|
8335
|
+
} (onlyOnce, onlyOnce.exports));
|
8336
|
+
|
8337
|
+
var onlyOnceExports = onlyOnce.exports;
|
8349
8338
|
|
8350
8339
|
var setImmediate$1 = {};
|
8351
8340
|
|
@@ -8382,11 +8371,7 @@ if (hasQueueMicrotask) {
|
|
8382
8371
|
|
8383
8372
|
setImmediate$1.default = wrap(_defer);
|
8384
8373
|
|
8385
|
-
var
|
8386
|
-
var DoublyLinkedList = {
|
8387
|
-
get exports(){ return DoublyLinkedListExports; },
|
8388
|
-
set exports(v){ DoublyLinkedListExports = v; },
|
8389
|
-
};
|
8374
|
+
var DoublyLinkedList = {exports: {}};
|
8390
8375
|
|
8391
8376
|
(function (module, exports) {
|
8392
8377
|
|
@@ -8479,22 +8464,16 @@ var DoublyLinkedList = {
|
|
8479
8464
|
dll.length = 1;
|
8480
8465
|
dll.head = dll.tail = node;
|
8481
8466
|
}
|
8482
|
-
module.exports = exports["default"];
|
8483
|
-
} (DoublyLinkedList,
|
8467
|
+
module.exports = exports["default"];
|
8468
|
+
} (DoublyLinkedList, DoublyLinkedList.exports));
|
8469
|
+
|
8470
|
+
var DoublyLinkedListExports = DoublyLinkedList.exports;
|
8484
8471
|
|
8485
8472
|
var wrapAsync = {};
|
8486
8473
|
|
8487
|
-
var
|
8488
|
-
var asyncify = {
|
8489
|
-
get exports(){ return asyncifyExports; },
|
8490
|
-
set exports(v){ asyncifyExports = v; },
|
8491
|
-
};
|
8474
|
+
var asyncify = {exports: {}};
|
8492
8475
|
|
8493
|
-
var
|
8494
|
-
var initialParams = {
|
8495
|
-
get exports(){ return initialParamsExports; },
|
8496
|
-
set exports(v){ initialParamsExports = v; },
|
8497
|
-
};
|
8476
|
+
var initialParams = {exports: {}};
|
8498
8477
|
|
8499
8478
|
(function (module, exports) {
|
8500
8479
|
|
@@ -8509,13 +8488,15 @@ var initialParams = {
|
|
8509
8488
|
};
|
8510
8489
|
};
|
8511
8490
|
|
8512
|
-
module.exports = exports["default"];
|
8513
|
-
} (initialParams,
|
8491
|
+
module.exports = exports["default"];
|
8492
|
+
} (initialParams, initialParams.exports));
|
8493
|
+
|
8494
|
+
var initialParamsExports = initialParams.exports;
|
8514
8495
|
|
8515
8496
|
var hasRequiredAsyncify;
|
8516
8497
|
|
8517
8498
|
function requireAsyncify () {
|
8518
|
-
if (hasRequiredAsyncify) return
|
8499
|
+
if (hasRequiredAsyncify) return asyncify.exports;
|
8519
8500
|
hasRequiredAsyncify = 1;
|
8520
8501
|
(function (module, exports) {
|
8521
8502
|
|
@@ -8634,9 +8615,9 @@ function requireAsyncify () {
|
|
8634
8615
|
}, err);
|
8635
8616
|
}
|
8636
8617
|
}
|
8637
|
-
module.exports = exports['default'];
|
8638
|
-
} (asyncify,
|
8639
|
-
return
|
8618
|
+
module.exports = exports['default'];
|
8619
|
+
} (asyncify, asyncify.exports));
|
8620
|
+
return asyncify.exports;
|
8640
8621
|
}
|
8641
8622
|
|
8642
8623
|
var hasRequiredWrapAsync;
|
@@ -8973,8 +8954,10 @@ function requireWrapAsync () {
|
|
8973
8954
|
});
|
8974
8955
|
return q;
|
8975
8956
|
}
|
8976
|
-
module.exports = exports['default'];
|
8977
|
-
} (queue$1,
|
8957
|
+
module.exports = exports['default'];
|
8958
|
+
} (queue$1, queue$1.exports));
|
8959
|
+
|
8960
|
+
var queueExports = queue$1.exports;
|
8978
8961
|
|
8979
8962
|
(function (module, exports) {
|
8980
8963
|
|
@@ -9046,9 +9029,10 @@ function requireWrapAsync () {
|
|
9046
9029
|
function cargo(worker, concurrency, payload) {
|
9047
9030
|
return (0, _queue2.default)(worker, concurrency, payload);
|
9048
9031
|
}
|
9049
|
-
module.exports = exports['default'];
|
9050
|
-
} (cargoQueue$1,
|
9032
|
+
module.exports = exports['default'];
|
9033
|
+
} (cargoQueue$1, cargoQueue$1.exports));
|
9051
9034
|
|
9035
|
+
var cargoQueueExports = cargoQueue$1.exports;
|
9052
9036
|
var cargoQueue = /*@__PURE__*/getDefaultExportFromCjs(cargoQueueExports);
|
9053
9037
|
|
9054
9038
|
var cryptoBrowserify = {};
|
@@ -9085,11 +9069,7 @@ var _polyfillNode_inherits = /*#__PURE__*/Object.freeze({
|
|
9085
9069
|
|
9086
9070
|
var require$$3$1 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_inherits);
|
9087
9071
|
|
9088
|
-
var
|
9089
|
-
var readableBrowser = {
|
9090
|
-
get exports(){ return readableBrowserExports; },
|
9091
|
-
set exports(v){ readableBrowserExports = v; },
|
9092
|
-
};
|
9072
|
+
var readableBrowser = {exports: {}};
|
9093
9073
|
|
9094
9074
|
var domain;
|
9095
9075
|
|
@@ -13486,8 +13466,10 @@ var pipeline_1 = pipeline;
|
|
13486
13466
|
exports.Transform = _stream_transform;
|
13487
13467
|
exports.PassThrough = _stream_passthrough;
|
13488
13468
|
exports.finished = endOfStream;
|
13489
|
-
exports.pipeline = pipeline_1;
|
13490
|
-
} (readableBrowser,
|
13469
|
+
exports.pipeline = pipeline_1;
|
13470
|
+
} (readableBrowser, readableBrowser.exports));
|
13471
|
+
|
13472
|
+
var readableBrowserExports = readableBrowser.exports;
|
13491
13473
|
|
13492
13474
|
var Buffer$E = safeBufferExports.Buffer;
|
13493
13475
|
var Transform$6 = readableBrowserExports.Transform;
|
@@ -13893,11 +13875,7 @@ function fn5 (a, b, c, d, e, m, k, s) {
|
|
13893
13875
|
|
13894
13876
|
var ripemd160 = RIPEMD160$4;
|
13895
13877
|
|
13896
|
-
var
|
13897
|
-
var sha_js = {
|
13898
|
-
get exports(){ return sha_jsExports; },
|
13899
|
-
set exports(v){ sha_jsExports = v; },
|
13900
|
-
};
|
13878
|
+
var sha_js = {exports: {}};
|
13901
13879
|
|
13902
13880
|
var Buffer$B = safeBufferExports.Buffer;
|
13903
13881
|
|
@@ -14701,6 +14679,8 @@ exports.sha256 = sha256$1;
|
|
14701
14679
|
exports.sha384 = sha384$1;
|
14702
14680
|
exports.sha512 = sha512$1;
|
14703
14681
|
|
14682
|
+
var sha_jsExports = sha_js.exports;
|
14683
|
+
|
14704
14684
|
function BufferList() {
|
14705
14685
|
this.head = null;
|
14706
14686
|
this.tail = null;
|
@@ -16651,12 +16631,6 @@ var browser$9 = function createHmac (alg, key) {
|
|
16651
16631
|
return new Hmac$2(alg, key)
|
16652
16632
|
};
|
16653
16633
|
|
16654
|
-
var algosExports = {};
|
16655
|
-
var algos = {
|
16656
|
-
get exports(){ return algosExports; },
|
16657
|
-
set exports(v){ algosExports = v; },
|
16658
|
-
};
|
16659
|
-
|
16660
16634
|
var sha224WithRSAEncryption = {
|
16661
16635
|
sign: "rsa",
|
16662
16636
|
hash: "sha224",
|
@@ -16821,9 +16795,7 @@ var require$$6 = {
|
|
16821
16795
|
}
|
16822
16796
|
};
|
16823
16797
|
|
16824
|
-
|
16825
|
-
module.exports = require$$6;
|
16826
|
-
} (algos));
|
16798
|
+
var algos = require$$6;
|
16827
16799
|
|
16828
16800
|
var browser$8 = {};
|
16829
16801
|
|
@@ -19063,7 +19035,7 @@ var modes = {};
|
|
19063
19035
|
exports['des-ede'] = {
|
19064
19036
|
key: 16,
|
19065
19037
|
iv: 0
|
19066
|
-
};
|
19038
|
+
};
|
19067
19039
|
} (modes));
|
19068
19040
|
|
19069
19041
|
var DES = browserifyDes;
|
@@ -19136,11 +19108,9 @@ browser$7.listCiphers = browser$7.getCiphers = getCiphers;
|
|
19136
19108
|
|
19137
19109
|
var browser$5 = {};
|
19138
19110
|
|
19139
|
-
var
|
19140
|
-
|
19141
|
-
|
19142
|
-
set exports(v){ bnExports$1 = v; },
|
19143
|
-
};
|
19111
|
+
var bn$1 = {exports: {}};
|
19112
|
+
|
19113
|
+
bn$1.exports;
|
19144
19114
|
|
19145
19115
|
(function (module) {
|
19146
19116
|
(function (module, exports) {
|
@@ -22585,19 +22555,17 @@ var bn$1 = {
|
|
22585
22555
|
var res = this.imod(a._invmp(this.m).mul(this.r2));
|
22586
22556
|
return res._forceRed(this);
|
22587
22557
|
};
|
22588
|
-
})(module, commonjsGlobal);
|
22558
|
+
})(module, commonjsGlobal);
|
22589
22559
|
} (bn$1));
|
22590
22560
|
|
22591
|
-
var
|
22592
|
-
|
22593
|
-
|
22594
|
-
set exports(v){ brorandExports = v; },
|
22595
|
-
};
|
22561
|
+
var bnExports$1 = bn$1.exports;
|
22562
|
+
|
22563
|
+
var brorand = {exports: {}};
|
22596
22564
|
|
22597
22565
|
var hasRequiredBrorand;
|
22598
22566
|
|
22599
22567
|
function requireBrorand () {
|
22600
|
-
if (hasRequiredBrorand) return
|
22568
|
+
if (hasRequiredBrorand) return brorand.exports;
|
22601
22569
|
hasRequiredBrorand = 1;
|
22602
22570
|
var r;
|
22603
22571
|
|
@@ -22611,7 +22579,7 @@ function requireBrorand () {
|
|
22611
22579
|
function Rand(rand) {
|
22612
22580
|
this.rand = rand;
|
22613
22581
|
}
|
22614
|
-
|
22582
|
+
brorand.exports.Rand = Rand;
|
22615
22583
|
|
22616
22584
|
Rand.prototype.generate = function generate(len) {
|
22617
22585
|
return this._rand(len);
|
@@ -22664,7 +22632,7 @@ function requireBrorand () {
|
|
22664
22632
|
} catch (e) {
|
22665
22633
|
}
|
22666
22634
|
}
|
22667
|
-
return
|
22635
|
+
return brorand.exports;
|
22668
22636
|
}
|
22669
22637
|
|
22670
22638
|
var mr;
|
@@ -23171,17 +23139,11 @@ function requireBrowser$2 () {
|
|
23171
23139
|
return browser$5;
|
23172
23140
|
}
|
23173
23141
|
|
23174
|
-
var
|
23175
|
-
var sign = {
|
23176
|
-
get exports(){ return signExports; },
|
23177
|
-
set exports(v){ signExports = v; },
|
23178
|
-
};
|
23142
|
+
var sign = {exports: {}};
|
23179
23143
|
|
23180
|
-
var
|
23181
|
-
|
23182
|
-
|
23183
|
-
set exports(v){ bnExports = v; },
|
23184
|
-
};
|
23144
|
+
var bn = {exports: {}};
|
23145
|
+
|
23146
|
+
bn.exports;
|
23185
23147
|
|
23186
23148
|
(function (module) {
|
23187
23149
|
(function (module, exports) {
|
@@ -26531,9 +26493,11 @@ var bn = {
|
|
26531
26493
|
var res = this.imod(a._invmp(this.m).mul(this.r2));
|
26532
26494
|
return res._forceRed(this);
|
26533
26495
|
};
|
26534
|
-
})(module, commonjsGlobal);
|
26496
|
+
})(module, commonjsGlobal);
|
26535
26497
|
} (bn));
|
26536
26498
|
|
26499
|
+
var bnExports = bn.exports;
|
26500
|
+
|
26537
26501
|
var BN$a = bnExports;
|
26538
26502
|
var randomBytes$1 = browserExports$1;
|
26539
26503
|
|
@@ -26704,7 +26668,7 @@ var utils$k = {};
|
|
26704
26668
|
return toHex(arr);
|
26705
26669
|
else
|
26706
26670
|
return arr;
|
26707
|
-
};
|
26671
|
+
};
|
26708
26672
|
} (utils$k));
|
26709
26673
|
|
26710
26674
|
(function (exports) {
|
@@ -26824,7 +26788,7 @@ var utils$k = {};
|
|
26824
26788
|
function intFromLE(bytes) {
|
26825
26789
|
return new BN(bytes, 'hex', 'le');
|
26826
26790
|
}
|
26827
|
-
utils.intFromLE = intFromLE;
|
26791
|
+
utils.intFromLE = intFromLE;
|
26828
26792
|
} (utils$l));
|
26829
26793
|
|
26830
26794
|
var curve = {};
|
@@ -28763,7 +28727,7 @@ Point.prototype.mixedAdd = Point.prototype.add;
|
|
28763
28727
|
curve.base = base$2;
|
28764
28728
|
curve.short = short;
|
28765
28729
|
curve.mont = mont;
|
28766
|
-
curve.edwards = edwards;
|
28730
|
+
curve.edwards = edwards;
|
28767
28731
|
} (curve));
|
28768
28732
|
|
28769
28733
|
var curves$1 = {};
|
@@ -29976,7 +29940,7 @@ Hmac.prototype.digest = function digest(enc) {
|
|
29976
29940
|
hash.sha224 = hash.sha.sha224;
|
29977
29941
|
hash.sha384 = hash.sha.sha384;
|
29978
29942
|
hash.sha512 = hash.sha.sha512;
|
29979
|
-
hash.ripemd160 = hash.ripemd.ripemd160;
|
29943
|
+
hash.ripemd160 = hash.ripemd.ripemd160;
|
29980
29944
|
} (hash$2));
|
29981
29945
|
|
29982
29946
|
var secp256k1;
|
@@ -30973,7 +30937,7 @@ function requireSecp256k1 () {
|
|
30973
30937
|
'483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8',
|
30974
30938
|
pre,
|
30975
30939
|
],
|
30976
|
-
});
|
30940
|
+
});
|
30977
30941
|
} (curves$1));
|
30978
30942
|
|
30979
30943
|
var hash$1 = hash$2;
|
@@ -31916,8 +31880,8 @@ function requireElliptic () {
|
|
31916
31880
|
|
31917
31881
|
// Protocols
|
31918
31882
|
elliptic.ec = requireEc();
|
31919
|
-
elliptic.eddsa = eddsa;
|
31920
|
-
} (elliptic));
|
31883
|
+
elliptic.eddsa = eddsa;
|
31884
|
+
} (elliptic));
|
31921
31885
|
return elliptic;
|
31922
31886
|
}
|
31923
31887
|
|
@@ -32977,7 +32941,7 @@ var der$2 = {};
|
|
32977
32941
|
0x1d: 'charstr',
|
32978
32942
|
0x1e: 'bmpstr'
|
32979
32943
|
};
|
32980
|
-
exports.tagByName = reverse(exports.tag);
|
32944
|
+
exports.tagByName = reverse(exports.tag);
|
32981
32945
|
} (der$2));
|
32982
32946
|
|
32983
32947
|
const inherits$3 = require$$3$1;
|
@@ -33301,7 +33265,7 @@ PEMEncoder.prototype.encode = function encode(data, options) {
|
|
33301
33265
|
const encoders = exports;
|
33302
33266
|
|
33303
33267
|
encoders.der = der_1$1;
|
33304
|
-
encoders.pem = pem$1;
|
33268
|
+
encoders.pem = pem$1;
|
33305
33269
|
} (encoders));
|
33306
33270
|
|
33307
33271
|
var decoders = {};
|
@@ -33695,7 +33659,7 @@ PEMDecoder.prototype.decode = function decode(data, options) {
|
|
33695
33659
|
const decoders = exports;
|
33696
33660
|
|
33697
33661
|
decoders.der = der_1;
|
33698
|
-
decoders.pem = pem;
|
33662
|
+
decoders.pem = pem;
|
33699
33663
|
} (decoders));
|
33700
33664
|
|
33701
33665
|
(function (exports) {
|
@@ -33754,7 +33718,7 @@ PEMDecoder.prototype.decode = function decode(data, options) {
|
|
33754
33718
|
|
33755
33719
|
Entity.prototype.encode = function encode(data, enc, /* internal */ reporter) {
|
33756
33720
|
return this._getEncoder(enc).encode(data, reporter);
|
33757
|
-
};
|
33721
|
+
};
|
33758
33722
|
} (api));
|
33759
33723
|
|
33760
33724
|
var base$1 = {};
|
@@ -33766,7 +33730,7 @@ var base$1 = {};
|
|
33766
33730
|
base.Reporter = reporter.Reporter;
|
33767
33731
|
base.DecoderBuffer = buffer.DecoderBuffer;
|
33768
33732
|
base.EncoderBuffer = buffer.EncoderBuffer;
|
33769
|
-
base.Node = node;
|
33733
|
+
base.Node = node;
|
33770
33734
|
} (base$1));
|
33771
33735
|
|
33772
33736
|
var constants = {};
|
@@ -33791,7 +33755,7 @@ var constants = {};
|
|
33791
33755
|
return res;
|
33792
33756
|
};
|
33793
33757
|
|
33794
|
-
constants.der = der$2;
|
33758
|
+
constants.der = der$2;
|
33795
33759
|
} (constants));
|
33796
33760
|
|
33797
33761
|
(function (exports) {
|
@@ -33804,7 +33768,7 @@ var constants = {};
|
|
33804
33768
|
asn1.base = base$1;
|
33805
33769
|
asn1.constants = constants;
|
33806
33770
|
asn1.decoders = decoders;
|
33807
|
-
asn1.encoders = encoders;
|
33771
|
+
asn1.encoders = encoders;
|
33808
33772
|
} (asn1$2));
|
33809
33773
|
|
33810
33774
|
var asn = asn1$2;
|
@@ -34178,7 +34142,7 @@ var require$$4 = {
|
|
34178
34142
|
var hasRequiredSign;
|
34179
34143
|
|
34180
34144
|
function requireSign () {
|
34181
|
-
if (hasRequiredSign) return
|
34145
|
+
if (hasRequiredSign) return sign.exports;
|
34182
34146
|
hasRequiredSign = 1;
|
34183
34147
|
// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js
|
34184
34148
|
var Buffer = safeBufferExports.Buffer;
|
@@ -34321,9 +34285,9 @@ function requireSign () {
|
|
34321
34285
|
}
|
34322
34286
|
|
34323
34287
|
sign.exports = sign$1;
|
34324
|
-
|
34325
|
-
|
34326
|
-
return
|
34288
|
+
sign.exports.getKey = getKey;
|
34289
|
+
sign.exports.makeKey = makeKey;
|
34290
|
+
return sign.exports;
|
34327
34291
|
}
|
34328
34292
|
|
34329
34293
|
var verify_1;
|
@@ -34902,7 +34866,7 @@ function compare$3 (a, b) {
|
|
34902
34866
|
|
34903
34867
|
exports.publicDecrypt = function publicDecrypt (key, buf) {
|
34904
34868
|
return exports.privateDecrypt(key, buf, true)
|
34905
|
-
};
|
34869
|
+
};
|
34906
34870
|
} (browser$2));
|
34907
34871
|
|
34908
34872
|
var browser$1 = {};
|
@@ -35024,8 +34988,8 @@ function requireCryptoBrowserify () {
|
|
35024
34988
|
cryptoBrowserify.createHash = cryptoBrowserify.Hash = browser$a;
|
35025
34989
|
cryptoBrowserify.createHmac = cryptoBrowserify.Hmac = browser$9;
|
35026
34990
|
|
35027
|
-
var algos =
|
35028
|
-
var algoKeys = Object.keys(algos);
|
34991
|
+
var algos$1 = algos;
|
34992
|
+
var algoKeys = Object.keys(algos$1);
|
35029
34993
|
var hashes = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'].concat(algoKeys);
|
35030
34994
|
cryptoBrowserify.getHashes = function () {
|
35031
34995
|
return hashes
|
@@ -37887,7 +37851,7 @@ async function visMerkleClock (blocks, head) {
|
|
37887
37851
|
return { vis: lines.join('\n') }
|
37888
37852
|
}
|
37889
37853
|
|
37890
|
-
var charwise = {};
|
37854
|
+
var charwise$1 = {};
|
37891
37855
|
|
37892
37856
|
var number = {};
|
37893
37857
|
|
@@ -38115,8 +38079,10 @@ object.factory = function (codec) {
|
|
38115
38079
|
|
38116
38080
|
//for leveldb, request strings
|
38117
38081
|
exports.buffer = false;
|
38118
|
-
exports.type = 'charwise';
|
38119
|
-
} (charwise));
|
38082
|
+
exports.type = 'charwise';
|
38083
|
+
} (charwise$1));
|
38084
|
+
|
38085
|
+
var charwise = /*@__PURE__*/getDefaultExportFromCjs(charwise$1);
|
38120
38086
|
|
38121
38087
|
/* global localStorage */
|
38122
38088
|
let storageSupported = false;
|
@@ -39089,11 +39055,7 @@ async function doIndexQuery (blocks, indexByKey, query = {}) {
|
|
39089
39055
|
}
|
39090
39056
|
}
|
39091
39057
|
|
39092
|
-
var
|
39093
|
-
var browser = {
|
39094
|
-
get exports(){ return browserExports; },
|
39095
|
-
set exports(v){ browserExports = v; },
|
39096
|
-
};
|
39058
|
+
var browser = {exports: {}};
|
39097
39059
|
|
39098
39060
|
/**
|
39099
39061
|
* Helpers.
|
@@ -39809,8 +39771,10 @@ var common = setup;
|
|
39809
39771
|
} catch (error) {
|
39810
39772
|
return '[UnexpectedJSONParseError]: ' + error.message;
|
39811
39773
|
}
|
39812
|
-
};
|
39813
|
-
} (browser,
|
39774
|
+
};
|
39775
|
+
} (browser, browser.exports));
|
39776
|
+
|
39777
|
+
var browserExports = browser.exports;
|
39814
39778
|
|
39815
39779
|
// originally pulled out of simple-peer
|
39816
39780
|
|
@@ -40961,6 +40925,8 @@ Peer.channelConfig = {};
|
|
40961
40925
|
|
40962
40926
|
var simplePeer = Peer;
|
40963
40927
|
|
40928
|
+
var SimplePeer = /*@__PURE__*/getDefaultExportFromCjs(simplePeer);
|
40929
|
+
|
40964
40930
|
/**
|
40965
40931
|
* @typedef {import('./database.js').Database} Database
|
40966
40932
|
*/
|
@@ -40971,7 +40937,7 @@ class Sync {
|
|
40971
40937
|
* @memberof Sync
|
40972
40938
|
* @static
|
40973
40939
|
*/
|
40974
|
-
constructor (database, PeerClass =
|
40940
|
+
constructor (database, PeerClass = SimplePeer) {
|
40975
40941
|
this.database = database;
|
40976
40942
|
this.database.blocks.syncs.add(this); // should this happen during setup?
|
40977
40943
|
this.PeerClass = PeerClass;
|
@@ -41054,6 +41020,10 @@ class Sync {
|
|
41054
41020
|
// get the roots parents
|
41055
41021
|
const parents = await Promise.all(roots.map(async (cid) => {
|
41056
41022
|
const rbl = await reader.get(cid);
|
41023
|
+
if (!rbl) {
|
41024
|
+
console.log('missing root block', cid.toString(), reader);
|
41025
|
+
throw new Error('missing root block')
|
41026
|
+
}
|
41057
41027
|
const block = await decodeEventBlock(rbl.bytes);
|
41058
41028
|
return block.value.parents
|
41059
41029
|
}));
|
@@ -41070,7 +41040,7 @@ class Sync {
|
|
41070
41040
|
} else if (message.clock) {
|
41071
41041
|
const reqCidDiff = message;
|
41072
41042
|
// this might be a CID diff
|
41073
|
-
|
41043
|
+
console.log('got diff', reqCidDiff);
|
41074
41044
|
const carBlock = await Sync.makeCar(this.database, null, reqCidDiff.cids);
|
41075
41045
|
if (!carBlock) {
|
41076
41046
|
// we are full synced
|
@@ -41173,9 +41143,9 @@ class Fireproof {
|
|
41173
41143
|
if (existing) {
|
41174
41144
|
const existingConfig = JSON.parse(existing);
|
41175
41145
|
const fp = new Database(new TransactionBlockstore(name, existingConfig.key), [], opts);
|
41176
|
-
return
|
41146
|
+
return Fireproof.fromJSON(existingConfig, fp)
|
41177
41147
|
} else {
|
41178
|
-
const instanceKey =
|
41148
|
+
const instanceKey = randomBytes$3(32).toString('hex'); // pass null to disable encryption
|
41179
41149
|
return new Database(new TransactionBlockstore(name, instanceKey), [], opts)
|
41180
41150
|
}
|
41181
41151
|
} else {
|
@@ -41216,7 +41186,7 @@ class Fireproof {
|
|
41216
41186
|
index.clock.db = null;
|
41217
41187
|
});
|
41218
41188
|
}
|
41219
|
-
const snappedDb =
|
41189
|
+
const snappedDb = Fireproof.fromJSON(definition, withBlocks)
|
41220
41190
|
;[...database.indexes.values()].forEach(index => {
|
41221
41191
|
snappedDb.indexes.get(index.mapFnString).mapFn = index.mapFn;
|
41222
41192
|
});
|