https://github.com/prongbang/local_auth_crypto
https://github.com/prongbang/local_auth_crypto
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/prongbang/local_auth_crypto
- Owner: prongbang
- License: mit
- Created: 2022-12-09T13:08:29.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-07-23T13:09:09.000Z (about 1 year ago)
- Last Synced: 2025-03-07T20:18:48.947Z (7 months ago)
- Language: Dart
- Size: 411 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# local_auth_crypto
[](https://pub.dartlang.org/packages/local_auth_crypto)
Android and iOS devices to allow Local Authentication + Cryptography via Biometric.

## Features
#### New instance
```dart
final localAuthCrypto = LocalAuthCrypto.instance;
```#### Encrypt
```dart
await localAuthCrypto.encrypt(message);
```### PromptInfo
```dart
BiometricPromptInfo(
title: 'BIOMETRIC',
subtitle: 'Please scan biometric to decrypt',
negativeButton: 'CANCEL',
);
```### Decrypt
```dart
await localAuthCrypto.authenticate(promptInfo, cipherText);
```## Getting started
It is really easy to use! You should ensure that you add the `local_auth_crypto` as a dependency in your flutter project.
```yaml
local_auth_crypto: "^1.1.1"
```## Usage
### Flutter
- Encrypt
```dart
final localAuthCrypto = localAuthCrypto.instance;final message = 'TOKEN';
final cipherText = await localAuthCrypto.encrypt(message);
```- Decrypt
```dart
final localAuthCrypto = localAuthCrypto.instance;final promptInfo = BiometricPromptInfo(
title: 'BIOMETRIC',
subtitle: 'Please scan biometric to decrypt',
negativeButton: 'CANCEL',
);
final plainText = await localAuthCrypto.authenticate(promptInfo, cipherText);
```### Android
- Update code in `MainActivity.kt` file
```kotlin
import io.flutter.embedding.android.FlutterFragmentActivityclass MainActivity : FlutterFragmentActivity()
```- Add use-permissions in `AndroidManifest.xml` file
```xml
```
### iOS
- Add privacy in `info.plist` file
```xml
NSFaceIDUsageDescription
This application wants to access your TouchID or FaceID```