{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,YAiBX;AAjBD,WAAY,YAAY;IACtB,eAAe;IACf,+CAAQ,CAAA;IACR,MAAM;IACN,uDAAY,CAAA;IACZ,MAAM;IACN,qDAAW,CAAA;IACX,UAAU;IACV,6DAAe,CAAA;IACf,UAAU;IACV,6EAAuB,CAAA;IACvB,UAAU;IACV,6EAAuB,CAAA;IACvB,UAAU;IACV,uDAAY,CAAA;IACZ,2DAA2D;IAC3D,yEAAqB,CAAA;AACvB,CAAC,EAjBW,YAAY,KAAZ,YAAY,QAiBvB;AAED,MAAM,CAAN,IAAY,sBAeX;AAfD,WAAY,sBAAsB;IAChC;;OAEG;IACH,mEAAQ,CAAA;IACR;;;OAGG;IACH,uEAAU,CAAA;IACV;;;OAGG;IACH,mEAAQ,CAAA;AACV,CAAC,EAfW,sBAAsB,KAAtB,sBAAsB,QAejC;AAED,MAAM,CAAN,IAAY,aAkBX;AAlBD,WAAY,aAAa;IACvB;;;OAGG;IACH,iDAAQ,CAAA;IACR;;;;OAIG;IACH,iFAAwB,CAAA;IACxB;;;;OAIG;IACH,iEAAgB,CAAA;AAClB,CAAC,EAlBW,aAAa,KAAb,aAAa,QAkBxB;AA8VD;;;;;;;GAOG;AACH,MAAM,CAAN,IAAY,kBAkFX;AAlFD,WAAY,kBAAkB;IAC5B;;OAEG;IACH,6EAAiB,CAAA;IACjB;;;OAGG;IACH,+FAA0B,CAAA;IAC1B;;;OAGG;IACH,2EAAgB,CAAA;IAChB;;;OAGG;IACH,iGAA2B,CAAA;IAC3B;;;OAGG;IACH,+FAA0B,CAAA;IAC1B;;;OAGG;IACH,8FAA0B,CAAA;IAC1B;;;OAGG;IACH,wEAAe,CAAA;IACf;;;OAGG;IACH,kFAAoB,CAAA;IACpB;;;OAGG;IACH,kFAAoB,CAAA;IACpB;;;OAGG;IACH,oFAAqB,CAAA;IACrB;;;OAGG;IACH,8EAAkB,CAAA;IAClB;;;OAGG;IACH,0EAAgB,CAAA;IAChB;;;OAGG;IACH,8EAAkB,CAAA;IAClB;;;;;;;;;;;;;;;OAeG;IACH,gHAAmC,CAAA;AACrC,CAAC,EAlFW,kBAAkB,KAAlB,kBAAkB,QAkF7B","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nexport enum BiometryType {\n // Android, iOS\n NONE = 0,\n // iOS\n TOUCH_ID = 1,\n // iOS\n FACE_ID = 2,\n // Android\n FINGERPRINT = 3,\n // Android\n FACE_AUTHENTICATION = 4,\n // Android\n IRIS_AUTHENTICATION = 5,\n // Android\n MULTIPLE = 6,\n // Android - Device credentials (PIN, pattern, or password)\n DEVICE_CREDENTIAL = 7,\n}\n\nexport enum AuthenticationStrength {\n /**\n * No authentication available, even if PIN is available but useFallback = false\n */\n NONE = 0,\n /**\n * Strong authentication: Face ID on iOS, fingerprints on devices that consider fingerprints strong (Android).\n * Note: PIN/pattern/password is NEVER considered STRONG, even when useFallback = true.\n */\n STRONG = 1,\n /**\n * Weak authentication: Face authentication on Android devices that consider face weak,\n * or PIN/pattern/password if useFallback = true (PIN is always WEAK, never STRONG).\n */\n WEAK = 2,\n}\n\nexport enum AccessControl {\n /**\n * No biometric protection. Credentials are accessible without authentication.\n * This is the default behavior for backward compatibility.\n */\n NONE = 0,\n /**\n * Biometric authentication required for credential access.\n * Credentials are invalidated if biometrics change (e.g., new fingerprint enrolled).\n * More secure but credentials are lost if user modifies their biometric enrollment.\n */\n BIOMETRY_CURRENT_SET = 1,\n /**\n * Biometric authentication required for credential access.\n * Credentials survive new biometric enrollment (e.g., adding a new fingerprint).\n * More lenient — recommended for most apps.\n */\n BIOMETRY_ANY = 2,\n}\n\nexport interface Credentials {\n username: string;\n password: string;\n}\n\nexport interface IsAvailableOptions {\n /**\n * Whether passcode or device credentials should count toward biometric availability\n * when no biometric is enrolled or available.\n *\n * - On iOS, this affects both `isAvailable()` and `verifyIdentity()`.\n * - On Android, this is honored by `isAvailable()` only — the native check computes\n * `fallbackAvailable = useFallback && deviceIsSecure` and reports availability\n * accordingly. The `verifyIdentity()` flow ignores this option on Android due to\n * BiometricPrompt API constraints (DEVICE_CREDENTIAL authenticator and negative\n * button are mutually exclusive); use `BiometricOptions.useFallback` (iOS-only) to\n * control the auth-dialog fallback there.\n */\n useFallback: boolean;\n /**\n * Android only. Report `BiometryType.MULTIPLE` whenever a fingerprint is enrolled and the device\n * also advertises a face or iris sensor, even when that second modality cannot be confirmed as\n * enrolled.\n *\n * You normally do not need this. On Android 12 and newer a face enrolled next to a fingerprint is\n * usually detected and reported as `BiometryType.MULTIPLE` on its own. Detection is best-effort,\n * and is not possible on Android 11 and older, for the rare Class 3 (Strong) face sensor, or on a\n * vendor build whose biometric labels name only the preferred modality. Undetected devices report\n * `BiometryType.FINGERPRINT`, because most devices advertise a face sensor the user never\n * enrolled. Set this to `true` if your UI would rather over-report `MULTIPLE` there.\n *\n * `verifyIdentity()` is unaffected and still offers every enrolled biometric the device supports;\n * this only changes the reported type. The most recent value is reused for `biometryChange`\n * events.\n *\n * @default false\n * @since 8.6.5\n */\n preferMultipleBiometryType?: boolean;\n}\n\n/**\n * Result from isAvailable() method indicating biometric authentication availability.\n */\nexport interface AvailableResult {\n /**\n * Whether authentication is available.\n *\n * On Android, weak-only biometrics (such as some face unlock implementations)\n * are available for `verifyIdentity()` when no `allowedBiometryTypes` filter\n * excludes them. If `useFallback` is true, PIN/pattern/password can also make\n * this value true.\n */\n isAvailable: boolean;\n /**\n * The strength of available authentication method (STRONG, WEAK, or NONE)\n */\n authenticationStrength: AuthenticationStrength;\n /**\n * The primary biometry type available on the device.\n * On Android devices with multiple biometry types, this returns MULTIPLE.\n * Use this for display purposes only - always use isAvailable for logic decisions.\n */\n biometryType: BiometryType;\n /**\n * Whether the device has a secure lock screen (PIN, pattern, or password).\n * This is independent of biometric enrollment.\n */\n deviceIsSecure: boolean;\n /**\n * Whether strong biometry (Face ID, Touch ID, or fingerprint on devices that consider it strong)\n * is specifically available, separate from weak biometry or device credentials.\n */\n strongBiometryIsAvailable: boolean;\n /**\n * Error code from BiometricAuthError enum. Only present when isAvailable is false.\n * Indicates why biometric authentication is not available.\n * @see BiometricAuthError\n */\n errorCode?: BiometricAuthError;\n}\n\nexport interface BiometricOptions {\n reason?: string;\n title?: string;\n subtitle?: string;\n description?: string;\n negativeButtonText?: string;\n /**\n * Only for iOS.\n * Specifies if should fallback to passcode authentication if biometric authentication fails.\n * On Android, this parameter is ignored due to BiometricPrompt API constraints:\n * DEVICE_CREDENTIAL authenticator and negative button (cancel) are mutually exclusive.\n */\n useFallback?: boolean;\n /**\n * Only for iOS.\n * Set the text for the fallback button in the authentication dialog.\n * If this property is not specified, the default text is set by the system.\n */\n fallbackTitle?: string;\n /**\n * Only for Android.\n * Set a maximum number of attempts for biometric authentication. The maximum allowed by android is 5.\n * @default 1\n */\n maxAttempts?: number;\n /**\n * Only for Android.\n * Specify which biometry types are allowed for authentication.\n * If not specified, all enrolled biometric classes (strong and weak) are allowed.\n * On Android, face unlock is often classified as weak biometrics — include\n * `BiometryType.FACE_AUTHENTICATION` or omit this option to allow it.\n * Use `BiometryType.DEVICE_CREDENTIAL` for PIN/pattern/password (disables the cancel button).\n * @example [BiometryType.FINGERPRINT, BiometryType.FACE_AUTHENTICATION]\n */\n allowedBiometryTypes?: BiometryType[];\n}\n\nexport interface GetCredentialOptions {\n server: string;\n}\n\nexport interface SetCredentialOptions {\n username: string;\n password: string;\n server: string;\n /**\n * Access control level for the stored credentials.\n * When set to BIOMETRY_CURRENT_SET or BIOMETRY_ANY, the credentials are\n * hardware-protected and require biometric authentication to access.\n *\n * On iOS, this adds SecAccessControl to the Keychain item.\n * On Android, this creates a biometric-protected Keystore key and requires\n * BiometricPrompt authentication for both storing and retrieving credentials.\n *\n * @default AccessControl.NONE\n * @since 8.4.0\n */\n accessControl?: AccessControl;\n /**\n * Only for Android. Ignored on iOS and web.\n * Only meaningful together with `accessControl` set to BIOMETRY_CURRENT_SET or BIOMETRY_ANY.\n *\n * Number of seconds a successful biometric authentication remains valid for\n * Keystore key use. When `0` or omitted (the default), the Keystore key requires\n * a fresh authentication for every operation — each `getSecureCredentials()` call\n * shows a `BiometricPrompt` cryptographically bound to that specific read via a\n * `CryptoObject`. This is the strongest mode: it guarantees no code path can use\n * the key without a live biometric check.\n *\n * When set to a value greater than `0`, one successful biometric authentication\n * authorizes Keystore key use for that many seconds. Subsequent\n * `getSecureCredentials()` calls within the window succeed without showing a\n * prompt. This trades security for convenience: any in-app code that can reach\n * the decryption call — not just the code path that triggered the prompt — can\n * silently read the credentials for the remainder of the window.\n *\n * @default 0\n * @since 8.5.0\n */\n authValidityDuration?: number;\n /**\n * Title for the biometric prompt shown while protecting credentials.\n * Only for Android.\n *\n * @default \"Protect Credentials\"\n * @since 8.4.14\n */\n title?: string;\n /**\n * Text for the negative/cancel button in the biometric prompt.\n * Only for Android.\n *\n * @default \"Cancel\"\n * @since 8.4.14\n */\n negativeButtonText?: string;\n /**\n * Set a maximum number of attempts for biometric authentication. The maximum allowed by Android is 5.\n * Only for Android.\n * @default 1\n */\n maxAttempts?: number;\n}\n\nexport interface GetSecureCredentialsOptions {\n server: string;\n /**\n * Explanation text shown as the subtitle of the Touch ID prompt. Face ID does not display it.\n * Only for iOS.\n */\n reason?: string;\n /**\n * Title for the biometric prompt.\n * Only for Android.\n */\n title?: string;\n /**\n * Subtitle for the biometric prompt.\n * Only for Android.\n */\n subtitle?: string;\n /**\n * Description for the biometric prompt.\n * Only for Android.\n */\n description?: string;\n /**\n * Text for the negative/cancel button.\n * Only for Android.\n */\n negativeButtonText?: string;\n /**\n * Set a maximum number of attempts for biometric authentication. The maximum allowed by Android is 5.\n * Only for Android.\n * @default 1\n */\n maxAttempts?: number;\n}\n\nexport interface DeleteCredentialOptions {\n server: string;\n}\n\nexport interface IsCredentialsSavedOptions {\n server: string;\n}\n\nexport interface IsCredentialsSavedResult {\n isSaved: boolean;\n}\nexport interface SetDataOptions {\n /**\n * Unique identifier for the stored value.\n * Use a stable app-specific namespace (e.g. `pin`, `session.token`).\n */\n key: string;\n /**\n * Arbitrary string payload. Serialize objects with `JSON.stringify()` before storing.\n *\n * Platform limits apply: Android Keystore-backed encryption works best with payloads\n * under ~8 KB; iOS Keychain practical limits are higher but very large values are discouraged.\n */\n value: string;\n /**\n * Access control level for the stored value.\n * When set to BIOMETRY_CURRENT_SET or BIOMETRY_ANY, the value is hardware-protected\n * and requires biometric authentication to access via `getSecureData()`.\n *\n * @default AccessControl.NONE\n * @since 8.6.0\n */\n accessControl?: AccessControl;\n /**\n * Only for Android. Ignored on iOS and web.\n * Only meaningful together with `accessControl` set to BIOMETRY_CURRENT_SET or BIOMETRY_ANY.\n *\n * @default 0\n * @since 8.6.0\n */\n authValidityDuration?: number;\n /**\n * Title for the biometric prompt shown while protecting data.\n * Only for Android.\n *\n * @default \"Protect Data\"\n * @since 8.6.0\n */\n title?: string;\n /**\n * Text for the negative/cancel button in the biometric prompt.\n * Only for Android.\n *\n * @default \"Cancel\"\n * @since 8.6.0\n */\n negativeButtonText?: string;\n /**\n * Set a maximum number of attempts for biometric authentication. The maximum allowed by Android is 5.\n * Only for Android.\n * @default 1\n */\n maxAttempts?: number;\n}\n\nexport interface GetDataOptions {\n key: string;\n}\n\nexport interface GetSecureDataOptions {\n key: string;\n /**\n * Explanation text shown as the subtitle of the Touch ID prompt. Face ID does not display it.\n * Only for iOS.\n */\n reason?: string;\n /**\n * Title for the biometric prompt.\n * Only for Android.\n */\n title?: string;\n /**\n * Subtitle for the biometric prompt.\n * Only for Android.\n */\n subtitle?: string;\n /**\n * Description for the biometric prompt.\n * Only for Android.\n */\n description?: string;\n /**\n * Text for the negative/cancel button.\n * Only for Android.\n */\n negativeButtonText?: string;\n /**\n * Set the text for the fallback button in the authentication dialog.\n * If this property is not specified, the default text is set by the system.\n * Set it to an empty string to hide the button.\n * Only for iOS.\n */\n fallbackTitle?: string;\n /**\n * Set a maximum number of attempts for biometric authentication. The maximum allowed by Android is 5.\n * Only for Android.\n * @default 1\n */\n maxAttempts?: number;\n}\n\nexport interface StoredData {\n value: string;\n}\n\nexport interface DeleteDataOptions {\n key: string;\n}\n\nexport interface IsDataSavedOptions {\n key: string;\n}\n\nexport interface IsDataSavedResult {\n isSaved: boolean;\n}\n\n/**\n * Biometric authentication error codes.\n * These error codes are used in `isAvailable()`, `verifyIdentity()`, `getSecureCredentials()`,\n * and `getSecureData()` rejection payloads.\n *\n * Keep this in sync with BiometricAuthError in README.md\n * Update whenever `convertToPluginErrorCode` functions are modified\n */\nexport enum BiometricAuthError {\n /**\n * Unknown error occurred\n */\n UNKNOWN_ERROR = 0,\n /**\n * Biometrics are unavailable (no hardware or hardware error)\n * Platform: Android, iOS\n */\n BIOMETRICS_UNAVAILABLE = 1,\n /**\n * User has been locked out due to too many failed attempts\n * Platform: Android, iOS\n */\n USER_LOCKOUT = 2,\n /**\n * No biometrics are enrolled on the device\n * Platform: Android, iOS\n */\n BIOMETRICS_NOT_ENROLLED = 3,\n /**\n * User is temporarily locked out (Android: 30 second lockout)\n * Platform: Android\n */\n USER_TEMPORARY_LOCKOUT = 4,\n /**\n * Authentication failed (user did not authenticate successfully)\n * Platform: Android, iOS\n */\n AUTHENTICATION_FAILED = 10,\n /**\n * App canceled the authentication (iOS only)\n * Platform: iOS\n */\n APP_CANCEL = 11,\n /**\n * Invalid context (iOS only)\n * Platform: iOS\n */\n INVALID_CONTEXT = 12,\n /**\n * Authentication was not interactive (iOS only)\n * Platform: iOS\n */\n NOT_INTERACTIVE = 13,\n /**\n * Passcode/PIN is not set on the device\n * Platform: Android, iOS\n */\n PASSCODE_NOT_SET = 14,\n /**\n * System canceled the authentication (e.g., due to screen lock)\n * Platform: Android, iOS\n */\n SYSTEM_CANCEL = 15,\n /**\n * User canceled the authentication\n * Platform: Android, iOS\n */\n USER_CANCEL = 16,\n /**\n * User chose to use fallback authentication method\n * Platform: Android, iOS\n */\n USER_FALLBACK = 17,\n /**\n * No biometric-protected credentials or data exist for the requested server or key.\n * Platform: Android, iOS (`getSecureCredentials()`, `getSecureData()`).\n *\n * Thrown when `getSecureCredentials()` or `getSecureData()` is called but nothing was stored\n * with `accessControl` BIOMETRY_CURRENT_SET or BIOMETRY_ANY — for example after deletion,\n * a fresh install, or items removed from the secure enclave after biometric enrollment changes.\n *\n * Rejection message differs by platform and method:\n * - `getSecureCredentials()`: Android `No protected credentials found`, iOS\n * `No protected credentials found for server`\n * - `getSecureData()`: Android `No protected data found`, iOS\n * `No protected data found for key`\n *\n * @since 8.4.0\n */\n NO_PROTECTED_CREDENTIALS_FOUND = 21,\n}\n\n/**\n * Callback type for biometry change listener\n */\nexport type BiometryChangeListener = (result: AvailableResult) => void;\n\nexport interface NativeBiometricPlugin {\n /**\n * Checks if biometric authentication hardware is available.\n * @param {IsAvailableOptions} [options]\n * @returns {Promise}\n * @memberof NativeBiometricPlugin\n * @since 1.0.0\n */\n isAvailable(options?: IsAvailableOptions): Promise;\n\n /**\n * Adds a listener that is called when the app resumes from background.\n * This is useful to detect if biometry availability has changed while\n * the app was in the background (e.g., user enrolled/unenrolled biometrics).\n *\n * @param eventName - Must be 'biometryChange'\n * @param {BiometryChangeListener} listener - Callback function that receives the updated AvailableResult\n * @returns {Promise} Handle to remove the listener\n * @since 7.6.0\n *\n * @example\n * ```typescript\n * const handle = await NativeBiometric.addListener('biometryChange', (result) => {\n * console.log('Biometry availability changed:', result.isAvailable);\n * });\n *\n * // To remove the listener:\n * await handle.remove();\n * ```\n */\n addListener(eventName: 'biometryChange', listener: BiometryChangeListener): Promise;\n /**\n * Prompts the user to authenticate with biometrics.\n * @param {BiometricOptions} [options]\n * @returns {Promise}\n * @memberof NativeBiometricPlugin\n * @since 1.0.0\n */\n verifyIdentity(options?: BiometricOptions): Promise;\n /**\n * Gets the stored credentials for a given server.\n * @param {GetCredentialOptions} options\n * @returns {Promise}\n * @memberof NativeBiometricPlugin\n * @since 1.0.0\n */\n getCredentials(options: GetCredentialOptions): Promise;\n /**\n * Stores the given credentials for a given server.\n * @param {SetCredentialOptions} options\n * @returns {Promise}\n * @memberof NativeBiometricPlugin\n * @since 1.0.0\n */\n setCredentials(options: SetCredentialOptions): Promise;\n /**\n * Deletes the stored credentials for a given server.\n * @param {DeleteCredentialOptions} options\n * @returns {Promise}\n * @memberof NativeBiometricPlugin\n * @since 1.0.0\n */\n deleteCredentials(options: DeleteCredentialOptions): Promise;\n /**\n * Gets the stored credentials for a given server, requiring biometric authentication.\n * Credentials must have been stored with accessControl set to BIOMETRY_CURRENT_SET or BIOMETRY_ANY.\n *\n * On iOS, the system automatically shows the biometric prompt when accessing the protected Keychain item.\n * On Android, BiometricPrompt is shown with a CryptoObject bound to the credential decryption key.\n *\n * If no protected credentials exist for the server, the promise rejects with code `21`\n * (`BiometricAuthError.NO_PROTECTED_CREDENTIALS_FOUND`). This is stable, expected\n * behavior — for example when credentials were never saved with biometric protection,\n * were deleted, or were invalidated after biometric enrollment changes.\n * `isCredentialsSaved()` returns true when any credentials (protected or unprotected) exist,\n * so it does not guarantee a biometric-protected entry is present — handle code `21` in\n * your catch block or only call after storing with `accessControl` BIOMETRY_CURRENT_SET\n * or BIOMETRY_ANY.\n * Platform messages: Android `No protected credentials found`, iOS\n * `No protected credentials found for server`.\n *\n * @see BiometricAuthError.NO_PROTECTED_CREDENTIALS_FOUND\n *\n * @param {GetSecureCredentialsOptions} options\n * @returns {Promise}\n * @memberof NativeBiometricPlugin\n * @since 8.4.0\n */\n getSecureCredentials(options: GetSecureCredentialsOptions): Promise;\n /**\n * Checks if credentials are already saved for a given server.\n * @param {IsCredentialsSavedOptions} options\n * @returns {Promise}\n * @memberof NativeBiometricPlugin\n * @since 7.3.0\n */\n isCredentialsSaved(options: IsCredentialsSavedOptions): Promise;\n\n /**\n * Stores an arbitrary string value under the given key.\n * Values are encrypted at rest using the platform secure storage backend\n * (Android Keystore + SharedPreferences, iOS Keychain).\n *\n * For biometric-protected storage, set `accessControl` and retrieve the value\n * with `getSecureData()`. Credential helpers remain available for username/password flows.\n *\n * @param {SetDataOptions} options\n * @returns {Promise}\n * @memberof NativeBiometricPlugin\n * @since 8.6.0\n */\n setData(options: SetDataOptions): Promise;\n\n /**\n * Gets a previously stored value for the given key.\n * Only returns values stored without biometric `accessControl`.\n *\n * @param {GetDataOptions} options\n * @returns {Promise}\n * @memberof NativeBiometricPlugin\n * @since 8.6.0\n */\n getData(options: GetDataOptions): Promise;\n\n /**\n * Gets a biometric-protected value for the given key.\n * The value must have been stored with `accessControl` set to BIOMETRY_CURRENT_SET or BIOMETRY_ANY.\n *\n * @param {GetSecureDataOptions} options\n * @returns {Promise}\n * @memberof NativeBiometricPlugin\n * @since 8.6.0\n */\n getSecureData(options: GetSecureDataOptions): Promise;\n\n /**\n * Deletes the stored value for the given key (protected and unprotected).\n *\n * @param {DeleteDataOptions} options\n * @returns {Promise}\n * @memberof NativeBiometricPlugin\n * @since 8.6.0\n */\n deleteData(options: DeleteDataOptions): Promise;\n\n /**\n * Checks whether a value is already saved for the given key.\n *\n * @param {IsDataSavedOptions} options\n * @returns {Promise}\n * @memberof NativeBiometricPlugin\n * @since 8.6.0\n */\n isDataSaved(options: IsDataSavedOptions): Promise;\n\n /**\n * Get the native Capacitor plugin version.\n *\n * @returns Promise that resolves with the plugin version\n * @since 1.0.0\n */\n getPluginVersion(): Promise<{ version: string }>;\n}\n"]}