corestore 6.15.4 → 6.15.6
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 +3 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -279,6 +279,7 @@ module.exports = class Corestore extends ReadyResource {
|
|
|
279
279
|
autoClose: true,
|
|
280
280
|
active: false,
|
|
281
281
|
encryptionKey: opts.encryptionKey || null,
|
|
282
|
+
isBlockKey: !!opts.isBlockKey,
|
|
282
283
|
userData,
|
|
283
284
|
manifest,
|
|
284
285
|
key,
|
|
@@ -350,6 +351,7 @@ module.exports = class Corestore extends ReadyResource {
|
|
|
350
351
|
...opts,
|
|
351
352
|
name: null,
|
|
352
353
|
preload: async () => {
|
|
354
|
+
if (opts.preload) opts = { ...opts, ...(await opts.preload()) }
|
|
353
355
|
if (!this.opened) await this.ready()
|
|
354
356
|
|
|
355
357
|
const keys = await this._generateKeys(opts)
|
|
@@ -497,7 +499,7 @@ function validateGetOptions (opts) {
|
|
|
497
499
|
if (opts.name && opts.secretKey) throw new Error('Cannot provide both a name and a secret key')
|
|
498
500
|
if (opts.publicKey && !b4a.isBuffer(opts.publicKey)) throw new Error('publicKey option must be a Buffer or Uint8Array')
|
|
499
501
|
if (opts.secretKey && !b4a.isBuffer(opts.secretKey)) throw new Error('secretKey option must be a Buffer or Uint8Array')
|
|
500
|
-
if (!opts._discoveryKey && (!opts.name && !opts.publicKey && !opts.manifest && !opts.key)) throw new Error('Must provide either a name or a publicKey')
|
|
502
|
+
if (!opts._discoveryKey && (!opts.name && !opts.publicKey && !opts.manifest && !opts.key && !opts.preload)) throw new Error('Must provide either a name or a publicKey')
|
|
501
503
|
return opts
|
|
502
504
|
}
|
|
503
505
|
|