import type { GoodVibesTokenStore } from './types.js'; /** * String union of the `Keychain.ACCESSIBLE` enum values. * Resolved by property lookup on `Keychain.ACCESSIBLE` at runtime. */ export type KeychainAccessible = '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 IOSKeychainTokenStoreOptions { /** * The keychain service identifier. * @default 'com.pellux.goodvibes-sdk' */ readonly service?: string | undefined; /** * Controls when stored data is accessible. * Maps to `Keychain.ACCESSIBLE` constants. * @default 'WHEN_UNLOCKED_THIS_DEVICE_ONLY' */ readonly accessible?: KeychainAccessible | undefined; /** * iOS Keychain access group for sharing credentials between apps. * Maps to `Keychain.Options.accessGroup`. */ readonly accessGroup?: string | undefined; } export interface IOSKeychainTokenStore extends GoodVibesTokenStore { /** * Persist a token together with an optional Unix-epoch expiry (ms). * Token and expiresAt are serialised as JSON in the keychain 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 iOS Keychain via * `react-native-keychain`. * * Suitable for **bare React Native** iOS apps. For Expo-managed workflow, use * `createExpoSecureTokenStore` instead. * * Both the `token` and `expiresAt` values are serialised as a single JSON * blob in the keychain password slot. The username slot is fixed to * `'goodvibes-sdk'`. * * `react-native-keychain` is an **optional peer dependency**, install it with: * * ```sh * npm install react-native-keychain * npx pod-install * ``` * * @example * ```ts * import { createIOSKeychainTokenStore, createReactNativeGoodVibesSdk } from '@pellux/goodvibes-sdk/react-native'; * * const tokenStore = createIOSKeychainTokenStore({ service: 'com.myapp.gv' }); * const sdk = createReactNativeGoodVibesSdk({ baseUrl: 'https://daemon.example.com', tokenStore }); * ``` */ export declare function createIOSKeychainTokenStore(options?: IOSKeychainTokenStoreOptions, __loadModule?: () => Promise): IOSKeychainTokenStore; //# sourceMappingURL=ios-keychain-token-store.d.ts.map