git ssb

1+

Dominic / ssb-keys



Commit e3cfd2e9f91c4e5ce882685477acef259622b53e

update readme to show new api examples

Paul Frazee committed on 11/20/2014, 10:03:07 PM
Parent: 3a5b82bd19a19d9f6cc51b0cde25b77c7ee08e62

Files changed

README.mdchanged
README.mdView
@@ -1,37 +1,52 @@
11 # SSB-Keys
22
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.
44
55 ```js
66 var ssbkeys = require('ssb-keys')
77
88 ssbkeys.create(path, function(err, k) {
99 console.log(k) /* => {
10- id: Buffer(...),
11- public: Buffer(...),
12- private: Buffer(...)
10+ id: String,
11+ public: String,
12+ private: String
1313 }*/
1414 })
1515
1616 ssbkeys.load(path, function(err, k) {
1717 console.log(k) /* => {
18- id: Buffer(...),
19- public: Buffer(...),
20- private: Buffer(...)
18+ id: String,
19+ public: String,
20+ private: String
2121 }*/
2222 })
2323
2424 var k = ssbkeys.createSync(path)
2525 console.log(k) /* => {
26- id: Buffer(...),
27- public: Buffer(...),
28- private: Buffer(...)
26+ id: String,
27+ public: String,
28+ private: String
2929 }*/
3030
3131 var k = ssbkeys.loadSync(path)
3232 console.log(k) /* => {
33- id: Buffer(...),
34- public: Buffer(...),
35- private: Buffer(...)
33+ id: String,
34+ public: String,
35+ private: String
3636 }*/
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
3752 ```

Built with git-ssb-web