twonly-app/test/model/pqc_upload_proto_test.dart
2026-09-24 14:30:38 +02:00

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);
});
}