Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/slow-hats-drum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/clerk-expo': minor
---

Default token cache `SecureStore` implementation `keychainAccessible` to `AFTER_FIRST_UNLOCK` createResourceCacheStore to align with createTokenCache - The data in the keychain item cannot be accessed after a restart until the device has been unlocked once by the user. This may be useful if you need to access the item when the device is locked.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ vi.mock('expo-secure-store', () => {
setItemAsync: mocks.setItemAsync,
getItemAsync: mocks.getItemAsync,
deleteItemAsync: mocks.deleteItemAsync,
AFTER_FIRST_UNLOCK: 0,
};
});

Expand Down
15 changes: 12 additions & 3 deletions packages/expo/src/resource-cache/resource-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,18 @@ export const createResourceCacheStore = (): IStorage => {
let queue: KeyValuePair[] = [];
let isProcessing = false;

const setItem = SecureStore.setItemAsync;
const getItem = SecureStore.getItemAsync;
const deleteItem = SecureStore.deleteItemAsync;
const secureStoreOpts: SecureStore.SecureStoreOptions = {
/**
* The data in the keychain item cannot be accessed after a restart until the
* device has been unlocked once by the user.
*
* This may be useful if you need to access the item when the phone is locked.
*/
keychainAccessible: SecureStore.AFTER_FIRST_UNLOCK,
};
const setItem = (key: string, value: string) => SecureStore.setItemAsync(key, value, secureStoreOpts);
const getItem = (key: string) => SecureStore.getItemAsync(key, secureStoreOpts);
const deleteItem = (key: string) => SecureStore.deleteItemAsync(key, secureStoreOpts);

const set = (key: string, value: string): Promise<void> => {
queue.push({ key, value });
Expand Down
Loading