mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-11-27 19:31:08 -06:00
Merge pull request #188 from keerthi16/SEARCH-206
Search 206 (Removed node-forge)
This commit is contained in:
commit
bbe0268184
@ -9,7 +9,6 @@ let stream = require('stream');
|
||||
let Transform = stream.Transform;
|
||||
let util = require('util');
|
||||
let crypto = require('crypto');
|
||||
let forge = require('node-forge');
|
||||
|
||||
let KEY_LENGTH = 32; // bytes
|
||||
let GCM_NONCE_LENGTH = 12; //bytes
|
||||
@ -28,11 +27,7 @@ let validateAndConvertKey = function(key) {
|
||||
if (key && key instanceof Buffer && key.length === KEY_LENGTH) {
|
||||
return key;
|
||||
} else if (key && typeof key === 'string') {
|
||||
// This is for temporary purpose only. Will be retrieving the key from the backend
|
||||
// Todo: remove node-forge
|
||||
let md = forge.md.sha256.create();
|
||||
md.update(key);
|
||||
let bufKey = new Buffer(bits2b64(md.digest().getBytes()), keyEncoding);
|
||||
let bufKey = new Buffer(key, keyEncoding);
|
||||
if (bufKey.length !== KEY_LENGTH) {
|
||||
let encodingErrorMessage = 'Provided key string is either of an unknown encoding (expected: ' +
|
||||
keyEncoding + ') or the wrong length.';
|
||||
@ -45,19 +40,9 @@ let validateAndConvertKey = function(key) {
|
||||
throw new Error(message);
|
||||
};
|
||||
|
||||
/**
|
||||
* encode bits to b64
|
||||
* @param bits
|
||||
* @returns {*}
|
||||
*/
|
||||
let bits2b64 = function (bits) {
|
||||
return forge.util.encode64(bits);
|
||||
};
|
||||
|
||||
exports.encrypt = EncryptionStream;
|
||||
exports.decrypt = DecryptionStream;
|
||||
|
||||
|
||||
/**
|
||||
* createSalt
|
||||
* Helper method that returns a salt
|
||||
|
@ -109,7 +109,6 @@
|
||||
"ffi": "^2.2.0",
|
||||
"filesize": "^3.5.10",
|
||||
"keymirror": "0.1.1",
|
||||
"node-forge": "^0.7.1",
|
||||
"randomstring": "^1.1.5",
|
||||
"ref": "^1.3.4",
|
||||
"winreg": "^1.2.3"
|
||||
|
Loading…
Reference in New Issue
Block a user