1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 16:53:34 +00:00

make getAllDecrypted synchronous

This commit is contained in:
Kyle Spearrin
2018-07-18 22:47:55 -04:00
parent e555536f24
commit 51ee0b065a
3 changed files with 9 additions and 17 deletions

View File

@@ -181,13 +181,10 @@ export class CipherService implements CipherServiceAbstraction {
throw new Error('No key.');
}
const promises: any[] = [];
const ciphers = await this.getAll();
ciphers.forEach((cipher) => {
promises.push(cipher.decrypt().then((c) => decCiphers.push(c)));
});
await Promise.all(promises);
for (let i = 0; i < ciphers.length; i++) {
decCiphers.push(await ciphers[i].decrypt());
}
decCiphers.sort(this.getLocaleSortingFunction());
this.decryptedCipherCache = decCiphers;
return this.decryptedCipherCache;