* Use Native libsodium when available

* add newline

* fix typo of exports

* add to webpack ignore

* Update Secretbox.js
This commit is contained in:
Jacob
2017-02-06 01:24:54 -05:00
committed by Schuyler Cebulskie
parent 02c23a8b53
commit 49944747ae
4 changed files with 21 additions and 4 deletions
+13
View File
@@ -0,0 +1,13 @@
try {
const sodium = require('sodium');
module.exports = {
open: sodium.api.crypto_secretbox_open,
close: sodium.api.crypto_secretbox,
};
} catch (err) {
const tweetnacl = require('tweetnacl');
module.exports = {
open: tweetnacl.secretbox.open,
close: tweetnacl.secretbox,
};
}