Browse Source

fix to use latest keypair fn

Kieran Gibb 2 years ago
parent
commit
5ced642487
No known key found for this signature in database
4 changed files with 6 additions and 3083 deletions
  1. 2
    2
      index.js
  2. 3
    3
      package.json
  3. 1
    1
      test/index.test.js
  4. 0
    3077
      yarn.lock

+ 2
- 2
index.js View File

@@ -38,7 +38,7 @@ class Admin extends Base {
38 38
       }, this._opts))
39 39
     })
40 40
 
41
-    this.derivedKeyPair = (seed, id) => crypto.keyPair(this.masterKey, id, seed)
41
+    this.derivedKeyPair = crypto.keyPair.bind(null, this.masterKey)
42 42
     this.core = kappa(this.storage, { multifeed: this.multifeed })
43 43
     this.core.use('logs', Query(this.db.log, query.log))
44 44
     this.logs = this.core.api.logs
@@ -74,7 +74,7 @@ class Admin extends Base {
74 74
 
75 75
   _ready (callback) {
76 76
     var self = this
77
-    var keypair = self.derivedKeyPair(self.address, LOG_ID)
77
+    var keypair = self.derivedKeyPair(LOG_ID, self.address)
78 78
     self.core._logs.writer('log', { keypair }, (err, feed) => {
79 79
       if (err) return callback(err)
80 80
       self.log = feed

+ 3
- 3
package.json View File

@@ -8,9 +8,9 @@
8 8
   "dependencies": {
9 9
     "assert": "^2.0.0",
10 10
     "cobox-command-schemas": "git+https://ledger-git.dyne.org/cobox/cobox-command-schemas",
11
-    "cobox-crypto": "git+https://ledger-git.dyne.org/cobox/cobox-crypto",
12
-    "cobox-group-base": "git+https://ledger-git.dyne.org/cobox/cobox-group-base",
13
-    "cobox-swarm": "git+https://ledger-git.dyne.org/cobox/cobox-swarm",
11
+    "cobox-crypto": "git+https://ledger-git.dyne.org/cobox/cobox-crypto#development",
12
+    "cobox-group-base": "git+https://ledger-git.dyne.org/cobox/cobox-group-base#development",
13
+    "cobox-swarm": "git+https://ledger-git.dyne.org/cobox/cobox-swarm#development",
14 14
     "debug": "^4.1.1",
15 15
     "kappa-core": "^6.0.0",
16 16
     "kappa-view-query": "^2.0.7",

+ 1
- 1
test/index.test.js View File

@@ -29,7 +29,7 @@ describe('basic', (context) => {
29 29
     await admin.ready()
30 30
 
31 31
     assert.ok(admin.log, 'has a hypercore log')
32
-    let keyPair = admin.derivedKeyPair(admin.address, 0)
32
+    let keyPair = admin.derivedKeyPair(0, admin.address)
33 33
     assert.same(admin.log.key.toString('hex'), keyPair.publicKey.toString('hex'), 'derives a publicKey')
34 34
     assert.ok(admin.discoveryKey, 'has a discoveryKey')
35 35
 

+ 0
- 3077
yarn.lock
File diff suppressed because it is too large
View File