Commit 99272cc765f98c8eeddc9786232fcdcdfa7b9263
use chloride directly
Dominic Tarr committed on 12/5/2015, 8:13:38 AMParent: ab0a28e502ed6f2e1c7cfb70e57b53ff0e9a99cc
Files changed
index.js | changed |
sodium.js | changed |
browser-sodium.js | deleted |
index.js | ||
---|---|---|
@@ -6,9 +6,9 @@ | ||
6 | 6 | var crypto = require('crypto') |
7 | 7 | var createHmac = require('hmac') |
8 | 8 | |
9 | 9 | var ecc = require('./eccjs') |
10 | -var sodium = require('chloride').api | |
10 | +var sodium = require('chloride') | |
11 | 11 | var ssbref = require('ssb-ref') |
12 | 12 | |
13 | 13 | var pb = require('private-box') |
14 | 14 |
sodium.js | ||
---|---|---|
@@ -1,6 +1,6 @@ | ||
1 | 1 | |
2 | -var sodium = require('chloride').api | |
2 | +var sodium = require('chloride') | |
3 | 3 | var crypto = require('crypto') |
4 | 4 | |
5 | 5 | module.exports = { |
6 | 6 |
browser-sodium.js | ||
---|---|---|
@@ -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