dage 0.0.2 dage: ^0.0.2 copied to clipboard
age encryption implementation using Dart. age is a modern file encryption format with multiple pluggable recipients, and seekable streaming encryption.
import 'dart:typed_data';
import 'package:dage/src/file.dart';
import 'package:dage/src/x25519.dart';
void main() async {
// Generate keypair
final keyPair = await X25519AgePlugin.generateKeyPair();
// Encryption
final content = Uint8List.fromList('Hello World'.codeUnits);
final encryptedFile = await AgeFile.encrypt(content, [keyPair.recipient]);
//Decryption
final decrypted = await encryptedFile.decrypt([keyPair]);
assert(String.fromCharCodes(decrypted) == 'Hello World');
}