@@ -36,19 +36,21 @@ export class MainThreadSecretState extends Disposable implements MainThreadSecre
36
36
}
37
37
38
38
async $getPassword ( extensionId : string , key : string ) : Promise < string | undefined > {
39
- this . logService . trace ( `Getting password for ${ extensionId } extension:` , key ) ;
39
+ this . logService . trace ( `MainThreadSecretState#getPassword: Getting password for ${ extensionId } extension: ` , key ) ;
40
40
const fullKey = await this . getFullKey ( extensionId ) ;
41
41
const password = await this . credentialsService . getPassword ( fullKey , key ) ;
42
42
if ( ! password ) {
43
- this . logService . trace ( 'No password found for:' , key ) ;
43
+ this . logService . trace ( 'MainThreadSecretState#getPassword: No password found for: ' , key ) ;
44
44
return undefined ;
45
45
}
46
46
47
47
let decrypted : string | null ;
48
48
try {
49
+ this . logService . trace ( 'MainThreadSecretState#getPassword: Decrypting password for: ' , key ) ;
49
50
decrypted = await this . encryptionService . decrypt ( password ) ;
50
51
} catch ( e ) {
51
52
this . logService . error ( e ) ;
53
+ this . logService . trace ( 'MainThreadSecretState#getPassword: Trying migration for: ' , key ) ;
52
54
53
55
// If we are on a platform that newly started encrypting secrets before storing them,
54
56
// then passwords previously stored were stored un-encrypted (NOTE: but still being stored in a secure keyring).
@@ -65,7 +67,7 @@ export class MainThreadSecretState extends Disposable implements MainThreadSecre
65
67
try {
66
68
const value = JSON . parse ( decrypted ) ;
67
69
if ( value . extensionId === extensionId ) {
68
- this . logService . trace ( 'Password found for:' , key ) ;
70
+ this . logService . trace ( 'MainThreadSecretState#getPassword: Password found for: ' , key ) ;
69
71
return value . content ;
70
72
}
71
73
} catch ( parseError ) {
@@ -82,17 +84,20 @@ export class MainThreadSecretState extends Disposable implements MainThreadSecre
82
84
}
83
85
}
84
86
85
- this . logService . trace ( 'No password found for:' , key ) ;
87
+ this . logService . trace ( 'MainThreadSecretState#getPassword: No password found for: ' , key ) ;
86
88
return undefined ;
87
89
}
88
90
89
91
async $setPassword ( extensionId : string , key : string , value : string ) : Promise < void > {
92
+ this . logService . trace ( `MainThreadSecretState#setPassword: Setting password for ${ extensionId } extension: ` , key ) ;
90
93
const fullKey = await this . getFullKey ( extensionId ) ;
91
94
const toEncrypt = JSON . stringify ( {
92
95
extensionId,
93
96
content : value
94
97
} ) ;
98
+ this . logService . trace ( 'MainThreadSecretState#setPassword: Encrypting password for: ' , key ) ;
95
99
const encrypted = await this . encryptionService . encrypt ( toEncrypt ) ;
100
+ this . logService . trace ( 'MainThreadSecretState#setPassword: Storing password for: ' , key ) ;
96
101
return await this . credentialsService . setPassword ( fullKey , key , encrypted ) ;
97
102
}
98
103
0 commit comments