📦 deps(thirdparty): update snapshots
This commit is contained in:
@@ -88,13 +88,16 @@ const takePhoto = async () => {
|
||||
return photo.webPath;
|
||||
};
|
||||
|
||||
// Secure storage
|
||||
// Secure storage: do not store auth tokens in Capacitor Preferences.
|
||||
// Use a platform-backed secure storage plugin such as
|
||||
// @aparajita/capacitor-secure-storage, Ionic Identity Vault, or an
|
||||
// equivalent Android Keystore-backed plugin.
|
||||
const saveToken = async (token: string) => {
|
||||
await Preferences.set({ key: 'auth_token', value: token });
|
||||
await SecureStorage.set({ key: 'auth_token', value: token });
|
||||
};
|
||||
|
||||
const getToken = async (): Promise<string | null> => {
|
||||
const { value } = await Preferences.get({ key: 'auth_token' });
|
||||
const { value } = await SecureStorage.get({ key: 'auth_token' });
|
||||
return value;
|
||||
};
|
||||
|
||||
@@ -155,4 +158,4 @@ class MyPlugin : Plugin() {
|
||||
import { registerPlugin } from '@capacitor/core';
|
||||
const MyPlugin = registerPlugin<{ doNativeWork: (opts: { input: string }) => Promise<{ output: string }> }>('MyPlugin');
|
||||
const result = await MyPlugin.doNativeWork({ input: 'hello' });
|
||||
```
|
||||
```
|
||||
|
||||
@@ -63,6 +63,9 @@ export const RootNavigator = () => {
|
||||
|
||||
```typescript
|
||||
// Client state — Zustand
|
||||
// Do not persist bearer or refresh tokens in AsyncStorage/plain MMKV.
|
||||
// Store secrets with a platform-backed module such as react-native-keychain
|
||||
// or expo-secure-store, and persist only non-sensitive UI state here.
|
||||
interface AuthState {
|
||||
token: string | null;
|
||||
isLoggedIn: boolean;
|
||||
@@ -78,7 +81,7 @@ export const useAuthStore = create<AuthState>()(
|
||||
setToken: (token) => set({ token, isLoggedIn: true }),
|
||||
logout: () => set({ token: null, isLoggedIn: false }),
|
||||
}),
|
||||
{ name: 'auth-storage', storage: createJSONStorage(() => mmkvStorage) }
|
||||
{ name: 'auth-ui-storage', storage: createJSONStorage(() => mmkvStorage) }
|
||||
)
|
||||
);
|
||||
|
||||
@@ -239,4 +242,4 @@ describe('HomeScreen', () => {
|
||||
expect(await findByText('Test Item')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
```
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user