hypercore 11.6.0 → 11.6.1

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.
Files changed (2) hide show
  1. package/index.js +5 -5
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -235,8 +235,8 @@ class Hypercore extends EventEmitter {
235
235
  return s
236
236
  }
237
237
 
238
- setEncryptionKey (encryptionKey, opts) {
239
- const encryption = this._getEncryptionProvider(encryptionKey, !!(opts && opts.block))
238
+ setEncryptionKey (key, opts) {
239
+ const encryption = this._getEncryptionProvider({ key, block: !!(opts && opts.block) })
240
240
  return this.setEncryption(encryption, opts)
241
241
  }
242
242
 
@@ -331,7 +331,8 @@ class Hypercore extends EventEmitter {
331
331
  const parent = opts.parent || null
332
332
  if (parent && parent.encryption) this.encryption = parent.encryption
333
333
 
334
- if (!this.encryption) this.encryption = this._getEncryptionProvider(opts)
334
+ const e = getEncryptionOption(opts)
335
+ if (!this.encryption) this.encryption = this._getEncryptionProvider(e)
335
336
 
336
337
  this.writable = this._isWritable()
337
338
 
@@ -1054,8 +1055,7 @@ class Hypercore extends EventEmitter {
1054
1055
  return block
1055
1056
  }
1056
1057
 
1057
- _getEncryptionProvider (opts) {
1058
- const e = getEncryptionOption(opts)
1058
+ _getEncryptionProvider (e) {
1059
1059
  if (isEncryptionProvider(e)) return e
1060
1060
  if (!e || !e.key) return null
1061
1061
  return new DefaultEncryption(e.key, this.key, { block: e.block, compat: this.core.compat })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypercore",
3
- "version": "11.6.0",
3
+ "version": "11.6.1",
4
4
  "description": "Hypercore is a secure, distributed append-only log",
5
5
  "main": "index.js",
6
6
  "scripts": {