Skip to content

Commit 4dfbe67

Browse files
More logging around the safeStorage API (microsoft#223784)
To help us understand the hang in microsoft#195800
1 parent 0021ada commit 4dfbe67

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/vs/platform/encryption/electron-main/encryptionMainService.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@ export class EncryptionMainService implements IEncryptionMainService {
2525
) {
2626
// if this commandLine switch is set, the user has opted in to using basic text encryption
2727
if (app.commandLine.getSwitchValue('password-store') === PasswordStoreCLIOption.basic) {
28+
this.logService.trace('[EncryptionMainService] setting usePlainTextEncryption to true...');
2829
safeStorage.setUsePlainTextEncryption?.(true);
30+
this.logService.trace('[EncryptionMainService] set usePlainTextEncryption to true');
2931
}
3032
}
3133

3234
async encrypt(value: string): Promise<string> {
33-
this.logService.trace('[EncryptionMainService] Encrypting value.');
35+
this.logService.trace('[EncryptionMainService] Encrypting value...');
3436
try {
3537
const result = JSON.stringify(safeStorage.encryptString(value));
3638
this.logService.trace('[EncryptionMainService] Encrypted value.');
@@ -50,7 +52,7 @@ export class EncryptionMainService implements IEncryptionMainService {
5052
}
5153
const bufferToDecrypt = Buffer.from(parsedValue.data);
5254

53-
this.logService.trace('[EncryptionMainService] Decrypting value.');
55+
this.logService.trace('[EncryptionMainService] Decrypting value...');
5456
const result = safeStorage.decryptString(bufferToDecrypt);
5557
this.logService.trace('[EncryptionMainService] Decrypted value.');
5658
return result;
@@ -61,7 +63,10 @@ export class EncryptionMainService implements IEncryptionMainService {
6163
}
6264

6365
isEncryptionAvailable(): Promise<boolean> {
64-
return Promise.resolve(safeStorage.isEncryptionAvailable());
66+
this.logService.trace('[EncryptionMainService] Checking if encryption is available...');
67+
const result = safeStorage.isEncryptionAvailable();
68+
this.logService.trace('[EncryptionMainService] Encryption is available: ', result);
69+
return Promise.resolve(result);
6570
}
6671

6772
getKeyStorageProvider(): Promise<KnownStorageProvider> {
@@ -73,7 +78,9 @@ export class EncryptionMainService implements IEncryptionMainService {
7378
}
7479
if (safeStorage.getSelectedStorageBackend) {
7580
try {
81+
this.logService.trace('[EncryptionMainService] Getting selected storage backend...');
7682
const result = safeStorage.getSelectedStorageBackend() as KnownStorageProvider;
83+
this.logService.trace('[EncryptionMainService] Selected storage backend: ', result);
7784
return Promise.resolve(result);
7885
} catch (e) {
7986
this.logService.error(e);
@@ -95,6 +102,8 @@ export class EncryptionMainService implements IEncryptionMainService {
95102
throw new Error('Setting plain text encryption is not supported.');
96103
}
97104

105+
this.logService.trace('[EncryptionMainService] Setting usePlainTextEncryption to true...');
98106
safeStorage.setUsePlainTextEncryption(true);
107+
this.logService.trace('[EncryptionMainService] Set usePlainTextEncryption to true');
99108
}
100109
}

0 commit comments

Comments
 (0)