encriptation
encriptation
encriptation is a Flutter/Dart library to securely store and retrieve data using Hive and AES encryption. It works on Android, iOS, Web, Linux, and Windows.
Features
- Secure storage with AES encryption
- Easy API for saving, reading, and deleting values
- Works on all Flutter platforms
Installation
Add the package to your pubspec.yaml:
dependencies:
encriptation: ^0.0.1
Then run:
flutter pub get
Configuration
- Create a
.envfile in your project root (or in theexample/folder if using the example):
ENCRIPTATION_KEY=12345678901234567890123456789012
- Add the
.envfile to theassetssection of yourpubspec.yaml:
flutter:
uses-material-design: true
assets:
- .env
Basic Usage
import 'package:encriptation/encriptation.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
void main() async {
await dotenv.load(fileName: '.env');
final secureStorage = SecureStorage(dotenv.env['ENCRIPTATION_KEY']!);
// Save an encrypted value
await secureStorage.saveString('key', 'value', encryptValue: true);
// Read the decrypted value
final value = await secureStorage.readString('key', encryptedValue: true);
print(value); // 'value'
}
Store and Read Multiple Values
// Store multiple values
await secureStorage.saveString('key1', 'value1', encryptValue: true);
await secureStorage.saveString('key2', 'value2', encryptValue: true);
// Read multiple values
final v1 = await secureStorage.readString('key1', encryptedValue: true);
final v2 = await secureStorage.readString('key2', encryptedValue: true);
Delete a Value
await SecureStorage.deleteKey('key1');
Example App
See the example/ folder for a complete Flutter app using this library.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contributors
![]() Junior García github.com/Juniorwebprogrammer |
