import type { GoodVibesTokenStore } from './types.js'; /** * String union of `Keychain.ACCESS_CONTROL` values relevant for Android. * `BIOMETRY_ANY` and `DEVICE_PASSCODE` are the two most useful options for * protecting Keystore-backed credentials with interactive auth prompts. */ export type AndroidAccessControl = 'BIOMETRY_ANY' | 'BIOMETRY_ANY_OR_DEVICE_PASSCODE' | 'BIOMETRY_CURRENT_SET' | 'BIOMETRY_CURRENT_SET_OR_DEVICE_PASSCODE' | 'DEVICE_PASSCODE' | 'APPLICATION_PASSWORD'; /** * String union of `Keychain.ACCESSIBLE` values (Android respects a subset). */ export type AndroidAccessible = 'WHEN_UNLOCKED' | 'AFTER_FIRST_UNLOCK' | 'ALWAYS' | 'WHEN_PASSCODE_SET_THIS_DEVICE_ONLY' | 'WHEN_UNLOCKED_THIS_DEVICE_ONLY' | 'AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY' | 'ALWAYS_THIS_DEVICE_ONLY'; export interface AndroidKeystoreTokenStoreOptions { /** * The keychain service identifier (used as the SharedPreferences file name * prefix on Android). * @default 'com.pellux.goodvibes-sdk' */ readonly service?: string | undefined; /** * Access control policy. Maps to `Keychain.ACCESS_CONTROL` constants. * * - `BIOMETRY_ANY`, require any enrolled biometric (fingerprint / face). * - `DEVICE_PASSCODE`, require the device passcode / PIN / pattern. * * Leave undefined to use the default Keystore protection without interactive * authentication prompts. */ readonly accessControl?: AndroidAccessControl | undefined; /** * Controls when stored data is accessible. * Maps to `Keychain.ACCESSIBLE` constants (Android respects a subset). * @default 'WHEN_UNLOCKED_THIS_DEVICE_ONLY' */ readonly accessible?: AndroidAccessible | undefined; } export interface AndroidKeystoreTokenStore extends GoodVibesTokenStore { /** * Persist a token together with an optional Unix-epoch expiry (ms). * Token and expiresAt are serialised as JSON in the Keystore password slot. * Picked up automatically by the `TokenStore` wrapper via duck-typing. */ setTokenEntry(token: string | null, expiresAt?: number): Promise; /** * Return the stored token and optional expiry timestamp. * Picked up automatically by the `TokenStore` wrapper via duck-typing. */ getTokenEntry(): Promise<{ token: string | null; expiresAt?: number; }>; } /** * Create a `GoodVibesTokenStore` backed by the Android Keystore system via * `react-native-keychain`. * * On Android, `react-native-keychain` uses `EncryptedSharedPreferences` backed * by the Android Keystore, hardware-backed AES-256-GCM encryption where * supported (API 23+). This is strongly preferred over plain AsyncStorage. * * Pass `accessControl: 'BIOMETRY_ANY'` or `'DEVICE_PASSCODE'` to require * interactive user authentication before reading the stored credential. * * `react-native-keychain` is an **optional peer dependency**, install it with: * * ```sh * npm install react-native-keychain * # No manual Gradle/CocoaPods step required for Android * ``` * * @example * ```ts * import { createAndroidKeystoreTokenStore, createReactNativeGoodVibesSdk } from '@pellux/goodvibes-sdk/react-native'; * * const tokenStore = createAndroidKeystoreTokenStore({ * service: 'com.myapp.gv', * accessControl: 'BIOMETRY_ANY', * }); * const sdk = createReactNativeGoodVibesSdk({ baseUrl: 'https://daemon.example.com', tokenStore }); * ``` */ export declare function createAndroidKeystoreTokenStore(options?: AndroidKeystoreTokenStoreOptions, __loadModule?: () => Promise): AndroidKeystoreTokenStore; //# sourceMappingURL=android-keystore-token-store.d.ts.map