mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-10-09 02:54:14 +00:00
27 lines
940 B
Dart
27 lines
940 B
Dart
import 'package:fixnum/fixnum.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:twonly/src/model/protobuf/api/websocket/client_to_server.pb.dart';
|
|
|
|
void main() {
|
|
test('PQC upload preserves migration identity fields on the wire', () {
|
|
final request = ApplicationData_UploadPqcPreKeys(
|
|
eccSignedPrekeyId: Int64(11),
|
|
eccSignedPrekey: [5, 6],
|
|
eccSignedPrekeySignature: [7, 8],
|
|
kyberSignedPrekeyId: Int64(12),
|
|
kyberSignedPrekey: [9, 10],
|
|
kyberSignedPrekeySignature: [11, 12],
|
|
publicIdentityKey: List<int>.filled(33, 1),
|
|
registrationId: Int64(42),
|
|
);
|
|
|
|
final decoded = ApplicationData_UploadPqcPreKeys.fromBuffer(
|
|
request.writeToBuffer(),
|
|
);
|
|
|
|
expect(decoded.publicIdentityKey, hasLength(33));
|
|
expect(decoded.registrationId, Int64(42));
|
|
expect(decoded.hasPublicIdentityKey(), isTrue);
|
|
expect(decoded.hasRegistrationId(), isTrue);
|
|
});
|
|
}
|