moxxy/test/logging.dart

21 lines
541 B
Dart
Raw Normal View History

import 'dart:convert';
2022-02-16 19:38:15 +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() {
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(
utf8.encode('Hallo Welt'),
await deriveKey('abc123'),
nonce: utf8.encode('123456789012'),
);
expect(
HEX.encode(bytes),
'313233343536373839303132423bfd17513c578952bf0cb217aabc9e615c4633883034d013a9',
);
2022-02-16 19:38:15 +00:00
});
}