{"id":27862599,"url":"https://github.com/maojiu-bb/biometric_authorization","last_synced_at":"2026-04-11T03:31:41.116Z","repository":{"id":288530458,"uuid":"968417751","full_name":"maojiu-bb/biometric_authorization","owner":"maojiu-bb","description":"A Flutter plugin for biometric authorization, support iOS、Android、macOS","archived":false,"fork":false,"pushed_at":"2025-08-30T06:07:49.000Z","size":2051,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-17T18:39:08.349Z","etag":null,"topics":["android","biometric-authentication","flutter","kotlin","muti-platform","plugin","swift","swiftui"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/biometric_authorization","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maojiu-bb.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-04-18T03:55:51.000Z","updated_at":"2025-09-09T06:37:00.000Z","dependencies_parsed_at":"2025-04-18T16:56:20.489Z","dependency_job_id":"ac4f449a-1984-46b0-bc4f-2fbc369beea4","html_url":"https://github.com/maojiu-bb/biometric_authorization","commit_stats":null,"previous_names":["maojiu-bb/biometric_authorization"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/maojiu-bb/biometric_authorization","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maojiu-bb%2Fbiometric_authorization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maojiu-bb%2Fbiometric_authorization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maojiu-bb%2Fbiometric_authorization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maojiu-bb%2Fbiometric_authorization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maojiu-bb","download_url":"https://codeload.github.com/maojiu-bb/biometric_authorization/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maojiu-bb%2Fbiometric_authorization/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31668046,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T17:19:37.612Z","status":"online","status_checked_at":"2026-04-11T02:00:05.776Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","biometric-authentication","flutter","kotlin","muti-platform","plugin","swift","swiftui"],"created_at":"2025-05-04T20:31:48.722Z","updated_at":"2026-04-11T03:31:40.976Z","avatar_url":"https://github.com/maojiu-bb.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Biometric Authorization\n\nA Flutter plugin that provides easy-to-use biometric authentication for Android, iOS, and macOS platforms. This plugin allows your app to securely authenticate users using biometric features such as fingerprint, face recognition, and other available biometric methods.\n\n![Platform Support](https://img.shields.io/badge/platform-android%20%7C%20ios%20%7C%20macos-green.svg)\n[![Pub Version](https://img.shields.io/pub/v/biometric_authorization.svg)](https://pub.dev/packages/biometric_authorization)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\n## Features\n\n- Check if biometric authentication is available on the device\n- Verify if biometric credentials are enrolled\n- Get a list of available biometric types (fingerprint, face recognition)\n- Authenticate users with biometric verification\n- Support for both default system UI and custom UI for authentication\n- Cross-platform implementations for Android, iOS, and macOS\n- Native macOS Touch ID integration with SwiftUI custom UI\n\n## Screenshots\n\n### iOS Authentication\n\n|                                                           Touch ID - System UI                                                           |                                                           Touch ID - Custom UI                                                            |                                                           Face ID - Custom UI                                                           |\n| :--------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------: |\n| ![iOS Touch ID System UI](https://github.com/maojiu-bb/biometric_authorization/blob/main/screenshots/ios-touch-default-pop.png?raw=true) | ![iOS Touch ID Custom UI](https://github.com/maojiu-bb/biometric_authorization/blob/main/screenshots/ios-touch-custom-sheet.png?raw=true) | ![iOS Face ID Custom UI](https://github.com/maojiu-bb/biometric_authorization/blob/main/screenshots/ios-face-custom-sheet.png?raw=true) |\n\n### Android Authentication\n\n|                                                              Default UI                                                              |                                                             Custom UI (Sheet)                                                              |                                                              Custom UI (Dialog)                                                              |\n| :----------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------: |\n| ![Android Default UI](https://github.com/maojiu-bb/biometric_authorization/blob/main/screenshots/android-default-sheet.png?raw=true) | ![Android Custom UI (Sheet)](https://github.com/maojiu-bb/biometric_authorization/blob/main/screenshots/android-custom-sheet.png?raw=true) | ![Android Custom UI (Dialog)](https://github.com/maojiu-bb/biometric_authorization/blob/main/screenshots/android-custom-dialog.png?raw=true) |\n\n### macOS Authentication\n\n|                                                              Touch ID - System UI                                                               |                                                              Touch ID - Custom UI                                                              |\n| :---------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------: |\n| ![macOS Touch ID System UI](https://github.com/maojiu-bb/biometric_authorization/blob/main/screenshots/macos-touch-default-dialog.png?raw=true) | ![macOS Touch ID Custom UI](https://github.com/maojiu-bb/biometric_authorization/blob/main/screenshots/macos-touch-custom-dialog.png?raw=true) |\n\n## Platform Support\n\n|            Android            |        iOS        |    macOS     |\n| :---------------------------: | :---------------: | :----------: |\n| Fingerprint, Face recognition | Face ID, Touch ID |   Touch ID   |\n|            API 21+            |     iOS 11.0+     | macOS 10.15+ |\n\n## Installation\n\nAdd this to your package's `pubspec.yaml` file:\n\n```yaml\ndependencies:\n  biometric_authorization: ^1.1.1\n```\n\nThen run:\n\n```bash\nflutter pub get\n```\n\n### Android Setup\n\n1. Add the following permission to your `AndroidManifest.xml` file:\n\n```xml\n\u003cuses-permission android:name=\"android.permission.USE_BIOMETRIC\" /\u003e\n```\n\n2. **Important**: You must use `FlutterFragmentActivity` instead of `FlutterActivity` in your Android project. In your `MainActivity.kt` file:\n\n```kotlin\nimport io.flutter.embedding.android.FlutterFragmentActivity\n\nclass MainActivity: FlutterFragmentActivity() {\n    // ...\n}\n```\n\n### iOS Setup\n\nAdd the following to your `Info.plist` file:\n\n```xml\n\u003ckey\u003eNSFaceIDUsageDescription\u003c/key\u003e\n\u003cstring\u003eYour app needs to authenticate using your biometric data for secure access\u003c/string\u003e\n```\n\n### macOS Setup\n\n1. **Minimum Version**: Ensure your macOS deployment target is at least **macOS 10.15** (Catalina) in your `macos/Runner.xcodeproj` project settings.\n\n2. **Entitlements**: No special entitlements are required for Touch ID authentication. The LocalAuthentication framework handles permissions automatically. Your existing entitlements files should work as-is:\n\n   ```xml\n   \u003c!-- macos/Runner/DebugProfile.entitlements --\u003e\n   \u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n   \u003c!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"\u003e\n   \u003cplist version=\"1.0\"\u003e\n   \u003cdict\u003e\n       \u003ckey\u003ecom.apple.security.app-sandbox\u003c/key\u003e\n       \u003ctrue/\u003e\n       \u003ckey\u003ecom.apple.security.cs.allow-jit\u003c/key\u003e\n       \u003ctrue/\u003e\n       \u003ckey\u003ecom.apple.security.network.server\u003c/key\u003e\n       \u003ctrue/\u003e\n   \u003c/dict\u003e\n   \u003c/plist\u003e\n   ```\n\n3. **Hardware Requirements**: Touch ID functionality requires a Mac with Touch ID sensor (MacBook Pro with Touch Bar, MacBook Air 2018+, iMac Pro, Mac Studio, etc.).\n\n## Usage\n\nImport the package:\n\n```dart\nimport 'package:biometric_authorization/biometric_authorization.dart';\nimport 'package:biometric_authorization/biometric_type.dart';\n```\n\n### Check Biometric Availability\n\n```dart\nfinal biometricAuth = BiometricAuthorization();\n\n// Check if biometric authentication is available\nbool isAvailable = await biometricAuth.isBiometricAvailable();\n\n// Check if biometric credentials are enrolled\nbool isEnrolled = await biometricAuth.isBiometricEnrolled();\n\n// Get available biometric types\nList\u003cBiometricType\u003e types = await biometricAuth.getAvailableBiometricTypes();\n```\n\n### Authenticate with Biometrics\n\n#### Using Default System UI\n\n```dart\ntry {\n  bool authenticated = await biometricAuth.authenticate(\n    reason: 'Please authenticate to access your account',\n    title: 'Biometric Authentication',\n    confirmText: 'Verify',\n  );\n\n  if (authenticated) {\n    // User authenticated successfully\n    print('Authentication successful');\n  } else {\n    // Authentication failed or was cancelled\n    print('Authentication failed');\n  }\n} catch (e) {\n  print('Error during authentication: $e');\n}\n```\n\n#### Using Custom UI\n\n```dart\nbool authenticated = await biometricAuth.authenticate(\n  reason: 'Please authenticate to access your account',\n  title: 'Biometric Authentication',\n  confirmText: 'Verify',\n  useCustomUI: true,\n);\n```\n\n#### Using Dialog UI (Available on Android)\n\n```dart\nbool authenticated = await biometricAuth.authenticate(\n  reason: 'Please authenticate to access your account',\n  title: 'Biometric Authentication',\n  confirmText: 'Verify',\n  useDialog: true,\n);\n```\n\n### Platform-Specific Parameters\n\nThe `authenticate` method has some parameters that behave differently depending on the platform:\n\n- **biometricType**: This parameter is **required on iOS and macOS** to specify which biometric method to use (face or fingerprint). On Android, it's optional as Android will automatically use available methods.\n\n  ```dart\n  // Example for iOS/macOS - must specify biometricType\n  await biometricAuth.authenticate(\n    biometricType: BiometricType.fingerprint, // Use Touch ID on macOS\n    reason: 'Authenticate to continue',\n  );\n  ```\n\n- **cancelText**: This parameter is only effective on **Android**. It specifies the text for the cancel button in the authentication dialog. On iOS and macOS, this parameter is ignored.\n\n  ```dart\n  // Example for Android - can specify cancelText\n  await biometricAuth.authenticate(\n    reason: 'Authenticate to continue',\n    cancelText: 'Not now',\n  );\n  ```\n\n## API Reference\n\n### BiometricAuthorization\n\nMain class providing biometric authentication functionality.\n\n#### Methods\n\n- `Future\u003cbool\u003e isBiometricAvailable()` - Checks if biometric authentication is available on the device.\n- `Future\u003cbool\u003e isBiometricEnrolled()` - Checks if biometric credentials are enrolled on the device.\n- `Future\u003cList\u003cBiometricType\u003e\u003e getAvailableBiometricTypes()` - Gets available biometric types on the device.\n- `Future\u003cbool\u003e authenticate({...})` - Authenticates the user with biometrics.\n\n### BiometricType\n\nEnum representing different biometric authentication types:\n\n- `BiometricType.face` - Face recognition (Face ID on iOS, face authentication on Android)\n- `BiometricType.fingerprint` - Fingerprint recognition (Touch ID on iOS/macOS, fingerprint on Android)\n- `BiometricType.none` - No biometric type available\n\n## Platform-Specific Features\n\n### Android\n\n- Support for both fingerprint and face recognition\n- Custom UI option with bottom sheet design\n- Support for predictive back gesture navigation on Android 13+\n- Handles biometric lockout scenarios gracefully\n- Requires `FlutterFragmentActivity` instead of `FlutterActivity`\n- The `cancelText` parameter can be used to customize the cancel button text\n\n### iOS\n\n- Native support for Face ID and Touch ID\n- Seamless integration with Apple's security framework\n- Proper handling of authentication cancelation and errors\n- The `biometricType` parameter is required to specify which biometric method to use\n- Custom UI with SwiftUI integration for iOS 13+\n\n### macOS\n\n- Native Touch ID support for compatible Mac hardware\n- Beautiful SwiftUI-based custom authentication interface\n- Automatic adaptation to system light/dark mode\n- Floating window authentication UI with proper focus management\n- Backward compatibility with macOS 10.15+ (with appropriate fallbacks for UI elements)\n- The `biometricType` parameter is required (use `BiometricType.fingerprint` for Touch ID)\n- Hardware dependency: Requires Mac with Touch ID sensor\n\n#### macOS Custom UI Features\n\n- **Responsive Design**: Adapts to different window sizes and system themes\n- **Animated Elements**: Smooth pulse animations and hover effects\n- **Version Compatibility**: Uses SF Symbols on macOS 11+ and Unicode fallbacks on macOS 10.15\n- **Native Feel**: Follows macOS design guidelines and interaction patterns\n\n## Example\n\nA full example app is available in the [example](https://github.com/your-username/biometric_authorization/tree/main/example) directory.\n\n## Contributing\n\nContributions are welcome! If you find a bug or want a feature, please open an issue or submit a PR.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaojiu-bb%2Fbiometric_authorization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaojiu-bb%2Fbiometric_authorization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaojiu-bb%2Fbiometric_authorization/lists"}