my_salt 1.1.0
my_salt: ^1.1.0 copied to clipboard
Authenticated, passphrase-based encryption for Dart with AES-256-GCM and CryptoJS legacy compatibility.
import 'package:my_salt/my_salt.dart';
Future<void> main() async {
const mySalt = MySalt();
const passphrase = 'use-a-long-random-passphrase';
const originalText = 'Hello, this is a secret message!';
final encryptedText = await mySalt.encrypt(originalText, passphrase);
final decryptedText = await mySalt.decrypt(encryptedText, passphrase);
final isVerified = await mySalt.verifyAuthenticated(
text: originalText,
encrypted: encryptedText,
passphrase: passphrase,
);
print('Encrypted text: $encryptedText');
print('Decrypted text: $decryptedText');
print('Verification result: $isVerified');
}