hypercore 11.4.0 → 11.4.2
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/lib/default-encryption.js +4 -4
- package/lib/verifier.js +1 -1
- package/package.json +1 -1
|
@@ -8,17 +8,17 @@ const nonce = b4a.alloc(sodium.crypto_stream_NONCEBYTES)
|
|
|
8
8
|
module.exports = class DefaultEncryption {
|
|
9
9
|
static PADDING = 8
|
|
10
10
|
|
|
11
|
-
constructor (encryptionKey, hypercoreKey,
|
|
11
|
+
constructor (encryptionKey, hypercoreKey, opts = {}) {
|
|
12
12
|
this.key = encryptionKey
|
|
13
|
-
this.compat = compat
|
|
13
|
+
this.compat = opts.compat === true
|
|
14
14
|
|
|
15
|
-
const keys = DefaultEncryption.deriveKeys(encryptionKey, hypercoreKey,
|
|
15
|
+
const keys = DefaultEncryption.deriveKeys(encryptionKey, hypercoreKey, opts)
|
|
16
16
|
|
|
17
17
|
this.blockKey = keys.block
|
|
18
18
|
this.blindingKey = keys.blinding
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
static deriveKeys (encryptionKey, hypercoreKey, block, compat) {
|
|
21
|
+
static deriveKeys (encryptionKey, hypercoreKey, { block = false, compat = false } = {}) {
|
|
22
22
|
const subKeys = b4a.alloc(2 * sodium.crypto_stream_KEYBYTES)
|
|
23
23
|
|
|
24
24
|
const blockKey = block ? encryptionKey : subKeys.subarray(0, sodium.crypto_stream_KEYBYTES)
|
package/lib/verifier.js
CHANGED
|
@@ -334,6 +334,6 @@ function proofToVersion1 (proof) {
|
|
|
334
334
|
function getManifestVersion (inp) {
|
|
335
335
|
if (typeof inp.version === 'number') return inp.version
|
|
336
336
|
if (inp.linked && inp.linked.length) return 2
|
|
337
|
-
if (inp.userData
|
|
337
|
+
if (inp.userData) return 2
|
|
338
338
|
return 1
|
|
339
339
|
}
|