git ssb

1+

Dominic / ssb-keys



Commit 99272cc765f98c8eeddc9786232fcdcdfa7b9263

use chloride directly

Dominic Tarr committed on 12/5/2015, 8:13:38 AM
Parent: ab0a28e502ed6f2e1c7cfb70e57b53ff0e9a99cc

Files changed

index.jschanged
sodium.jschanged
browser-sodium.jsdeleted
index.jsView
@@ -6,9 +6,9 @@
66 var crypto = require('crypto')
77 var createHmac = require('hmac')
88
99 var ecc = require('./eccjs')
10-var sodium = require('chloride').api
10+var sodium = require('chloride')
1111 var ssbref = require('ssb-ref')
1212
1313 var pb = require('private-box')
1414
sodium.jsView
@@ -1,6 +1,6 @@
11
2-var sodium = require('chloride').api
2+var sodium = require('chloride')
33 var crypto = require('crypto')
44
55 module.exports = {
66
browser-sodium.jsView
@@ -1,35 +1,0 @@
1-
2-var sodium = require('libsodium-wrappers')
3-var crypto = require('crypto')
4-
5-var B = Buffer
6-
7-function Ui8 (b) {
8- return new Uint8Array(b)
9-}
10-
11-module.exports = {
12-
13- curves: ['ed25519'],
14-
15- generate: function () {
16- var keys = sodium.crypto_sign_keypair()
17- return {
18- curve: 'ed25519',
19- public: B(keys.publicKey),
20-
21- //so that this works with either sodium
22- //or libsodium-wrappers (in browser)
23- private: B(keys.privateKey || keys.secretKey)
24- }
25- },
26-
27- sign: function (private, message) {
28- return B(sodium.crypto_sign_detached(Ui8(message), Ui8(private)))
29- },
30-
31- verify: function (public, sig, message) {
32- return sodium.crypto_sign_verify_detached(Ui8(sig), Ui8(message), Ui8(public))
33- }
34-
35-}

Built with git-ssb-web