import * as SecureStore from 'expo-secure-store'

const KEY = 'crumbs.session'

export const getSessionToken = () => SecureStore.getItemAsync(KEY)

export const setSessionToken = (token: string) =>
  SecureStore.setItemAsync(KEY, token, {
    keychainAccessible: SecureStore.WHEN_UNLOCKED_THIS_DEVICE_ONLY,
  })

export const clearSessionToken = () =>
  SecureStore.deleteItemAsync(KEY)
