corestore 6.18.2 → 6.18.4
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/index.js +6 -2
- package/package.json +3 -2
package/index.js
CHANGED
|
@@ -33,6 +33,7 @@ module.exports = class Corestore extends ReadyResource {
|
|
|
33
33
|
this.manifestVersion = typeof opts.manifestVersion === 'number' ? opts.manifestVersion : (root ? root.manifestVersion : DEFAULT_MANIFEST)
|
|
34
34
|
this.compat = typeof opts.compat === 'boolean' ? opts.compat : (root ? root.compat : DEFAULT_COMPAT)
|
|
35
35
|
this.inflightRange = opts.inflightRange || null
|
|
36
|
+
this.globalCache = opts.globalCache || null
|
|
36
37
|
|
|
37
38
|
this._keyStorage = null
|
|
38
39
|
this._bootstrap = opts._bootstrap || null
|
|
@@ -319,6 +320,7 @@ module.exports = class Corestore extends ReadyResource {
|
|
|
319
320
|
key,
|
|
320
321
|
compat: opts.compat,
|
|
321
322
|
cache: opts.cache,
|
|
323
|
+
globalCache: this.globalCache,
|
|
322
324
|
createIfMissing: opts.createIfMissing === false ? false : !opts._discoveryKey,
|
|
323
325
|
keyPair: hasKeyPair ? keyPair : null
|
|
324
326
|
})
|
|
@@ -366,7 +368,7 @@ module.exports = class Corestore extends ReadyResource {
|
|
|
366
368
|
if (!this.opened) await this.ready()
|
|
367
369
|
|
|
368
370
|
const keyPair = {
|
|
369
|
-
publicKey: b4a.
|
|
371
|
+
publicKey: b4a.allocUnsafeSlow(sodium.crypto_sign_PUBLICKEYBYTES),
|
|
370
372
|
secretKey: b4a.alloc(sodium.crypto_sign_SECRETKEYBYTES)
|
|
371
373
|
}
|
|
372
374
|
|
|
@@ -392,6 +394,7 @@ module.exports = class Corestore extends ReadyResource {
|
|
|
392
394
|
|
|
393
395
|
const core = new Hypercore(null, {
|
|
394
396
|
...opts,
|
|
397
|
+
globalCache: this.globalCache,
|
|
395
398
|
name: null,
|
|
396
399
|
preload: async () => {
|
|
397
400
|
if (opts.preload) opts = { ...opts, ...(await opts.preload()) }
|
|
@@ -489,6 +492,7 @@ module.exports = class Corestore extends ReadyResource {
|
|
|
489
492
|
_attached: opts && opts.detach === false ? this : null,
|
|
490
493
|
_root: this._root,
|
|
491
494
|
inflightRange: this.inflightRange,
|
|
495
|
+
globalCache: this.globalCache,
|
|
492
496
|
...opts
|
|
493
497
|
})
|
|
494
498
|
if (this === this._root) this._rootStoreSessions.add(session)
|
|
@@ -557,7 +561,7 @@ function validateGetOptions (opts) {
|
|
|
557
561
|
|
|
558
562
|
function generateNamespace (namespace, name) {
|
|
559
563
|
if (!b4a.isBuffer(name)) name = b4a.from(name)
|
|
560
|
-
const out = b4a.
|
|
564
|
+
const out = b4a.allocUnsafeSlow(32)
|
|
561
565
|
sodium.crypto_generichash_batch(out, [namespace, name])
|
|
562
566
|
return out
|
|
563
567
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "corestore",
|
|
3
|
-
"version": "6.18.
|
|
3
|
+
"version": "6.18.4",
|
|
4
4
|
"description": "A Hypercore factory that simplifies managing collections of cores.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -25,13 +25,14 @@
|
|
|
25
25
|
],
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"brittle": "^3.2.2",
|
|
28
|
+
"rache": "^1.0.0",
|
|
28
29
|
"random-access-memory": "^6.2.0",
|
|
29
30
|
"standard": "^17.1.0",
|
|
30
31
|
"test-tmp": "^1.0.2"
|
|
31
32
|
},
|
|
32
33
|
"dependencies": {
|
|
33
34
|
"b4a": "^1.6.4",
|
|
34
|
-
"hypercore": "^10.
|
|
35
|
+
"hypercore": "^10.37.10",
|
|
35
36
|
"hypercore-crypto": "^3.4.0",
|
|
36
37
|
"hypercore-id-encoding": "^1.2.0",
|
|
37
38
|
"read-write-mutexify": "^2.1.0",
|