@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.
@@ -34,17 +34,9 @@ function getAugmentedNamespace(n) {
34
34
  return a;
35
35
  }
36
36
 
37
- var browserExports$1 = {};
38
- var browser$d = {
39
- get exports(){ return browserExports$1; },
40
- set exports(v){ browserExports$1 = v; },
41
- };
37
+ var browser$d = {exports: {}};
42
38
 
43
- var safeBufferExports = {};
44
- var safeBuffer$1 = {
45
- get exports(){ return safeBufferExports; },
46
- set exports(v){ safeBufferExports = v; },
47
- };
39
+ var safeBuffer$1 = {exports: {}};
48
40
 
49
41
  var global$1 = (typeof global !== "undefined" ? global :
50
42
  typeof self !== "undefined" ? self :
@@ -2109,8 +2101,10 @@ var require$$6$1 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_buffer);
2109
2101
  throw new TypeError('Argument must be a number')
2110
2102
  }
2111
2103
  return buffer.SlowBuffer(size)
2112
- };
2113
- } (safeBuffer$1, safeBufferExports));
2104
+ };
2105
+ } (safeBuffer$1, safeBuffer$1.exports));
2106
+
2107
+ var safeBufferExports = safeBuffer$1.exports;
2114
2108
 
2115
2109
  // limit of Crypto.getRandomValues()
2116
2110
  // https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues
@@ -2161,6 +2155,9 @@ function randomBytes$2 (size, cb) {
2161
2155
  return bytes
2162
2156
  }
2163
2157
 
2158
+ var browserExports$1 = browser$d.exports;
2159
+ var randomBytes$3 = /*@__PURE__*/getDefaultExportFromCjs(browserExports$1);
2160
+
2164
2161
  var encode_1$2 = encode$9;
2165
2162
 
2166
2163
  var MSB$4 = 0x80
@@ -2243,13 +2240,13 @@ var length$2 = function (value) {
2243
2240
  )
2244
2241
  };
2245
2242
 
2246
- var varint$2 = {
2243
+ var varint$3 = {
2247
2244
  encode: encode_1$2
2248
2245
  , decode: decode$d
2249
2246
  , encodingLength: length$2
2250
2247
  };
2251
2248
 
2252
- var _brrp_varint$1 = varint$2;
2249
+ var _brrp_varint$1 = varint$3;
2253
2250
 
2254
2251
  /**
2255
2252
  * @param {Uint8Array} data
@@ -7078,6 +7075,8 @@ var varint$1 = {
7078
7075
  , encodingLength: length$1
7079
7076
  };
7080
7077
 
7078
+ var varint$2 = /*@__PURE__*/getDefaultExportFromCjs(varint$1);
7079
+
7081
7080
  const CIDV0_BYTES = {
7082
7081
  SHA2_256: 0x12,
7083
7082
  LENGTH: 0x20,
@@ -7102,8 +7101,8 @@ function decodeVarint (bytes, seeker) {
7102
7101
  if (!bytes.length) {
7103
7102
  throw new Error('Unexpected end of data')
7104
7103
  }
7105
- const i = varint$1.decode(bytes);
7106
- seeker.seek(/** @type {number} */(varint$1.decode.bytes));
7104
+ const i = varint$2.decode(bytes);
7105
+ seeker.seek(/** @type {number} */(varint$2.decode.bytes));
7107
7106
  return i
7108
7107
  /* c8 ignore next 2 */
7109
7108
  // Node.js 12 c8 bug
@@ -7154,10 +7153,10 @@ function getMultihashLength (bytes) {
7154
7153
  // where both code and length are varints, so we have to decode
7155
7154
  // them first before we can know total length
7156
7155
 
7157
- varint$1.decode(bytes); // code
7158
- const codeLength = /** @type {number} */(varint$1.decode.bytes);
7159
- const length = varint$1.decode(bytes.subarray(varint$1.decode.bytes));
7160
- const lengthLength = /** @type {number} */(varint$1.decode.bytes);
7156
+ varint$2.decode(bytes); // code
7157
+ const codeLength = /** @type {number} */(varint$2.decode.bytes);
7158
+ const length = varint$2.decode(bytes.subarray(varint$2.decode.bytes));
7159
+ const lengthLength = /** @type {number} */(varint$2.decode.bytes);
7161
7160
  const mhLength = codeLength + lengthLength + length;
7162
7161
 
7163
7162
  return mhLength
@@ -7865,7 +7864,7 @@ const addRoot = (writer, root, options = {}) => {
7865
7864
  */
7866
7865
  const blockLength = ({ cid, bytes }) => {
7867
7866
  const size = cid.bytes.byteLength + bytes.byteLength;
7868
- return varint$1.encodingLength(size) + size
7867
+ return varint$2.encodingLength(size) + size
7869
7868
  };
7870
7869
 
7871
7870
  /**
@@ -7874,7 +7873,7 @@ const blockLength = ({ cid, bytes }) => {
7874
7873
  */
7875
7874
  const addBlock = (writer, { cid, bytes }) => {
7876
7875
  const byteLength = cid.bytes.byteLength + bytes.byteLength;
7877
- const size = varint$1.encode(byteLength);
7876
+ const size = varint$2.encode(byteLength);
7878
7877
  if (writer.byteOffset + size.length + byteLength > writer.bytes.byteLength) {
7879
7878
  throw new RangeError('Buffer has no capacity for this block')
7880
7879
  } else {
@@ -7894,7 +7893,7 @@ const close = (writer, options = {}) => {
7894
7893
  const { roots, bytes, byteOffset, headerSize } = writer;
7895
7894
 
7896
7895
  const headerBytes = encode$5({ version: 1, roots });
7897
- const varintBytes = varint$1.encode(headerBytes.length);
7896
+ const varintBytes = varint$2.encode(headerBytes.length);
7898
7897
 
7899
7898
  const size = varintBytes.length + headerBytes.byteLength;
7900
7899
  const offset = headerSize - size;
@@ -7971,7 +7970,7 @@ const calculateHeaderLength = (rootLengths) => {
7971
7970
  tokens.push(new Token(Type.bytes, { length: rootLength + 1 }));
7972
7971
  }
7973
7972
  const length = tokensToLength(tokens); // no options needed here because we have simple tokens
7974
- return varint$1.encodingLength(length) + length
7973
+ return varint$2.encodingLength(length) + length
7975
7974
  };
7976
7975
 
7977
7976
  /**
@@ -8314,23 +8313,11 @@ replaceTraps((oldTraps) => ({
8314
8313
  has: (target, prop) => !!getMethod(target, prop) || oldTraps.has(target, prop),
8315
8314
  }));
8316
8315
 
8317
- var cargoQueueExports = {};
8318
- var cargoQueue$1 = {
8319
- get exports(){ return cargoQueueExports; },
8320
- set exports(v){ cargoQueueExports = v; },
8321
- };
8316
+ var cargoQueue$1 = {exports: {}};
8322
8317
 
8323
- var queueExports = {};
8324
- var queue$1 = {
8325
- get exports(){ return queueExports; },
8326
- set exports(v){ queueExports = v; },
8327
- };
8318
+ var queue$1 = {exports: {}};
8328
8319
 
8329
- var onlyOnceExports = {};
8330
- var onlyOnce = {
8331
- get exports(){ return onlyOnceExports; },
8332
- set exports(v){ onlyOnceExports = v; },
8333
- };
8320
+ var onlyOnce = {exports: {}};
8334
8321
 
8335
8322
  (function (module, exports) {
8336
8323
 
@@ -8346,8 +8333,10 @@ var onlyOnce = {
8346
8333
  callFn.apply(this, args);
8347
8334
  };
8348
8335
  }
8349
- module.exports = exports["default"];
8350
- } (onlyOnce, onlyOnceExports));
8336
+ module.exports = exports["default"];
8337
+ } (onlyOnce, onlyOnce.exports));
8338
+
8339
+ var onlyOnceExports = onlyOnce.exports;
8351
8340
 
8352
8341
  var setImmediate$1 = {};
8353
8342
 
@@ -8384,11 +8373,7 @@ if (hasQueueMicrotask) {
8384
8373
 
8385
8374
  setImmediate$1.default = wrap(_defer);
8386
8375
 
8387
- var DoublyLinkedListExports = {};
8388
- var DoublyLinkedList = {
8389
- get exports(){ return DoublyLinkedListExports; },
8390
- set exports(v){ DoublyLinkedListExports = v; },
8391
- };
8376
+ var DoublyLinkedList = {exports: {}};
8392
8377
 
8393
8378
  (function (module, exports) {
8394
8379
 
@@ -8481,22 +8466,16 @@ var DoublyLinkedList = {
8481
8466
  dll.length = 1;
8482
8467
  dll.head = dll.tail = node;
8483
8468
  }
8484
- module.exports = exports["default"];
8485
- } (DoublyLinkedList, DoublyLinkedListExports));
8469
+ module.exports = exports["default"];
8470
+ } (DoublyLinkedList, DoublyLinkedList.exports));
8471
+
8472
+ var DoublyLinkedListExports = DoublyLinkedList.exports;
8486
8473
 
8487
8474
  var wrapAsync = {};
8488
8475
 
8489
- var asyncifyExports = {};
8490
- var asyncify = {
8491
- get exports(){ return asyncifyExports; },
8492
- set exports(v){ asyncifyExports = v; },
8493
- };
8476
+ var asyncify = {exports: {}};
8494
8477
 
8495
- var initialParamsExports = {};
8496
- var initialParams = {
8497
- get exports(){ return initialParamsExports; },
8498
- set exports(v){ initialParamsExports = v; },
8499
- };
8478
+ var initialParams = {exports: {}};
8500
8479
 
8501
8480
  (function (module, exports) {
8502
8481
 
@@ -8511,13 +8490,15 @@ var initialParams = {
8511
8490
  };
8512
8491
  };
8513
8492
 
8514
- module.exports = exports["default"];
8515
- } (initialParams, initialParamsExports));
8493
+ module.exports = exports["default"];
8494
+ } (initialParams, initialParams.exports));
8495
+
8496
+ var initialParamsExports = initialParams.exports;
8516
8497
 
8517
8498
  var hasRequiredAsyncify;
8518
8499
 
8519
8500
  function requireAsyncify () {
8520
- if (hasRequiredAsyncify) return asyncifyExports;
8501
+ if (hasRequiredAsyncify) return asyncify.exports;
8521
8502
  hasRequiredAsyncify = 1;
8522
8503
  (function (module, exports) {
8523
8504
 
@@ -8636,9 +8617,9 @@ function requireAsyncify () {
8636
8617
  }, err);
8637
8618
  }
8638
8619
  }
8639
- module.exports = exports['default'];
8640
- } (asyncify, asyncifyExports));
8641
- return asyncifyExports;
8620
+ module.exports = exports['default'];
8621
+ } (asyncify, asyncify.exports));
8622
+ return asyncify.exports;
8642
8623
  }
8643
8624
 
8644
8625
  var hasRequiredWrapAsync;
@@ -8975,8 +8956,10 @@ function requireWrapAsync () {
8975
8956
  });
8976
8957
  return q;
8977
8958
  }
8978
- module.exports = exports['default'];
8979
- } (queue$1, queueExports));
8959
+ module.exports = exports['default'];
8960
+ } (queue$1, queue$1.exports));
8961
+
8962
+ var queueExports = queue$1.exports;
8980
8963
 
8981
8964
  (function (module, exports) {
8982
8965
 
@@ -9048,9 +9031,10 @@ function requireWrapAsync () {
9048
9031
  function cargo(worker, concurrency, payload) {
9049
9032
  return (0, _queue2.default)(worker, concurrency, payload);
9050
9033
  }
9051
- module.exports = exports['default'];
9052
- } (cargoQueue$1, cargoQueueExports));
9034
+ module.exports = exports['default'];
9035
+ } (cargoQueue$1, cargoQueue$1.exports));
9053
9036
 
9037
+ var cargoQueueExports = cargoQueue$1.exports;
9054
9038
  var cargoQueue = /*@__PURE__*/getDefaultExportFromCjs(cargoQueueExports);
9055
9039
 
9056
9040
  var cryptoBrowserify = {};
@@ -9087,11 +9071,7 @@ var _polyfillNode_inherits = /*#__PURE__*/Object.freeze({
9087
9071
 
9088
9072
  var require$$3$1 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_inherits);
9089
9073
 
9090
- var readableBrowserExports = {};
9091
- var readableBrowser = {
9092
- get exports(){ return readableBrowserExports; },
9093
- set exports(v){ readableBrowserExports = v; },
9094
- };
9074
+ var readableBrowser = {exports: {}};
9095
9075
 
9096
9076
  var domain;
9097
9077
 
@@ -13488,8 +13468,10 @@ var pipeline_1 = pipeline;
13488
13468
  exports.Transform = _stream_transform;
13489
13469
  exports.PassThrough = _stream_passthrough;
13490
13470
  exports.finished = endOfStream;
13491
- exports.pipeline = pipeline_1;
13492
- } (readableBrowser, readableBrowserExports));
13471
+ exports.pipeline = pipeline_1;
13472
+ } (readableBrowser, readableBrowser.exports));
13473
+
13474
+ var readableBrowserExports = readableBrowser.exports;
13493
13475
 
13494
13476
  var Buffer$E = safeBufferExports.Buffer;
13495
13477
  var Transform$6 = readableBrowserExports.Transform;
@@ -13895,11 +13877,7 @@ function fn5 (a, b, c, d, e, m, k, s) {
13895
13877
 
13896
13878
  var ripemd160 = RIPEMD160$4;
13897
13879
 
13898
- var sha_jsExports = {};
13899
- var sha_js = {
13900
- get exports(){ return sha_jsExports; },
13901
- set exports(v){ sha_jsExports = v; },
13902
- };
13880
+ var sha_js = {exports: {}};
13903
13881
 
13904
13882
  var Buffer$B = safeBufferExports.Buffer;
13905
13883
 
@@ -14703,6 +14681,8 @@ exports$1.sha256 = sha256$1;
14703
14681
  exports$1.sha384 = sha384$1;
14704
14682
  exports$1.sha512 = sha512$1;
14705
14683
 
14684
+ var sha_jsExports = sha_js.exports;
14685
+
14706
14686
  function BufferList() {
14707
14687
  this.head = null;
14708
14688
  this.tail = null;
@@ -16653,12 +16633,6 @@ var browser$9 = function createHmac (alg, key) {
16653
16633
  return new Hmac$2(alg, key)
16654
16634
  };
16655
16635
 
16656
- var algosExports = {};
16657
- var algos = {
16658
- get exports(){ return algosExports; },
16659
- set exports(v){ algosExports = v; },
16660
- };
16661
-
16662
16636
  var sha224WithRSAEncryption = {
16663
16637
  sign: "rsa",
16664
16638
  hash: "sha224",
@@ -16823,9 +16797,7 @@ var require$$6 = {
16823
16797
  }
16824
16798
  };
16825
16799
 
16826
- (function (module) {
16827
- module.exports = require$$6;
16828
- } (algos));
16800
+ var algos = require$$6;
16829
16801
 
16830
16802
  var browser$8 = {};
16831
16803
 
@@ -19065,7 +19037,7 @@ var modes = {};
19065
19037
  exports['des-ede'] = {
19066
19038
  key: 16,
19067
19039
  iv: 0
19068
- };
19040
+ };
19069
19041
  } (modes));
19070
19042
 
19071
19043
  var DES = browserifyDes;
@@ -19138,11 +19110,9 @@ browser$7.listCiphers = browser$7.getCiphers = getCiphers;
19138
19110
 
19139
19111
  var browser$5 = {};
19140
19112
 
19141
- var bnExports$1 = {};
19142
- var bn$1 = {
19143
- get exports(){ return bnExports$1; },
19144
- set exports(v){ bnExports$1 = v; },
19145
- };
19113
+ var bn$1 = {exports: {}};
19114
+
19115
+ bn$1.exports;
19146
19116
 
19147
19117
  (function (module) {
19148
19118
  (function (module, exports) {
@@ -22587,19 +22557,17 @@ var bn$1 = {
22587
22557
  var res = this.imod(a._invmp(this.m).mul(this.r2));
22588
22558
  return res._forceRed(this);
22589
22559
  };
22590
- })(module, commonjsGlobal);
22560
+ })(module, commonjsGlobal);
22591
22561
  } (bn$1));
22592
22562
 
22593
- var brorandExports = {};
22594
- var brorand = {
22595
- get exports(){ return brorandExports; },
22596
- set exports(v){ brorandExports = v; },
22597
- };
22563
+ var bnExports$1 = bn$1.exports;
22564
+
22565
+ var brorand = {exports: {}};
22598
22566
 
22599
22567
  var hasRequiredBrorand;
22600
22568
 
22601
22569
  function requireBrorand () {
22602
- if (hasRequiredBrorand) return brorandExports;
22570
+ if (hasRequiredBrorand) return brorand.exports;
22603
22571
  hasRequiredBrorand = 1;
22604
22572
  var r;
22605
22573
 
@@ -22613,7 +22581,7 @@ function requireBrorand () {
22613
22581
  function Rand(rand) {
22614
22582
  this.rand = rand;
22615
22583
  }
22616
- brorandExports.Rand = Rand;
22584
+ brorand.exports.Rand = Rand;
22617
22585
 
22618
22586
  Rand.prototype.generate = function generate(len) {
22619
22587
  return this._rand(len);
@@ -22666,7 +22634,7 @@ function requireBrorand () {
22666
22634
  } catch (e) {
22667
22635
  }
22668
22636
  }
22669
- return brorandExports;
22637
+ return brorand.exports;
22670
22638
  }
22671
22639
 
22672
22640
  var mr;
@@ -23173,17 +23141,11 @@ function requireBrowser$2 () {
23173
23141
  return browser$5;
23174
23142
  }
23175
23143
 
23176
- var signExports = {};
23177
- var sign = {
23178
- get exports(){ return signExports; },
23179
- set exports(v){ signExports = v; },
23180
- };
23144
+ var sign = {exports: {}};
23181
23145
 
23182
- var bnExports = {};
23183
- var bn = {
23184
- get exports(){ return bnExports; },
23185
- set exports(v){ bnExports = v; },
23186
- };
23146
+ var bn = {exports: {}};
23147
+
23148
+ bn.exports;
23187
23149
 
23188
23150
  (function (module) {
23189
23151
  (function (module, exports) {
@@ -26533,9 +26495,11 @@ var bn = {
26533
26495
  var res = this.imod(a._invmp(this.m).mul(this.r2));
26534
26496
  return res._forceRed(this);
26535
26497
  };
26536
- })(module, commonjsGlobal);
26498
+ })(module, commonjsGlobal);
26537
26499
  } (bn));
26538
26500
 
26501
+ var bnExports = bn.exports;
26502
+
26539
26503
  var BN$a = bnExports;
26540
26504
  var randomBytes$1 = browserExports$1;
26541
26505
 
@@ -26706,7 +26670,7 @@ var utils$k = {};
26706
26670
  return toHex(arr);
26707
26671
  else
26708
26672
  return arr;
26709
- };
26673
+ };
26710
26674
  } (utils$k));
26711
26675
 
26712
26676
  (function (exports) {
@@ -26826,7 +26790,7 @@ var utils$k = {};
26826
26790
  function intFromLE(bytes) {
26827
26791
  return new BN(bytes, 'hex', 'le');
26828
26792
  }
26829
- utils.intFromLE = intFromLE;
26793
+ utils.intFromLE = intFromLE;
26830
26794
  } (utils$l));
26831
26795
 
26832
26796
  var curve = {};
@@ -28765,7 +28729,7 @@ Point.prototype.mixedAdd = Point.prototype.add;
28765
28729
  curve.base = base$2;
28766
28730
  curve.short = short;
28767
28731
  curve.mont = mont;
28768
- curve.edwards = edwards;
28732
+ curve.edwards = edwards;
28769
28733
  } (curve));
28770
28734
 
28771
28735
  var curves$1 = {};
@@ -29978,7 +29942,7 @@ Hmac.prototype.digest = function digest(enc) {
29978
29942
  hash.sha224 = hash.sha.sha224;
29979
29943
  hash.sha384 = hash.sha.sha384;
29980
29944
  hash.sha512 = hash.sha.sha512;
29981
- hash.ripemd160 = hash.ripemd.ripemd160;
29945
+ hash.ripemd160 = hash.ripemd.ripemd160;
29982
29946
  } (hash$2));
29983
29947
 
29984
29948
  var secp256k1;
@@ -30975,7 +30939,7 @@ function requireSecp256k1 () {
30975
30939
  '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8',
30976
30940
  pre,
30977
30941
  ],
30978
- });
30942
+ });
30979
30943
  } (curves$1));
30980
30944
 
30981
30945
  var hash$1 = hash$2;
@@ -31918,8 +31882,8 @@ function requireElliptic () {
31918
31882
 
31919
31883
  // Protocols
31920
31884
  elliptic.ec = requireEc();
31921
- elliptic.eddsa = eddsa;
31922
- } (elliptic));
31885
+ elliptic.eddsa = eddsa;
31886
+ } (elliptic));
31923
31887
  return elliptic;
31924
31888
  }
31925
31889
 
@@ -32979,7 +32943,7 @@ var der$2 = {};
32979
32943
  0x1d: 'charstr',
32980
32944
  0x1e: 'bmpstr'
32981
32945
  };
32982
- exports.tagByName = reverse(exports.tag);
32946
+ exports.tagByName = reverse(exports.tag);
32983
32947
  } (der$2));
32984
32948
 
32985
32949
  const inherits$3 = require$$3$1;
@@ -33303,7 +33267,7 @@ PEMEncoder.prototype.encode = function encode(data, options) {
33303
33267
  const encoders = exports;
33304
33268
 
33305
33269
  encoders.der = der_1$1;
33306
- encoders.pem = pem$1;
33270
+ encoders.pem = pem$1;
33307
33271
  } (encoders));
33308
33272
 
33309
33273
  var decoders = {};
@@ -33697,7 +33661,7 @@ PEMDecoder.prototype.decode = function decode(data, options) {
33697
33661
  const decoders = exports;
33698
33662
 
33699
33663
  decoders.der = der_1;
33700
- decoders.pem = pem;
33664
+ decoders.pem = pem;
33701
33665
  } (decoders));
33702
33666
 
33703
33667
  (function (exports) {
@@ -33756,7 +33720,7 @@ PEMDecoder.prototype.decode = function decode(data, options) {
33756
33720
 
33757
33721
  Entity.prototype.encode = function encode(data, enc, /* internal */ reporter) {
33758
33722
  return this._getEncoder(enc).encode(data, reporter);
33759
- };
33723
+ };
33760
33724
  } (api));
33761
33725
 
33762
33726
  var base$1 = {};
@@ -33768,7 +33732,7 @@ var base$1 = {};
33768
33732
  base.Reporter = reporter.Reporter;
33769
33733
  base.DecoderBuffer = buffer.DecoderBuffer;
33770
33734
  base.EncoderBuffer = buffer.EncoderBuffer;
33771
- base.Node = node;
33735
+ base.Node = node;
33772
33736
  } (base$1));
33773
33737
 
33774
33738
  var constants = {};
@@ -33793,7 +33757,7 @@ var constants = {};
33793
33757
  return res;
33794
33758
  };
33795
33759
 
33796
- constants.der = der$2;
33760
+ constants.der = der$2;
33797
33761
  } (constants));
33798
33762
 
33799
33763
  (function (exports) {
@@ -33806,7 +33770,7 @@ var constants = {};
33806
33770
  asn1.base = base$1;
33807
33771
  asn1.constants = constants;
33808
33772
  asn1.decoders = decoders;
33809
- asn1.encoders = encoders;
33773
+ asn1.encoders = encoders;
33810
33774
  } (asn1$2));
33811
33775
 
33812
33776
  var asn = asn1$2;
@@ -34180,7 +34144,7 @@ var require$$4 = {
34180
34144
  var hasRequiredSign;
34181
34145
 
34182
34146
  function requireSign () {
34183
- if (hasRequiredSign) return signExports;
34147
+ if (hasRequiredSign) return sign.exports;
34184
34148
  hasRequiredSign = 1;
34185
34149
  // much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js
34186
34150
  var Buffer = safeBufferExports.Buffer;
@@ -34323,9 +34287,9 @@ function requireSign () {
34323
34287
  }
34324
34288
 
34325
34289
  sign.exports = sign$1;
34326
- signExports.getKey = getKey;
34327
- signExports.makeKey = makeKey;
34328
- return signExports;
34290
+ sign.exports.getKey = getKey;
34291
+ sign.exports.makeKey = makeKey;
34292
+ return sign.exports;
34329
34293
  }
34330
34294
 
34331
34295
  var verify_1;
@@ -34904,7 +34868,7 @@ function compare$3 (a, b) {
34904
34868
 
34905
34869
  exports.publicDecrypt = function publicDecrypt (key, buf) {
34906
34870
  return exports.privateDecrypt(key, buf, true)
34907
- };
34871
+ };
34908
34872
  } (browser$2));
34909
34873
 
34910
34874
  var browser$1 = {};
@@ -35026,8 +34990,8 @@ function requireCryptoBrowserify () {
35026
34990
  cryptoBrowserify.createHash = cryptoBrowserify.Hash = browser$a;
35027
34991
  cryptoBrowserify.createHmac = cryptoBrowserify.Hmac = browser$9;
35028
34992
 
35029
- var algos = algosExports;
35030
- var algoKeys = Object.keys(algos);
34993
+ var algos$1 = algos;
34994
+ var algoKeys = Object.keys(algos$1);
35031
34995
  var hashes = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'].concat(algoKeys);
35032
34996
  cryptoBrowserify.getHashes = function () {
35033
34997
  return hashes
@@ -37889,7 +37853,7 @@ async function visMerkleClock (blocks, head) {
37889
37853
  return { vis: lines.join('\n') }
37890
37854
  }
37891
37855
 
37892
- var charwise = {};
37856
+ var charwise$1 = {};
37893
37857
 
37894
37858
  var number = {};
37895
37859
 
@@ -38117,8 +38081,10 @@ object.factory = function (codec) {
38117
38081
 
38118
38082
  //for leveldb, request strings
38119
38083
  exports.buffer = false;
38120
- exports.type = 'charwise';
38121
- } (charwise));
38084
+ exports.type = 'charwise';
38085
+ } (charwise$1));
38086
+
38087
+ var charwise = /*@__PURE__*/getDefaultExportFromCjs(charwise$1);
38122
38088
 
38123
38089
  /* global localStorage */
38124
38090
  let storageSupported = false;
@@ -39091,11 +39057,7 @@ async function doIndexQuery (blocks, indexByKey, query = {}) {
39091
39057
  }
39092
39058
  }
39093
39059
 
39094
- var browserExports = {};
39095
- var browser = {
39096
- get exports(){ return browserExports; },
39097
- set exports(v){ browserExports = v; },
39098
- };
39060
+ var browser = {exports: {}};
39099
39061
 
39100
39062
  /**
39101
39063
  * Helpers.
@@ -39811,8 +39773,10 @@ var common = setup;
39811
39773
  } catch (error) {
39812
39774
  return '[UnexpectedJSONParseError]: ' + error.message;
39813
39775
  }
39814
- };
39815
- } (browser, browserExports));
39776
+ };
39777
+ } (browser, browser.exports));
39778
+
39779
+ var browserExports = browser.exports;
39816
39780
 
39817
39781
  // originally pulled out of simple-peer
39818
39782
 
@@ -40963,6 +40927,8 @@ Peer.channelConfig = {};
40963
40927
 
40964
40928
  var simplePeer = Peer;
40965
40929
 
40930
+ var SimplePeer = /*@__PURE__*/getDefaultExportFromCjs(simplePeer);
40931
+
40966
40932
  /**
40967
40933
  * @typedef {import('./database.js').Database} Database
40968
40934
  */
@@ -40973,7 +40939,7 @@ class Sync {
40973
40939
  * @memberof Sync
40974
40940
  * @static
40975
40941
  */
40976
- constructor (database, PeerClass = simplePeer) {
40942
+ constructor (database, PeerClass = SimplePeer) {
40977
40943
  this.database = database;
40978
40944
  this.database.blocks.syncs.add(this); // should this happen during setup?
40979
40945
  this.PeerClass = PeerClass;
@@ -41056,6 +41022,10 @@ class Sync {
41056
41022
  // get the roots parents
41057
41023
  const parents = await Promise.all(roots.map(async (cid) => {
41058
41024
  const rbl = await reader.get(cid);
41025
+ if (!rbl) {
41026
+ console.log('missing root block', cid.toString(), reader);
41027
+ throw new Error('missing root block')
41028
+ }
41059
41029
  const block = await decodeEventBlock(rbl.bytes);
41060
41030
  return block.value.parents
41061
41031
  }));
@@ -41072,7 +41042,7 @@ class Sync {
41072
41042
  } else if (message.clock) {
41073
41043
  const reqCidDiff = message;
41074
41044
  // this might be a CID diff
41075
- // console.log('got diff', reqCidDiff)
41045
+ console.log('got diff', reqCidDiff);
41076
41046
  const carBlock = await Sync.makeCar(this.database, null, reqCidDiff.cids);
41077
41047
  if (!carBlock) {
41078
41048
  // we are full synced
@@ -41175,9 +41145,9 @@ class Fireproof {
41175
41145
  if (existing) {
41176
41146
  const existingConfig = JSON.parse(existing);
41177
41147
  const fp = new Database(new TransactionBlockstore(name, existingConfig.key), [], opts);
41178
- return this.fromJSON(existingConfig, fp)
41148
+ return Fireproof.fromJSON(existingConfig, fp)
41179
41149
  } else {
41180
- const instanceKey = browserExports$1(32).toString('hex'); // pass null to disable encryption
41150
+ const instanceKey = randomBytes$3(32).toString('hex'); // pass null to disable encryption
41181
41151
  return new Database(new TransactionBlockstore(name, instanceKey), [], opts)
41182
41152
  }
41183
41153
  } else {
@@ -41218,7 +41188,7 @@ class Fireproof {
41218
41188
  index.clock.db = null;
41219
41189
  });
41220
41190
  }
41221
- const snappedDb = this.fromJSON(definition, withBlocks)
41191
+ const snappedDb = Fireproof.fromJSON(definition, withBlocks)
41222
41192
  ;[...database.indexes.values()].forEach(index => {
41223
41193
  snappedDb.indexes.get(index.mapFnString).mapFn = index.mapFn;
41224
41194
  });