File tree Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -373,8 +373,13 @@ export abstract class BaseLogin {
373
373
* Decrypts an encrypted string, removes its quotes, and returns the resulting string
374
374
*/
375
375
protected async decrypt ( encrypted : string ) : Promise < string > {
376
- const decrypted = await jose . compactDecrypt ( encrypted , this . lspAuth . encryptionKey )
377
- return decrypted . plaintext . toString ( ) . replaceAll ( '"' , '' )
376
+ try {
377
+ const decrypted = await jose . compactDecrypt ( encrypted , this . lspAuth . encryptionKey )
378
+ return decrypted . plaintext . toString ( ) . replaceAll ( '"' , '' )
379
+ } catch ( e ) {
380
+ getLogger ( ) . error ( `Failed to decrypt: ${ encrypted } ` )
381
+ return encrypted
382
+ }
378
383
}
379
384
}
380
385
@@ -586,6 +591,14 @@ export class IamLogin extends BaseLogin {
586
591
* Restore the connection state and connection details to memory, if they exist.
587
592
*/
588
593
async restore ( ) {
594
+ const sessionData = await this . getProfile ( )
595
+ const credentials = sessionData ?. profile ?. settings
596
+ if ( credentials ?. aws_access_key_id && credentials ?. aws_secret_access_key ) {
597
+ this . _data = {
598
+ accessKey : credentials . aws_access_key_id ,
599
+ secretKey : credentials . aws_secret_access_key ,
600
+ }
601
+ }
589
602
try {
590
603
await this . _getIamCredential ( false )
591
604
} catch ( err ) {
Original file line number Diff line number Diff line change @@ -156,7 +156,7 @@ export class AuthUtil implements IAuthProvider {
156
156
await this . session . restore ( )
157
157
if ( ! this . isConnected ( ) ) {
158
158
// If both fail, reset the session
159
- await this . session ?. logout ( )
159
+ this . session = undefined
160
160
}
161
161
}
162
162
}
Original file line number Diff line number Diff line change @@ -187,7 +187,7 @@ export abstract class CommonAuthWebview extends VueWebview {
187
187
abstract fetchConnections ( ) : Promise < AwsConnection [ ] | undefined >
188
188
189
189
async errorNotification ( e : AuthError ) {
190
- showMessage ( 'error' , e . text )
190
+ await showMessage ( 'error' , e . text )
191
191
}
192
192
193
193
abstract quitLoginScreen ( ) : Promise < void >
You can’t perform that action at this time.
0 commit comments