my_salt 1.2.0 copy "my_salt: ^1.2.0" to clipboard
my_salt: ^1.2.0 copied to clipboard

Authenticated text and binary encryption for Dart with AES-256-GCM, associated data, rotation, and CryptoJS migration.

example/my_salt_example.dart

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!';

  // 1. Encrypt the text.
  final encryptedText = await mySalt.encrypt(originalText, passphrase);

  // 2. Decrypt it with the same passphrase.
  final decryptedText = await mySalt.decrypt(encryptedText, passphrase);

  // 3. Verify without exposing decryption failures.
  final isVerified = await mySalt.verifyAuthenticated(
    text: originalText,
    encrypted: encryptedText,
    passphrase: passphrase,
  );

  print('Encrypted text: $encryptedText');
  print('Decrypted text: $decryptedText');
  print('Verification result: $isVerified');
}
2
likes
160
points
12
downloads
screenshot

Documentation

Documentation
API reference

Publisher

verified publisherwongcoupon.com

Weekly Downloads

Authenticated text and binary encryption for Dart with AES-256-GCM, associated data, rotation, and CryptoJS migration.

Repository (GitHub)
View/report issues

Topics

#aes-gcm #cryptography #encryption #password #security

Funding

Consider supporting this project:

ko-fi.com

License

MIT (license)

Dependencies

crypto, cryptography, encrypt

More

Packages that depend on my_salt