UNPKG

@pubflow/react-native

Version:

React Native adapter for Pubflow framework

77 lines (76 loc) 1.95 kB
/** * Secure Storage Adapter for React Native * * Provides a storage adapter for React Native with Expo SecureStore support */ import { StorageAdapter } from '@pubflow/core'; /** * Options for the secure storage adapter */ export interface SecureStorageOptions { /** * Prefix for storage keys */ prefix?: string; /** * Whether to use secure storage (SecureStore) when available */ useSecureStorage?: boolean; /** * Whether to use AsyncStorage as fallback when SecureStore fails */ useAsyncStorageFallback?: boolean; } /** * Secure storage adapter for React Native * Uses Expo SecureStore when available, falls back to AsyncStorage */ export declare class SecureStorageAdapter implements StorageAdapter { private prefix; private useSecureStorage; private useAsyncStorageFallback; private storageKeys; /** * Create a new secure storage adapter * * @param options Storage options */ constructor(options?: SecureStorageOptions); /** * Create a storage key with proper prefix */ private createKey; /** * Get a value from storage * * @param key Storage key * @returns Stored value or null */ getItem(key: string): Promise<string | null>; /** * Save a value to storage * * @param key Storage key * @param value Value to store */ setItem(key: string, value: string): Promise<void>; /** * Remove a value from storage * * @param key Storage key */ removeItem(key: string): Promise<void>; /** * Clear all storage keys with the current prefix */ clear(): Promise<void>; /** * Get all storage keys with the current prefix */ getAllKeys(): Promise<string[]>; /** * Clear session-related data * This method specifically removes session and user data */ clearSessionData(): Promise<void>; }