mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-20 11:48:30 -06:00
SEARCH-116-GCM
1. Fixed userData path issue
This commit is contained in:
parent
b36b546c3d
commit
8c1c599699
@ -28,6 +28,8 @@ 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);
|
||||
|
@ -26,6 +26,7 @@ class Crypto {
|
||||
this.indexDataFolder = INDEX_DATA_FOLDER + '_' + userId + '_' + INDEX_VERSION;
|
||||
this.permanentIndexFolderName = 'search_index_' + userId + '_' + INDEX_VERSION;
|
||||
this.dump = TEMPORARY_PATH;
|
||||
this.extractToPath = `${TEMPORARY_PATH}/data/${this.permanentIndexFolderName}`;
|
||||
this.key = "XrwVgWR4czB1a9scwvgRUNbXiN3W0oWq7oUBenyq7bo="; // temporary only
|
||||
this.encryptedIndex = `${INDEX_DATA_FOLDER + '_' + userId + '_' + INDEX_VERSION}.enc`;
|
||||
this.zipErrored = false;
|
||||
@ -82,7 +83,7 @@ class Crypto {
|
||||
|
||||
zipArchive.pipe(output);
|
||||
|
||||
zipArchive.directory(this.indexDataFolder);
|
||||
zipArchive.directory(this.indexDataFolder + '/', false);
|
||||
|
||||
zipArchive.finalize((err) => {
|
||||
if (err) {
|
||||
@ -136,7 +137,7 @@ class Crypto {
|
||||
});
|
||||
|
||||
let extractZip = () => {
|
||||
extract(`${this.dump}/decrypted.zip`, {dir: TEMPORARY_PATH}, (err) => {
|
||||
extract(`${this.dump}/decrypted.zip`, {dir: `${this.extractToPath}`}, (err) => {
|
||||
if (err) {
|
||||
reject(new Error(err));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user