autobee 1.0.7 → 1.0.8
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/encoding.js +9 -2
- package/package.json +2 -2
package/lib/encoding.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const b4a = require('b4a')
|
|
2
2
|
const c = require('compact-encoding')
|
|
3
3
|
const crypto = require('hypercore-crypto')
|
|
4
|
-
const { AutobeeEncryption } = require('autobee-encryption')
|
|
4
|
+
const { AutobeeEncryption, WriterEncryption } = require('autobee-encryption')
|
|
5
5
|
|
|
6
6
|
const { getEncoding } = require('../encoding/spec/autobee')
|
|
7
7
|
const { LEGACY_OPLOG_VERSION, OPLOG_VERSION } = require('./constants')
|
|
@@ -155,6 +155,13 @@ function encodeValue(value, opts = {}) {
|
|
|
155
155
|
return b4a.concat([padding.subarray(0, AutobeeEncryption.PADDING), state.buffer])
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
function decodeValue(buf,
|
|
158
|
+
async function decodeValue(buf, { encryptionKey, autobeeKey, key, manifest, index = 0 } = {}) {
|
|
159
|
+
if (encryptionKey) {
|
|
160
|
+
const w = new WriterEncryption({ encryptionKey, key: autobeeKey })
|
|
161
|
+
|
|
162
|
+
await w.decrypt(index, buf, { key, manifest })
|
|
163
|
+
buf = buf.subarray(AutobeeEncryption.PADDING)
|
|
164
|
+
}
|
|
165
|
+
|
|
159
166
|
return decodeOplog(buf).value
|
|
160
167
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autobee",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Bee based autobase",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Holepunch Inc.",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"test:generate": "brittle -r test/all.js test/*.js"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"autobee-encryption": "^0.
|
|
26
|
+
"autobee-encryption": "^0.1.2",
|
|
27
27
|
"autobee-wakeup": "^1.0.5",
|
|
28
28
|
"b4a": "^1.8.0",
|
|
29
29
|
"compact-encoding": "^2.18.0",
|