git ssb

1+

Dominic / ssb-keys



Commit 4303c41cef3eb136a15a3adeffe559314bc53a3b

fix syntax bugs

Dominic Tarr committed on 11/20/2014, 7:56:59 PM
Parent: bda63326e87aca8b09964b6bf51fa604ae0b39f9

Files changed

index.jschanged
index.jsView
@@ -4,12 +4,12 @@
44 var k256 = ecc.curves.k256
55 var Blake2s = require('blake2s')
66 var mkdirp = require('mkdirp')
77 var path = require('path')
8-var curve = ecc.curves.k256
8+var curve = ecc.curves.k256
9+var createHmac = require('hmac')
910
1011
11-
1212 function hash (data, enc) {
1313 return new Blake2s().update(data, enc).digest('base64') + '.blake2s'
1414 }
1515
@@ -24,9 +24,8 @@
2424 function isString(s) {
2525 return 'string' === typeof s
2626 }
2727
28-
2928 function empty(v) { return !!v }
3029
3130 function constructKeys() {
3231 var privateKey = crypto.randomBytes(32)
@@ -144,9 +143,9 @@
144143 // {public: Buffer, private: Buffer}
145144
146145 exports.generate = function () {
147146 return keysToBase64(ecc.restore(curve, crypto.randomBytes(32)))
148-},
147+}
149148
150149 //takes a public key and a hash and returns a signature.
151150 //(a signature must be a node buffer)
152151 exports.sign = function (keys, hash) {
@@ -154,17 +153,16 @@
154153 return tag(
155154 ecc.sign(curve, keysToBuffer(keys), hashToBuffer(hash)),
156155 hashTag + '.k256'
157156 )
158-},
157+}
159158
160159 //takes a public key, signature, and a hash
161160 //and returns true if the signature was valid.
162161 exports.verify = function (pub, sig, hash) {
163162 return ecc.verify(curve, keysToBuffer(pub), toBuffer(sig), hashToBuffer(hash))
164-},
163+}
165164
166-
167165 function createHash() {
168166 return new Blake2s()
169167 }
170168

Built with git-ssb-web