hypercore 10.25.2 → 10.25.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 CHANGED
@@ -248,6 +248,11 @@ module.exports = class Hypercore extends EventEmitter {
248
248
  return s
249
249
  }
250
250
 
251
+ async setEncryptionKey (key) {
252
+ if (!this.opened) await this.opening
253
+ this.encryption = key ? new BlockEncryption(key, this.key) : null
254
+ }
255
+
251
256
  setKeyPair (keyPair) {
252
257
  this.keyPair = keyPair
253
258
  this.writable = this._isWritable()
package/lib/batch.js CHANGED
@@ -183,7 +183,7 @@ module.exports = class HypercoreBatch extends EventEmitter {
183
183
  if (len < this.length) return b
184
184
 
185
185
  for (let i = 0; i < length - len; i++) {
186
- b.append(this._appendsActual === this._appends ? blocks[i] : this._encrypt(b.length + i, blocks[i]))
186
+ b.append(this._appendsActual === this._appends ? blocks[i] : this._encrypt(b.length, blocks[i]))
187
187
  }
188
188
 
189
189
  return b
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypercore",
3
- "version": "10.25.2",
3
+ "version": "10.25.4",
4
4
  "description": "Hypercore is a secure, distributed append-only log",
5
5
  "main": "index.js",
6
6
  "scripts": {