@@ -8,7 +8,6 @@ import * as localizedText from '../../shared/localizedText'
88import * as nls from 'vscode-nls'
99import { fs } from '../../shared/fs/fs'
1010import * as path from 'path'
11- import * as crypto from 'crypto'
1211import { ToolkitError } from '../../shared/errors'
1312import { AmazonQPromptSettings } from '../../shared/settings'
1413import {
@@ -37,7 +36,7 @@ import { VSCODE_EXTENSION_ID } from '../../shared/extensions'
3736import { RegionProfileManager } from '../region/regionProfileManager'
3837import { AuthFormId } from '../../login/webview/vue/types'
3938import { getEnvironmentSpecificMemento } from '../../shared/utilities/mementos'
40- import { getCacheDir , getRegistrationCacheFile , getTokenCacheFile } from '../../auth/sso/cache'
39+ import { getCacheDir , getFlareCacheFileName , getRegistrationCacheFile , getTokenCacheFile } from '../../auth/sso/cache'
4140import { notifySelectDeveloperProfile } from '../region/utils'
4241import { once } from '../../shared/utilities/functionUtils'
4342
@@ -278,6 +277,7 @@ export class AuthUtil implements IAuthProvider {
278277 }
279278
280279 private async cacheChangedHandler ( event : cacheChangedEvent ) {
280+ getLogger ( ) . debug ( `Auth: Cache change event received: ${ event } ` )
281281 if ( event === 'delete' ) {
282282 await this . logout ( )
283283 } else if ( event === 'create' ) {
@@ -427,25 +427,20 @@ export class AuthUtil implements IAuthProvider {
427427
428428 const cacheDir = getCacheDir ( )
429429
430- const hash = ( str : string ) => {
431- const hasher = crypto . createHash ( 'sha1' )
432- return hasher . update ( str ) . digest ( 'hex' )
433- }
434- const filePath = ( str : string ) => {
435- return path . join ( cacheDir , hash ( str ) + '.json' )
436- }
437-
438430 const fromRegistrationFile = getRegistrationCacheFile ( cacheDir , registrationKey )
439- const toRegistrationFile = filePath (
440- JSON . stringify ( {
441- region : toImport . ssoRegion ,
442- startUrl : toImport . startUrl ,
443- tool : clientName ,
444- } )
431+ const toRegistrationFile = path . join (
432+ cacheDir ,
433+ getFlareCacheFileName (
434+ JSON . stringify ( {
435+ region : toImport . ssoRegion ,
436+ startUrl : toImport . startUrl ,
437+ tool : clientName ,
438+ } )
439+ )
445440 )
446441
447442 const fromTokenFile = getTokenCacheFile ( cacheDir , profileId )
448- const toTokenFile = filePath ( this . profileName )
443+ const toTokenFile = path . join ( cacheDir , getFlareCacheFileName ( this . profileName ) )
449444
450445 try {
451446 await fs . rename ( fromRegistrationFile , toRegistrationFile )
0 commit comments