Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Sparowhawk committed Dec 6, 2024
1 parent c2769fb commit 0393072
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions VAMobile/src/utils/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ import { logAnalyticsEvent, logNonFatalErrorToFirebase, setAnalyticsUserProperty
import { pkceAuthorizeParams } from './oauth'
import { isAndroid } from './platform'

let inMemoryRefreshToken: string | undefined

export const NEW_SESSION = '@store_new_session'
export const FIRST_TIME_LOGIN = '@store_first_time_login'
export const KEYCHAIN_DEVICE_SECRET_KEY = 'vamobileDeviceSecret'
Expand All @@ -49,7 +47,6 @@ const SSO_COOKIE_NAMES = ['vagov_access_token', 'vagov_anti_csrf_token', 'vagov_
const { AUTH_SIS_TOKEN_EXCHANGE_URL, ENVIRONMENT, IS_TEST } = getEnv()

export const saveRefreshToken = async (refreshToken: string): Promise<void> => {
inMemoryRefreshToken = refreshToken
const canSaveWithBiometrics = !!(await deviceSupportedBiometrics())
const biometricsPreferred = await isBiometricsPreferred()
const saveWithBiometrics = canSaveWithBiometrics && biometricsPreferred
Expand Down Expand Up @@ -194,7 +191,6 @@ export const clearStoredAuthCreds = async (): Promise<void> => {
await Keychain.resetInternetCredentials(KEYCHAIN_STORAGE_KEY)
await Keychain.resetInternetCredentials(KEYCHAIN_DEVICE_SECRET_KEY)
await AsyncStorage.removeItem(REFRESH_TOKEN_TYPE)
inMemoryRefreshToken = undefined
}

/**
Expand Down Expand Up @@ -261,7 +257,7 @@ export const completeFirstTimeLogin = async () => {

export const setBiometricsPreference = async (value: boolean) => {
await AsyncStorage.setItem(BIOMETRICS_STORE_PREF_KEY, value ? AUTH_STORAGE_TYPE.BIOMETRIC : AUTH_STORAGE_TYPE.NONE)
await saveRefreshToken(inMemoryRefreshToken || '')
await saveRefreshToken(api.getRefreshToken() || '')
const userSettings = queryClient.getQueryData(authKeys.biometrics) as UserBiometricsSettings
queryClient.setQueryData(authKeys.biometrics, { ...userSettings, shouldStoreWithBiometric: value })
await setAnalyticsUserProperty(UserAnalytics.vama_uses_biometric(value))
Expand Down

0 comments on commit 0393072

Please sign in to comment.