Commit 7f1bf9e79916feee154feb29bed1fadca5c04e4c
Merge branch 'master' of git://github.com/pfraze/ssb-keys
Dominic Tarr committed on 11/22/2014, 2:48:18 PMParent: f49ed9d612208d9cfa2e456cbbdc329ddf133cdf
Parent: 6c030d1ba292d2341fe3d4497374c3536d3d0566
Files changed
README.md | changed |
package.json | changed |
README.md | ||
---|---|---|
@@ -1,37 +1,52 @@ | ||
1 | 1 | # SSB-Keys |
2 | 2 | |
3 | -A common module for secure-scuttlebutt projects, provides an API to create or load elliptic-curve keypairs. | |
3 | +A common module for secure-scuttlebutt projects, provides an API to create or load elliptic-curve keypairs and to execute related crypto operations. | |
4 | 4 | |
5 | 5 | ```js |
6 | 6 | var ssbkeys = require('ssb-keys') |
7 | 7 | |
8 | 8 | ssbkeys.create(path, function(err, k) { |
9 | 9 | console.log(k) /* => { |
10 | - id: Buffer(...), | |
11 | - public: Buffer(...), | |
12 | - private: Buffer(...) | |
10 | + id: String, | |
11 | + public: String, | |
12 | + private: String | |
13 | 13 | }*/ |
14 | 14 | }) |
15 | 15 | |
16 | 16 | ssbkeys.load(path, function(err, k) { |
17 | 17 | console.log(k) /* => { |
18 | - id: Buffer(...), | |
19 | - public: Buffer(...), | |
20 | - private: Buffer(...) | |
18 | + id: String, | |
19 | + public: String, | |
20 | + private: String | |
21 | 21 | }*/ |
22 | 22 | }) |
23 | 23 | |
24 | 24 | var k = ssbkeys.createSync(path) |
25 | 25 | console.log(k) /* => { |
26 | - id: Buffer(...), | |
27 | - public: Buffer(...), | |
28 | - private: Buffer(...) | |
26 | + id: String, | |
27 | + public: String, | |
28 | + private: String | |
29 | 29 | }*/ |
30 | 30 | |
31 | 31 | var k = ssbkeys.loadSync(path) |
32 | 32 | console.log(k) /* => { |
33 | - id: Buffer(...), | |
34 | - public: Buffer(...), | |
35 | - private: Buffer(...) | |
33 | + id: String, | |
34 | + public: String, | |
35 | + private: String | |
36 | 36 | }*/ |
37 | + | |
38 | +var k = ssbkeys.generate() | |
39 | +console.log(k) /* => { | |
40 | + id: String, | |
41 | + public: String, | |
42 | + private: String | |
43 | +}*/ | |
44 | + | |
45 | +var hash = ssbkeys.hash(new Buffer('deadbeef', 'hex')) | |
46 | +ssbkeys.isHash(hash) // => true | |
47 | + | |
48 | +var sig = ssbkeys.sign(k, hash) | |
49 | +ssbkeys.verify(k.public, sig, hash) | |
50 | + | |
51 | +ssbkeys.hmac(new Buffer('deadbeef', 'hex'), k.private) // => String | |
37 | 52 | ``` |
package.json | ||
---|---|---|
@@ -1,8 +1,8 @@ | ||
1 | 1 | { |
2 | 2 | "name": "ssb-keys", |
3 | 3 | "description": "create or load a keypair file for secure-scuttlebutt", |
4 | - "version": "0.2.1", | |
4 | + "version": "0.3.0", | |
5 | 5 | "homepage": "https://github.com/pfraze/ssb-keys", |
6 | 6 | "repository": { |
7 | 7 | "type": "git", |
8 | 8 | "url": "git://github.com/pfraze/ssb-crypto.git" |
Built with git-ssb-web