mirror of
https://github.com/moparisthebest/mail
synced 2025-02-07 02:20:14 -05:00
added git submodule deps in npm
This commit is contained in:
parent
d731ae32d8
commit
4a080eed26
@ -4,7 +4,11 @@
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "./res/copy-deps.sh"
|
||||
},
|
||||
"dependencies": {
|
||||
"express": "latest"
|
||||
"express": "latest",
|
||||
"crypto-lib": "git://github.com/whiteout-io/crypto-lib.git#master"
|
||||
}
|
||||
}
|
9
res/copy-deps.sh
Executable file
9
res/copy-deps.sh
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "--> copying dependencies to src\n"
|
||||
|
||||
# go to root
|
||||
cd `dirname $0`
|
||||
cd ..
|
||||
|
||||
cp ./node_modules/crypto-lib/src/*.js ./src/js/crypto/
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* A Wrapper for Forge's AES-CBC encryption
|
||||
*/
|
||||
app.crypto.AesCBC = function(forge) {
|
||||
var AesCBC = function(forge) {
|
||||
'use strict';
|
||||
|
||||
var utl = forge.util;
|
||||
@ -42,4 +42,10 @@ app.crypto.AesCBC = function(forge) {
|
||||
return utl.decodeUtf8(cipher.output.getBytes());
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
if (typeof module !== 'undefined' && module.exports) {
|
||||
module.exports = AesCBC;
|
||||
} else {
|
||||
app.crypto.AesCBC = AesCBC;
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* A Wrapper for Forge's RSA encryption
|
||||
*/
|
||||
app.crypto.RSA = function(forge, util) {
|
||||
var RSA = function(forge, util) {
|
||||
'use strict';
|
||||
|
||||
var utl = forge.util;
|
||||
@ -29,7 +29,7 @@ app.crypto.RSA = function(forge, util) {
|
||||
this.generateKeypair = function(keySize, callback) {
|
||||
forge.rsa.generateKeyPair({
|
||||
bits: keySize,
|
||||
workerScript: app.config.workerPath + '/../../lib/forge/prime.worker.js'
|
||||
workerScript: (typeof app !== 'undefined') ? (app.config.workerPath + '/../../lib/forge/prime.worker.js') : undefined
|
||||
}, function(err, newKeypair) {
|
||||
if (err || !newKeypair || !newKeypair.publicKey || !newKeypair.privateKey) {
|
||||
callback({
|
||||
@ -117,4 +117,10 @@ app.crypto.RSA = function(forge, util) {
|
||||
return keypair.publicKey.verify(sha.digest().getBytes(), sigUtf8);
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
if (typeof module !== 'undefined' && module.exports) {
|
||||
module.exports = RSA;
|
||||
} else {
|
||||
app.crypto.RSA = RSA;
|
||||
}
|
Loading…
Reference in New Issue
Block a user