import * as SecureStore from 'expo-secure-store'; import * as zod from 'zod'; import { ZodType } from 'zod'; /** * A typed wrapper for expo-secure-store with optional Zod validation. */ declare class TypedStore { /** A string that determines the namespace used for every key within the object. */ private namespace?; /** * @param namespace - Optional namespace for keys */ constructor(namespace?: string); /** * Returns a namespaced key. * @param key - The key to namespace. * @returns The namespaced key. */ private _getNamespacedKey; /** * Helper function to serialize values for storage. */ private _serializeValue; /** * Gets the current namespace. * @returns Can be undefined. */ getNamespace(): string | undefined; /** * Sets a new namespace. * @param namespace - The namespace. */ setNamespace(namespace: string): void; /** * Returns whether the SecureStore API is enabled on the current device. * This does not check the app permissions. * @returns True if available, false otherwise. */ static isAvailableAsync(): Promise; /** * Checks if the value can be saved with requireAuthentication option enabled. * @returns True if biometric authentication is available. * @platform android * @platform ios */ canUseBiometricAuthentication(): boolean; /** * Stores a value in the store. * @param key - The key to store the value under. * @param value - The value to store. */ setItem(key: string, value: T): void; /** * Stores a value in the store asynchronously. * @param key - The key to store the value under. * @param value - The value to store. */ setItemAsync(key: string, value: T): Promise; /** * Stores a value in the store with an expiration time. * @param key - The key to store the value under. * @param value - The value to store. * @param ttl - Time to live in milliseconds. */ setItemWithExpiration(key: string, value: T, ttl: number): Promise; /** * Retrieves a value from the store. * @param key - The key to retrieve the value from. * @returns The retrieved value or null if not found. */ getItem(key: string): T | null; /** * Retrieves a value from the store with a fallback. * @param key - The key to retrieve the value from. * @param fallback - The fallback value if key is not found. * @returns The retrieved value or fallback. */ getItem(key: string, fallback: T): T; /** * Retrieves a value from the store with a fallback and Zod validation. * @param key - The key to retrieve the value from. * @param fallback - The fallback value if key is not found or invalid. * @param schema - Zod schema to validate the parsed value. * @returns The retrieved value or fallback. */ getItem(key: string, fallback: T, schema: ZodType): T; /** * Retrieves a value from the store asynchronously. * @param key - The key to retrieve the value from. * @returns The retrieved value or null if not found. */ getItemAsync(key: string): Promise; /** * Retrieves a value from the store asynchronously with a fallback. * @param key - The key to retrieve the value from. * @param fallback - The fallback value if key is not found. * @returns The retrieved value or fallback. */ getItemAsync(key: string, fallback: T): Promise; /** * Retrieves a value from the store asynchronously with a fallback and Zod validation. * @param key - The key to retrieve the value from. * @param fallback - The fallback value if key is not found or invalid. * @param schema - Zod schema to validate the parsed value. * @returns The retrieved value or fallback. */ getItemAsync(key: string, fallback: T, schema: ZodType): Promise; /** * Removes a key from the store. * @param key - The key to remove. * @param options - Optional secure store options. */ removeItemAsync(key: string, options?: SecureStore.SecureStoreOptions): Promise; /** * Checks if a key exists in storage. * @param key - The key to check. * @returns True if exists, false otherwise. */ itemExists(key: string): boolean; /** * Checks if a key exists in storage asynchronously. * @param key - The key to check. * @returns True if exists, false otherwise. */ itemExistsAsync(key: string): Promise; } declare const getItem: { (key: string): T | null; (key: string, fallback: T): T; (key: string, fallback: T, schema: zod.ZodType): T; }; declare const getItemAsync: { (key: string): Promise; (key: string, fallback: T): Promise; (key: string, fallback: T, schema: zod.ZodType): Promise; }; declare const setItem: (key: string, value: T) => void; declare const setItemAsync: (key: string, value: T) => Promise; declare const setItemWithExpiration: (key: string, value: T, ttl: number) => Promise; declare const itemExists: (key: string) => boolean; declare const itemExistsAsync: (key: string) => Promise; declare const removeItemAsync: (key: string, options?: SecureStore.SecureStoreOptions) => Promise; export { TypedStore, getItem, getItemAsync, itemExists, itemExistsAsync, removeItemAsync, setItem, setItemAsync, setItemWithExpiration };