2022-07-17 12:55:16 +00:00
|
|
|
import 'dart:convert';
|
2022-02-16 19:38:15 +00:00
|
|
|
|
2022-07-17 12:55:16 +00:00
|
|
|
import 'package:hex/hex.dart';
|
|
|
|
import 'package:moxxyv2/shared/logging.dart';
|
|
|
|
import 'package:test/test.dart';
|
2022-02-16 19:38:15 +00:00
|
|
|
|
|
|
|
void main() {
|
2022-07-17 12:55:16 +00:00
|
|
|
test('Test encryption', () async {
|
2023-03-06 04:49:10 +00:00
|
|
|
// Simple test vector verified with the monal UDP log server
|
|
|
|
final bytes = await encryptData(
|
2023-03-21 15:32:34 +00:00
|
|
|
utf8.encode('Hallo Welt'),
|
|
|
|
await deriveKey('abc123'),
|
|
|
|
nonce: utf8.encode('123456789012'),
|
|
|
|
);
|
|
|
|
expect(
|
|
|
|
HEX.encode(bytes),
|
|
|
|
'313233343536373839303132423bfd17513c578952bf0cb217aabc9e615c4633883034d013a9',
|
|
|
|
);
|
2022-02-16 19:38:15 +00:00
|
|
|
});
|
|
|
|
}
|