add nodejs support to common-hash
This commit is contained in:
parent
6049e67795
commit
ed82936610
@ -1,10 +1,5 @@
|
|||||||
define([
|
(function () {
|
||||||
'/common/common-util.js',
|
var factory = function (Util, Crypto, Nacl) {
|
||||||
'/bower_components/chainpad-crypto/crypto.js',
|
|
||||||
'/bower_components/tweetnacl/nacl-fast.min.js'
|
|
||||||
], function (Util, Crypto) {
|
|
||||||
var Nacl = window.nacl;
|
|
||||||
|
|
||||||
var Hash = window.CryptPad_Hash = {};
|
var Hash = window.CryptPad_Hash = {};
|
||||||
|
|
||||||
var uint8ArrayToHex = Util.uint8ArrayToHex;
|
var uint8ArrayToHex = Util.uint8ArrayToHex;
|
||||||
@ -537,4 +532,19 @@ Version 1
|
|||||||
};
|
};
|
||||||
|
|
||||||
return Hash;
|
return Hash;
|
||||||
});
|
};
|
||||||
|
|
||||||
|
if (typeof(module) !== 'undefined' && module.exports) {
|
||||||
|
module.exports = factory(require("./common-util"), require("chainpad-crypto"), require("tweetnacl"));
|
||||||
|
} else if ((typeof(define) !== 'undefined' && define !== null) && (define.amd !== null)) {
|
||||||
|
define([
|
||||||
|
'/common/common-util.js',
|
||||||
|
'/bower_components/chainpad-crypto/crypto.js',
|
||||||
|
'/bower_components/tweetnacl/nacl-fast.min.js'
|
||||||
|
], function (Util, Crypto) {
|
||||||
|
factory(Util, Crypto, window.nacl);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// unsupported initialization
|
||||||
|
}
|
||||||
|
}());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user