hypercore 11.4.2 → 11.6.0
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 +7 -15
- package/lib/core.js +0 -1
- package/package.json +3 -2
package/index.js
CHANGED
|
@@ -253,7 +253,6 @@ class Hypercore extends EventEmitter {
|
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
this.encryption = encryption
|
|
256
|
-
if (!this.core.encryption) this.core.encryption = this.encryption
|
|
257
256
|
}
|
|
258
257
|
|
|
259
258
|
setKeyPair (keyPair) {
|
|
@@ -329,19 +328,10 @@ class Hypercore extends EventEmitter {
|
|
|
329
328
|
|
|
330
329
|
if (this.keyPair === null) this.keyPair = opts.keyPair || this.core.header.keyPair
|
|
331
330
|
|
|
332
|
-
const e = getEncryptionOption(opts)
|
|
333
|
-
if (!this.core.encryption && e) {
|
|
334
|
-
if (isEncryptionProvider(e)) {
|
|
335
|
-
this.core.encryption = e
|
|
336
|
-
} else {
|
|
337
|
-
this.core.encryption = this._getEncryptionProvider(e.key, e.block)
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
|
|
341
331
|
const parent = opts.parent || null
|
|
332
|
+
if (parent && parent.encryption) this.encryption = parent.encryption
|
|
342
333
|
|
|
343
|
-
if (this.
|
|
344
|
-
else if (parent && parent.encryption) this.encryption = this.core.encryption = parent.encryption
|
|
334
|
+
if (!this.encryption) this.encryption = this._getEncryptionProvider(opts)
|
|
345
335
|
|
|
346
336
|
this.writable = this._isWritable()
|
|
347
337
|
|
|
@@ -1064,9 +1054,11 @@ class Hypercore extends EventEmitter {
|
|
|
1064
1054
|
return block
|
|
1065
1055
|
}
|
|
1066
1056
|
|
|
1067
|
-
_getEncryptionProvider (
|
|
1068
|
-
|
|
1069
|
-
|
|
1057
|
+
_getEncryptionProvider (opts) {
|
|
1058
|
+
const e = getEncryptionOption(opts)
|
|
1059
|
+
if (isEncryptionProvider(e)) return e
|
|
1060
|
+
if (!e || !e.key) return null
|
|
1061
|
+
return new DefaultEncryption(e.key, this.key, { block: e.block, compat: this.core.compat })
|
|
1070
1062
|
}
|
|
1071
1063
|
}
|
|
1072
1064
|
|
package/lib/core.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hypercore",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.6.0",
|
|
4
4
|
"description": "Hypercore is a secure, distributed append-only log",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -54,11 +54,12 @@
|
|
|
54
54
|
"hypercore-id-encoding": "^1.2.0",
|
|
55
55
|
"hypercore-storage": "^1.0.0",
|
|
56
56
|
"is-options": "^1.0.1",
|
|
57
|
+
"nanoassert": "^2.0.0",
|
|
57
58
|
"protomux": "^3.5.0",
|
|
58
59
|
"quickbit-universal": "^2.2.0",
|
|
59
60
|
"random-array-iterator": "^1.0.0",
|
|
60
61
|
"safety-catch": "^1.0.1",
|
|
61
|
-
"sodium-universal": "^
|
|
62
|
+
"sodium-universal": "^5.0.1",
|
|
62
63
|
"streamx": "^2.12.4",
|
|
63
64
|
"unslab": "^1.3.0",
|
|
64
65
|
"z32": "^1.0.0"
|