Buscar pacotes, repositórios e categorias de apps

Detalhes do pacotev0.0.2

biometricx

A maneira fácil de usar autenticação biométrica no seu aplicativo Flutter.

Android
Downloads em 30 dias
145
Curtidas
36
Pontos Pub
150

Instalar pacote

flutter pub add biometricx

Visão geral do pacote

Orientação gerada a partir de informações públicas. Apenas para referência.

BiometricX é um pacote Flutter que simplifica a integração de autenticação biométrica — como reconhecimento de impressão digital ou rosto — em aplicativos Android. Ele fornece uma API simples para verificar a disponibilidade biométrica e autenticar usuários com segurança usando biometria do dispositivo. Projetado para facilitar o uso, ele abstrai implementações complexas específicas da plataforma, permitindo que desenvolvedores implementem autenticação segura com pouquíssimo código. O pacote é compatível apenas com Android e utiliza APIs biométricas nativas para desempenho confiável e segurança.

Casos de uso

  • Login seguro do aplicativo
  • Verificação de identidade do usuário
  • Acesso protegido aos dados
  • Reautenticação de sessão
  • Autenticação de dois fatores

Principais recursos

  • API simples para verificações biométricas
  • Suporte exclusivo para Android
  • Autenticação biométrica segura
  • Tratamento automático de fallback
  • Configuração mínima necessária

Indicado para

  • Aplicativos que exigem autenticação de usuário segura
  • Desenvolvedores procurando integração biométrica rápida
  • Projetos focados na segurança do Android
  • Aplicativos móveis com dados sensíveis
  • Protótipos que precisam de testes biométricos rápidos

Considerações

  • Limitado a plataformas Android
  • Requer hardware biométrico do dispositivo
  • Sem suporte para iOS
  • Depende da compatibilidade da versão do Android SDK
  • Necessita de tratamento adequado de permissões no manifesto

README original

Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.

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.

Categorias

Repositório-fonte

Projetos que usam este pacote

Ainda não há dados.