hypercore 10.1.0 → 10.2.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/README.md +6 -0
- package/index.js +4 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -289,6 +289,12 @@ Can we read from this core? After closing the core this will be false.
|
|
|
289
289
|
|
|
290
290
|
Populated after `ready` has been emitted. Will be `false` before the event.
|
|
291
291
|
|
|
292
|
+
#### `core.id`
|
|
293
|
+
|
|
294
|
+
String containing the id (z-base-32 of the public key) identifying this core.
|
|
295
|
+
|
|
296
|
+
Populated after `ready` has been emitted. Will be `null` before the event.
|
|
297
|
+
|
|
292
298
|
#### `core.key`
|
|
293
299
|
|
|
294
300
|
Buffer containing the public key identifying this core.
|
package/index.js
CHANGED
|
@@ -7,6 +7,7 @@ const b4a = require('b4a')
|
|
|
7
7
|
const Xache = require('xache')
|
|
8
8
|
const NoiseSecretStream = require('@hyperswarm/secret-stream')
|
|
9
9
|
const Protomux = require('protomux')
|
|
10
|
+
const z32 = require('z32')
|
|
10
11
|
|
|
11
12
|
const Replicator = require('./lib/replicator')
|
|
12
13
|
const Core = require('./lib/core')
|
|
@@ -58,6 +59,7 @@ module.exports = class Hypercore extends EventEmitter {
|
|
|
58
59
|
this.encodeBatch = null
|
|
59
60
|
this.activeRequests = []
|
|
60
61
|
|
|
62
|
+
this.id = null
|
|
61
63
|
this.key = key || null
|
|
62
64
|
this.keyPair = null
|
|
63
65
|
this.readable = true
|
|
@@ -225,6 +227,7 @@ module.exports = class Hypercore extends EventEmitter {
|
|
|
225
227
|
if (!this.auth) this.auth = o.auth
|
|
226
228
|
|
|
227
229
|
this.crypto = o.crypto
|
|
230
|
+
this.id = o.id
|
|
228
231
|
this.key = o.key
|
|
229
232
|
this.core = o.core
|
|
230
233
|
this.replicator = o.replicator
|
|
@@ -326,6 +329,7 @@ module.exports = class Hypercore extends EventEmitter {
|
|
|
326
329
|
|
|
327
330
|
this.key = this.core.header.signer.publicKey
|
|
328
331
|
this.keyPair = this.core.header.signer
|
|
332
|
+
this.id = z32.encode(this.key)
|
|
329
333
|
|
|
330
334
|
this.replicator = new Replicator(this.core, this.key, {
|
|
331
335
|
eagerUpdate: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hypercore",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.2.0",
|
|
4
4
|
"description": "Hypercore is a secure, distributed append-only log",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -49,7 +49,8 @@
|
|
|
49
49
|
"safety-catch": "^1.0.1",
|
|
50
50
|
"sodium-universal": "^3.0.4",
|
|
51
51
|
"streamx": "^2.12.4",
|
|
52
|
-
"xache": "^1.1.0"
|
|
52
|
+
"xache": "^1.1.0",
|
|
53
|
+
"z32": "^1.0.0"
|
|
53
54
|
},
|
|
54
55
|
"devDependencies": {
|
|
55
56
|
"brittle": "^3.0.0",
|