Commit c0fdcee6ac3da05da20ec37431fd85c2a897cacd
make eccjs a devdep
Dominic Tarr committed on 2/24/2016, 9:17:52 AMParent: ec16ac523ff4e0a2f22f55668d90fe7601ee560f
Files changed
index.js | changed |
package.json | changed |
index.js | ||
---|---|---|
@@ -5,9 +5,8 @@ | ||
5 | 5 | |
6 | 6 | var crypto = require('crypto') |
7 | 7 | var createHmac = require('hmac') |
8 | 8 | |
9 | -var ecc = require('./eccjs') | |
10 | 9 | var sodium = require('chloride') |
11 | 10 | var ssbref = require('ssb-ref') |
12 | 11 | |
13 | 12 | var pb = require('private-box') |
@@ -131,8 +130,10 @@ | ||
131 | 130 | |
132 | 131 | if(curve !== 'k256') |
133 | 132 | throw new Error('expected legacy curve (k256) but found:' + curve) |
134 | 133 | |
134 | + var ecc = require('./eccjs') | |
135 | + | |
135 | 136 | return keysToJSON(ecc.restore(toBuffer(private)), 'k256') |
136 | 137 | } |
137 | 138 | |
138 | 139 | var toNameFile = exports.toNameFile = function (namefile) { |
@@ -201,12 +202,12 @@ | ||
201 | 202 | |
202 | 203 | |
203 | 204 | // DIGITAL SIGNATURES |
204 | 205 | |
205 | -var curves = { | |
206 | - ed25519 : require('./sodium'), | |
207 | - k256 : ecc //LEGACY | |
208 | -} | |
206 | +var curves = {} | |
207 | +curves.ed25519 = require('./sodium') | |
208 | +try { curves.k256 = require('./eccjs') } | |
209 | +catch (_) {} | |
209 | 210 | |
210 | 211 | function getCurve(keys) { |
211 | 212 | var curve = keys.curve |
212 | 213 | |
@@ -308,4 +309,6 @@ | ||
308 | 309 | |
309 | 310 | var msg = pb.multibox_open(boxed, sk) |
310 | 311 | if(msg) return JSON.parse(''+msg) |
311 | 312 | } |
313 | + | |
314 | + |
package.json | ||
---|---|---|
@@ -10,19 +10,20 @@ | ||
10 | 10 | "dependencies": { |
11 | 11 | "blake2s": "~1.0.0", |
12 | 12 | "chloride": "^2.0.1", |
13 | 13 | "deep-equal": "~0.2.1", |
14 | - "eccjs": "git://github.com/dominictarr/eccjs.git#586f6d47507184a2efe84684ed0a30605cbc43a5", | |
15 | 14 | "hmac": "~1.0.1", |
16 | 15 | "mkdirp": "~0.5.0", |
17 | 16 | "private-box": "~0.0.3", |
18 | 17 | "ssb-ref": "^2.0.0" |
19 | 18 | }, |
20 | 19 | "devDependencies": { |
20 | + "eccjs": "git://github.com/dominictarr/eccjs.git#586f6d47507184a2efe84684ed0a30605cbc43a5", | |
21 | 21 | "tape": "^3.0.3" |
22 | 22 | }, |
23 | 23 | "scripts": { |
24 | 24 | "test": "set -e; for t in test/*.js; do node $t; done" |
25 | 25 | }, |
26 | 26 | "author": "Paul Frazee <pfrazee@gmail.com>", |
27 | 27 | "license": "MIT" |
28 | 28 | } |
29 | + |
Built with git-ssb-web