SEARCH-273

- Changed the encryption to async
- Logged decryption time
This commit is contained in:
Keerthi Niranjan 2017-10-12 11:07:04 +05:30
parent 0f18b17cf0
commit ab963f4567
2 changed files with 7 additions and 3 deletions

View File

@ -200,7 +200,9 @@
merge.addEventListener('click', function () {
search.mergeIndexBatches().then(function () {
search.encryptIndex();
search.encryptIndex().then(function () {
resultsEl.innerHTML = "Merging and Encrypting index completed"
});
}).catch(function (err) {
resultsEl.innerHTML = 'Error: ' + err;
});

View File

@ -54,6 +54,7 @@ class Search {
* @param key
*/
constructor(userId, key) {
console.time('Decrypting');
this.isInitialized = false;
this.userId = userId;
this.key = key;
@ -68,6 +69,7 @@ class Search {
decryptAndInit() {
this.crypto.decryption().then(() => {
console.timeEnd('Decrypting');
this.init();
}).catch(() => {
this.init();
@ -206,10 +208,10 @@ class Search {
* to the main user index
*/
encryptIndex() {
this.crypto.encryption().then(() => {
return this.crypto.encryption().then(() => {
return 'Success'
}).catch((e) => {
throw new Error(e)
return (new Error(e));
});
}