mirror of
https://github.com/bitwarden/jslib
synced 2025-12-28 06:03:14 +00:00
[bug] Add several missing awaits
This commit is contained in:
@@ -11,7 +11,7 @@ import { CipherView } from '../models/view/cipherView';
|
||||
import { FieldView } from '../models/view/fieldView';
|
||||
|
||||
export abstract class CipherService {
|
||||
clearCache: () => void;
|
||||
clearCache: () => Promise<void>;
|
||||
encrypt: (model: CipherView, key?: SymmetricCryptoKey, originalCipher?: Cipher) => Promise<Cipher>;
|
||||
encryptFields: (fieldsModel: FieldView[], key: SymmetricCryptoKey) => Promise<Field[]>;
|
||||
encryptField: (fieldModel: FieldView, key: SymmetricCryptoKey) => Promise<Field>;
|
||||
|
||||
@@ -7,7 +7,7 @@ import { TreeNode } from '../models/domain/treeNode';
|
||||
import { FolderView } from '../models/view/folderView';
|
||||
|
||||
export abstract class FolderService {
|
||||
clearCache: () => void;
|
||||
clearCache: () => Promise<void>;
|
||||
encrypt: (model: FolderView, key?: SymmetricCryptoKey) => Promise<Folder>;
|
||||
get: (id: string) => Promise<Folder>;
|
||||
getAll: () => Promise<Folder[]>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export abstract class SystemService {
|
||||
startProcessReload: () => Promise<void>;
|
||||
cancelProcessReload: () => void;
|
||||
clearClipboard: (clipboardValue: string, timeoutMs?: number) => void;
|
||||
clearClipboard: (clipboardValue: string, timeoutMs?: number) => Promise<void>;
|
||||
clearPendingClipboard: () => Promise<any>;
|
||||
}
|
||||
|
||||
@@ -364,7 +364,7 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
}
|
||||
}
|
||||
|
||||
clearKeyPair(memoryOnly?: boolean): Promise<any> {
|
||||
async clearKeyPair(memoryOnly?: boolean): Promise<any> {
|
||||
const keysToClear: Promise<void>[] = [
|
||||
this.stateService.setDecryptedPrivateKey(null),
|
||||
this.stateService.setPublicKey(null),
|
||||
|
||||
@@ -65,7 +65,7 @@ export class EventService implements EventServiceAbstraction {
|
||||
}
|
||||
|
||||
async uploadEvents(): Promise<any> {
|
||||
const authed = this.stateService.getIsAuthenticated();
|
||||
const authed = await this.stateService.getIsAuthenticated();
|
||||
if (!authed) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -332,7 +332,7 @@ export class PasswordGenerationService implements PasswordGenerationServiceAbstr
|
||||
return new Array<GeneratedPasswordHistory>();
|
||||
}
|
||||
|
||||
if (this.stateService.getDecryptedPasswordGenerationHistory() != null) {
|
||||
if (await this.stateService.getDecryptedPasswordGenerationHistory() != null) {
|
||||
const encrypted = await this.stateService.getEncryptedPasswordGenerationHistory();
|
||||
const decrypted = await this.decryptHistory(encrypted);
|
||||
await this.stateService.setDecryptedPasswordGenerationHistory(decrypted);
|
||||
|
||||
@@ -238,7 +238,7 @@ export class SyncService implements SyncServiceAbstraction {
|
||||
|
||||
async syncDeleteSend(notification: SyncSendNotification): Promise<boolean> {
|
||||
this.syncStarted();
|
||||
if (this.stateService.getIsAuthenticated()) {
|
||||
if (await this.stateService.getIsAuthenticated()) {
|
||||
await this.sendService.delete(notification.id);
|
||||
this.messagingService.send('syncedDeletedSend', { sendId: notification.id });
|
||||
this.syncCompleted(true);
|
||||
|
||||
@@ -49,7 +49,7 @@ export class SystemService implements SystemServiceAbstraction {
|
||||
}
|
||||
}
|
||||
|
||||
clearClipboard(clipboardValue: string, timeoutMs: number = null): void {
|
||||
async clearClipboard(clipboardValue: string, timeoutMs: number = null): Promise<void> {
|
||||
if (this.clearClipboardTimeout != null) {
|
||||
clearTimeout(this.clearClipboardTimeout);
|
||||
this.clearClipboardTimeout = null;
|
||||
@@ -57,7 +57,7 @@ export class SystemService implements SystemServiceAbstraction {
|
||||
if (Utils.isNullOrWhitespace(clipboardValue)) {
|
||||
return;
|
||||
}
|
||||
this.stateService.getClearClipboard().then(clearSeconds => {
|
||||
await this.stateService.getClearClipboard().then(clearSeconds => {
|
||||
if (clearSeconds == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ export class TokenService implements TokenServiceAbstraction {
|
||||
if (await this.skipTokenStorage() || clientId == null) {
|
||||
return;
|
||||
}
|
||||
return this.stateService.setApiKeyClientId(clientId);
|
||||
return await this.stateService.setApiKeyClientId(clientId);
|
||||
}
|
||||
|
||||
async getClientId(): Promise<string> {
|
||||
@@ -32,7 +32,7 @@ export class TokenService implements TokenServiceAbstraction {
|
||||
if (await this.skipTokenStorage() || clientSecret == null) {
|
||||
return;
|
||||
}
|
||||
return this.stateService.setApiKeyClientSecret(clientSecret);
|
||||
return await this.stateService.setApiKeyClientSecret(clientSecret);
|
||||
}
|
||||
|
||||
async getClientSecret(): Promise<string> {
|
||||
|
||||
@@ -44,7 +44,7 @@ export class VaultTimeoutService implements VaultTimeoutServiceAbstraction {
|
||||
// Keys aren't stored for a device that is locked or logged out.
|
||||
async isLocked(): Promise<boolean> {
|
||||
// Handle never lock startup situation
|
||||
if (await this.cryptoService.hasKeyStored(KeySuffixOptions.Auto) && !this.stateService.getEverBeenUnlocked()) {
|
||||
if (await this.cryptoService.hasKeyStored(KeySuffixOptions.Auto) && !(await this.stateService.getEverBeenUnlocked())) {
|
||||
await this.cryptoService.getKey(KeySuffixOptions.Auto);
|
||||
}
|
||||
|
||||
@@ -92,16 +92,16 @@ export class VaultTimeoutService implements VaultTimeoutServiceAbstraction {
|
||||
return;
|
||||
}
|
||||
|
||||
this.stateService.setBiometricLocked(true);
|
||||
this.stateService.setEverBeenUnlocked(true);
|
||||
await this.stateService.setBiometricLocked(true);
|
||||
await this.stateService.setEverBeenUnlocked(true);
|
||||
await this.cryptoService.clearKey(false);
|
||||
await this.cryptoService.clearOrgKeys(true);
|
||||
await this.cryptoService.clearKeyPair(true);
|
||||
await this.cryptoService.clearEncKey(true);
|
||||
|
||||
this.folderService.clearCache();
|
||||
this.cipherService.clearCache();
|
||||
this.collectionService.clearCache();
|
||||
await this.folderService.clearCache();
|
||||
await this.cipherService.clearCache();
|
||||
await this.collectionService.clearCache();
|
||||
this.searchService.clearIndex();
|
||||
this.messagingService.send('locked');
|
||||
if (this.lockedCallback != null) {
|
||||
|
||||
@@ -25,9 +25,9 @@ export default class BiometricWindowsMain implements BiometricMain {
|
||||
// store error state so we can let the user know on the settings page
|
||||
this.isError = true;
|
||||
}
|
||||
this.stateService.setEnableBiometric(supportsBiometric);
|
||||
this.stateService.setBiometricText('unlockWithWindowsHello');
|
||||
this.stateService.setNoAutoPromptBiometricsText('noAutoPromptWindowsHello');
|
||||
await this.stateService.setEnableBiometric(supportsBiometric);
|
||||
await this.stateService.setBiometricText('unlockWithWindowsHello');
|
||||
await this.stateService.setNoAutoPromptBiometricsText('noAutoPromptWindowsHello');
|
||||
|
||||
ipcMain.on('biometric', async (event: any, message: any) => {
|
||||
event.returnValue = await this.authenticateBiometric();
|
||||
|
||||
Reference in New Issue
Block a user