Skip to content

[biometric] Feature Request: Support for Hardware-Backed Cryptographic Operations (Secret Retrieval) #3169

Closed

Description

@surkaa

Describe the problem

Currently, the authenticate method in the Biometric plugin only returns a boolean-like success or failure (via Result<()>). While this confirms that the user is the device owner, it doesn't provide a way to securely store or retrieve sensitive information (like an app's master key or login token) bound to the biometric factor.

In a high-security scenario, we need to ensure that certain data can only be decrypted or accessed if the biometric authentication was successful, leveraging hardware-backed security (Android Keystore / iOS Keychain with AccessControl). Simply trusting a "Success" callback from the OS is susceptible to hooks or bypasses on compromised devices.

Describe the solution you'd like

I would like the authenticate method to support cryptographic operations and return a "secret" or "token" upon successful authentication.

Proposed Changes:

  1. **Extended AuthOptions**: Add a way to specify a key name or a payload to be processed.
  2. Cryptographic Integration:
  • Android: Support BiometricPrompt.CryptoObject. The plugin should allow users to initialize a Cipher or Signature backed by the Android Keystore that requires user authentication.
  • iOS: Support SecAccessControl with kSecAccessControlBiometryAny or kSecAccessControlBiometryCurrentSet.
  1. Modified Return Type: Change authenticate to return a value (e.g., a Base64 encoded string or a Vec<u8>).

Updated Rust Interface Idea:

// Proposed model change
pub struct AuthResponse {
    pub signature: Option<String>,
    pub decrypted_data: Option<String>,
}

impl<R: Runtime> Biometric<R> {
    pub fn authenticate(&self, reason: String, options: AuthOptions) -> crate::Result<AuthResponse> {
        // ...
    }
}

Alternatives considered

Developers can currently try to write custom Kotlin/Swift code via Tauri's command system, but since the Biometric plugin already handles the complex UI and permission lifecycle of the Biometric Prompt, it makes more sense to integrate the "Secure Storage/Cryptographic" part directly into this official plugin.
Currently, the plugin only provides 'authentication' but not 'secure storage'. Without this feature, the plugin is just a UI wrapper for the system prompt, and doesn't actually help in creating a zero-trust security model.

Additional context

  • On Android, this would involve using KeyGenParameterSpec.Builder.setUserAuthenticationRequired(true).
  • On iOS, this would involve retrieving an item from the Keychain using LAContext for evaluation.
  • This is a standard feature in many other cross-platform biometric libraries (like react-native-keychain or Flutter's local_auth with extra secure storage plugins).

Activity

  1. surkaa commented on Dec 18, 2025

    @surkaa
    Author

    Duplicate with PR #2454

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions