搜尋套件、儲存庫與 APP 分類

套件詳情v0.0.2

biometricx

在您的 Flutter 應用中使用生物識別驗證的簡單方法。

Android
近 30 天下載
145
喜歡數
36
Pub 分數
150

安裝套件

flutter pub add biometricx

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

BiometricX 是一個 Flutter 套件,可簡化在 Android 應用中整合生物識別驗證(例如指紋或臉部辨識)的過程。它提供了一個直觀的 API,用於檢查生物識別功能的可用性,並使用設備級生物識別安全地驗證使用者。此套件設計為易於使用,抽象了複雜的平台特定實作,讓開發者能以最少的程式碼實現安全驗證。該套件僅支援 Android,並利用原生生物識別 API 來確保可靠的效能與安全性。

適用情境

  • 安全應用登入
  • 用戶身份驗證
  • 受保護的資料存取
  • 會話重新認證
  • 雙因素驗證

主要特色

  • 用於生物識別檢查的簡單 API
  • 僅支援 Android
  • 安全的生物識別認證
  • 自動回退處理
  • 所需設定最少

適合對象

  • 需要安全用戶認證的應用程式
  • 尋求快速生物識別整合的開發者
  • 專注於Android安全的項目
  • 包含敏感數據的移動應用
  • 需要快速生物識別測試的原型

使用建議

  • 僅限 Android 平台
  • 需要設備生物識別硬體
  • 不支援 iOS
  • 依賴於 Android SDK 版本相容性
  • 需要在清單中正確處理權限

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

BiometricX

The easy way to use biometric authentication in your Flutter app.
Supports Fingerprint, FaceID and Iris.

Demo APK.

Starting

$ flutter pub add biometricx

Configuration

Change your android MainActivity to extends FlutterFragmentActivity.

import io.flutter.embedding.android.FlutterFragmentActivity

// kotlin
class MainActivity: FlutterFragmentActivity() {
  ...
}
import io.flutter.embedding.android.FlutterFragmentActivity;

// java
class MainActivity extends FlutterFragmentActivity {
  ...
}

Usage

To check biometric type of your device.

BiometricType type = await BiometricX.type;

Here is the list of biometric types.

BiometricType.FACE
BiometricType.FINGERPRINT
BiometricType.IRIS
BiometricType.MULTIPLE
BiometricType.NONE
BiometricType.NO_HARDWARE
BiometricType.UNAVAILABLE
BiometricType.UNSUPPORTED

To check if your device can use biometric authentication.

bool isBiometricEnabled = await BiometricX.isEnabled;

To encrypt data using biometric authentication.

BiometricResult result = await BiometricX.encrypt({
  biometricKey: 'salkuadrat',
  message: 'This is a very secret message',
});

if (result.isSuccess && result.hasData) {
  // Keep this messageKey to decrypt your message.
  // This messageKey will be randomly generated by BiometricX plugin.
  String messageKey = result.data!;
} else {
  showToast(result.errorMsg, context: context);
}

If you need a persistent messageKey, you can supply it as parameter to encrypt.

BiometricResult result = await BiometricX.encrypt({
  biometricKey: 'salkuadrat',
  messageKey: 'secret_message', // use persistent messageKey
  message: 'This is a very secret message',
});

if (result.isSuccess && result.hasData) {
  // Keep this messageKey to decrypt your message.
  // This will be the same value as messageKey above ('secret_message')
  String messageKey = result.data!;
} else {
  showToast(result.errorMsg, context: context);
}

To decrypt data using biometric authentication.

// Use the same biometricKey that is used to encrypt your message.
// Use messageKey that you get from [BiometricX.encrypt].
BiometricResult result = await BiometricX.decrypt({
  biometricKey: 'salkuadrat',
  messageKey: messageKey,
});

if (result.isSuccess && result.hasData) {
  // This will contains your original message.
  String message = result.data!;
} else {
  showToast(result.errorMsg, context: context);
}

To show custom message in your biometric prompt, method encrypt and decrypt have parameters you can use to change the biometric prompt dialog.

BiometricResult result = await BiometricX.encrypt({
  biometricKey: 'salkuadrat',
  message: 'This is a very secret message',
  title: 'Biometric Encryption',
  subtitle: 'Enter biometric credentials to encrypt your message',
  description: 'Scan fingerprint or face.',
  negativeButtonText: 'USE PASSWORD',
  confirmationRequired: true,
});
BiometricResult message = await BiometricX.decrypt({
  biometricKey: 'salkuadrat',
  messageKey: messageKey,
  title: 'Biometric Decryption',
  subtitle: 'Enter biometric credentials to decrypt your message',
  description: 'Scan fingerprint or face.',
  negativeButtonText: 'USE PASSWORD',
  confirmationRequired: true,
});

Example

Example project.
Demo APK.

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。