monorepo/dialer/lib/features/settings/key/key_storage.dart
Bartosz e8aba933d0
All checks were successful
/ mirror (push) Successful in 4s
Cryptographic Keys and History changes (#8)
Co-authored-by: stcb <21@stcb.cc>
Reviewed-on: icing/G-EIP-700-TLS-7-1-eip-stephane.corbiere#8
Co-authored-by: Bartosz <bartosz.michalak@epitech.eu>
Co-committed-by: Bartosz <bartosz.michalak@epitech.eu>
2024-12-20 09:13:05 +00:00

29 lines
833 B
Dart

// key_storage.dart
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
class KeyStorage {
static const _publicKeyKey = 'public_key';
static const _privateKeyKey = 'private_key';
final FlutterSecureStorage _storage = const FlutterSecureStorage();
Future<void> saveKeys({required String publicKey, required String privateKey}) async {
await _storage.write(key: _publicKeyKey, value: publicKey);
await _storage.write(key: _privateKeyKey, value: privateKey);
}
Future<String?> getPublicKey() async {
return await _storage.read(key: _publicKeyKey);
}
Future<String?> getPrivateKey() async {
return await _storage.read(key: _privateKeyKey);
}
Future<void> deleteKeys() async {
await _storage.delete(key: _publicKeyKey);
await _storage.delete(key: _privateKeyKey);
}
}