From eab83a97561b80db81fefcf812c694e0c0fa595a Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 5 Dec 2017 12:14:45 -0500 Subject: [PATCH] fixes to generation service --- src/services/passwordGeneration.service.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/services/passwordGeneration.service.ts b/src/services/passwordGeneration.service.ts index f7a71ff45d..4e52438d46 100644 --- a/src/services/passwordGeneration.service.ts +++ b/src/services/passwordGeneration.service.ts @@ -179,7 +179,7 @@ export default class PasswordGenerationService { return this.history || new Array(); } - async addHistory(password: string) { + async addHistory(password: string): Promise { // Prevent duplicates if (this.matchesPrevious(password)) { return; @@ -193,12 +193,12 @@ export default class PasswordGenerationService { } const newHistory = await this.encryptHistory(); - await UtilsService.saveObjToStorage(Keys.history, newHistory); + return await UtilsService.saveObjToStorage(Keys.history, newHistory); } async clear(): Promise { this.history = []; - await UtilsService.removeFromStorage(Keys.history); + return await UtilsService.removeFromStorage(Keys.history); } private async encryptHistory(): Promise { @@ -211,11 +211,11 @@ export default class PasswordGenerationService { return new PasswordHistory(encrypted.encryptedString, item.date); }); - await Promise.all(promises); + return await Promise.all(promises); } private async decryptHistory(history: PasswordHistory[]): Promise { - if (history == null || this.history.length === 0) { + if (history == null || history.length === 0) { return Promise.resolve([]); } @@ -224,7 +224,7 @@ export default class PasswordGenerationService { return new PasswordHistory(decrypted, item.date); }); - await Promise.all(promises); + return await Promise.all(promises); } private matchesPrevious(password: string): boolean {