mirror of
https://github.com/moparisthebest/mail
synced 2025-02-11 20:50:10 -05:00
added git submodule deps in npm
This commit is contained in:
parent
d731ae32d8
commit
4a080eed26
@ -4,7 +4,11 @@
|
|||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.8"
|
"node": ">=0.8"
|
||||||
},
|
},
|
||||||
|
"scripts": {
|
||||||
|
"postinstall": "./res/copy-deps.sh"
|
||||||
|
},
|
||||||
"dependencies": {
|
"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
|
* A Wrapper for Forge's AES-CBC encryption
|
||||||
*/
|
*/
|
||||||
app.crypto.AesCBC = function(forge) {
|
var AesCBC = function(forge) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var utl = forge.util;
|
var utl = forge.util;
|
||||||
@ -42,4 +42,10 @@ app.crypto.AesCBC = function(forge) {
|
|||||||
return utl.decodeUtf8(cipher.output.getBytes());
|
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
|
* A Wrapper for Forge's RSA encryption
|
||||||
*/
|
*/
|
||||||
app.crypto.RSA = function(forge, util) {
|
var RSA = function(forge, util) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var utl = forge.util;
|
var utl = forge.util;
|
||||||
@ -29,7 +29,7 @@ app.crypto.RSA = function(forge, util) {
|
|||||||
this.generateKeypair = function(keySize, callback) {
|
this.generateKeypair = function(keySize, callback) {
|
||||||
forge.rsa.generateKeyPair({
|
forge.rsa.generateKeyPair({
|
||||||
bits: keySize,
|
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) {
|
}, function(err, newKeypair) {
|
||||||
if (err || !newKeypair || !newKeypair.publicKey || !newKeypair.privateKey) {
|
if (err || !newKeypair || !newKeypair.publicKey || !newKeypair.privateKey) {
|
||||||
callback({
|
callback({
|
||||||
@ -117,4 +117,10 @@ app.crypto.RSA = function(forge, util) {
|
|||||||
return keypair.publicKey.verify(sha.digest().getBytes(), sigUtf8);
|
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