File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -139,8 +139,13 @@ export class LanguageClientAuth {
139139 * Decrypts an object
140140 */
141141 private async decrypt < T > ( request : string ) : Promise < T > {
142- const result = await jose . compactDecrypt ( request , this . encryptionKey )
143- return JSON . parse ( new TextDecoder ( ) . decode ( result . plaintext ) ) as T
142+ try {
143+ const result = await jose . compactDecrypt ( request , this . encryptionKey )
144+ return JSON . parse ( new TextDecoder ( ) . decode ( result . plaintext ) ) as T
145+ } catch ( e ) {
146+ getLogger ( ) . error ( `Failed to decrypt: ${ request } ` )
147+ return request as T
148+ }
144149 }
145150
146151 async getSsoToken (
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ const tokenId = 'test-token'
4040describe ( 'LanguageClientAuth' , ( ) => {
4141 let client : sinon . SinonStubbedInstance < LanguageClient >
4242 let auth : LanguageClientAuth
43- const encryptionKey = Buffer . from ( 'test-key' )
43+ const encryptionKey = Buffer . from ( 'test-key' . padEnd ( 32 , '0' ) )
4444 let useDeviceFlowStub : sinon . SinonStub
4545
4646 beforeEach ( ( ) => {
You can’t perform that action at this time.
0 commit comments