Skip to content

biometric_auth_sdk Pro

Biometric authentication (Face ID / Touch ID / fingerprint) feature SDK. Wraps local_auth and integrates as a passive unlock gate with auth_sdk.

Version: 1.0.0

Variables

This brick has no generation-time variables. All runtime configuration is done via the generated BiometricAuthSDK interface.

Usage

Interactive

bash
archipelago generate biometric_auth_sdk

Non-interactive (CI)

bash
archipelago generate biometric_auth_sdk --config my_config.json

Generated Structure

features/
└── biometric_auth/
    ├── biometric_auth_api/
    │   └── lib/src/
    │       └── models/
    └── biometric_auth_impl/
        └── lib/src/
            └── di/

Platform Setup

iOS — Info.plist

Add the Face ID usage description to ios/Runner/Info.plist:

xml
<key>NSFaceIDUsageDescription</key>
<string>We use Face ID to quickly verify your identity.</string>

Without this key the app will crash at runtime when local_auth requests Face ID on iOS.

Android — Permission

local_auth uses BiometricPrompt which does not require explicit manifest permissions on API 28+. For API 23–27 (fingerprint only), add:

xml
<uses-permission android:name="android.permission.USE_FINGERPRINT" />

Unlock vs. Primary Credential

Biometric is an unlock gate, not a primary credential. After a successful BiometricAuthSDK.authenticate() call, the host app is responsible for calling authSDK.loginSuccess(userId: cachedUserId) to restore the session. The SDK intentionally does not do this automatically to keep session semantics under the caller's control.

Runtime API

dart
final biometricSDK = getIt<BiometricAuthSDK>();

// Check device support:
final isSupported = await biometricSDK.isAvailable();

// Authenticate:
final result = await biometricSDK.authenticate(
  reason: 'Verify your identity to continue',
);

if (result.isSuccess) {
  // Restore session in auth_sdk
  await getIt<AuthSDK>().loginSuccess(userId: cachedUserId);
}

Known Limitations

  • Does not store or manage session tokens — that responsibility remains with auth_sdk.
  • On Android emulators without enrolled biometrics, isAvailable() returns false.

Built by Banua Coder