From 6a711431aaa1a468303aa7160d83cba03e09dc39 Mon Sep 17 00:00:00 2001 From: otsmr Date: Sat, 29 Aug 2026 16:27:36 +0200 Subject: [PATCH] remove unused proto from dart --- lib/core/api/api_helper.dart | 42 - lib/core/api/operations.dart | 42 - .../api/proto/client/encrypted_content.dart | 32 - .../handshake/initial_pqc_keys.dart | 42 - .../api/proto/client_to_server/response.dart | 28 - .../api/proto/server_to_client/response.dart | 296 ------ lib/core/app_database.dart | 103 -- lib/core/backup/backup_password.dart | 29 - lib/core/bridge/api.freezed.dart | 888 ------------------ lib/core/bridge/callbacks/user_discovery.dart | 173 ---- lib/core/context.dart | 28 - .../protobuf/client/generated/groups.pb.dart | 261 ----- .../client/generated/groups.pbenum.dart | 35 - .../client/generated/groups.pbjson.dart | 100 -- .../client/generated/groups.pbserver.dart | 13 - .../client/generated/http_requests.pb.dart | 741 --------------- .../generated/http_requests.pbjson.dart | 229 ----- .../client/generated/messages.pb.dart | 559 ----------- .../client/generated/messages.pbenum.dart | 54 -- .../client/generated/messages.pbjson.dart | 193 ---- .../generated/push_notification.pb.dart | 418 --------- .../generated/push_notification.pbenum.dart | 77 -- .../generated/push_notification.pbjson.dart | 173 ---- .../generated/push_notification.pbserver.dart | 13 - .../model/protobuf/client/http_requests.proto | 56 -- .../protobuf/client/push_notification.proto | 52 - lib/src/services/api/utils.api.dart | 3 +- .../background.notifications.dart | 224 ----- .../entries/chat_media_entry.dart | 3 +- rust/build.rs | 20 +- .../src/api/proto}/client/data.proto | 0 .../src/api/proto}/client/groups.proto | 2 +- .../src/api/proto}/client/messages.proto | 89 -- rust/src/api/proto/client/sealed_sender.proto | 90 ++ test/mocks/test_client.dart | 209 +---- test/mocks/workmanager.dart | 29 - test/services/api_and_c2c_test.dart | 242 ----- 37 files changed, 105 insertions(+), 5483 deletions(-) delete mode 100644 lib/core/api/api_helper.dart delete mode 100644 lib/core/api/operations.dart delete mode 100644 lib/core/api/proto/client/encrypted_content.dart delete mode 100644 lib/core/api/proto/client_to_server/handshake/initial_pqc_keys.dart delete mode 100644 lib/core/api/proto/client_to_server/response.dart delete mode 100644 lib/core/api/proto/server_to_client/response.dart delete mode 100644 lib/core/app_database.dart delete mode 100644 lib/core/backup/backup_password.dart delete mode 100644 lib/core/bridge/api.freezed.dart delete mode 100644 lib/core/bridge/callbacks/user_discovery.dart delete mode 100644 lib/core/context.dart delete mode 100644 lib/src/model/protobuf/client/generated/groups.pb.dart delete mode 100644 lib/src/model/protobuf/client/generated/groups.pbenum.dart delete mode 100644 lib/src/model/protobuf/client/generated/groups.pbjson.dart delete mode 100644 lib/src/model/protobuf/client/generated/groups.pbserver.dart delete mode 100644 lib/src/model/protobuf/client/generated/push_notification.pb.dart delete mode 100644 lib/src/model/protobuf/client/generated/push_notification.pbenum.dart delete mode 100644 lib/src/model/protobuf/client/generated/push_notification.pbjson.dart delete mode 100644 lib/src/model/protobuf/client/generated/push_notification.pbserver.dart delete mode 100644 lib/src/model/protobuf/client/push_notification.proto rename {lib/src/model/protobuf => rust/src/api/proto}/client/data.proto (100%) rename {lib/src/model/protobuf => rust/src/api/proto}/client/groups.proto (99%) rename {lib/src/model/protobuf => rust/src/api/proto}/client/messages.proto (64%) create mode 100644 rust/src/api/proto/client/sealed_sender.proto delete mode 100644 test/mocks/workmanager.dart delete mode 100644 test/services/api_and_c2c_test.dart diff --git a/lib/core/api/api_helper.dart b/lib/core/api/api_helper.dart deleted file mode 100644 index 9d30b052..00000000 --- a/lib/core/api/api_helper.dart +++ /dev/null @@ -1,42 +0,0 @@ -// This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.12.0. - -// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import - -import '../frb_generated.dart'; -import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; - -class PqcPreKeyInput { - final PlatformInt64 eccPreKeyId; - final Uint8List eccPreKey; - final PlatformInt64 kyberPreKeyId; - final Uint8List kyberPreKey; - final Uint8List kyberPreKeySignature; - - const PqcPreKeyInput({ - required this.eccPreKeyId, - required this.eccPreKey, - required this.kyberPreKeyId, - required this.kyberPreKey, - required this.kyberPreKeySignature, - }); - - @override - int get hashCode => - eccPreKeyId.hashCode ^ - eccPreKey.hashCode ^ - kyberPreKeyId.hashCode ^ - kyberPreKey.hashCode ^ - kyberPreKeySignature.hashCode; - - @override - bool operator ==(Object other) => - identical(this, other) || - other is PqcPreKeyInput && - runtimeType == other.runtimeType && - eccPreKeyId == other.eccPreKeyId && - eccPreKey == other.eccPreKey && - kyberPreKeyId == other.kyberPreKeyId && - kyberPreKey == other.kyberPreKey && - kyberPreKeySignature == other.kyberPreKeySignature; -} diff --git a/lib/core/api/operations.dart b/lib/core/api/operations.dart deleted file mode 100644 index 9d30b052..00000000 --- a/lib/core/api/operations.dart +++ /dev/null @@ -1,42 +0,0 @@ -// This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.12.0. - -// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import - -import '../frb_generated.dart'; -import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; - -class PqcPreKeyInput { - final PlatformInt64 eccPreKeyId; - final Uint8List eccPreKey; - final PlatformInt64 kyberPreKeyId; - final Uint8List kyberPreKey; - final Uint8List kyberPreKeySignature; - - const PqcPreKeyInput({ - required this.eccPreKeyId, - required this.eccPreKey, - required this.kyberPreKeyId, - required this.kyberPreKey, - required this.kyberPreKeySignature, - }); - - @override - int get hashCode => - eccPreKeyId.hashCode ^ - eccPreKey.hashCode ^ - kyberPreKeyId.hashCode ^ - kyberPreKey.hashCode ^ - kyberPreKeySignature.hashCode; - - @override - bool operator ==(Object other) => - identical(this, other) || - other is PqcPreKeyInput && - runtimeType == other.runtimeType && - eccPreKeyId == other.eccPreKeyId && - eccPreKey == other.eccPreKey && - kyberPreKeyId == other.kyberPreKeyId && - kyberPreKey == other.kyberPreKey && - kyberPreKeySignature == other.kyberPreKeySignature; -} diff --git a/lib/core/api/proto/client/encrypted_content.dart b/lib/core/api/proto/client/encrypted_content.dart deleted file mode 100644 index 8d69d722..00000000 --- a/lib/core/api/proto/client/encrypted_content.dart +++ /dev/null @@ -1,32 +0,0 @@ -// This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.12.0. - -// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import - -import '../../../frb_generated.dart'; -import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; - -class PasswordLessRecovery { - final Uint8List? recoverySecretShare; - final bool delete; - final PlatformInt64 threshold; - - const PasswordLessRecovery({ - this.recoverySecretShare, - required this.delete, - required this.threshold, - }); - - @override - int get hashCode => - recoverySecretShare.hashCode ^ delete.hashCode ^ threshold.hashCode; - - @override - bool operator ==(Object other) => - identical(this, other) || - other is PasswordLessRecovery && - runtimeType == other.runtimeType && - recoverySecretShare == other.recoverySecretShare && - delete == other.delete && - threshold == other.threshold; -} diff --git a/lib/core/api/proto/client_to_server/handshake/initial_pqc_keys.dart b/lib/core/api/proto/client_to_server/handshake/initial_pqc_keys.dart deleted file mode 100644 index 2936eba9..00000000 --- a/lib/core/api/proto/client_to_server/handshake/initial_pqc_keys.dart +++ /dev/null @@ -1,42 +0,0 @@ -// This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.12.0. - -// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import - -import '../../../../frb_generated.dart'; -import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; - -class PqcPreKey { - final PlatformInt64 eccPreKeyId; - final Uint8List eccPreKey; - final PlatformInt64 kyberPreKeyId; - final Uint8List kyberPreKey; - final Uint8List kyberPreKeySignature; - - const PqcPreKey({ - required this.eccPreKeyId, - required this.eccPreKey, - required this.kyberPreKeyId, - required this.kyberPreKey, - required this.kyberPreKeySignature, - }); - - @override - int get hashCode => - eccPreKeyId.hashCode ^ - eccPreKey.hashCode ^ - kyberPreKeyId.hashCode ^ - kyberPreKey.hashCode ^ - kyberPreKeySignature.hashCode; - - @override - bool operator ==(Object other) => - identical(this, other) || - other is PqcPreKey && - runtimeType == other.runtimeType && - eccPreKeyId == other.eccPreKeyId && - eccPreKey == other.eccPreKey && - kyberPreKeyId == other.kyberPreKeyId && - kyberPreKey == other.kyberPreKey && - kyberPreKeySignature == other.kyberPreKeySignature; -} diff --git a/lib/core/api/proto/client_to_server/response.dart b/lib/core/api/proto/client_to_server/response.dart deleted file mode 100644 index ff844a8f..00000000 --- a/lib/core/api/proto/client_to_server/response.dart +++ /dev/null @@ -1,28 +0,0 @@ -// This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.12.0. - -// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import - -import '../../../frb_generated.dart'; -import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; - -class PreKey { - final PlatformInt64 id; - final Uint8List prekey; - - const PreKey({ - required this.id, - required this.prekey, - }); - - @override - int get hashCode => id.hashCode ^ prekey.hashCode; - - @override - bool operator ==(Object other) => - identical(this, other) || - other is PreKey && - runtimeType == other.runtimeType && - id == other.id && - prekey == other.prekey; -} diff --git a/lib/core/api/proto/server_to_client/response.dart b/lib/core/api/proto/server_to_client/response.dart deleted file mode 100644 index 97eb4795..00000000 --- a/lib/core/api/proto/server_to_client/response.dart +++ /dev/null @@ -1,296 +0,0 @@ -// This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.12.0. - -// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import - -import '../../../frb_generated.dart'; -import '../client_to_server/handshake/initial_pqc_keys.dart'; -import '../client_to_server/response.dart'; -import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; - -class AdditionalAccount { - final PlatformInt64 userId; - final String planId; - - const AdditionalAccount({ - required this.userId, - required this.planId, - }); - - @override - int get hashCode => userId.hashCode ^ planId.hashCode; - - @override - bool operator ==(Object other) => - identical(this, other) || - other is AdditionalAccount && - runtimeType == other.runtimeType && - userId == other.userId && - planId == other.planId; -} - -class MemoriesUploadUrls { - final String mediaId; - final PresignedPost? thumbnailUpload; - final PresignedPost? fullUpload; - - const MemoriesUploadUrls({ - required this.mediaId, - this.thumbnailUpload, - this.fullUpload, - }); - - @override - int get hashCode => - mediaId.hashCode ^ thumbnailUpload.hashCode ^ fullUpload.hashCode; - - @override - bool operator ==(Object other) => - identical(this, other) || - other is MemoriesUploadUrls && - runtimeType == other.runtimeType && - mediaId == other.mediaId && - thumbnailUpload == other.thumbnailUpload && - fullUpload == other.fullUpload; -} - -class MemoriesUsage { - final PlatformInt64 maxBytes; - final PlatformInt64 currentBytes; - final PlatformInt64 count; - - const MemoriesUsage({ - required this.maxBytes, - required this.currentBytes, - required this.count, - }); - - @override - int get hashCode => - maxBytes.hashCode ^ currentBytes.hashCode ^ count.hashCode; - - @override - bool operator ==(Object other) => - identical(this, other) || - other is MemoriesUsage && - runtimeType == other.runtimeType && - maxBytes == other.maxBytes && - currentBytes == other.currentBytes && - count == other.count; -} - -class PasswordlessNotificationMessage { - final PlatformInt64 id; - final Uint8List encryptedMessage; - - const PasswordlessNotificationMessage({ - required this.id, - required this.encryptedMessage, - }); - - @override - int get hashCode => id.hashCode ^ encryptedMessage.hashCode; - - @override - bool operator ==(Object other) => - identical(this, other) || - other is PasswordlessNotificationMessage && - runtimeType == other.runtimeType && - id == other.id && - encryptedMessage == other.encryptedMessage; -} - -class PlanBallance { - final PlatformInt64 usedDailyMediaUploadLimit; - final PlatformInt64 usedUploadMediaSizeLimit; - final PlatformInt64? paymentPeriodDays; - final PlatformInt64? lastPaymentDoneUnixTimestamp; - final List transactions; - final List additionalAccounts; - final bool? autoRenewal; - final PlatformInt64? additionalAccountOwnerId; - - const PlanBallance({ - required this.usedDailyMediaUploadLimit, - required this.usedUploadMediaSizeLimit, - this.paymentPeriodDays, - this.lastPaymentDoneUnixTimestamp, - required this.transactions, - required this.additionalAccounts, - this.autoRenewal, - this.additionalAccountOwnerId, - }); - - @override - int get hashCode => - usedDailyMediaUploadLimit.hashCode ^ - usedUploadMediaSizeLimit.hashCode ^ - paymentPeriodDays.hashCode ^ - lastPaymentDoneUnixTimestamp.hashCode ^ - transactions.hashCode ^ - additionalAccounts.hashCode ^ - autoRenewal.hashCode ^ - additionalAccountOwnerId.hashCode; - - @override - bool operator ==(Object other) => - identical(this, other) || - other is PlanBallance && - runtimeType == other.runtimeType && - usedDailyMediaUploadLimit == other.usedDailyMediaUploadLimit && - usedUploadMediaSizeLimit == other.usedUploadMediaSizeLimit && - paymentPeriodDays == other.paymentPeriodDays && - lastPaymentDoneUnixTimestamp == other.lastPaymentDoneUnixTimestamp && - transactions == other.transactions && - additionalAccounts == other.additionalAccounts && - autoRenewal == other.autoRenewal && - additionalAccountOwnerId == other.additionalAccountOwnerId; -} - -class PqcBundle { - final PlatformInt64 eccSignedPrekeyId; - final Uint8List eccSignedPrekey; - final Uint8List eccSignedPrekeySignature; - final PlatformInt64 kyberSignedPrekeyId; - final Uint8List kyberSignedPrekey; - final Uint8List kyberSignedPrekeySignature; - final PqcPreKey? prekey; - - const PqcBundle({ - required this.eccSignedPrekeyId, - required this.eccSignedPrekey, - required this.eccSignedPrekeySignature, - required this.kyberSignedPrekeyId, - required this.kyberSignedPrekey, - required this.kyberSignedPrekeySignature, - this.prekey, - }); - - @override - int get hashCode => - eccSignedPrekeyId.hashCode ^ - eccSignedPrekey.hashCode ^ - eccSignedPrekeySignature.hashCode ^ - kyberSignedPrekeyId.hashCode ^ - kyberSignedPrekey.hashCode ^ - kyberSignedPrekeySignature.hashCode ^ - prekey.hashCode; - - @override - bool operator ==(Object other) => - identical(this, other) || - other is PqcBundle && - runtimeType == other.runtimeType && - eccSignedPrekeyId == other.eccSignedPrekeyId && - eccSignedPrekey == other.eccSignedPrekey && - eccSignedPrekeySignature == other.eccSignedPrekeySignature && - kyberSignedPrekeyId == other.kyberSignedPrekeyId && - kyberSignedPrekey == other.kyberSignedPrekey && - kyberSignedPrekeySignature == other.kyberSignedPrekeySignature && - prekey == other.prekey; -} - -class PresignedPost { - final String url; - final Map fields; - - const PresignedPost({ - required this.url, - required this.fields, - }); - - @override - int get hashCode => url.hashCode ^ fields.hashCode; - - @override - bool operator ==(Object other) => - identical(this, other) || - other is PresignedPost && - runtimeType == other.runtimeType && - url == other.url && - fields == other.fields; -} - -class ProofOfWork { - final String prefix; - final PlatformInt64 difficulty; - - const ProofOfWork({ - required this.prefix, - required this.difficulty, - }); - - @override - int get hashCode => prefix.hashCode ^ difficulty.hashCode; - - @override - bool operator ==(Object other) => - identical(this, other) || - other is ProofOfWork && - runtimeType == other.runtimeType && - prefix == other.prefix && - difficulty == other.difficulty; -} - -class Transaction { - const Transaction(); - - @override - int get hashCode => 0; - - @override - bool operator ==(Object other) => - identical(this, other) || - other is Transaction && runtimeType == other.runtimeType; -} - -class UserData { - final PlatformInt64 userId; - final List prekeys; - final Uint8List? username; - final Uint8List? publicIdentityKey; - final Uint8List? signedPrekey; - final Uint8List? signedPrekeySignature; - final PlatformInt64? signedPrekeyId; - final PlatformInt64? registrationId; - final PqcBundle? pqcBundle; - - const UserData({ - required this.userId, - required this.prekeys, - this.username, - this.publicIdentityKey, - this.signedPrekey, - this.signedPrekeySignature, - this.signedPrekeyId, - this.registrationId, - this.pqcBundle, - }); - - @override - int get hashCode => - userId.hashCode ^ - prekeys.hashCode ^ - username.hashCode ^ - publicIdentityKey.hashCode ^ - signedPrekey.hashCode ^ - signedPrekeySignature.hashCode ^ - signedPrekeyId.hashCode ^ - registrationId.hashCode ^ - pqcBundle.hashCode; - - @override - bool operator ==(Object other) => - identical(this, other) || - other is UserData && - runtimeType == other.runtimeType && - userId == other.userId && - prekeys == other.prekeys && - username == other.username && - publicIdentityKey == other.publicIdentityKey && - signedPrekey == other.signedPrekey && - signedPrekeySignature == other.signedPrekeySignature && - signedPrekeyId == other.signedPrekeyId && - registrationId == other.registrationId && - pqcBundle == other.pqcBundle; -} diff --git a/lib/core/app_database.dart b/lib/core/app_database.dart deleted file mode 100644 index f3596554..00000000 --- a/lib/core/app_database.dart +++ /dev/null @@ -1,103 +0,0 @@ -// This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.12.0. - -// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import - -import 'frb_generated.dart'; -import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; - -class SqlExecutionResult { - final PlatformInt64 affectedRows; - final PlatformInt64 lastInsertRowId; - - const SqlExecutionResult({ - required this.affectedRows, - required this.lastInsertRowId, - }); - - @override - int get hashCode => affectedRows.hashCode ^ lastInsertRowId.hashCode; - - @override - bool operator ==(Object other) => - identical(this, other) || - other is SqlExecutionResult && - runtimeType == other.runtimeType && - affectedRows == other.affectedRows && - lastInsertRowId == other.lastInsertRowId; -} - -class SqlRow { - final List values; - - const SqlRow({ - required this.values, - }); - - @override - int get hashCode => values.hashCode; - - @override - bool operator ==(Object other) => - identical(this, other) || - other is SqlRow && - runtimeType == other.runtimeType && - values == other.values; -} - -class SqlRows { - final List columns; - final List rows; - - const SqlRows({ - required this.columns, - required this.rows, - }); - - @override - int get hashCode => columns.hashCode ^ rows.hashCode; - - @override - bool operator ==(Object other) => - identical(this, other) || - other is SqlRows && - runtimeType == other.runtimeType && - columns == other.columns && - rows == other.rows; -} - -class SqlValue { - /// 0 = null, 1 = integer, 2 = real, 3 = text, 4 = blob. - final int kind; - final PlatformInt64? integerValue; - final double? realValue; - final String? textValue; - final Uint8List? blobValue; - - const SqlValue({ - required this.kind, - this.integerValue, - this.realValue, - this.textValue, - this.blobValue, - }); - - @override - int get hashCode => - kind.hashCode ^ - integerValue.hashCode ^ - realValue.hashCode ^ - textValue.hashCode ^ - blobValue.hashCode; - - @override - bool operator ==(Object other) => - identical(this, other) || - other is SqlValue && - runtimeType == other.runtimeType && - kind == other.kind && - integerValue == other.integerValue && - realValue == other.realValue && - textValue == other.textValue && - blobValue == other.blobValue; -} diff --git a/lib/core/backup/backup_password.dart b/lib/core/backup/backup_password.dart deleted file mode 100644 index eacdead5..00000000 --- a/lib/core/backup/backup_password.dart +++ /dev/null @@ -1,29 +0,0 @@ -// This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.12.0. - -// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import - -import '../frb_generated.dart'; -import '../lib.dart'; -import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; - -class BackupPasswordKeys { - final U8Array32 backupId; - final U8Array32 encryptionKey; - - const BackupPasswordKeys({ - required this.backupId, - required this.encryptionKey, - }); - - @override - int get hashCode => backupId.hashCode ^ encryptionKey.hashCode; - - @override - bool operator ==(Object other) => - identical(this, other) || - other is BackupPasswordKeys && - runtimeType == other.runtimeType && - backupId == other.backupId && - encryptionKey == other.encryptionKey; -} diff --git a/lib/core/bridge/api.freezed.dart b/lib/core/bridge/api.freezed.dart deleted file mode 100644 index 609b5bd3..00000000 --- a/lib/core/bridge/api.freezed.dart +++ /dev/null @@ -1,888 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND -// coverage:ignore-file -// ignore_for_file: type=lint, type=warning, deprecated_member_use, deprecated_member_use_from_same_package -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'api.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// GENERATED CODE - DO NOT MODIFY BY HAND -// dart format off -T _$identity(T value) => value; -/// @nodoc -mixin _$ServerResultEmpty { - - - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is ServerResultEmpty); -} - - -@override -int get hashCode => runtimeType.hashCode; - -@override -String toString() { - return 'ServerResultEmpty()'; -} - - -} - -/// @nodoc -class $ServerResultEmptyCopyWith<$Res> { -$ServerResultEmptyCopyWith(ServerResultEmpty _, $Res Function(ServerResultEmpty) __); -} - - -/// Adds pattern-matching-related methods to [ServerResultEmpty]. -extension ServerResultEmptyPatterns on ServerResultEmpty { -/// A variant of `map` that fallback to returning `orElse`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeMap({TResult Function( ServerResultEmpty_Ok value)? ok,TResult Function( ServerResultEmpty_ErrorCode value)? errorCode,required TResult orElse(),}){ -final _that = this; -switch (_that) { -case ServerResultEmpty_Ok() when ok != null: -return ok(_that);case ServerResultEmpty_ErrorCode() when errorCode != null: -return errorCode(_that);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// Callbacks receives the raw object, upcasted. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case final Subclass2 value: -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult map({required TResult Function( ServerResultEmpty_Ok value) ok,required TResult Function( ServerResultEmpty_ErrorCode value) errorCode,}){ -final _that = this; -switch (_that) { -case ServerResultEmpty_Ok(): -return ok(_that);case ServerResultEmpty_ErrorCode(): -return errorCode(_that);} -} -/// A variant of `map` that fallback to returning `null`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? mapOrNull({TResult? Function( ServerResultEmpty_Ok value)? ok,TResult? Function( ServerResultEmpty_ErrorCode value)? errorCode,}){ -final _that = this; -switch (_that) { -case ServerResultEmpty_Ok() when ok != null: -return ok(_that);case ServerResultEmpty_ErrorCode() when errorCode != null: -return errorCode(_that);case _: - return null; - -} -} -/// A variant of `when` that fallback to an `orElse` callback. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeWhen({TResult Function()? ok,TResult Function( int field0)? errorCode,required TResult orElse(),}) {final _that = this; -switch (_that) { -case ServerResultEmpty_Ok() when ok != null: -return ok();case ServerResultEmpty_ErrorCode() when errorCode != null: -return errorCode(_that.field0);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// As opposed to `map`, this offers destructuring. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case Subclass2(:final field2): -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult when({required TResult Function() ok,required TResult Function( int field0) errorCode,}) {final _that = this; -switch (_that) { -case ServerResultEmpty_Ok(): -return ok();case ServerResultEmpty_ErrorCode(): -return errorCode(_that.field0);} -} -/// A variant of `when` that fallback to returning `null` -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? whenOrNull({TResult? Function()? ok,TResult? Function( int field0)? errorCode,}) {final _that = this; -switch (_that) { -case ServerResultEmpty_Ok() when ok != null: -return ok();case ServerResultEmpty_ErrorCode() when errorCode != null: -return errorCode(_that.field0);case _: - return null; - -} -} - -} - -/// @nodoc - - -class ServerResultEmpty_Ok extends ServerResultEmpty { - const ServerResultEmpty_Ok(): super._(); - - - - - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is ServerResultEmpty_Ok); -} - - -@override -int get hashCode => runtimeType.hashCode; - -@override -String toString() { - return 'ServerResultEmpty.ok()'; -} - - -} - - - - -/// @nodoc - - -class ServerResultEmpty_ErrorCode extends ServerResultEmpty { - const ServerResultEmpty_ErrorCode(this.field0): super._(); - - - final int field0; - -/// Create a copy of ServerResultEmpty -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$ServerResultEmpty_ErrorCodeCopyWith get copyWith => _$ServerResultEmpty_ErrorCodeCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is ServerResultEmpty_ErrorCode&&(identical(other.field0, field0) || other.field0 == field0)); -} - - -@override -int get hashCode => Object.hash(runtimeType,field0); - -@override -String toString() { - return 'ServerResultEmpty.errorCode(field0: $field0)'; -} - - -} - -/// @nodoc -abstract mixin class $ServerResultEmpty_ErrorCodeCopyWith<$Res> implements $ServerResultEmptyCopyWith<$Res> { - factory $ServerResultEmpty_ErrorCodeCopyWith(ServerResultEmpty_ErrorCode value, $Res Function(ServerResultEmpty_ErrorCode) _then) = _$ServerResultEmpty_ErrorCodeCopyWithImpl; -@useResult -$Res call({ - int field0 -}); - - - - -} -/// @nodoc -class _$ServerResultEmpty_ErrorCodeCopyWithImpl<$Res> - implements $ServerResultEmpty_ErrorCodeCopyWith<$Res> { - _$ServerResultEmpty_ErrorCodeCopyWithImpl(this._self, this._then); - - final ServerResultEmpty_ErrorCode _self; - final $Res Function(ServerResultEmpty_ErrorCode) _then; - -/// Create a copy of ServerResultEmpty -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? field0 = null,}) { - return _then(ServerResultEmpty_ErrorCode( -null == field0 ? _self.field0 : field0 // ignore: cast_nullable_to_non_nullable -as int, - )); -} - - -} - -/// @nodoc -mixin _$ServerResultI64 { - - int get field0; -/// Create a copy of ServerResultI64 -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$ServerResultI64CopyWith get copyWith => _$ServerResultI64CopyWithImpl(this as ServerResultI64, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is ServerResultI64&&(identical(other.field0, field0) || other.field0 == field0)); -} - - -@override -int get hashCode => Object.hash(runtimeType,field0); - -@override -String toString() { - return 'ServerResultI64(field0: $field0)'; -} - - -} - -/// @nodoc -abstract mixin class $ServerResultI64CopyWith<$Res> { - factory $ServerResultI64CopyWith(ServerResultI64 value, $Res Function(ServerResultI64) _then) = _$ServerResultI64CopyWithImpl; -@useResult -$Res call({ - int field0 -}); - - - - -} -/// @nodoc -class _$ServerResultI64CopyWithImpl<$Res> - implements $ServerResultI64CopyWith<$Res> { - _$ServerResultI64CopyWithImpl(this._self, this._then); - - final ServerResultI64 _self; - final $Res Function(ServerResultI64) _then; - -/// Create a copy of ServerResultI64 -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? field0 = null,}) { - return _then(_self.copyWith( -field0: null == field0 ? _self.field0 : field0 // ignore: cast_nullable_to_non_nullable -as int, - )); -} - -} - - -/// Adds pattern-matching-related methods to [ServerResultI64]. -extension ServerResultI64Patterns on ServerResultI64 { -/// A variant of `map` that fallback to returning `orElse`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeMap({TResult Function( ServerResultI64_Ok value)? ok,TResult Function( ServerResultI64_ErrorCode value)? errorCode,required TResult orElse(),}){ -final _that = this; -switch (_that) { -case ServerResultI64_Ok() when ok != null: -return ok(_that);case ServerResultI64_ErrorCode() when errorCode != null: -return errorCode(_that);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// Callbacks receives the raw object, upcasted. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case final Subclass2 value: -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult map({required TResult Function( ServerResultI64_Ok value) ok,required TResult Function( ServerResultI64_ErrorCode value) errorCode,}){ -final _that = this; -switch (_that) { -case ServerResultI64_Ok(): -return ok(_that);case ServerResultI64_ErrorCode(): -return errorCode(_that);} -} -/// A variant of `map` that fallback to returning `null`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? mapOrNull({TResult? Function( ServerResultI64_Ok value)? ok,TResult? Function( ServerResultI64_ErrorCode value)? errorCode,}){ -final _that = this; -switch (_that) { -case ServerResultI64_Ok() when ok != null: -return ok(_that);case ServerResultI64_ErrorCode() when errorCode != null: -return errorCode(_that);case _: - return null; - -} -} -/// A variant of `when` that fallback to an `orElse` callback. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeWhen({TResult Function( PlatformInt64 field0)? ok,TResult Function( int field0)? errorCode,required TResult orElse(),}) {final _that = this; -switch (_that) { -case ServerResultI64_Ok() when ok != null: -return ok(_that.field0);case ServerResultI64_ErrorCode() when errorCode != null: -return errorCode(_that.field0);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// As opposed to `map`, this offers destructuring. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case Subclass2(:final field2): -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult when({required TResult Function( PlatformInt64 field0) ok,required TResult Function( int field0) errorCode,}) {final _that = this; -switch (_that) { -case ServerResultI64_Ok(): -return ok(_that.field0);case ServerResultI64_ErrorCode(): -return errorCode(_that.field0);} -} -/// A variant of `when` that fallback to returning `null` -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? whenOrNull({TResult? Function( PlatformInt64 field0)? ok,TResult? Function( int field0)? errorCode,}) {final _that = this; -switch (_that) { -case ServerResultI64_Ok() when ok != null: -return ok(_that.field0);case ServerResultI64_ErrorCode() when errorCode != null: -return errorCode(_that.field0);case _: - return null; - -} -} - -} - -/// @nodoc - - -class ServerResultI64_Ok extends ServerResultI64 { - const ServerResultI64_Ok(this.field0): super._(); - - -@override final PlatformInt64 field0; - -/// Create a copy of ServerResultI64 -/// with the given fields replaced by the non-null parameter values. -@override @JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$ServerResultI64_OkCopyWith get copyWith => _$ServerResultI64_OkCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is ServerResultI64_Ok&&(identical(other.field0, field0) || other.field0 == field0)); -} - - -@override -int get hashCode => Object.hash(runtimeType,field0); - -@override -String toString() { - return 'ServerResultI64.ok(field0: $field0)'; -} - - -} - -/// @nodoc -abstract mixin class $ServerResultI64_OkCopyWith<$Res> implements $ServerResultI64CopyWith<$Res> { - factory $ServerResultI64_OkCopyWith(ServerResultI64_Ok value, $Res Function(ServerResultI64_Ok) _then) = _$ServerResultI64_OkCopyWithImpl; -@override @useResult -$Res call({ - PlatformInt64 field0 -}); - - - - -} -/// @nodoc -class _$ServerResultI64_OkCopyWithImpl<$Res> - implements $ServerResultI64_OkCopyWith<$Res> { - _$ServerResultI64_OkCopyWithImpl(this._self, this._then); - - final ServerResultI64_Ok _self; - final $Res Function(ServerResultI64_Ok) _then; - -/// Create a copy of ServerResultI64 -/// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? field0 = null,}) { - return _then(ServerResultI64_Ok( -null == field0 ? _self.field0 : field0 // ignore: cast_nullable_to_non_nullable -as PlatformInt64, - )); -} - - -} - -/// @nodoc - - -class ServerResultI64_ErrorCode extends ServerResultI64 { - const ServerResultI64_ErrorCode(this.field0): super._(); - - -@override final int field0; - -/// Create a copy of ServerResultI64 -/// with the given fields replaced by the non-null parameter values. -@override @JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$ServerResultI64_ErrorCodeCopyWith get copyWith => _$ServerResultI64_ErrorCodeCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is ServerResultI64_ErrorCode&&(identical(other.field0, field0) || other.field0 == field0)); -} - - -@override -int get hashCode => Object.hash(runtimeType,field0); - -@override -String toString() { - return 'ServerResultI64.errorCode(field0: $field0)'; -} - - -} - -/// @nodoc -abstract mixin class $ServerResultI64_ErrorCodeCopyWith<$Res> implements $ServerResultI64CopyWith<$Res> { - factory $ServerResultI64_ErrorCodeCopyWith(ServerResultI64_ErrorCode value, $Res Function(ServerResultI64_ErrorCode) _then) = _$ServerResultI64_ErrorCodeCopyWithImpl; -@override @useResult -$Res call({ - int field0 -}); - - - - -} -/// @nodoc -class _$ServerResultI64_ErrorCodeCopyWithImpl<$Res> - implements $ServerResultI64_ErrorCodeCopyWith<$Res> { - _$ServerResultI64_ErrorCodeCopyWithImpl(this._self, this._then); - - final ServerResultI64_ErrorCode _self; - final $Res Function(ServerResultI64_ErrorCode) _then; - -/// Create a copy of ServerResultI64 -/// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? field0 = null,}) { - return _then(ServerResultI64_ErrorCode( -null == field0 ? _self.field0 : field0 // ignore: cast_nullable_to_non_nullable -as int, - )); -} - - -} - -/// @nodoc -mixin _$ServerResultVecU8 { - - Object get field0; - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is ServerResultVecU8&&const DeepCollectionEquality().equals(other.field0, field0)); -} - - -@override -int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(field0)); - -@override -String toString() { - return 'ServerResultVecU8(field0: $field0)'; -} - - -} - -/// @nodoc -class $ServerResultVecU8CopyWith<$Res> { -$ServerResultVecU8CopyWith(ServerResultVecU8 _, $Res Function(ServerResultVecU8) __); -} - - -/// Adds pattern-matching-related methods to [ServerResultVecU8]. -extension ServerResultVecU8Patterns on ServerResultVecU8 { -/// A variant of `map` that fallback to returning `orElse`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeMap({TResult Function( ServerResultVecU8_Ok value)? ok,TResult Function( ServerResultVecU8_ErrorCode value)? errorCode,required TResult orElse(),}){ -final _that = this; -switch (_that) { -case ServerResultVecU8_Ok() when ok != null: -return ok(_that);case ServerResultVecU8_ErrorCode() when errorCode != null: -return errorCode(_that);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// Callbacks receives the raw object, upcasted. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case final Subclass2 value: -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult map({required TResult Function( ServerResultVecU8_Ok value) ok,required TResult Function( ServerResultVecU8_ErrorCode value) errorCode,}){ -final _that = this; -switch (_that) { -case ServerResultVecU8_Ok(): -return ok(_that);case ServerResultVecU8_ErrorCode(): -return errorCode(_that);} -} -/// A variant of `map` that fallback to returning `null`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? mapOrNull({TResult? Function( ServerResultVecU8_Ok value)? ok,TResult? Function( ServerResultVecU8_ErrorCode value)? errorCode,}){ -final _that = this; -switch (_that) { -case ServerResultVecU8_Ok() when ok != null: -return ok(_that);case ServerResultVecU8_ErrorCode() when errorCode != null: -return errorCode(_that);case _: - return null; - -} -} -/// A variant of `when` that fallback to an `orElse` callback. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeWhen({TResult Function( Uint8List field0)? ok,TResult Function( int field0)? errorCode,required TResult orElse(),}) {final _that = this; -switch (_that) { -case ServerResultVecU8_Ok() when ok != null: -return ok(_that.field0);case ServerResultVecU8_ErrorCode() when errorCode != null: -return errorCode(_that.field0);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// As opposed to `map`, this offers destructuring. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case Subclass2(:final field2): -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult when({required TResult Function( Uint8List field0) ok,required TResult Function( int field0) errorCode,}) {final _that = this; -switch (_that) { -case ServerResultVecU8_Ok(): -return ok(_that.field0);case ServerResultVecU8_ErrorCode(): -return errorCode(_that.field0);} -} -/// A variant of `when` that fallback to returning `null` -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? whenOrNull({TResult? Function( Uint8List field0)? ok,TResult? Function( int field0)? errorCode,}) {final _that = this; -switch (_that) { -case ServerResultVecU8_Ok() when ok != null: -return ok(_that.field0);case ServerResultVecU8_ErrorCode() when errorCode != null: -return errorCode(_that.field0);case _: - return null; - -} -} - -} - -/// @nodoc - - -class ServerResultVecU8_Ok extends ServerResultVecU8 { - const ServerResultVecU8_Ok(this.field0): super._(); - - -@override final Uint8List field0; - -/// Create a copy of ServerResultVecU8 -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$ServerResultVecU8_OkCopyWith get copyWith => _$ServerResultVecU8_OkCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is ServerResultVecU8_Ok&&const DeepCollectionEquality().equals(other.field0, field0)); -} - - -@override -int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(field0)); - -@override -String toString() { - return 'ServerResultVecU8.ok(field0: $field0)'; -} - - -} - -/// @nodoc -abstract mixin class $ServerResultVecU8_OkCopyWith<$Res> implements $ServerResultVecU8CopyWith<$Res> { - factory $ServerResultVecU8_OkCopyWith(ServerResultVecU8_Ok value, $Res Function(ServerResultVecU8_Ok) _then) = _$ServerResultVecU8_OkCopyWithImpl; -@useResult -$Res call({ - Uint8List field0 -}); - - - - -} -/// @nodoc -class _$ServerResultVecU8_OkCopyWithImpl<$Res> - implements $ServerResultVecU8_OkCopyWith<$Res> { - _$ServerResultVecU8_OkCopyWithImpl(this._self, this._then); - - final ServerResultVecU8_Ok _self; - final $Res Function(ServerResultVecU8_Ok) _then; - -/// Create a copy of ServerResultVecU8 -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? field0 = null,}) { - return _then(ServerResultVecU8_Ok( -null == field0 ? _self.field0 : field0 // ignore: cast_nullable_to_non_nullable -as Uint8List, - )); -} - - -} - -/// @nodoc - - -class ServerResultVecU8_ErrorCode extends ServerResultVecU8 { - const ServerResultVecU8_ErrorCode(this.field0): super._(); - - -@override final int field0; - -/// Create a copy of ServerResultVecU8 -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$ServerResultVecU8_ErrorCodeCopyWith get copyWith => _$ServerResultVecU8_ErrorCodeCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is ServerResultVecU8_ErrorCode&&(identical(other.field0, field0) || other.field0 == field0)); -} - - -@override -int get hashCode => Object.hash(runtimeType,field0); - -@override -String toString() { - return 'ServerResultVecU8.errorCode(field0: $field0)'; -} - - -} - -/// @nodoc -abstract mixin class $ServerResultVecU8_ErrorCodeCopyWith<$Res> implements $ServerResultVecU8CopyWith<$Res> { - factory $ServerResultVecU8_ErrorCodeCopyWith(ServerResultVecU8_ErrorCode value, $Res Function(ServerResultVecU8_ErrorCode) _then) = _$ServerResultVecU8_ErrorCodeCopyWithImpl; -@useResult -$Res call({ - int field0 -}); - - - - -} -/// @nodoc -class _$ServerResultVecU8_ErrorCodeCopyWithImpl<$Res> - implements $ServerResultVecU8_ErrorCodeCopyWith<$Res> { - _$ServerResultVecU8_ErrorCodeCopyWithImpl(this._self, this._then); - - final ServerResultVecU8_ErrorCode _self; - final $Res Function(ServerResultVecU8_ErrorCode) _then; - -/// Create a copy of ServerResultVecU8 -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? field0 = null,}) { - return _then(ServerResultVecU8_ErrorCode( -null == field0 ? _self.field0 : field0 // ignore: cast_nullable_to_non_nullable -as int, - )); -} - - -} - -// dart format on diff --git a/lib/core/bridge/callbacks/user_discovery.dart b/lib/core/bridge/callbacks/user_discovery.dart deleted file mode 100644 index 569a0013..00000000 --- a/lib/core/bridge/callbacks/user_discovery.dart +++ /dev/null @@ -1,173 +0,0 @@ -// This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.12.0. - -// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import - -import '../../bridge.dart'; -import '../../frb_generated.dart'; -import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; - -// These function are ignored because they are on traits that is not defined in current crate (put an empty `#[frb]` on it to unignore): `clone` - -class UserDiscoveryStoreFlutter { - const UserDiscoveryStoreFlutter(); - - Future getAnnouncedUserByPublicId({ - required PlatformInt64 publicId, - }) => RustLib.instance.api - .crateBridgeCallbacksUserDiscoveryUserDiscoveryStoreFlutterGetAnnouncedUserByPublicId( - that: this, - publicId: publicId, - ); - - Future getConfig() => RustLib.instance.api - .crateBridgeCallbacksUserDiscoveryUserDiscoveryStoreFlutterGetConfig( - that: this, - ); - - Future getContactPromotion({ - required PlatformInt64 contactId, - }) => RustLib.instance.api - .crateBridgeCallbacksUserDiscoveryUserDiscoveryStoreFlutterGetContactPromotion( - that: this, - contactId: contactId, - ); - - Future getContactVersion({ - required PlatformInt64 contactId, - }) => RustLib.instance.api - .crateBridgeCallbacksUserDiscoveryUserDiscoveryStoreFlutterGetContactVersion( - that: this, - contactId: contactId, - ); - - Future> getOtherPromotionsByPublicId({ - required PlatformInt64 publicId, - }) => RustLib.instance.api - .crateBridgeCallbacksUserDiscoveryUserDiscoveryStoreFlutterGetOtherPromotionsByPublicId( - that: this, - publicId: publicId, - ); - - Future> getOwnPromotionsAfterVersion({ - required int version, - }) => RustLib.instance.api - .crateBridgeCallbacksUserDiscoveryUserDiscoveryStoreFlutterGetOwnPromotionsAfterVersion( - that: this, - version: version, - ); - - Future getShareForContact({ - required PlatformInt64 contactId, - }) => RustLib.instance.api - .crateBridgeCallbacksUserDiscoveryUserDiscoveryStoreFlutterGetShareForContact( - that: this, - contactId: contactId, - ); - - Future pushNewUserRelation({ - required PlatformInt64 fromContactId, - required AnnouncedUser announcedUser, - PlatformInt64? publicKeyVerifiedTimestamp, - }) => RustLib.instance.api - .crateBridgeCallbacksUserDiscoveryUserDiscoveryStoreFlutterPushNewUserRelation( - that: this, - fromContactId: fromContactId, - announcedUser: announcedUser, - publicKeyVerifiedTimestamp: publicKeyVerifiedTimestamp, - ); - - Future pushOwnPromotionAndClearOldVersion({ - required PlatformInt64 contactId, - required int version, - required List promotion, - }) => RustLib.instance.api - .crateBridgeCallbacksUserDiscoveryUserDiscoveryStoreFlutterPushOwnPromotionAndClearOldVersion( - that: this, - contactId: contactId, - version: version, - promotion: promotion, - ); - - Future setContactVersion({ - required PlatformInt64 contactId, - required List update, - }) => RustLib.instance.api - .crateBridgeCallbacksUserDiscoveryUserDiscoveryStoreFlutterSetContactVersion( - that: this, - contactId: contactId, - update: update, - ); - - Future setShares({required List shares}) => RustLib - .instance - .api - .crateBridgeCallbacksUserDiscoveryUserDiscoveryStoreFlutterSetShares( - that: this, - shares: shares, - ); - - Future storeOtherPromotion({ - required OtherPromotion promotion, - }) => RustLib.instance.api - .crateBridgeCallbacksUserDiscoveryUserDiscoveryStoreFlutterStoreOtherPromotion( - that: this, - promotion: promotion, - ); - - Future updateConfig({required String update}) => RustLib.instance.api - .crateBridgeCallbacksUserDiscoveryUserDiscoveryStoreFlutterUpdateConfig( - that: this, - update: update, - ); - - @override - int get hashCode => 0; - - @override - bool operator ==(Object other) => - identical(this, other) || - other is UserDiscoveryStoreFlutter && runtimeType == other.runtimeType; -} - -class UserDiscoveryUtilsFlutter { - const UserDiscoveryUtilsFlutter(); - - Future signData({required List inputData}) => RustLib - .instance - .api - .crateBridgeCallbacksUserDiscoveryUserDiscoveryUtilsFlutterSignData( - that: this, - inputData: inputData, - ); - - Future verifySignature({ - required List inputData, - required List pubkey, - required List signature, - }) => RustLib.instance.api - .crateBridgeCallbacksUserDiscoveryUserDiscoveryUtilsFlutterVerifySignature( - that: this, - inputData: inputData, - pubkey: pubkey, - signature: signature, - ); - - Future verifyStoredPubkey({ - required PlatformInt64 fromContactId, - required List pubkey, - }) => RustLib.instance.api - .crateBridgeCallbacksUserDiscoveryUserDiscoveryUtilsFlutterVerifyStoredPubkey( - that: this, - fromContactId: fromContactId, - pubkey: pubkey, - ); - - @override - int get hashCode => 0; - - @override - bool operator ==(Object other) => - identical(this, other) || - other is UserDiscoveryUtilsFlutter && runtimeType == other.runtimeType; -} diff --git a/lib/core/context.dart b/lib/core/context.dart deleted file mode 100644 index 7294be61..00000000 --- a/lib/core/context.dart +++ /dev/null @@ -1,28 +0,0 @@ -// This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.12.0. - -// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import - -import 'frb_generated.dart'; -import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; - -class InitConfig { - final String databasePath; - final String dataDirectory; - - const InitConfig({ - required this.databasePath, - required this.dataDirectory, - }); - - @override - int get hashCode => databasePath.hashCode ^ dataDirectory.hashCode; - - @override - bool operator ==(Object other) => - identical(this, other) || - other is InitConfig && - runtimeType == other.runtimeType && - databasePath == other.databasePath && - dataDirectory == other.dataDirectory; -} diff --git a/lib/src/model/protobuf/client/generated/groups.pb.dart b/lib/src/model/protobuf/client/generated/groups.pb.dart deleted file mode 100644 index 0f0c82fa..00000000 --- a/lib/src/model/protobuf/client/generated/groups.pb.dart +++ /dev/null @@ -1,261 +0,0 @@ -// This is a generated file - do not edit. -// -// Generated from groups.proto. - -// @dart = 3.3 - -// ignore_for_file: annotate_overrides, camel_case_types, comment_references -// ignore_for_file: constant_identifier_names -// ignore_for_file: curly_braces_in_flow_control_structures -// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes -// ignore_for_file: non_constant_identifier_names, prefer_relative_imports - -import 'dart:core' as $core; - -import 'package:fixnum/fixnum.dart' as $fixnum; -import 'package:protobuf/protobuf.dart' as $pb; - -import 'groups.pbenum.dart'; - -export 'package:protobuf/protobuf.dart' show GeneratedMessageGenericExtensions; - -export 'groups.pbenum.dart'; - -/// Stored encrypted on the server in the members columns. -class EncryptedGroupState extends $pb.GeneratedMessage { - factory EncryptedGroupState({ - $core.Iterable<$fixnum.Int64>? memberIds, - $core.Iterable<$fixnum.Int64>? adminIds, - $core.String? groupName, - $fixnum.Int64? deleteMessagesAfterMilliseconds, - $core.List<$core.int>? padding, - }) { - final result = create(); - if (memberIds != null) result.memberIds.addAll(memberIds); - if (adminIds != null) result.adminIds.addAll(adminIds); - if (groupName != null) result.groupName = groupName; - if (deleteMessagesAfterMilliseconds != null) - result.deleteMessagesAfterMilliseconds = deleteMessagesAfterMilliseconds; - if (padding != null) result.padding = padding; - return result; - } - - EncryptedGroupState._(); - - factory EncryptedGroupState.fromBuffer($core.List<$core.int> data, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(data, registry); - factory EncryptedGroupState.fromJson($core.String json, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(json, registry); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - _omitMessageNames ? '' : 'EncryptedGroupState', - createEmptyInstance: create) - ..p<$fixnum.Int64>( - 1, _omitFieldNames ? '' : 'memberIds', $pb.PbFieldType.K6) - ..p<$fixnum.Int64>(2, _omitFieldNames ? '' : 'adminIds', $pb.PbFieldType.K6) - ..aOS(3, _omitFieldNames ? '' : 'groupName') - ..aInt64(4, _omitFieldNames ? '' : 'deleteMessagesAfterMilliseconds') - ..a<$core.List<$core.int>>( - 5, _omitFieldNames ? '' : 'padding', $pb.PbFieldType.OY) - ..hasRequiredFields = false; - - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - EncryptedGroupState clone() => deepCopy(); - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - EncryptedGroupState copyWith(void Function(EncryptedGroupState) updates) => - super.copyWith((message) => updates(message as EncryptedGroupState)) - as EncryptedGroupState; - - @$core.override - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static EncryptedGroupState create() => EncryptedGroupState._(); - @$core.override - EncryptedGroupState createEmptyInstance() => create(); - @$core.pragma('dart2js:noInline') - static EncryptedGroupState getDefault() => _defaultInstance ??= - $pb.GeneratedMessage.$_defaultFor(create); - static EncryptedGroupState? _defaultInstance; - - @$pb.TagNumber(1) - $pb.PbList<$fixnum.Int64> get memberIds => $_getList(0); - - @$pb.TagNumber(2) - $pb.PbList<$fixnum.Int64> get adminIds => $_getList(1); - - @$pb.TagNumber(3) - $core.String get groupName => $_getSZ(2); - @$pb.TagNumber(3) - set groupName($core.String value) => $_setString(2, value); - @$pb.TagNumber(3) - $core.bool hasGroupName() => $_has(2); - @$pb.TagNumber(3) - void clearGroupName() => $_clearField(3); - - @$pb.TagNumber(4) - $fixnum.Int64 get deleteMessagesAfterMilliseconds => $_getI64(3); - @$pb.TagNumber(4) - set deleteMessagesAfterMilliseconds($fixnum.Int64 value) => - $_setInt64(3, value); - @$pb.TagNumber(4) - $core.bool hasDeleteMessagesAfterMilliseconds() => $_has(3); - @$pb.TagNumber(4) - void clearDeleteMessagesAfterMilliseconds() => $_clearField(4); - - @$pb.TagNumber(5) - $core.List<$core.int> get padding => $_getN(4); - @$pb.TagNumber(5) - set padding($core.List<$core.int> value) => $_setBytes(4, value); - @$pb.TagNumber(5) - $core.bool hasPadding() => $_has(4); - @$pb.TagNumber(5) - void clearPadding() => $_clearField(5); -} - -class EncryptedAppendedGroupState extends $pb.GeneratedMessage { - factory EncryptedAppendedGroupState({ - EncryptedAppendedGroupState_Type? type, - }) { - final result = create(); - if (type != null) result.type = type; - return result; - } - - EncryptedAppendedGroupState._(); - - factory EncryptedAppendedGroupState.fromBuffer($core.List<$core.int> data, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(data, registry); - factory EncryptedAppendedGroupState.fromJson($core.String json, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(json, registry); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - _omitMessageNames ? '' : 'EncryptedAppendedGroupState', - createEmptyInstance: create) - ..aE(1, _omitFieldNames ? '' : 'type', - enumValues: EncryptedAppendedGroupState_Type.values) - ..hasRequiredFields = false; - - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - EncryptedAppendedGroupState clone() => deepCopy(); - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - EncryptedAppendedGroupState copyWith( - void Function(EncryptedAppendedGroupState) updates) => - super.copyWith( - (message) => updates(message as EncryptedAppendedGroupState)) - as EncryptedAppendedGroupState; - - @$core.override - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static EncryptedAppendedGroupState create() => - EncryptedAppendedGroupState._(); - @$core.override - EncryptedAppendedGroupState createEmptyInstance() => create(); - @$core.pragma('dart2js:noInline') - static EncryptedAppendedGroupState getDefault() => _defaultInstance ??= - $pb.GeneratedMessage.$_defaultFor(create); - static EncryptedAppendedGroupState? _defaultInstance; - - @$pb.TagNumber(1) - EncryptedAppendedGroupState_Type get type => $_getN(0); - @$pb.TagNumber(1) - set type(EncryptedAppendedGroupState_Type value) => $_setField(1, value); - @$pb.TagNumber(1) - $core.bool hasType() => $_has(0); - @$pb.TagNumber(1) - void clearType() => $_clearField(1); -} - -class EncryptedGroupStateEnvelop extends $pb.GeneratedMessage { - factory EncryptedGroupStateEnvelop({ - $core.List<$core.int>? nonce, - $core.List<$core.int>? encryptedGroupState, - $core.List<$core.int>? mac, - }) { - final result = create(); - if (nonce != null) result.nonce = nonce; - if (encryptedGroupState != null) - result.encryptedGroupState = encryptedGroupState; - if (mac != null) result.mac = mac; - return result; - } - - EncryptedGroupStateEnvelop._(); - - factory EncryptedGroupStateEnvelop.fromBuffer($core.List<$core.int> data, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(data, registry); - factory EncryptedGroupStateEnvelop.fromJson($core.String json, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(json, registry); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - _omitMessageNames ? '' : 'EncryptedGroupStateEnvelop', - createEmptyInstance: create) - ..a<$core.List<$core.int>>( - 1, _omitFieldNames ? '' : 'nonce', $pb.PbFieldType.OY) - ..a<$core.List<$core.int>>( - 2, _omitFieldNames ? '' : 'encryptedGroupState', $pb.PbFieldType.OY) - ..a<$core.List<$core.int>>( - 3, _omitFieldNames ? '' : 'mac', $pb.PbFieldType.OY) - ..hasRequiredFields = false; - - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - EncryptedGroupStateEnvelop clone() => deepCopy(); - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - EncryptedGroupStateEnvelop copyWith( - void Function(EncryptedGroupStateEnvelop) updates) => - super.copyWith( - (message) => updates(message as EncryptedGroupStateEnvelop)) - as EncryptedGroupStateEnvelop; - - @$core.override - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static EncryptedGroupStateEnvelop create() => EncryptedGroupStateEnvelop._(); - @$core.override - EncryptedGroupStateEnvelop createEmptyInstance() => create(); - @$core.pragma('dart2js:noInline') - static EncryptedGroupStateEnvelop getDefault() => _defaultInstance ??= - $pb.GeneratedMessage.$_defaultFor(create); - static EncryptedGroupStateEnvelop? _defaultInstance; - - @$pb.TagNumber(1) - $core.List<$core.int> get nonce => $_getN(0); - @$pb.TagNumber(1) - set nonce($core.List<$core.int> value) => $_setBytes(0, value); - @$pb.TagNumber(1) - $core.bool hasNonce() => $_has(0); - @$pb.TagNumber(1) - void clearNonce() => $_clearField(1); - - @$pb.TagNumber(2) - $core.List<$core.int> get encryptedGroupState => $_getN(1); - @$pb.TagNumber(2) - set encryptedGroupState($core.List<$core.int> value) => $_setBytes(1, value); - @$pb.TagNumber(2) - $core.bool hasEncryptedGroupState() => $_has(1); - @$pb.TagNumber(2) - void clearEncryptedGroupState() => $_clearField(2); - - @$pb.TagNumber(3) - $core.List<$core.int> get mac => $_getN(2); - @$pb.TagNumber(3) - set mac($core.List<$core.int> value) => $_setBytes(2, value); - @$pb.TagNumber(3) - $core.bool hasMac() => $_has(2); - @$pb.TagNumber(3) - void clearMac() => $_clearField(3); -} - -const $core.bool _omitFieldNames = - $core.bool.fromEnvironment('protobuf.omit_field_names'); -const $core.bool _omitMessageNames = - $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/lib/src/model/protobuf/client/generated/groups.pbenum.dart b/lib/src/model/protobuf/client/generated/groups.pbenum.dart deleted file mode 100644 index 7d19a932..00000000 --- a/lib/src/model/protobuf/client/generated/groups.pbenum.dart +++ /dev/null @@ -1,35 +0,0 @@ -// This is a generated file - do not edit. -// -// Generated from groups.proto. - -// @dart = 3.3 - -// ignore_for_file: annotate_overrides, camel_case_types, comment_references -// ignore_for_file: constant_identifier_names -// ignore_for_file: curly_braces_in_flow_control_structures -// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes -// ignore_for_file: non_constant_identifier_names, prefer_relative_imports - -import 'dart:core' as $core; - -import 'package:protobuf/protobuf.dart' as $pb; - -class EncryptedAppendedGroupState_Type extends $pb.ProtobufEnum { - static const EncryptedAppendedGroupState_Type LEFT_GROUP = - EncryptedAppendedGroupState_Type._(0, _omitEnumNames ? '' : 'LEFT_GROUP'); - - static const $core.List values = - [ - LEFT_GROUP, - ]; - - static final $core.List _byValue = - $pb.ProtobufEnum.$_initByValueList(values, 0); - static EncryptedAppendedGroupState_Type? valueOf($core.int value) => - value < 0 || value >= _byValue.length ? null : _byValue[value]; - - const EncryptedAppendedGroupState_Type._(super.value, super.name); -} - -const $core.bool _omitEnumNames = - $core.bool.fromEnvironment('protobuf.omit_enum_names'); diff --git a/lib/src/model/protobuf/client/generated/groups.pbjson.dart b/lib/src/model/protobuf/client/generated/groups.pbjson.dart deleted file mode 100644 index ba32065f..00000000 --- a/lib/src/model/protobuf/client/generated/groups.pbjson.dart +++ /dev/null @@ -1,100 +0,0 @@ -// This is a generated file - do not edit. -// -// Generated from groups.proto. - -// @dart = 3.3 - -// ignore_for_file: annotate_overrides, camel_case_types, comment_references -// ignore_for_file: constant_identifier_names -// ignore_for_file: curly_braces_in_flow_control_structures -// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes -// ignore_for_file: non_constant_identifier_names, prefer_relative_imports -// ignore_for_file: unused_import - -import 'dart:convert' as $convert; -import 'dart:core' as $core; -import 'dart:typed_data' as $typed_data; - -@$core.Deprecated('Use encryptedGroupStateDescriptor instead') -const EncryptedGroupState$json = { - '1': 'EncryptedGroupState', - '2': [ - {'1': 'member_ids', '3': 1, '4': 3, '5': 3, '10': 'memberIds'}, - {'1': 'admin_ids', '3': 2, '4': 3, '5': 3, '10': 'adminIds'}, - {'1': 'group_name', '3': 3, '4': 1, '5': 9, '10': 'groupName'}, - { - '1': 'delete_messages_after_milliseconds', - '3': 4, - '4': 1, - '5': 3, - '9': 0, - '10': 'deleteMessagesAfterMilliseconds', - '17': true - }, - {'1': 'padding', '3': 5, '4': 1, '5': 12, '10': 'padding'}, - ], - '8': [ - {'1': '_delete_messages_after_milliseconds'}, - ], -}; - -/// Descriptor for `EncryptedGroupState`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List encryptedGroupStateDescriptor = $convert.base64Decode( - 'ChNFbmNyeXB0ZWRHcm91cFN0YXRlEh0KCm1lbWJlcl9pZHMYASADKANSCW1lbWJlcklkcxIbCg' - 'lhZG1pbl9pZHMYAiADKANSCGFkbWluSWRzEh0KCmdyb3VwX25hbWUYAyABKAlSCWdyb3VwTmFt' - 'ZRJQCiJkZWxldGVfbWVzc2FnZXNfYWZ0ZXJfbWlsbGlzZWNvbmRzGAQgASgDSABSH2RlbGV0ZU' - '1lc3NhZ2VzQWZ0ZXJNaWxsaXNlY29uZHOIAQESGAoHcGFkZGluZxgFIAEoDFIHcGFkZGluZ0Il' - 'CiNfZGVsZXRlX21lc3NhZ2VzX2FmdGVyX21pbGxpc2Vjb25kcw=='); - -@$core.Deprecated('Use encryptedAppendedGroupStateDescriptor instead') -const EncryptedAppendedGroupState$json = { - '1': 'EncryptedAppendedGroupState', - '2': [ - { - '1': 'type', - '3': 1, - '4': 1, - '5': 14, - '6': '.EncryptedAppendedGroupState.Type', - '10': 'type' - }, - ], - '4': [EncryptedAppendedGroupState_Type$json], -}; - -@$core.Deprecated('Use encryptedAppendedGroupStateDescriptor instead') -const EncryptedAppendedGroupState_Type$json = { - '1': 'Type', - '2': [ - {'1': 'LEFT_GROUP', '2': 0}, - ], -}; - -/// Descriptor for `EncryptedAppendedGroupState`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List encryptedAppendedGroupStateDescriptor = - $convert.base64Decode( - 'ChtFbmNyeXB0ZWRBcHBlbmRlZEdyb3VwU3RhdGUSNQoEdHlwZRgBIAEoDjIhLkVuY3J5cHRlZE' - 'FwcGVuZGVkR3JvdXBTdGF0ZS5UeXBlUgR0eXBlIhYKBFR5cGUSDgoKTEVGVF9HUk9VUBAA'); - -@$core.Deprecated('Use encryptedGroupStateEnvelopDescriptor instead') -const EncryptedGroupStateEnvelop$json = { - '1': 'EncryptedGroupStateEnvelop', - '2': [ - {'1': 'nonce', '3': 1, '4': 1, '5': 12, '10': 'nonce'}, - { - '1': 'encrypted_group_state', - '3': 2, - '4': 1, - '5': 12, - '10': 'encryptedGroupState' - }, - {'1': 'mac', '3': 3, '4': 1, '5': 12, '10': 'mac'}, - ], -}; - -/// Descriptor for `EncryptedGroupStateEnvelop`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List encryptedGroupStateEnvelopDescriptor = - $convert.base64Decode( - 'ChpFbmNyeXB0ZWRHcm91cFN0YXRlRW52ZWxvcBIUCgVub25jZRgBIAEoDFIFbm9uY2USMgoVZW' - '5jcnlwdGVkX2dyb3VwX3N0YXRlGAIgASgMUhNlbmNyeXB0ZWRHcm91cFN0YXRlEhAKA21hYxgD' - 'IAEoDFIDbWFj'); diff --git a/lib/src/model/protobuf/client/generated/groups.pbserver.dart b/lib/src/model/protobuf/client/generated/groups.pbserver.dart deleted file mode 100644 index 880b9819..00000000 --- a/lib/src/model/protobuf/client/generated/groups.pbserver.dart +++ /dev/null @@ -1,13 +0,0 @@ -// -// Generated code. Do not modify. -// source: groups.proto -// -// @dart = 2.12 - -// ignore_for_file: annotate_overrides, camel_case_types, comment_references -// ignore_for_file: constant_identifier_names -// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes -// ignore_for_file: non_constant_identifier_names, prefer_final_fields -// ignore_for_file: unnecessary_import, unnecessary_this, unused_import - -export 'groups.pb.dart'; diff --git a/lib/src/model/protobuf/client/generated/http_requests.pb.dart b/lib/src/model/protobuf/client/generated/http_requests.pb.dart index 4cc1b132..768ce32b 100644 --- a/lib/src/model/protobuf/client/generated/http_requests.pb.dart +++ b/lib/src/model/protobuf/client/generated/http_requests.pb.dart @@ -167,747 +167,6 @@ class UploadRequest extends $pb.GeneratedMessage { $pb.PbList get messagesOnSuccess => $_getList(2); } -class SealedSenderMessageRequest extends $pb.GeneratedMessage { - factory SealedSenderMessageRequest({ - $fixnum.Int64? recipientUserId, - $core.List<$core.int>? sealedSenderMessage, - $core.List<$core.int>? privacyPassToken, - }) { - final result = create(); - if (recipientUserId != null) result.recipientUserId = recipientUserId; - if (sealedSenderMessage != null) - result.sealedSenderMessage = sealedSenderMessage; - if (privacyPassToken != null) result.privacyPassToken = privacyPassToken; - return result; - } - - SealedSenderMessageRequest._(); - - factory SealedSenderMessageRequest.fromBuffer($core.List<$core.int> data, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(data, registry); - factory SealedSenderMessageRequest.fromJson($core.String json, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(json, registry); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - _omitMessageNames ? '' : 'SealedSenderMessageRequest', - package: const $pb.PackageName(_omitMessageNames ? '' : 'http_requests'), - createEmptyInstance: create) - ..aInt64(1, _omitFieldNames ? '' : 'recipientUserId') - ..a<$core.List<$core.int>>( - 2, _omitFieldNames ? '' : 'sealedSenderMessage', $pb.PbFieldType.OY) - ..a<$core.List<$core.int>>( - 3, _omitFieldNames ? '' : 'privacyPassToken', $pb.PbFieldType.OY) - ..hasRequiredFields = false; - - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - SealedSenderMessageRequest clone() => deepCopy(); - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - SealedSenderMessageRequest copyWith( - void Function(SealedSenderMessageRequest) updates) => - super.copyWith( - (message) => updates(message as SealedSenderMessageRequest)) - as SealedSenderMessageRequest; - - @$core.override - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static SealedSenderMessageRequest create() => SealedSenderMessageRequest._(); - @$core.override - SealedSenderMessageRequest createEmptyInstance() => create(); - @$core.pragma('dart2js:noInline') - static SealedSenderMessageRequest getDefault() => _defaultInstance ??= - $pb.GeneratedMessage.$_defaultFor(create); - static SealedSenderMessageRequest? _defaultInstance; - - @$pb.TagNumber(1) - $fixnum.Int64 get recipientUserId => $_getI64(0); - @$pb.TagNumber(1) - set recipientUserId($fixnum.Int64 value) => $_setInt64(0, value); - @$pb.TagNumber(1) - $core.bool hasRecipientUserId() => $_has(0); - @$pb.TagNumber(1) - void clearRecipientUserId() => $_clearField(1); - - @$pb.TagNumber(2) - $core.List<$core.int> get sealedSenderMessage => $_getN(1); - @$pb.TagNumber(2) - set sealedSenderMessage($core.List<$core.int> value) => $_setBytes(1, value); - @$pb.TagNumber(2) - $core.bool hasSealedSenderMessage() => $_has(1); - @$pb.TagNumber(2) - void clearSealedSenderMessage() => $_clearField(2); - - @$pb.TagNumber(3) - $core.List<$core.int> get privacyPassToken => $_getN(2); - @$pb.TagNumber(3) - set privacyPassToken($core.List<$core.int> value) => $_setBytes(2, value); - @$pb.TagNumber(3) - $core.bool hasPrivacyPassToken() => $_has(2); - @$pb.TagNumber(3) - void clearPrivacyPassToken() => $_clearField(3); -} - -class SealedSenderMessageResponse extends $pb.GeneratedMessage { - factory SealedSenderMessageResponse({ - $core.String? messageId, - }) { - final result = create(); - if (messageId != null) result.messageId = messageId; - return result; - } - - SealedSenderMessageResponse._(); - - factory SealedSenderMessageResponse.fromBuffer($core.List<$core.int> data, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(data, registry); - factory SealedSenderMessageResponse.fromJson($core.String json, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(json, registry); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - _omitMessageNames ? '' : 'SealedSenderMessageResponse', - package: const $pb.PackageName(_omitMessageNames ? '' : 'http_requests'), - createEmptyInstance: create) - ..aOS(1, _omitFieldNames ? '' : 'messageId') - ..hasRequiredFields = false; - - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - SealedSenderMessageResponse clone() => deepCopy(); - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - SealedSenderMessageResponse copyWith( - void Function(SealedSenderMessageResponse) updates) => - super.copyWith( - (message) => updates(message as SealedSenderMessageResponse)) - as SealedSenderMessageResponse; - - @$core.override - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static SealedSenderMessageResponse create() => - SealedSenderMessageResponse._(); - @$core.override - SealedSenderMessageResponse createEmptyInstance() => create(); - @$core.pragma('dart2js:noInline') - static SealedSenderMessageResponse getDefault() => _defaultInstance ??= - $pb.GeneratedMessage.$_defaultFor(create); - static SealedSenderMessageResponse? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get messageId => $_getSZ(0); - @$pb.TagNumber(1) - set messageId($core.String value) => $_setString(0, value); - @$pb.TagNumber(1) - $core.bool hasMessageId() => $_has(0); - @$pb.TagNumber(1) - void clearMessageId() => $_clearField(1); -} - -class UpdateGroupState_UpdateTBS extends $pb.GeneratedMessage { - factory UpdateGroupState_UpdateTBS({ - $fixnum.Int64? versionId, - $core.List<$core.int>? encryptedGroupState, - $core.List<$core.int>? publicKey, - $core.List<$core.int>? removeAdmin, - $core.List<$core.int>? addAdmin, - $core.List<$core.int>? nonce, - }) { - final result = create(); - if (versionId != null) result.versionId = versionId; - if (encryptedGroupState != null) - result.encryptedGroupState = encryptedGroupState; - if (publicKey != null) result.publicKey = publicKey; - if (removeAdmin != null) result.removeAdmin = removeAdmin; - if (addAdmin != null) result.addAdmin = addAdmin; - if (nonce != null) result.nonce = nonce; - return result; - } - - UpdateGroupState_UpdateTBS._(); - - factory UpdateGroupState_UpdateTBS.fromBuffer($core.List<$core.int> data, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(data, registry); - factory UpdateGroupState_UpdateTBS.fromJson($core.String json, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(json, registry); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - _omitMessageNames ? '' : 'UpdateGroupState.UpdateTBS', - package: const $pb.PackageName(_omitMessageNames ? '' : 'http_requests'), - createEmptyInstance: create) - ..a<$fixnum.Int64>( - 1, _omitFieldNames ? '' : 'versionId', $pb.PbFieldType.OU6, - defaultOrMaker: $fixnum.Int64.ZERO) - ..a<$core.List<$core.int>>( - 3, _omitFieldNames ? '' : 'encryptedGroupState', $pb.PbFieldType.OY) - ..a<$core.List<$core.int>>( - 4, _omitFieldNames ? '' : 'publicKey', $pb.PbFieldType.OY) - ..a<$core.List<$core.int>>( - 5, _omitFieldNames ? '' : 'removeAdmin', $pb.PbFieldType.OY) - ..a<$core.List<$core.int>>( - 6, _omitFieldNames ? '' : 'addAdmin', $pb.PbFieldType.OY) - ..a<$core.List<$core.int>>( - 7, _omitFieldNames ? '' : 'nonce', $pb.PbFieldType.OY) - ..hasRequiredFields = false; - - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - UpdateGroupState_UpdateTBS clone() => deepCopy(); - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - UpdateGroupState_UpdateTBS copyWith( - void Function(UpdateGroupState_UpdateTBS) updates) => - super.copyWith( - (message) => updates(message as UpdateGroupState_UpdateTBS)) - as UpdateGroupState_UpdateTBS; - - @$core.override - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static UpdateGroupState_UpdateTBS create() => UpdateGroupState_UpdateTBS._(); - @$core.override - UpdateGroupState_UpdateTBS createEmptyInstance() => create(); - @$core.pragma('dart2js:noInline') - static UpdateGroupState_UpdateTBS getDefault() => _defaultInstance ??= - $pb.GeneratedMessage.$_defaultFor(create); - static UpdateGroupState_UpdateTBS? _defaultInstance; - - @$pb.TagNumber(1) - $fixnum.Int64 get versionId => $_getI64(0); - @$pb.TagNumber(1) - set versionId($fixnum.Int64 value) => $_setInt64(0, value); - @$pb.TagNumber(1) - $core.bool hasVersionId() => $_has(0); - @$pb.TagNumber(1) - void clearVersionId() => $_clearField(1); - - @$pb.TagNumber(3) - $core.List<$core.int> get encryptedGroupState => $_getN(1); - @$pb.TagNumber(3) - set encryptedGroupState($core.List<$core.int> value) => $_setBytes(1, value); - @$pb.TagNumber(3) - $core.bool hasEncryptedGroupState() => $_has(1); - @$pb.TagNumber(3) - void clearEncryptedGroupState() => $_clearField(3); - - @$pb.TagNumber(4) - $core.List<$core.int> get publicKey => $_getN(2); - @$pb.TagNumber(4) - set publicKey($core.List<$core.int> value) => $_setBytes(2, value); - @$pb.TagNumber(4) - $core.bool hasPublicKey() => $_has(2); - @$pb.TagNumber(4) - void clearPublicKey() => $_clearField(4); - - /// public group key - @$pb.TagNumber(5) - $core.List<$core.int> get removeAdmin => $_getN(3); - @$pb.TagNumber(5) - set removeAdmin($core.List<$core.int> value) => $_setBytes(3, value); - @$pb.TagNumber(5) - $core.bool hasRemoveAdmin() => $_has(3); - @$pb.TagNumber(5) - void clearRemoveAdmin() => $_clearField(5); - - @$pb.TagNumber(6) - $core.List<$core.int> get addAdmin => $_getN(4); - @$pb.TagNumber(6) - set addAdmin($core.List<$core.int> value) => $_setBytes(4, value); - @$pb.TagNumber(6) - $core.bool hasAddAdmin() => $_has(4); - @$pb.TagNumber(6) - void clearAddAdmin() => $_clearField(6); - - @$pb.TagNumber(7) - $core.List<$core.int> get nonce => $_getN(5); - @$pb.TagNumber(7) - set nonce($core.List<$core.int> value) => $_setBytes(5, value); - @$pb.TagNumber(7) - $core.bool hasNonce() => $_has(5); - @$pb.TagNumber(7) - void clearNonce() => $_clearField(7); -} - -/// plaintext message send to the server -class UpdateGroupState extends $pb.GeneratedMessage { - factory UpdateGroupState({ - UpdateGroupState_UpdateTBS? update, - $core.List<$core.int>? signature, - }) { - final result = create(); - if (update != null) result.update = update; - if (signature != null) result.signature = signature; - return result; - } - - UpdateGroupState._(); - - factory UpdateGroupState.fromBuffer($core.List<$core.int> data, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(data, registry); - factory UpdateGroupState.fromJson($core.String json, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(json, registry); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - _omitMessageNames ? '' : 'UpdateGroupState', - package: const $pb.PackageName(_omitMessageNames ? '' : 'http_requests'), - createEmptyInstance: create) - ..aOM(1, _omitFieldNames ? '' : 'update', - subBuilder: UpdateGroupState_UpdateTBS.create) - ..a<$core.List<$core.int>>( - 2, _omitFieldNames ? '' : 'signature', $pb.PbFieldType.OY) - ..hasRequiredFields = false; - - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - UpdateGroupState clone() => deepCopy(); - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - UpdateGroupState copyWith(void Function(UpdateGroupState) updates) => - super.copyWith((message) => updates(message as UpdateGroupState)) - as UpdateGroupState; - - @$core.override - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static UpdateGroupState create() => UpdateGroupState._(); - @$core.override - UpdateGroupState createEmptyInstance() => create(); - @$core.pragma('dart2js:noInline') - static UpdateGroupState getDefault() => _defaultInstance ??= - $pb.GeneratedMessage.$_defaultFor(create); - static UpdateGroupState? _defaultInstance; - - @$pb.TagNumber(1) - UpdateGroupState_UpdateTBS get update => $_getN(0); - @$pb.TagNumber(1) - set update(UpdateGroupState_UpdateTBS value) => $_setField(1, value); - @$pb.TagNumber(1) - $core.bool hasUpdate() => $_has(0); - @$pb.TagNumber(1) - void clearUpdate() => $_clearField(1); - @$pb.TagNumber(1) - UpdateGroupState_UpdateTBS ensureUpdate() => $_ensure(0); - - @$pb.TagNumber(2) - $core.List<$core.int> get signature => $_getN(1); - @$pb.TagNumber(2) - set signature($core.List<$core.int> value) => $_setBytes(1, value); - @$pb.TagNumber(2) - $core.bool hasSignature() => $_has(1); - @$pb.TagNumber(2) - void clearSignature() => $_clearField(2); -} - -class NewGroupState extends $pb.GeneratedMessage { - factory NewGroupState({ - $core.String? groupId, - $fixnum.Int64? versionId, - $core.List<$core.int>? encryptedGroupState, - $core.List<$core.int>? publicKey, - }) { - final result = create(); - if (groupId != null) result.groupId = groupId; - if (versionId != null) result.versionId = versionId; - if (encryptedGroupState != null) - result.encryptedGroupState = encryptedGroupState; - if (publicKey != null) result.publicKey = publicKey; - return result; - } - - NewGroupState._(); - - factory NewGroupState.fromBuffer($core.List<$core.int> data, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(data, registry); - factory NewGroupState.fromJson($core.String json, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(json, registry); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - _omitMessageNames ? '' : 'NewGroupState', - package: const $pb.PackageName(_omitMessageNames ? '' : 'http_requests'), - createEmptyInstance: create) - ..aOS(1, _omitFieldNames ? '' : 'groupId') - ..a<$fixnum.Int64>( - 2, _omitFieldNames ? '' : 'versionId', $pb.PbFieldType.OU6, - defaultOrMaker: $fixnum.Int64.ZERO) - ..a<$core.List<$core.int>>( - 3, _omitFieldNames ? '' : 'encryptedGroupState', $pb.PbFieldType.OY) - ..a<$core.List<$core.int>>( - 4, _omitFieldNames ? '' : 'publicKey', $pb.PbFieldType.OY) - ..hasRequiredFields = false; - - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - NewGroupState clone() => deepCopy(); - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - NewGroupState copyWith(void Function(NewGroupState) updates) => - super.copyWith((message) => updates(message as NewGroupState)) - as NewGroupState; - - @$core.override - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static NewGroupState create() => NewGroupState._(); - @$core.override - NewGroupState createEmptyInstance() => create(); - @$core.pragma('dart2js:noInline') - static NewGroupState getDefault() => _defaultInstance ??= - $pb.GeneratedMessage.$_defaultFor(create); - static NewGroupState? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get groupId => $_getSZ(0); - @$pb.TagNumber(1) - set groupId($core.String value) => $_setString(0, value); - @$pb.TagNumber(1) - $core.bool hasGroupId() => $_has(0); - @$pb.TagNumber(1) - void clearGroupId() => $_clearField(1); - - @$pb.TagNumber(2) - $fixnum.Int64 get versionId => $_getI64(1); - @$pb.TagNumber(2) - set versionId($fixnum.Int64 value) => $_setInt64(1, value); - @$pb.TagNumber(2) - $core.bool hasVersionId() => $_has(1); - @$pb.TagNumber(2) - void clearVersionId() => $_clearField(2); - - @$pb.TagNumber(3) - $core.List<$core.int> get encryptedGroupState => $_getN(2); - @$pb.TagNumber(3) - set encryptedGroupState($core.List<$core.int> value) => $_setBytes(2, value); - @$pb.TagNumber(3) - $core.bool hasEncryptedGroupState() => $_has(2); - @$pb.TagNumber(3) - void clearEncryptedGroupState() => $_clearField(3); - - @$pb.TagNumber(4) - $core.List<$core.int> get publicKey => $_getN(3); - @$pb.TagNumber(4) - set publicKey($core.List<$core.int> value) => $_setBytes(3, value); - @$pb.TagNumber(4) - $core.bool hasPublicKey() => $_has(3); - @$pb.TagNumber(4) - void clearPublicKey() => $_clearField(4); -} - -class AppendGroupState_AppendTBS extends $pb.GeneratedMessage { - factory AppendGroupState_AppendTBS({ - $core.List<$core.int>? encryptedGroupStateAppend, - $core.List<$core.int>? publicKey, - $core.String? groupId, - $core.List<$core.int>? nonce, - }) { - final result = create(); - if (encryptedGroupStateAppend != null) - result.encryptedGroupStateAppend = encryptedGroupStateAppend; - if (publicKey != null) result.publicKey = publicKey; - if (groupId != null) result.groupId = groupId; - if (nonce != null) result.nonce = nonce; - return result; - } - - AppendGroupState_AppendTBS._(); - - factory AppendGroupState_AppendTBS.fromBuffer($core.List<$core.int> data, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(data, registry); - factory AppendGroupState_AppendTBS.fromJson($core.String json, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(json, registry); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - _omitMessageNames ? '' : 'AppendGroupState.AppendTBS', - package: const $pb.PackageName(_omitMessageNames ? '' : 'http_requests'), - createEmptyInstance: create) - ..a<$core.List<$core.int>>(1, - _omitFieldNames ? '' : 'encryptedGroupStateAppend', $pb.PbFieldType.OY) - ..a<$core.List<$core.int>>( - 2, _omitFieldNames ? '' : 'publicKey', $pb.PbFieldType.OY) - ..aOS(3, _omitFieldNames ? '' : 'groupId') - ..a<$core.List<$core.int>>( - 4, _omitFieldNames ? '' : 'nonce', $pb.PbFieldType.OY) - ..hasRequiredFields = false; - - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - AppendGroupState_AppendTBS clone() => deepCopy(); - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - AppendGroupState_AppendTBS copyWith( - void Function(AppendGroupState_AppendTBS) updates) => - super.copyWith( - (message) => updates(message as AppendGroupState_AppendTBS)) - as AppendGroupState_AppendTBS; - - @$core.override - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static AppendGroupState_AppendTBS create() => AppendGroupState_AppendTBS._(); - @$core.override - AppendGroupState_AppendTBS createEmptyInstance() => create(); - @$core.pragma('dart2js:noInline') - static AppendGroupState_AppendTBS getDefault() => _defaultInstance ??= - $pb.GeneratedMessage.$_defaultFor(create); - static AppendGroupState_AppendTBS? _defaultInstance; - - @$pb.TagNumber(1) - $core.List<$core.int> get encryptedGroupStateAppend => $_getN(0); - @$pb.TagNumber(1) - set encryptedGroupStateAppend($core.List<$core.int> value) => - $_setBytes(0, value); - @$pb.TagNumber(1) - $core.bool hasEncryptedGroupStateAppend() => $_has(0); - @$pb.TagNumber(1) - void clearEncryptedGroupStateAppend() => $_clearField(1); - - @$pb.TagNumber(2) - $core.List<$core.int> get publicKey => $_getN(1); - @$pb.TagNumber(2) - set publicKey($core.List<$core.int> value) => $_setBytes(1, value); - @$pb.TagNumber(2) - $core.bool hasPublicKey() => $_has(1); - @$pb.TagNumber(2) - void clearPublicKey() => $_clearField(2); - - @$pb.TagNumber(3) - $core.String get groupId => $_getSZ(2); - @$pb.TagNumber(3) - set groupId($core.String value) => $_setString(2, value); - @$pb.TagNumber(3) - $core.bool hasGroupId() => $_has(2); - @$pb.TagNumber(3) - void clearGroupId() => $_clearField(3); - - @$pb.TagNumber(4) - $core.List<$core.int> get nonce => $_getN(3); - @$pb.TagNumber(4) - set nonce($core.List<$core.int> value) => $_setBytes(3, value); - @$pb.TagNumber(4) - $core.bool hasNonce() => $_has(3); - @$pb.TagNumber(4) - void clearNonce() => $_clearField(4); -} - -class AppendGroupState extends $pb.GeneratedMessage { - factory AppendGroupState({ - $core.List<$core.int>? signature, - AppendGroupState_AppendTBS? appendTBS, - $fixnum.Int64? versionId, - }) { - final result = create(); - if (signature != null) result.signature = signature; - if (appendTBS != null) result.appendTBS = appendTBS; - if (versionId != null) result.versionId = versionId; - return result; - } - - AppendGroupState._(); - - factory AppendGroupState.fromBuffer($core.List<$core.int> data, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(data, registry); - factory AppendGroupState.fromJson($core.String json, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(json, registry); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - _omitMessageNames ? '' : 'AppendGroupState', - package: const $pb.PackageName(_omitMessageNames ? '' : 'http_requests'), - createEmptyInstance: create) - ..a<$core.List<$core.int>>( - 1, _omitFieldNames ? '' : 'signature', $pb.PbFieldType.OY) - ..aOM(2, _omitFieldNames ? '' : 'appendTBS', - protoName: 'appendTBS', subBuilder: AppendGroupState_AppendTBS.create) - ..a<$fixnum.Int64>( - 3, _omitFieldNames ? '' : 'versionId', $pb.PbFieldType.OU6, - protoName: 'versionId', defaultOrMaker: $fixnum.Int64.ZERO) - ..hasRequiredFields = false; - - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - AppendGroupState clone() => deepCopy(); - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - AppendGroupState copyWith(void Function(AppendGroupState) updates) => - super.copyWith((message) => updates(message as AppendGroupState)) - as AppendGroupState; - - @$core.override - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static AppendGroupState create() => AppendGroupState._(); - @$core.override - AppendGroupState createEmptyInstance() => create(); - @$core.pragma('dart2js:noInline') - static AppendGroupState getDefault() => _defaultInstance ??= - $pb.GeneratedMessage.$_defaultFor(create); - static AppendGroupState? _defaultInstance; - - @$pb.TagNumber(1) - $core.List<$core.int> get signature => $_getN(0); - @$pb.TagNumber(1) - set signature($core.List<$core.int> value) => $_setBytes(0, value); - @$pb.TagNumber(1) - $core.bool hasSignature() => $_has(0); - @$pb.TagNumber(1) - void clearSignature() => $_clearField(1); - - @$pb.TagNumber(2) - AppendGroupState_AppendTBS get appendTBS => $_getN(1); - @$pb.TagNumber(2) - set appendTBS(AppendGroupState_AppendTBS value) => $_setField(2, value); - @$pb.TagNumber(2) - $core.bool hasAppendTBS() => $_has(1); - @$pb.TagNumber(2) - void clearAppendTBS() => $_clearField(2); - @$pb.TagNumber(2) - AppendGroupState_AppendTBS ensureAppendTBS() => $_ensure(1); - - @$pb.TagNumber(3) - $fixnum.Int64 get versionId => $_getI64(2); - @$pb.TagNumber(3) - set versionId($fixnum.Int64 value) => $_setInt64(2, value); - @$pb.TagNumber(3) - $core.bool hasVersionId() => $_has(2); - @$pb.TagNumber(3) - void clearVersionId() => $_clearField(3); -} - -class GroupState extends $pb.GeneratedMessage { - factory GroupState({ - $fixnum.Int64? versionId, - $core.List<$core.int>? encryptedGroupState, - $core.Iterable? appendedGroupStates, - }) { - final result = create(); - if (versionId != null) result.versionId = versionId; - if (encryptedGroupState != null) - result.encryptedGroupState = encryptedGroupState; - if (appendedGroupStates != null) - result.appendedGroupStates.addAll(appendedGroupStates); - return result; - } - - GroupState._(); - - factory GroupState.fromBuffer($core.List<$core.int> data, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(data, registry); - factory GroupState.fromJson($core.String json, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(json, registry); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - _omitMessageNames ? '' : 'GroupState', - package: const $pb.PackageName(_omitMessageNames ? '' : 'http_requests'), - createEmptyInstance: create) - ..a<$fixnum.Int64>( - 1, _omitFieldNames ? '' : 'versionId', $pb.PbFieldType.OU6, - defaultOrMaker: $fixnum.Int64.ZERO) - ..a<$core.List<$core.int>>( - 2, _omitFieldNames ? '' : 'encryptedGroupState', $pb.PbFieldType.OY) - ..pPM(3, _omitFieldNames ? '' : 'appendedGroupStates', - subBuilder: AppendGroupState.create) - ..hasRequiredFields = false; - - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - GroupState clone() => deepCopy(); - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - GroupState copyWith(void Function(GroupState) updates) => - super.copyWith((message) => updates(message as GroupState)) as GroupState; - - @$core.override - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static GroupState create() => GroupState._(); - @$core.override - GroupState createEmptyInstance() => create(); - @$core.pragma('dart2js:noInline') - static GroupState getDefault() => _defaultInstance ??= - $pb.GeneratedMessage.$_defaultFor(create); - static GroupState? _defaultInstance; - - @$pb.TagNumber(1) - $fixnum.Int64 get versionId => $_getI64(0); - @$pb.TagNumber(1) - set versionId($fixnum.Int64 value) => $_setInt64(0, value); - @$pb.TagNumber(1) - $core.bool hasVersionId() => $_has(0); - @$pb.TagNumber(1) - void clearVersionId() => $_clearField(1); - - @$pb.TagNumber(2) - $core.List<$core.int> get encryptedGroupState => $_getN(1); - @$pb.TagNumber(2) - set encryptedGroupState($core.List<$core.int> value) => $_setBytes(1, value); - @$pb.TagNumber(2) - $core.bool hasEncryptedGroupState() => $_has(1); - @$pb.TagNumber(2) - void clearEncryptedGroupState() => $_clearField(2); - - @$pb.TagNumber(3) - $pb.PbList get appendedGroupStates => $_getList(2); -} - -/// this is just a database helper to store multiple appends -class AppendGroupStateHelper extends $pb.GeneratedMessage { - factory AppendGroupStateHelper({ - $core.Iterable? appendedGroupStates, - }) { - final result = create(); - if (appendedGroupStates != null) - result.appendedGroupStates.addAll(appendedGroupStates); - return result; - } - - AppendGroupStateHelper._(); - - factory AppendGroupStateHelper.fromBuffer($core.List<$core.int> data, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(data, registry); - factory AppendGroupStateHelper.fromJson($core.String json, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(json, registry); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - _omitMessageNames ? '' : 'AppendGroupStateHelper', - package: const $pb.PackageName(_omitMessageNames ? '' : 'http_requests'), - createEmptyInstance: create) - ..pPM(1, _omitFieldNames ? '' : 'appendedGroupStates', - subBuilder: AppendGroupState.create) - ..hasRequiredFields = false; - - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - AppendGroupStateHelper clone() => deepCopy(); - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - AppendGroupStateHelper copyWith( - void Function(AppendGroupStateHelper) updates) => - super.copyWith((message) => updates(message as AppendGroupStateHelper)) - as AppendGroupStateHelper; - - @$core.override - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static AppendGroupStateHelper create() => AppendGroupStateHelper._(); - @$core.override - AppendGroupStateHelper createEmptyInstance() => create(); - @$core.pragma('dart2js:noInline') - static AppendGroupStateHelper getDefault() => _defaultInstance ??= - $pb.GeneratedMessage.$_defaultFor(create); - static AppendGroupStateHelper? _defaultInstance; - - @$pb.TagNumber(1) - $pb.PbList get appendedGroupStates => $_getList(0); -} - const $core.bool _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); const $core.bool _omitMessageNames = diff --git a/lib/src/model/protobuf/client/generated/http_requests.pbjson.dart b/lib/src/model/protobuf/client/generated/http_requests.pbjson.dart index 33cc9ddd..eef1036e 100644 --- a/lib/src/model/protobuf/client/generated/http_requests.pbjson.dart +++ b/lib/src/model/protobuf/client/generated/http_requests.pbjson.dart @@ -64,232 +64,3 @@ final $typed_data.Uint8List uploadRequestDescriptor = $convert.base64Decode( 'cKD2Rvd25sb2FkX3Rva2VucxgCIAMoDFIOZG93bmxvYWRUb2tlbnMSSgoTbWVzc2FnZXNfb25f' 'c3VjY2VzcxgDIAMoCzIaLmh0dHBfcmVxdWVzdHMuVGV4dE1lc3NhZ2VSEW1lc3NhZ2VzT25TdW' 'NjZXNz'); - -@$core.Deprecated('Use sealedSenderMessageRequestDescriptor instead') -const SealedSenderMessageRequest$json = { - '1': 'SealedSenderMessageRequest', - '2': [ - {'1': 'recipient_user_id', '3': 1, '4': 1, '5': 3, '10': 'recipientUserId'}, - { - '1': 'sealed_sender_message', - '3': 2, - '4': 1, - '5': 12, - '10': 'sealedSenderMessage' - }, - { - '1': 'privacy_pass_token', - '3': 3, - '4': 1, - '5': 12, - '10': 'privacyPassToken' - }, - ], - '9': [ - {'1': 4, '2': 5}, - ], -}; - -/// Descriptor for `SealedSenderMessageRequest`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List sealedSenderMessageRequestDescriptor = $convert.base64Decode( - 'ChpTZWFsZWRTZW5kZXJNZXNzYWdlUmVxdWVzdBIqChFyZWNpcGllbnRfdXNlcl9pZBgBIAEoA1' - 'IPcmVjaXBpZW50VXNlcklkEjIKFXNlYWxlZF9zZW5kZXJfbWVzc2FnZRgCIAEoDFITc2VhbGVk' - 'U2VuZGVyTWVzc2FnZRIsChJwcml2YWN5X3Bhc3NfdG9rZW4YAyABKAxSEHByaXZhY3lQYXNzVG' - '9rZW5KBAgEEAU='); - -@$core.Deprecated('Use sealedSenderMessageResponseDescriptor instead') -const SealedSenderMessageResponse$json = { - '1': 'SealedSenderMessageResponse', - '2': [ - {'1': 'message_id', '3': 1, '4': 1, '5': 9, '10': 'messageId'}, - ], -}; - -/// Descriptor for `SealedSenderMessageResponse`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List sealedSenderMessageResponseDescriptor = - $convert.base64Decode( - 'ChtTZWFsZWRTZW5kZXJNZXNzYWdlUmVzcG9uc2USHQoKbWVzc2FnZV9pZBgBIAEoCVIJbWVzc2' - 'FnZUlk'); - -@$core.Deprecated('Use updateGroupStateDescriptor instead') -const UpdateGroupState$json = { - '1': 'UpdateGroupState', - '2': [ - { - '1': 'update', - '3': 1, - '4': 1, - '5': 11, - '6': '.http_requests.UpdateGroupState.UpdateTBS', - '10': 'update' - }, - {'1': 'signature', '3': 2, '4': 1, '5': 12, '10': 'signature'}, - ], - '3': [UpdateGroupState_UpdateTBS$json], -}; - -@$core.Deprecated('Use updateGroupStateDescriptor instead') -const UpdateGroupState_UpdateTBS$json = { - '1': 'UpdateTBS', - '2': [ - {'1': 'version_id', '3': 1, '4': 1, '5': 4, '10': 'versionId'}, - { - '1': 'encrypted_group_state', - '3': 3, - '4': 1, - '5': 12, - '10': 'encryptedGroupState' - }, - {'1': 'public_key', '3': 4, '4': 1, '5': 12, '10': 'publicKey'}, - { - '1': 'remove_admin', - '3': 5, - '4': 1, - '5': 12, - '9': 0, - '10': 'removeAdmin', - '17': true - }, - { - '1': 'add_admin', - '3': 6, - '4': 1, - '5': 12, - '9': 1, - '10': 'addAdmin', - '17': true - }, - {'1': 'nonce', '3': 7, '4': 1, '5': 12, '10': 'nonce'}, - ], - '8': [ - {'1': '_remove_admin'}, - {'1': '_add_admin'}, - ], -}; - -/// Descriptor for `UpdateGroupState`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List updateGroupStateDescriptor = $convert.base64Decode( - 'ChBVcGRhdGVHcm91cFN0YXRlEkEKBnVwZGF0ZRgBIAEoCzIpLmh0dHBfcmVxdWVzdHMuVXBkYX' - 'RlR3JvdXBTdGF0ZS5VcGRhdGVUQlNSBnVwZGF0ZRIcCglzaWduYXR1cmUYAiABKAxSCXNpZ25h' - 'dHVyZRr8AQoJVXBkYXRlVEJTEh0KCnZlcnNpb25faWQYASABKARSCXZlcnNpb25JZBIyChVlbm' - 'NyeXB0ZWRfZ3JvdXBfc3RhdGUYAyABKAxSE2VuY3J5cHRlZEdyb3VwU3RhdGUSHQoKcHVibGlj' - 'X2tleRgEIAEoDFIJcHVibGljS2V5EiYKDHJlbW92ZV9hZG1pbhgFIAEoDEgAUgtyZW1vdmVBZG' - '1pbogBARIgCglhZGRfYWRtaW4YBiABKAxIAVIIYWRkQWRtaW6IAQESFAoFbm9uY2UYByABKAxS' - 'BW5vbmNlQg8KDV9yZW1vdmVfYWRtaW5CDAoKX2FkZF9hZG1pbg=='); - -@$core.Deprecated('Use newGroupStateDescriptor instead') -const NewGroupState$json = { - '1': 'NewGroupState', - '2': [ - {'1': 'group_id', '3': 1, '4': 1, '5': 9, '10': 'groupId'}, - {'1': 'version_id', '3': 2, '4': 1, '5': 4, '10': 'versionId'}, - { - '1': 'encrypted_group_state', - '3': 3, - '4': 1, - '5': 12, - '10': 'encryptedGroupState' - }, - {'1': 'public_key', '3': 4, '4': 1, '5': 12, '10': 'publicKey'}, - ], -}; - -/// Descriptor for `NewGroupState`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List newGroupStateDescriptor = $convert.base64Decode( - 'Cg1OZXdHcm91cFN0YXRlEhkKCGdyb3VwX2lkGAEgASgJUgdncm91cElkEh0KCnZlcnNpb25faW' - 'QYAiABKARSCXZlcnNpb25JZBIyChVlbmNyeXB0ZWRfZ3JvdXBfc3RhdGUYAyABKAxSE2VuY3J5' - 'cHRlZEdyb3VwU3RhdGUSHQoKcHVibGljX2tleRgEIAEoDFIJcHVibGljS2V5'); - -@$core.Deprecated('Use appendGroupStateDescriptor instead') -const AppendGroupState$json = { - '1': 'AppendGroupState', - '2': [ - {'1': 'signature', '3': 1, '4': 1, '5': 12, '10': 'signature'}, - { - '1': 'appendTBS', - '3': 2, - '4': 1, - '5': 11, - '6': '.http_requests.AppendGroupState.AppendTBS', - '10': 'appendTBS' - }, - {'1': 'versionId', '3': 3, '4': 1, '5': 4, '10': 'versionId'}, - ], - '3': [AppendGroupState_AppendTBS$json], -}; - -@$core.Deprecated('Use appendGroupStateDescriptor instead') -const AppendGroupState_AppendTBS$json = { - '1': 'AppendTBS', - '2': [ - { - '1': 'encrypted_group_state_append', - '3': 1, - '4': 1, - '5': 12, - '10': 'encryptedGroupStateAppend' - }, - {'1': 'public_key', '3': 2, '4': 1, '5': 12, '10': 'publicKey'}, - {'1': 'group_id', '3': 3, '4': 1, '5': 9, '10': 'groupId'}, - {'1': 'nonce', '3': 4, '4': 1, '5': 12, '10': 'nonce'}, - ], -}; - -/// Descriptor for `AppendGroupState`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List appendGroupStateDescriptor = $convert.base64Decode( - 'ChBBcHBlbmRHcm91cFN0YXRlEhwKCXNpZ25hdHVyZRgBIAEoDFIJc2lnbmF0dXJlEkcKCWFwcG' - 'VuZFRCUxgCIAEoCzIpLmh0dHBfcmVxdWVzdHMuQXBwZW5kR3JvdXBTdGF0ZS5BcHBlbmRUQlNS' - 'CWFwcGVuZFRCUxIcCgl2ZXJzaW9uSWQYAyABKARSCXZlcnNpb25JZBqcAQoJQXBwZW5kVEJTEj' - '8KHGVuY3J5cHRlZF9ncm91cF9zdGF0ZV9hcHBlbmQYASABKAxSGWVuY3J5cHRlZEdyb3VwU3Rh' - 'dGVBcHBlbmQSHQoKcHVibGljX2tleRgCIAEoDFIJcHVibGljS2V5EhkKCGdyb3VwX2lkGAMgAS' - 'gJUgdncm91cElkEhQKBW5vbmNlGAQgASgMUgVub25jZQ=='); - -@$core.Deprecated('Use groupStateDescriptor instead') -const GroupState$json = { - '1': 'GroupState', - '2': [ - {'1': 'version_id', '3': 1, '4': 1, '5': 4, '10': 'versionId'}, - { - '1': 'encrypted_group_state', - '3': 2, - '4': 1, - '5': 12, - '10': 'encryptedGroupState' - }, - { - '1': 'appended_group_states', - '3': 3, - '4': 3, - '5': 11, - '6': '.http_requests.AppendGroupState', - '10': 'appendedGroupStates' - }, - ], -}; - -/// Descriptor for `GroupState`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List groupStateDescriptor = $convert.base64Decode( - 'CgpHcm91cFN0YXRlEh0KCnZlcnNpb25faWQYASABKARSCXZlcnNpb25JZBIyChVlbmNyeXB0ZW' - 'RfZ3JvdXBfc3RhdGUYAiABKAxSE2VuY3J5cHRlZEdyb3VwU3RhdGUSUwoVYXBwZW5kZWRfZ3Jv' - 'dXBfc3RhdGVzGAMgAygLMh8uaHR0cF9yZXF1ZXN0cy5BcHBlbmRHcm91cFN0YXRlUhNhcHBlbm' - 'RlZEdyb3VwU3RhdGVz'); - -@$core.Deprecated('Use appendGroupStateHelperDescriptor instead') -const AppendGroupStateHelper$json = { - '1': 'AppendGroupStateHelper', - '2': [ - { - '1': 'appended_group_states', - '3': 1, - '4': 3, - '5': 11, - '6': '.http_requests.AppendGroupState', - '10': 'appendedGroupStates' - }, - ], -}; - -/// Descriptor for `AppendGroupStateHelper`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List appendGroupStateHelperDescriptor = $convert.base64Decode( - 'ChZBcHBlbmRHcm91cFN0YXRlSGVscGVyElMKFWFwcGVuZGVkX2dyb3VwX3N0YXRlcxgBIAMoCz' - 'IfLmh0dHBfcmVxdWVzdHMuQXBwZW5kR3JvdXBTdGF0ZVITYXBwZW5kZWRHcm91cFN0YXRlcw=='); diff --git a/lib/src/model/protobuf/client/generated/messages.pb.dart b/lib/src/model/protobuf/client/generated/messages.pb.dart index ee72b2fa..6c7043fc 100644 --- a/lib/src/model/protobuf/client/generated/messages.pb.dart +++ b/lib/src/model/protobuf/client/generated/messages.pb.dart @@ -21,565 +21,6 @@ export 'package:protobuf/protobuf.dart' show GeneratedMessageGenericExtensions; export 'messages.pbenum.dart'; -class EncryptedMessageEnvelope extends $pb.GeneratedMessage { - factory EncryptedMessageEnvelope({ - $core.List<$core.int>? ephemeralPublicKey, - $core.List<$core.int>? nonce, - $core.List<$core.int>? ciphertext, - }) { - final result = create(); - if (ephemeralPublicKey != null) - result.ephemeralPublicKey = ephemeralPublicKey; - if (nonce != null) result.nonce = nonce; - if (ciphertext != null) result.ciphertext = ciphertext; - return result; - } - - EncryptedMessageEnvelope._(); - - factory EncryptedMessageEnvelope.fromBuffer($core.List<$core.int> data, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(data, registry); - factory EncryptedMessageEnvelope.fromJson($core.String json, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(json, registry); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - _omitMessageNames ? '' : 'EncryptedMessageEnvelope', - createEmptyInstance: create) - ..a<$core.List<$core.int>>( - 1, _omitFieldNames ? '' : 'ephemeralPublicKey', $pb.PbFieldType.OY) - ..a<$core.List<$core.int>>( - 2, _omitFieldNames ? '' : 'nonce', $pb.PbFieldType.OY) - ..a<$core.List<$core.int>>( - 3, _omitFieldNames ? '' : 'ciphertext', $pb.PbFieldType.OY) - ..hasRequiredFields = false; - - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - EncryptedMessageEnvelope clone() => deepCopy(); - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - EncryptedMessageEnvelope copyWith( - void Function(EncryptedMessageEnvelope) updates) => - super.copyWith((message) => updates(message as EncryptedMessageEnvelope)) - as EncryptedMessageEnvelope; - - @$core.override - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static EncryptedMessageEnvelope create() => EncryptedMessageEnvelope._(); - @$core.override - EncryptedMessageEnvelope createEmptyInstance() => create(); - @$core.pragma('dart2js:noInline') - static EncryptedMessageEnvelope getDefault() => _defaultInstance ??= - $pb.GeneratedMessage.$_defaultFor(create); - static EncryptedMessageEnvelope? _defaultInstance; - - /// Fresh 32-byte X25519 public key generated for this envelope. The sender - /// derives the encryption key from this ephemeral key pair and the recipient's - /// public identity key using HKDF-SHA-256 with an empty salt and a 32-byte - /// output. HKDF info must be the UTF-8 bytes of - /// "twonly-message-envelope-encryption-v1" followed by ephemeral_public_key - /// and the recipient's serialized public identity key. - @$pb.TagNumber(1) - $core.List<$core.int> get ephemeralPublicKey => $_getN(0); - @$pb.TagNumber(1) - set ephemeralPublicKey($core.List<$core.int> value) => $_setBytes(0, value); - @$pb.TagNumber(1) - $core.bool hasEphemeralPublicKey() => $_has(0); - @$pb.TagNumber(1) - void clearEphemeralPublicKey() => $_clearField(1); - - /// Fresh 24-byte XChaCha20-Poly1305 nonce. - @$pb.TagNumber(2) - $core.List<$core.int> get nonce => $_getN(1); - @$pb.TagNumber(2) - set nonce($core.List<$core.int> value) => $_setBytes(1, value); - @$pb.TagNumber(2) - $core.bool hasNonce() => $_has(1); - @$pb.TagNumber(2) - void clearNonce() => $_clearField(2); - - /// Serialized MessageEnvelope encrypted with XChaCha20-Poly1305. This includes - /// the 16-byte Poly1305 authentication tag. The AEAD associated data is exactly - /// the UTF-8 bytes of "twonly-message-envelope-encryption-v1". - @$pb.TagNumber(3) - $core.List<$core.int> get ciphertext => $_getN(2); - @$pb.TagNumber(3) - set ciphertext($core.List<$core.int> value) => $_setBytes(2, value); - @$pb.TagNumber(3) - $core.bool hasCiphertext() => $_has(2); - @$pb.TagNumber(3) - void clearCiphertext() => $_clearField(3); -} - -class MessageEnvelope extends $pb.GeneratedMessage { - factory MessageEnvelope({ - $core.List<$core.int>? signedPayload, - $core.List<$core.int>? signature, - }) { - final result = create(); - if (signedPayload != null) result.signedPayload = signedPayload; - if (signature != null) result.signature = signature; - return result; - } - - MessageEnvelope._(); - - factory MessageEnvelope.fromBuffer($core.List<$core.int> data, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(data, registry); - factory MessageEnvelope.fromJson($core.String json, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(json, registry); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - _omitMessageNames ? '' : 'MessageEnvelope', - createEmptyInstance: create) - ..a<$core.List<$core.int>>( - 1, _omitFieldNames ? '' : 'signedPayload', $pb.PbFieldType.OY) - ..a<$core.List<$core.int>>( - 2, _omitFieldNames ? '' : 'signature', $pb.PbFieldType.OY) - ..hasRequiredFields = false; - - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - MessageEnvelope clone() => deepCopy(); - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - MessageEnvelope copyWith(void Function(MessageEnvelope) updates) => - super.copyWith((message) => updates(message as MessageEnvelope)) - as MessageEnvelope; - - @$core.override - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static MessageEnvelope create() => MessageEnvelope._(); - @$core.override - MessageEnvelope createEmptyInstance() => create(); - @$core.pragma('dart2js:noInline') - static MessageEnvelope getDefault() => _defaultInstance ??= - $pb.GeneratedMessage.$_defaultFor(create); - static MessageEnvelope? _defaultInstance; - - /// Exact serialized MessageEnvelopePayload bytes. The signature is calculated - /// directly over these bytes. Keeping the serialized payload allows verification - /// without relying on canonical protobuf serialization. - @$pb.TagNumber(1) - $core.List<$core.int> get signedPayload => $_getN(0); - @$pb.TagNumber(1) - set signedPayload($core.List<$core.int> value) => $_setBytes(0, value); - @$pb.TagNumber(1) - $core.bool hasSignedPayload() => $_has(0); - @$pb.TagNumber(1) - void clearSignedPayload() => $_clearField(1); - - /// Signature created with the sender's identity key. For a known contact, use - /// the pinned public identity key. For an unknown sender, fetch the public key - /// from the trusted server, verify this signature, and only then pin the key and - /// process the raw message. - @$pb.TagNumber(2) - $core.List<$core.int> get signature => $_getN(1); - @$pb.TagNumber(2) - set signature($core.List<$core.int> value) => $_setBytes(1, value); - @$pb.TagNumber(2) - $core.bool hasSignature() => $_has(1); - @$pb.TagNumber(2) - void clearSignature() => $_clearField(2); -} - -class MessageEnvelopePayload extends $pb.GeneratedMessage { - factory MessageEnvelopePayload({ - $core.String? magic, - $fixnum.Int64? fromUserId, - $fixnum.Int64? recipientUserId, - Message? message, - $fixnum.Int64? createdAtUnixSeconds, - }) { - final result = create(); - if (magic != null) result.magic = magic; - if (fromUserId != null) result.fromUserId = fromUserId; - if (recipientUserId != null) result.recipientUserId = recipientUserId; - if (message != null) result.message = message; - if (createdAtUnixSeconds != null) - result.createdAtUnixSeconds = createdAtUnixSeconds; - return result; - } - - MessageEnvelopePayload._(); - - factory MessageEnvelopePayload.fromBuffer($core.List<$core.int> data, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(data, registry); - factory MessageEnvelopePayload.fromJson($core.String json, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(json, registry); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - _omitMessageNames ? '' : 'MessageEnvelopePayload', - createEmptyInstance: create) - ..aOS(1, _omitFieldNames ? '' : 'magic') - ..aInt64(2, _omitFieldNames ? '' : 'fromUserId') - ..aInt64(3, _omitFieldNames ? '' : 'recipientUserId') - ..aOM(4, _omitFieldNames ? '' : 'message', - subBuilder: Message.create) - ..aInt64(5, _omitFieldNames ? '' : 'createdAtUnixSeconds') - ..hasRequiredFields = false; - - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - MessageEnvelopePayload clone() => deepCopy(); - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - MessageEnvelopePayload copyWith( - void Function(MessageEnvelopePayload) updates) => - super.copyWith((message) => updates(message as MessageEnvelopePayload)) - as MessageEnvelopePayload; - - @$core.override - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static MessageEnvelopePayload create() => MessageEnvelopePayload._(); - @$core.override - MessageEnvelopePayload createEmptyInstance() => create(); - @$core.pragma('dart2js:noInline') - static MessageEnvelopePayload getDefault() => _defaultInstance ??= - $pb.GeneratedMessage.$_defaultFor(create); - static MessageEnvelopePayload? _defaultInstance; - - /// Domain-separation and protocol-version marker. The receiver must reject the - /// payload unless this is exactly "twonly-message-envelope-v1". - @$pb.TagNumber(1) - $core.String get magic => $_getSZ(0); - @$pb.TagNumber(1) - set magic($core.String value) => $_setString(0, value); - @$pb.TagNumber(1) - $core.bool hasMagic() => $_has(0); - @$pb.TagNumber(1) - void clearMagic() => $_clearField(1); - - /// The sender is protected by the encryption of the outer MessageEnvelope. - @$pb.TagNumber(2) - $fixnum.Int64 get fromUserId => $_getI64(1); - @$pb.TagNumber(2) - set fromUserId($fixnum.Int64 value) => $_setInt64(1, value); - @$pb.TagNumber(2) - $core.bool hasFromUserId() => $_has(1); - @$pb.TagNumber(2) - void clearFromUserId() => $_clearField(2); - - /// Bind the sender's signature to the intended recipient. This prevents a - /// recipient from re-encrypting a valid signed envelope for another user. The - /// binding is required because raw_message is not always a Signal ciphertext - /// and therefore is not always independently bound to a Signal session. The - /// receiver must reject an envelope when this ID does not match its own user ID. - @$pb.TagNumber(3) - $fixnum.Int64 get recipientUserId => $_getI64(2); - @$pb.TagNumber(3) - set recipientUserId($fixnum.Int64 value) => $_setInt64(2, value); - @$pb.TagNumber(3) - $core.bool hasRecipientUserId() => $_has(2); - @$pb.TagNumber(3) - void clearRecipientUserId() => $_clearField(3); - - /// The mandatory UUIDv4 receipt_id is covered by the envelope signature and is - /// used by the receiver to reject replayed messages before processing them. - @$pb.TagNumber(4) - Message get message => $_getN(3); - @$pb.TagNumber(4) - set message(Message value) => $_setField(4, value); - @$pb.TagNumber(4) - $core.bool hasMessage() => $_has(3); - @$pb.TagNumber(4) - void clearMessage() => $_clearField(4); - @$pb.TagNumber(4) - Message ensureMessage() => $_ensure(3); - - /// UTC Unix timestamp in seconds when the envelope was created. The receiver - /// must reject envelopes older than 45 days or more than five minutes in the - /// future. This field is covered by the envelope signature. - @$pb.TagNumber(5) - $fixnum.Int64 get createdAtUnixSeconds => $_getI64(4); - @$pb.TagNumber(5) - set createdAtUnixSeconds($fixnum.Int64 value) => $_setInt64(4, value); - @$pb.TagNumber(5) - $core.bool hasCreatedAtUnixSeconds() => $_has(4); - @$pb.TagNumber(5) - void clearCreatedAtUnixSeconds() => $_clearField(5); -} - -class Message extends $pb.GeneratedMessage { - factory Message({ - Message_Type? type, - $core.String? receiptId, - $core.List<$core.int>? encryptedContent, - PlaintextContent? plaintextContent, - }) { - final result = create(); - if (type != null) result.type = type; - if (receiptId != null) result.receiptId = receiptId; - if (encryptedContent != null) result.encryptedContent = encryptedContent; - if (plaintextContent != null) result.plaintextContent = plaintextContent; - return result; - } - - Message._(); - - factory Message.fromBuffer($core.List<$core.int> data, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(data, registry); - factory Message.fromJson($core.String json, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(json, registry); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - _omitMessageNames ? '' : 'Message', - createEmptyInstance: create) - ..aE(1, _omitFieldNames ? '' : 'type', - enumValues: Message_Type.values) - ..aOS(2, _omitFieldNames ? '' : 'receiptId') - ..a<$core.List<$core.int>>( - 3, _omitFieldNames ? '' : 'encryptedContent', $pb.PbFieldType.OY) - ..aOM(4, _omitFieldNames ? '' : 'plaintextContent', - subBuilder: PlaintextContent.create) - ..hasRequiredFields = false; - - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - Message clone() => deepCopy(); - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - Message copyWith(void Function(Message) updates) => - super.copyWith((message) => updates(message as Message)) as Message; - - @$core.override - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static Message create() => Message._(); - @$core.override - Message createEmptyInstance() => create(); - @$core.pragma('dart2js:noInline') - static Message getDefault() => - _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static Message? _defaultInstance; - - @$pb.TagNumber(1) - Message_Type get type => $_getN(0); - @$pb.TagNumber(1) - set type(Message_Type value) => $_setField(1, value); - @$pb.TagNumber(1) - $core.bool hasType() => $_has(0); - @$pb.TagNumber(1) - void clearType() => $_clearField(1); - - @$pb.TagNumber(2) - $core.String get receiptId => $_getSZ(1); - @$pb.TagNumber(2) - set receiptId($core.String value) => $_setString(1, value); - @$pb.TagNumber(2) - $core.bool hasReceiptId() => $_has(1); - @$pb.TagNumber(2) - void clearReceiptId() => $_clearField(2); - - @$pb.TagNumber(3) - $core.List<$core.int> get encryptedContent => $_getN(2); - @$pb.TagNumber(3) - set encryptedContent($core.List<$core.int> value) => $_setBytes(2, value); - @$pb.TagNumber(3) - $core.bool hasEncryptedContent() => $_has(2); - @$pb.TagNumber(3) - void clearEncryptedContent() => $_clearField(3); - - @$pb.TagNumber(4) - PlaintextContent get plaintextContent => $_getN(3); - @$pb.TagNumber(4) - set plaintextContent(PlaintextContent value) => $_setField(4, value); - @$pb.TagNumber(4) - $core.bool hasPlaintextContent() => $_has(3); - @$pb.TagNumber(4) - void clearPlaintextContent() => $_clearField(4); - @$pb.TagNumber(4) - PlaintextContent ensurePlaintextContent() => $_ensure(3); -} - -class PlaintextContent_RetryErrorMessage extends $pb.GeneratedMessage { - factory PlaintextContent_RetryErrorMessage() => create(); - - PlaintextContent_RetryErrorMessage._(); - - factory PlaintextContent_RetryErrorMessage.fromBuffer( - $core.List<$core.int> data, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(data, registry); - factory PlaintextContent_RetryErrorMessage.fromJson($core.String json, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(json, registry); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - _omitMessageNames ? '' : 'PlaintextContent.RetryErrorMessage', - createEmptyInstance: create) - ..hasRequiredFields = false; - - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - PlaintextContent_RetryErrorMessage clone() => deepCopy(); - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - PlaintextContent_RetryErrorMessage copyWith( - void Function(PlaintextContent_RetryErrorMessage) updates) => - super.copyWith((message) => - updates(message as PlaintextContent_RetryErrorMessage)) - as PlaintextContent_RetryErrorMessage; - - @$core.override - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static PlaintextContent_RetryErrorMessage create() => - PlaintextContent_RetryErrorMessage._(); - @$core.override - PlaintextContent_RetryErrorMessage createEmptyInstance() => create(); - @$core.pragma('dart2js:noInline') - static PlaintextContent_RetryErrorMessage getDefault() => _defaultInstance ??= - $pb.GeneratedMessage.$_defaultFor( - create); - static PlaintextContent_RetryErrorMessage? _defaultInstance; -} - -class PlaintextContent_DecryptionErrorMessage extends $pb.GeneratedMessage { - factory PlaintextContent_DecryptionErrorMessage({ - PlaintextContent_DecryptionErrorMessage_Type? type, - }) { - final result = create(); - if (type != null) result.type = type; - return result; - } - - PlaintextContent_DecryptionErrorMessage._(); - - factory PlaintextContent_DecryptionErrorMessage.fromBuffer( - $core.List<$core.int> data, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(data, registry); - factory PlaintextContent_DecryptionErrorMessage.fromJson($core.String json, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(json, registry); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - _omitMessageNames ? '' : 'PlaintextContent.DecryptionErrorMessage', - createEmptyInstance: create) - ..aE( - 1, _omitFieldNames ? '' : 'type', - enumValues: PlaintextContent_DecryptionErrorMessage_Type.values) - ..hasRequiredFields = false; - - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - PlaintextContent_DecryptionErrorMessage clone() => deepCopy(); - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - PlaintextContent_DecryptionErrorMessage copyWith( - void Function(PlaintextContent_DecryptionErrorMessage) updates) => - super.copyWith((message) => - updates(message as PlaintextContent_DecryptionErrorMessage)) - as PlaintextContent_DecryptionErrorMessage; - - @$core.override - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static PlaintextContent_DecryptionErrorMessage create() => - PlaintextContent_DecryptionErrorMessage._(); - @$core.override - PlaintextContent_DecryptionErrorMessage createEmptyInstance() => create(); - @$core.pragma('dart2js:noInline') - static PlaintextContent_DecryptionErrorMessage getDefault() => - _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor< - PlaintextContent_DecryptionErrorMessage>(create); - static PlaintextContent_DecryptionErrorMessage? _defaultInstance; - - @$pb.TagNumber(1) - PlaintextContent_DecryptionErrorMessage_Type get type => $_getN(0); - @$pb.TagNumber(1) - set type(PlaintextContent_DecryptionErrorMessage_Type value) => - $_setField(1, value); - @$pb.TagNumber(1) - $core.bool hasType() => $_has(0); - @$pb.TagNumber(1) - void clearType() => $_clearField(1); -} - -class PlaintextContent extends $pb.GeneratedMessage { - factory PlaintextContent({ - PlaintextContent_DecryptionErrorMessage? decryptionErrorMessage, - PlaintextContent_RetryErrorMessage? retryControlError, - }) { - final result = create(); - if (decryptionErrorMessage != null) - result.decryptionErrorMessage = decryptionErrorMessage; - if (retryControlError != null) result.retryControlError = retryControlError; - return result; - } - - PlaintextContent._(); - - factory PlaintextContent.fromBuffer($core.List<$core.int> data, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(data, registry); - factory PlaintextContent.fromJson($core.String json, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(json, registry); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - _omitMessageNames ? '' : 'PlaintextContent', - createEmptyInstance: create) - ..aOM( - 1, _omitFieldNames ? '' : 'decryptionErrorMessage', - subBuilder: PlaintextContent_DecryptionErrorMessage.create) - ..aOM( - 2, _omitFieldNames ? '' : 'retryControlError', - subBuilder: PlaintextContent_RetryErrorMessage.create) - ..hasRequiredFields = false; - - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - PlaintextContent clone() => deepCopy(); - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - PlaintextContent copyWith(void Function(PlaintextContent) updates) => - super.copyWith((message) => updates(message as PlaintextContent)) - as PlaintextContent; - - @$core.override - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static PlaintextContent create() => PlaintextContent._(); - @$core.override - PlaintextContent createEmptyInstance() => create(); - @$core.pragma('dart2js:noInline') - static PlaintextContent getDefault() => _defaultInstance ??= - $pb.GeneratedMessage.$_defaultFor(create); - static PlaintextContent? _defaultInstance; - - @$pb.TagNumber(1) - PlaintextContent_DecryptionErrorMessage get decryptionErrorMessage => - $_getN(0); - @$pb.TagNumber(1) - set decryptionErrorMessage(PlaintextContent_DecryptionErrorMessage value) => - $_setField(1, value); - @$pb.TagNumber(1) - $core.bool hasDecryptionErrorMessage() => $_has(0); - @$pb.TagNumber(1) - void clearDecryptionErrorMessage() => $_clearField(1); - @$pb.TagNumber(1) - PlaintextContent_DecryptionErrorMessage ensureDecryptionErrorMessage() => - $_ensure(0); - - @$pb.TagNumber(2) - PlaintextContent_RetryErrorMessage get retryControlError => $_getN(1); - @$pb.TagNumber(2) - set retryControlError(PlaintextContent_RetryErrorMessage value) => - $_setField(2, value); - @$pb.TagNumber(2) - $core.bool hasRetryControlError() => $_has(1); - @$pb.TagNumber(2) - void clearRetryControlError() => $_clearField(2); - @$pb.TagNumber(2) - PlaintextContent_RetryErrorMessage ensureRetryControlError() => $_ensure(1); -} - class EncryptedContent_ErrorMessages extends $pb.GeneratedMessage { factory EncryptedContent_ErrorMessages({ EncryptedContent_ErrorMessages_Type? type, diff --git a/lib/src/model/protobuf/client/generated/messages.pbenum.dart b/lib/src/model/protobuf/client/generated/messages.pbenum.dart index d2a36442..7ff4b706 100644 --- a/lib/src/model/protobuf/client/generated/messages.pbenum.dart +++ b/lib/src/model/protobuf/client/generated/messages.pbenum.dart @@ -14,60 +14,6 @@ import 'dart:core' as $core; import 'package:protobuf/protobuf.dart' as $pb; -class Message_Type extends $pb.ProtobufEnum { - static const Message_Type SENDER_DELIVERY_RECEIPT = - Message_Type._(0, _omitEnumNames ? '' : 'SENDER_DELIVERY_RECEIPT'); - static const Message_Type PLAINTEXT_CONTENT = - Message_Type._(1, _omitEnumNames ? '' : 'PLAINTEXT_CONTENT'); - static const Message_Type CIPHERTEXT = - Message_Type._(2, _omitEnumNames ? '' : 'CIPHERTEXT'); - static const Message_Type PREKEY_BUNDLE = - Message_Type._(3, _omitEnumNames ? '' : 'PREKEY_BUNDLE'); - static const Message_Type TEST_NOTIFICATION = - Message_Type._(4, _omitEnumNames ? '' : 'TEST_NOTIFICATION'); - static const Message_Type CIPHERTEXT_V2 = - Message_Type._(5, _omitEnumNames ? '' : 'CIPHERTEXT_V2'); - - static const $core.List values = [ - SENDER_DELIVERY_RECEIPT, - PLAINTEXT_CONTENT, - CIPHERTEXT, - PREKEY_BUNDLE, - TEST_NOTIFICATION, - CIPHERTEXT_V2, - ]; - - static final $core.List _byValue = - $pb.ProtobufEnum.$_initByValueList(values, 5); - static Message_Type? valueOf($core.int value) => - value < 0 || value >= _byValue.length ? null : _byValue[value]; - - const Message_Type._(super.value, super.name); -} - -class PlaintextContent_DecryptionErrorMessage_Type extends $pb.ProtobufEnum { - static const PlaintextContent_DecryptionErrorMessage_Type UNKNOWN = - PlaintextContent_DecryptionErrorMessage_Type._( - 0, _omitEnumNames ? '' : 'UNKNOWN'); - static const PlaintextContent_DecryptionErrorMessage_Type PREKEY_UNKNOWN = - PlaintextContent_DecryptionErrorMessage_Type._( - 1, _omitEnumNames ? '' : 'PREKEY_UNKNOWN'); - - static const $core.List values = - [ - UNKNOWN, - PREKEY_UNKNOWN, - ]; - - static final $core.List - _byValue = $pb.ProtobufEnum.$_initByValueList(values, 1); - static PlaintextContent_DecryptionErrorMessage_Type? valueOf( - $core.int value) => - value < 0 || value >= _byValue.length ? null : _byValue[value]; - - const PlaintextContent_DecryptionErrorMessage_Type._(super.value, super.name); -} - class EncryptedContent_ErrorMessages_Type extends $pb.ProtobufEnum { static const EncryptedContent_ErrorMessages_Type ERROR_PROCESSING_MESSAGE_CREATED_ACCOUNT_REQUEST_INSTEAD = diff --git a/lib/src/model/protobuf/client/generated/messages.pbjson.dart b/lib/src/model/protobuf/client/generated/messages.pbjson.dart index 4c4258f6..51481a50 100644 --- a/lib/src/model/protobuf/client/generated/messages.pbjson.dart +++ b/lib/src/model/protobuf/client/generated/messages.pbjson.dart @@ -15,199 +15,6 @@ import 'dart:convert' as $convert; import 'dart:core' as $core; import 'dart:typed_data' as $typed_data; -@$core.Deprecated('Use encryptedMessageEnvelopeDescriptor instead') -const EncryptedMessageEnvelope$json = { - '1': 'EncryptedMessageEnvelope', - '2': [ - { - '1': 'ephemeral_public_key', - '3': 1, - '4': 1, - '5': 12, - '10': 'ephemeralPublicKey' - }, - {'1': 'nonce', '3': 2, '4': 1, '5': 12, '10': 'nonce'}, - {'1': 'ciphertext', '3': 3, '4': 1, '5': 12, '10': 'ciphertext'}, - ], -}; - -/// Descriptor for `EncryptedMessageEnvelope`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List encryptedMessageEnvelopeDescriptor = $convert.base64Decode( - 'ChhFbmNyeXB0ZWRNZXNzYWdlRW52ZWxvcGUSMAoUZXBoZW1lcmFsX3B1YmxpY19rZXkYASABKA' - 'xSEmVwaGVtZXJhbFB1YmxpY0tleRIUCgVub25jZRgCIAEoDFIFbm9uY2USHgoKY2lwaGVydGV4' - 'dBgDIAEoDFIKY2lwaGVydGV4dA=='); - -@$core.Deprecated('Use messageEnvelopeDescriptor instead') -const MessageEnvelope$json = { - '1': 'MessageEnvelope', - '2': [ - {'1': 'signed_payload', '3': 1, '4': 1, '5': 12, '10': 'signedPayload'}, - {'1': 'signature', '3': 2, '4': 1, '5': 12, '10': 'signature'}, - ], -}; - -/// Descriptor for `MessageEnvelope`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List messageEnvelopeDescriptor = $convert.base64Decode( - 'Cg9NZXNzYWdlRW52ZWxvcGUSJQoOc2lnbmVkX3BheWxvYWQYASABKAxSDXNpZ25lZFBheWxvYW' - 'QSHAoJc2lnbmF0dXJlGAIgASgMUglzaWduYXR1cmU='); - -@$core.Deprecated('Use messageEnvelopePayloadDescriptor instead') -const MessageEnvelopePayload$json = { - '1': 'MessageEnvelopePayload', - '2': [ - {'1': 'magic', '3': 1, '4': 1, '5': 9, '10': 'magic'}, - {'1': 'from_user_id', '3': 2, '4': 1, '5': 3, '10': 'fromUserId'}, - {'1': 'recipient_user_id', '3': 3, '4': 1, '5': 3, '10': 'recipientUserId'}, - {'1': 'message', '3': 4, '4': 1, '5': 11, '6': '.Message', '10': 'message'}, - { - '1': 'created_at_unix_seconds', - '3': 5, - '4': 1, - '5': 3, - '10': 'createdAtUnixSeconds' - }, - ], -}; - -/// Descriptor for `MessageEnvelopePayload`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List messageEnvelopePayloadDescriptor = $convert.base64Decode( - 'ChZNZXNzYWdlRW52ZWxvcGVQYXlsb2FkEhQKBW1hZ2ljGAEgASgJUgVtYWdpYxIgCgxmcm9tX3' - 'VzZXJfaWQYAiABKANSCmZyb21Vc2VySWQSKgoRcmVjaXBpZW50X3VzZXJfaWQYAyABKANSD3Jl' - 'Y2lwaWVudFVzZXJJZBIiCgdtZXNzYWdlGAQgASgLMgguTWVzc2FnZVIHbWVzc2FnZRI1Chdjcm' - 'VhdGVkX2F0X3VuaXhfc2Vjb25kcxgFIAEoA1IUY3JlYXRlZEF0VW5peFNlY29uZHM='); - -@$core.Deprecated('Use messageDescriptor instead') -const Message$json = { - '1': 'Message', - '2': [ - {'1': 'type', '3': 1, '4': 1, '5': 14, '6': '.Message.Type', '10': 'type'}, - {'1': 'receipt_id', '3': 2, '4': 1, '5': 9, '10': 'receiptId'}, - { - '1': 'encrypted_content', - '3': 3, - '4': 1, - '5': 12, - '9': 0, - '10': 'encryptedContent', - '17': true - }, - { - '1': 'plaintext_content', - '3': 4, - '4': 1, - '5': 11, - '6': '.PlaintextContent', - '9': 1, - '10': 'plaintextContent', - '17': true - }, - ], - '4': [Message_Type$json], - '8': [ - {'1': '_encrypted_content'}, - {'1': '_plaintext_content'}, - ], -}; - -@$core.Deprecated('Use messageDescriptor instead') -const Message_Type$json = { - '1': 'Type', - '2': [ - {'1': 'SENDER_DELIVERY_RECEIPT', '2': 0}, - {'1': 'PLAINTEXT_CONTENT', '2': 1}, - {'1': 'CIPHERTEXT', '2': 2}, - {'1': 'PREKEY_BUNDLE', '2': 3}, - {'1': 'TEST_NOTIFICATION', '2': 4}, - {'1': 'CIPHERTEXT_V2', '2': 5}, - ], -}; - -/// Descriptor for `Message`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List messageDescriptor = $convert.base64Decode( - 'CgdNZXNzYWdlEiEKBHR5cGUYASABKA4yDS5NZXNzYWdlLlR5cGVSBHR5cGUSHQoKcmVjZWlwdF' - '9pZBgCIAEoCVIJcmVjZWlwdElkEjAKEWVuY3J5cHRlZF9jb250ZW50GAMgASgMSABSEGVuY3J5' - 'cHRlZENvbnRlbnSIAQESQwoRcGxhaW50ZXh0X2NvbnRlbnQYBCABKAsyES5QbGFpbnRleHRDb2' - '50ZW50SAFSEHBsYWludGV4dENvbnRlbnSIAQEihwEKBFR5cGUSGwoXU0VOREVSX0RFTElWRVJZ' - 'X1JFQ0VJUFQQABIVChFQTEFJTlRFWFRfQ09OVEVOVBABEg4KCkNJUEhFUlRFWFQQAhIRCg1QUk' - 'VLRVlfQlVORExFEAMSFQoRVEVTVF9OT1RJRklDQVRJT04QBBIRCg1DSVBIRVJURVhUX1YyEAVC' - 'FAoSX2VuY3J5cHRlZF9jb250ZW50QhQKEl9wbGFpbnRleHRfY29udGVudA=='); - -@$core.Deprecated('Use plaintextContentDescriptor instead') -const PlaintextContent$json = { - '1': 'PlaintextContent', - '2': [ - { - '1': 'decryption_error_message', - '3': 1, - '4': 1, - '5': 11, - '6': '.PlaintextContent.DecryptionErrorMessage', - '9': 0, - '10': 'decryptionErrorMessage', - '17': true - }, - { - '1': 'retry_control_error', - '3': 2, - '4': 1, - '5': 11, - '6': '.PlaintextContent.RetryErrorMessage', - '9': 1, - '10': 'retryControlError', - '17': true - }, - ], - '3': [ - PlaintextContent_RetryErrorMessage$json, - PlaintextContent_DecryptionErrorMessage$json - ], - '8': [ - {'1': '_decryption_error_message'}, - {'1': '_retry_control_error'}, - ], -}; - -@$core.Deprecated('Use plaintextContentDescriptor instead') -const PlaintextContent_RetryErrorMessage$json = { - '1': 'RetryErrorMessage', -}; - -@$core.Deprecated('Use plaintextContentDescriptor instead') -const PlaintextContent_DecryptionErrorMessage$json = { - '1': 'DecryptionErrorMessage', - '2': [ - { - '1': 'type', - '3': 1, - '4': 1, - '5': 14, - '6': '.PlaintextContent.DecryptionErrorMessage.Type', - '10': 'type' - }, - ], - '4': [PlaintextContent_DecryptionErrorMessage_Type$json], -}; - -@$core.Deprecated('Use plaintextContentDescriptor instead') -const PlaintextContent_DecryptionErrorMessage_Type$json = { - '1': 'Type', - '2': [ - {'1': 'UNKNOWN', '2': 0}, - {'1': 'PREKEY_UNKNOWN', '2': 1}, - ], -}; - -/// Descriptor for `PlaintextContent`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List plaintextContentDescriptor = $convert.base64Decode( - 'ChBQbGFpbnRleHRDb250ZW50EmcKGGRlY3J5cHRpb25fZXJyb3JfbWVzc2FnZRgBIAEoCzIoLl' - 'BsYWludGV4dENvbnRlbnQuRGVjcnlwdGlvbkVycm9yTWVzc2FnZUgAUhZkZWNyeXB0aW9uRXJy' - 'b3JNZXNzYWdliAEBElgKE3JldHJ5X2NvbnRyb2xfZXJyb3IYAiABKAsyIy5QbGFpbnRleHRDb2' - '50ZW50LlJldHJ5RXJyb3JNZXNzYWdlSAFSEXJldHJ5Q29udHJvbEVycm9yiAEBGhMKEVJldHJ5' - 'RXJyb3JNZXNzYWdlGoQBChZEZWNyeXB0aW9uRXJyb3JNZXNzYWdlEkEKBHR5cGUYASABKA4yLS' - '5QbGFpbnRleHRDb250ZW50LkRlY3J5cHRpb25FcnJvck1lc3NhZ2UuVHlwZVIEdHlwZSInCgRU' - 'eXBlEgsKB1VOS05PV04QABISCg5QUkVLRVlfVU5LTk9XThABQhsKGV9kZWNyeXB0aW9uX2Vycm' - '9yX21lc3NhZ2VCFgoUX3JldHJ5X2NvbnRyb2xfZXJyb3I='); - @$core.Deprecated('Use encryptedContentDescriptor instead') const EncryptedContent$json = { '1': 'EncryptedContent', diff --git a/lib/src/model/protobuf/client/generated/push_notification.pb.dart b/lib/src/model/protobuf/client/generated/push_notification.pb.dart deleted file mode 100644 index 009928ee..00000000 --- a/lib/src/model/protobuf/client/generated/push_notification.pb.dart +++ /dev/null @@ -1,418 +0,0 @@ -// This is a generated file - do not edit. -// -// Generated from push_notification.proto. - -// @dart = 3.3 - -// ignore_for_file: annotate_overrides, camel_case_types, comment_references -// ignore_for_file: constant_identifier_names -// ignore_for_file: curly_braces_in_flow_control_structures -// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes -// ignore_for_file: non_constant_identifier_names, prefer_relative_imports - -import 'dart:core' as $core; - -import 'package:fixnum/fixnum.dart' as $fixnum; -import 'package:protobuf/protobuf.dart' as $pb; - -import 'push_notification.pbenum.dart'; - -export 'package:protobuf/protobuf.dart' show GeneratedMessageGenericExtensions; - -export 'push_notification.pbenum.dart'; - -class EncryptedPushNotification extends $pb.GeneratedMessage { - factory EncryptedPushNotification({ - $fixnum.Int64? keyId, - $core.List<$core.int>? nonce, - $core.List<$core.int>? ciphertext, - $core.List<$core.int>? mac, - }) { - final result = create(); - if (keyId != null) result.keyId = keyId; - if (nonce != null) result.nonce = nonce; - if (ciphertext != null) result.ciphertext = ciphertext; - if (mac != null) result.mac = mac; - return result; - } - - EncryptedPushNotification._(); - - factory EncryptedPushNotification.fromBuffer($core.List<$core.int> data, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(data, registry); - factory EncryptedPushNotification.fromJson($core.String json, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(json, registry); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - _omitMessageNames ? '' : 'EncryptedPushNotification', - createEmptyInstance: create) - ..aInt64(1, _omitFieldNames ? '' : 'keyId') - ..a<$core.List<$core.int>>( - 2, _omitFieldNames ? '' : 'nonce', $pb.PbFieldType.OY) - ..a<$core.List<$core.int>>( - 3, _omitFieldNames ? '' : 'ciphertext', $pb.PbFieldType.OY) - ..a<$core.List<$core.int>>( - 4, _omitFieldNames ? '' : 'mac', $pb.PbFieldType.OY) - ..hasRequiredFields = false; - - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - EncryptedPushNotification clone() => deepCopy(); - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - EncryptedPushNotification copyWith( - void Function(EncryptedPushNotification) updates) => - super.copyWith((message) => updates(message as EncryptedPushNotification)) - as EncryptedPushNotification; - - @$core.override - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static EncryptedPushNotification create() => EncryptedPushNotification._(); - @$core.override - EncryptedPushNotification createEmptyInstance() => create(); - @$core.pragma('dart2js:noInline') - static EncryptedPushNotification getDefault() => _defaultInstance ??= - $pb.GeneratedMessage.$_defaultFor(create); - static EncryptedPushNotification? _defaultInstance; - - @$pb.TagNumber(1) - $fixnum.Int64 get keyId => $_getI64(0); - @$pb.TagNumber(1) - set keyId($fixnum.Int64 value) => $_setInt64(0, value); - @$pb.TagNumber(1) - $core.bool hasKeyId() => $_has(0); - @$pb.TagNumber(1) - void clearKeyId() => $_clearField(1); - - @$pb.TagNumber(2) - $core.List<$core.int> get nonce => $_getN(1); - @$pb.TagNumber(2) - set nonce($core.List<$core.int> value) => $_setBytes(1, value); - @$pb.TagNumber(2) - $core.bool hasNonce() => $_has(1); - @$pb.TagNumber(2) - void clearNonce() => $_clearField(2); - - @$pb.TagNumber(3) - $core.List<$core.int> get ciphertext => $_getN(2); - @$pb.TagNumber(3) - set ciphertext($core.List<$core.int> value) => $_setBytes(2, value); - @$pb.TagNumber(3) - $core.bool hasCiphertext() => $_has(2); - @$pb.TagNumber(3) - void clearCiphertext() => $_clearField(3); - - @$pb.TagNumber(4) - $core.List<$core.int> get mac => $_getN(3); - @$pb.TagNumber(4) - set mac($core.List<$core.int> value) => $_setBytes(3, value); - @$pb.TagNumber(4) - $core.bool hasMac() => $_has(3); - @$pb.TagNumber(4) - void clearMac() => $_clearField(4); -} - -class PushNotification extends $pb.GeneratedMessage { - factory PushNotification({ - PushKind? kind, - $core.String? messageId, - $core.String? additionalContent, - }) { - final result = create(); - if (kind != null) result.kind = kind; - if (messageId != null) result.messageId = messageId; - if (additionalContent != null) result.additionalContent = additionalContent; - return result; - } - - PushNotification._(); - - factory PushNotification.fromBuffer($core.List<$core.int> data, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(data, registry); - factory PushNotification.fromJson($core.String json, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(json, registry); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - _omitMessageNames ? '' : 'PushNotification', - createEmptyInstance: create) - ..aE(1, _omitFieldNames ? '' : 'kind', - enumValues: PushKind.values) - ..aOS(2, _omitFieldNames ? '' : 'messageId') - ..aOS(3, _omitFieldNames ? '' : 'additionalContent') - ..hasRequiredFields = false; - - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - PushNotification clone() => deepCopy(); - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - PushNotification copyWith(void Function(PushNotification) updates) => - super.copyWith((message) => updates(message as PushNotification)) - as PushNotification; - - @$core.override - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static PushNotification create() => PushNotification._(); - @$core.override - PushNotification createEmptyInstance() => create(); - @$core.pragma('dart2js:noInline') - static PushNotification getDefault() => _defaultInstance ??= - $pb.GeneratedMessage.$_defaultFor(create); - static PushNotification? _defaultInstance; - - @$pb.TagNumber(1) - PushKind get kind => $_getN(0); - @$pb.TagNumber(1) - set kind(PushKind value) => $_setField(1, value); - @$pb.TagNumber(1) - $core.bool hasKind() => $_has(0); - @$pb.TagNumber(1) - void clearKind() => $_clearField(1); - - @$pb.TagNumber(2) - $core.String get messageId => $_getSZ(1); - @$pb.TagNumber(2) - set messageId($core.String value) => $_setString(1, value); - @$pb.TagNumber(2) - $core.bool hasMessageId() => $_has(1); - @$pb.TagNumber(2) - void clearMessageId() => $_clearField(2); - - @$pb.TagNumber(3) - $core.String get additionalContent => $_getSZ(2); - @$pb.TagNumber(3) - set additionalContent($core.String value) => $_setString(2, value); - @$pb.TagNumber(3) - $core.bool hasAdditionalContent() => $_has(2); - @$pb.TagNumber(3) - void clearAdditionalContent() => $_clearField(3); -} - -class PushUsers extends $pb.GeneratedMessage { - factory PushUsers({ - $core.Iterable? users, - }) { - final result = create(); - if (users != null) result.users.addAll(users); - return result; - } - - PushUsers._(); - - factory PushUsers.fromBuffer($core.List<$core.int> data, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(data, registry); - factory PushUsers.fromJson($core.String json, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(json, registry); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - _omitMessageNames ? '' : 'PushUsers', - createEmptyInstance: create) - ..pPM(1, _omitFieldNames ? '' : 'users', - subBuilder: PushUser.create) - ..hasRequiredFields = false; - - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - PushUsers clone() => deepCopy(); - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - PushUsers copyWith(void Function(PushUsers) updates) => - super.copyWith((message) => updates(message as PushUsers)) as PushUsers; - - @$core.override - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static PushUsers create() => PushUsers._(); - @$core.override - PushUsers createEmptyInstance() => create(); - @$core.pragma('dart2js:noInline') - static PushUsers getDefault() => - _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static PushUsers? _defaultInstance; - - @$pb.TagNumber(1) - $pb.PbList get users => $_getList(0); -} - -class PushUser extends $pb.GeneratedMessage { - factory PushUser({ - $fixnum.Int64? userId, - $core.String? displayName, - $core.bool? blocked, - $core.String? lastMessageId, - $core.Iterable? pushKeys, - }) { - final result = create(); - if (userId != null) result.userId = userId; - if (displayName != null) result.displayName = displayName; - if (blocked != null) result.blocked = blocked; - if (lastMessageId != null) result.lastMessageId = lastMessageId; - if (pushKeys != null) result.pushKeys.addAll(pushKeys); - return result; - } - - PushUser._(); - - factory PushUser.fromBuffer($core.List<$core.int> data, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(data, registry); - factory PushUser.fromJson($core.String json, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(json, registry); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - _omitMessageNames ? '' : 'PushUser', - createEmptyInstance: create) - ..aInt64(1, _omitFieldNames ? '' : 'userId') - ..aOS(2, _omitFieldNames ? '' : 'displayName') - ..aOB(3, _omitFieldNames ? '' : 'blocked') - ..aOS(4, _omitFieldNames ? '' : 'lastMessageId') - ..pPM(5, _omitFieldNames ? '' : 'pushKeys', - subBuilder: PushKey.create) - ..hasRequiredFields = false; - - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - PushUser clone() => deepCopy(); - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - PushUser copyWith(void Function(PushUser) updates) => - super.copyWith((message) => updates(message as PushUser)) as PushUser; - - @$core.override - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static PushUser create() => PushUser._(); - @$core.override - PushUser createEmptyInstance() => create(); - @$core.pragma('dart2js:noInline') - static PushUser getDefault() => - _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static PushUser? _defaultInstance; - - @$pb.TagNumber(1) - $fixnum.Int64 get userId => $_getI64(0); - @$pb.TagNumber(1) - set userId($fixnum.Int64 value) => $_setInt64(0, value); - @$pb.TagNumber(1) - $core.bool hasUserId() => $_has(0); - @$pb.TagNumber(1) - void clearUserId() => $_clearField(1); - - @$pb.TagNumber(2) - $core.String get displayName => $_getSZ(1); - @$pb.TagNumber(2) - set displayName($core.String value) => $_setString(1, value); - @$pb.TagNumber(2) - $core.bool hasDisplayName() => $_has(1); - @$pb.TagNumber(2) - void clearDisplayName() => $_clearField(2); - - @$pb.TagNumber(3) - $core.bool get blocked => $_getBF(2); - @$pb.TagNumber(3) - set blocked($core.bool value) => $_setBool(2, value); - @$pb.TagNumber(3) - $core.bool hasBlocked() => $_has(2); - @$pb.TagNumber(3) - void clearBlocked() => $_clearField(3); - - @$pb.TagNumber(4) - $core.String get lastMessageId => $_getSZ(3); - @$pb.TagNumber(4) - set lastMessageId($core.String value) => $_setString(3, value); - @$pb.TagNumber(4) - $core.bool hasLastMessageId() => $_has(3); - @$pb.TagNumber(4) - void clearLastMessageId() => $_clearField(4); - - @$pb.TagNumber(5) - $pb.PbList get pushKeys => $_getList(4); -} - -class PushKey extends $pb.GeneratedMessage { - factory PushKey({ - $fixnum.Int64? id, - $core.List<$core.int>? key, - $fixnum.Int64? createdAtUnixTimestamp, - }) { - final result = create(); - if (id != null) result.id = id; - if (key != null) result.key = key; - if (createdAtUnixTimestamp != null) - result.createdAtUnixTimestamp = createdAtUnixTimestamp; - return result; - } - - PushKey._(); - - factory PushKey.fromBuffer($core.List<$core.int> data, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(data, registry); - factory PushKey.fromJson($core.String json, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(json, registry); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - _omitMessageNames ? '' : 'PushKey', - createEmptyInstance: create) - ..aInt64(1, _omitFieldNames ? '' : 'id') - ..a<$core.List<$core.int>>( - 2, _omitFieldNames ? '' : 'key', $pb.PbFieldType.OY) - ..aInt64(3, _omitFieldNames ? '' : 'createdAtUnixTimestamp') - ..hasRequiredFields = false; - - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - PushKey clone() => deepCopy(); - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - PushKey copyWith(void Function(PushKey) updates) => - super.copyWith((message) => updates(message as PushKey)) as PushKey; - - @$core.override - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static PushKey create() => PushKey._(); - @$core.override - PushKey createEmptyInstance() => create(); - @$core.pragma('dart2js:noInline') - static PushKey getDefault() => - _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static PushKey? _defaultInstance; - - @$pb.TagNumber(1) - $fixnum.Int64 get id => $_getI64(0); - @$pb.TagNumber(1) - set id($fixnum.Int64 value) => $_setInt64(0, value); - @$pb.TagNumber(1) - $core.bool hasId() => $_has(0); - @$pb.TagNumber(1) - void clearId() => $_clearField(1); - - @$pb.TagNumber(2) - $core.List<$core.int> get key => $_getN(1); - @$pb.TagNumber(2) - set key($core.List<$core.int> value) => $_setBytes(1, value); - @$pb.TagNumber(2) - $core.bool hasKey() => $_has(1); - @$pb.TagNumber(2) - void clearKey() => $_clearField(2); - - @$pb.TagNumber(3) - $fixnum.Int64 get createdAtUnixTimestamp => $_getI64(2); - @$pb.TagNumber(3) - set createdAtUnixTimestamp($fixnum.Int64 value) => $_setInt64(2, value); - @$pb.TagNumber(3) - $core.bool hasCreatedAtUnixTimestamp() => $_has(2); - @$pb.TagNumber(3) - void clearCreatedAtUnixTimestamp() => $_clearField(3); -} - -const $core.bool _omitFieldNames = - $core.bool.fromEnvironment('protobuf.omit_field_names'); -const $core.bool _omitMessageNames = - $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/lib/src/model/protobuf/client/generated/push_notification.pbenum.dart b/lib/src/model/protobuf/client/generated/push_notification.pbenum.dart deleted file mode 100644 index f205a976..00000000 --- a/lib/src/model/protobuf/client/generated/push_notification.pbenum.dart +++ /dev/null @@ -1,77 +0,0 @@ -// This is a generated file - do not edit. -// -// Generated from push_notification.proto. - -// @dart = 3.3 - -// ignore_for_file: annotate_overrides, camel_case_types, comment_references -// ignore_for_file: constant_identifier_names -// ignore_for_file: curly_braces_in_flow_control_structures -// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes -// ignore_for_file: non_constant_identifier_names, prefer_relative_imports - -import 'dart:core' as $core; - -import 'package:protobuf/protobuf.dart' as $pb; - -class PushKind extends $pb.ProtobufEnum { - static const PushKind REACTION = - PushKind._(0, _omitEnumNames ? '' : 'REACTION'); - static const PushKind RESPONSE = - PushKind._(1, _omitEnumNames ? '' : 'RESPONSE'); - static const PushKind TEXT = PushKind._(2, _omitEnumNames ? '' : 'TEXT'); - static const PushKind VIDEO = PushKind._(3, _omitEnumNames ? '' : 'VIDEO'); - static const PushKind TWONLY = PushKind._(4, _omitEnumNames ? '' : 'TWONLY'); - static const PushKind IMAGE = PushKind._(5, _omitEnumNames ? '' : 'IMAGE'); - static const PushKind CONTACT_REQUEST = - PushKind._(6, _omitEnumNames ? '' : 'CONTACT_REQUEST'); - static const PushKind ACCEPT_REQUEST = - PushKind._(7, _omitEnumNames ? '' : 'ACCEPT_REQUEST'); - static const PushKind STORED_MEDIA_FILE = - PushKind._(8, _omitEnumNames ? '' : 'STORED_MEDIA_FILE'); - static const PushKind TEST_NOTIFICATION = - PushKind._(9, _omitEnumNames ? '' : 'TEST_NOTIFICATION'); - static const PushKind REOPENED_MEDIA = - PushKind._(10, _omitEnumNames ? '' : 'REOPENED_MEDIA'); - static const PushKind REACTION_TO_VIDEO = - PushKind._(11, _omitEnumNames ? '' : 'REACTION_TO_VIDEO'); - static const PushKind REACTION_TO_TEXT = - PushKind._(12, _omitEnumNames ? '' : 'REACTION_TO_TEXT'); - static const PushKind REACTION_TO_IMAGE = - PushKind._(13, _omitEnumNames ? '' : 'REACTION_TO_IMAGE'); - static const PushKind REACTION_TO_AUDIO = - PushKind._(14, _omitEnumNames ? '' : 'REACTION_TO_AUDIO'); - static const PushKind ADDED_TO_GROUP = - PushKind._(15, _omitEnumNames ? '' : 'ADDED_TO_GROUP'); - static const PushKind AUDIO = PushKind._(16, _omitEnumNames ? '' : 'AUDIO'); - - static const $core.List values = [ - REACTION, - RESPONSE, - TEXT, - VIDEO, - TWONLY, - IMAGE, - CONTACT_REQUEST, - ACCEPT_REQUEST, - STORED_MEDIA_FILE, - TEST_NOTIFICATION, - REOPENED_MEDIA, - REACTION_TO_VIDEO, - REACTION_TO_TEXT, - REACTION_TO_IMAGE, - REACTION_TO_AUDIO, - ADDED_TO_GROUP, - AUDIO, - ]; - - static final $core.List _byValue = - $pb.ProtobufEnum.$_initByValueList(values, 16); - static PushKind? valueOf($core.int value) => - value < 0 || value >= _byValue.length ? null : _byValue[value]; - - const PushKind._(super.value, super.name); -} - -const $core.bool _omitEnumNames = - $core.bool.fromEnvironment('protobuf.omit_enum_names'); diff --git a/lib/src/model/protobuf/client/generated/push_notification.pbjson.dart b/lib/src/model/protobuf/client/generated/push_notification.pbjson.dart deleted file mode 100644 index 2baf2fd6..00000000 --- a/lib/src/model/protobuf/client/generated/push_notification.pbjson.dart +++ /dev/null @@ -1,173 +0,0 @@ -// This is a generated file - do not edit. -// -// Generated from push_notification.proto. - -// @dart = 3.3 - -// ignore_for_file: annotate_overrides, camel_case_types, comment_references -// ignore_for_file: constant_identifier_names -// ignore_for_file: curly_braces_in_flow_control_structures -// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes -// ignore_for_file: non_constant_identifier_names, prefer_relative_imports -// ignore_for_file: unused_import - -import 'dart:convert' as $convert; -import 'dart:core' as $core; -import 'dart:typed_data' as $typed_data; - -@$core.Deprecated('Use pushKindDescriptor instead') -const PushKind$json = { - '1': 'PushKind', - '2': [ - {'1': 'REACTION', '2': 0}, - {'1': 'RESPONSE', '2': 1}, - {'1': 'TEXT', '2': 2}, - {'1': 'VIDEO', '2': 3}, - {'1': 'TWONLY', '2': 4}, - {'1': 'IMAGE', '2': 5}, - {'1': 'CONTACT_REQUEST', '2': 6}, - {'1': 'ACCEPT_REQUEST', '2': 7}, - {'1': 'STORED_MEDIA_FILE', '2': 8}, - {'1': 'TEST_NOTIFICATION', '2': 9}, - {'1': 'REOPENED_MEDIA', '2': 10}, - {'1': 'REACTION_TO_VIDEO', '2': 11}, - {'1': 'REACTION_TO_TEXT', '2': 12}, - {'1': 'REACTION_TO_IMAGE', '2': 13}, - {'1': 'REACTION_TO_AUDIO', '2': 14}, - {'1': 'ADDED_TO_GROUP', '2': 15}, - {'1': 'AUDIO', '2': 16}, - ], -}; - -/// Descriptor for `PushKind`. Decode as a `google.protobuf.EnumDescriptorProto`. -final $typed_data.Uint8List pushKindDescriptor = $convert.base64Decode( - 'CghQdXNoS2luZBIMCghSRUFDVElPThAAEgwKCFJFU1BPTlNFEAESCAoEVEVYVBACEgkKBVZJRE' - 'VPEAMSCgoGVFdPTkxZEAQSCQoFSU1BR0UQBRITCg9DT05UQUNUX1JFUVVFU1QQBhISCg5BQ0NF' - 'UFRfUkVRVUVTVBAHEhUKEVNUT1JFRF9NRURJQV9GSUxFEAgSFQoRVEVTVF9OT1RJRklDQVRJT0' - '4QCRISCg5SRU9QRU5FRF9NRURJQRAKEhUKEVJFQUNUSU9OX1RPX1ZJREVPEAsSFAoQUkVBQ1RJ' - 'T05fVE9fVEVYVBAMEhUKEVJFQUNUSU9OX1RPX0lNQUdFEA0SFQoRUkVBQ1RJT05fVE9fQVVESU' - '8QDhISCg5BRERFRF9UT19HUk9VUBAPEgkKBUFVRElPEBA='); - -@$core.Deprecated('Use encryptedPushNotificationDescriptor instead') -const EncryptedPushNotification$json = { - '1': 'EncryptedPushNotification', - '2': [ - {'1': 'key_id', '3': 1, '4': 1, '5': 3, '10': 'keyId'}, - {'1': 'nonce', '3': 2, '4': 1, '5': 12, '10': 'nonce'}, - {'1': 'ciphertext', '3': 3, '4': 1, '5': 12, '10': 'ciphertext'}, - {'1': 'mac', '3': 4, '4': 1, '5': 12, '10': 'mac'}, - ], -}; - -/// Descriptor for `EncryptedPushNotification`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List encryptedPushNotificationDescriptor = $convert.base64Decode( - 'ChlFbmNyeXB0ZWRQdXNoTm90aWZpY2F0aW9uEhUKBmtleV9pZBgBIAEoA1IFa2V5SWQSFAoFbm' - '9uY2UYAiABKAxSBW5vbmNlEh4KCmNpcGhlcnRleHQYAyABKAxSCmNpcGhlcnRleHQSEAoDbWFj' - 'GAQgASgMUgNtYWM='); - -@$core.Deprecated('Use pushNotificationDescriptor instead') -const PushNotification$json = { - '1': 'PushNotification', - '2': [ - {'1': 'kind', '3': 1, '4': 1, '5': 14, '6': '.PushKind', '10': 'kind'}, - { - '1': 'message_id', - '3': 2, - '4': 1, - '5': 9, - '9': 0, - '10': 'messageId', - '17': true - }, - { - '1': 'additional_content', - '3': 3, - '4': 1, - '5': 9, - '9': 1, - '10': 'additionalContent', - '17': true - }, - ], - '8': [ - {'1': '_message_id'}, - {'1': '_additional_content'}, - ], -}; - -/// Descriptor for `PushNotification`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List pushNotificationDescriptor = $convert.base64Decode( - 'ChBQdXNoTm90aWZpY2F0aW9uEh0KBGtpbmQYASABKA4yCS5QdXNoS2luZFIEa2luZBIiCgptZX' - 'NzYWdlX2lkGAIgASgJSABSCW1lc3NhZ2VJZIgBARIyChJhZGRpdGlvbmFsX2NvbnRlbnQYAyAB' - 'KAlIAVIRYWRkaXRpb25hbENvbnRlbnSIAQFCDQoLX21lc3NhZ2VfaWRCFQoTX2FkZGl0aW9uYW' - 'xfY29udGVudA=='); - -@$core.Deprecated('Use pushUsersDescriptor instead') -const PushUsers$json = { - '1': 'PushUsers', - '2': [ - {'1': 'users', '3': 1, '4': 3, '5': 11, '6': '.PushUser', '10': 'users'}, - ], -}; - -/// Descriptor for `PushUsers`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List pushUsersDescriptor = $convert.base64Decode( - 'CglQdXNoVXNlcnMSHwoFdXNlcnMYASADKAsyCS5QdXNoVXNlclIFdXNlcnM='); - -@$core.Deprecated('Use pushUserDescriptor instead') -const PushUser$json = { - '1': 'PushUser', - '2': [ - {'1': 'user_id', '3': 1, '4': 1, '5': 3, '10': 'userId'}, - {'1': 'display_name', '3': 2, '4': 1, '5': 9, '10': 'displayName'}, - {'1': 'blocked', '3': 3, '4': 1, '5': 8, '10': 'blocked'}, - { - '1': 'last_message_id', - '3': 4, - '4': 1, - '5': 9, - '9': 0, - '10': 'lastMessageId', - '17': true - }, - { - '1': 'push_keys', - '3': 5, - '4': 3, - '5': 11, - '6': '.PushKey', - '10': 'pushKeys' - }, - ], - '8': [ - {'1': '_last_message_id'}, - ], -}; - -/// Descriptor for `PushUser`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List pushUserDescriptor = $convert.base64Decode( - 'CghQdXNoVXNlchIXCgd1c2VyX2lkGAEgASgDUgZ1c2VySWQSIQoMZGlzcGxheV9uYW1lGAIgAS' - 'gJUgtkaXNwbGF5TmFtZRIYCgdibG9ja2VkGAMgASgIUgdibG9ja2VkEisKD2xhc3RfbWVzc2Fn' - 'ZV9pZBgEIAEoCUgAUg1sYXN0TWVzc2FnZUlkiAEBEiUKCXB1c2hfa2V5cxgFIAMoCzIILlB1c2' - 'hLZXlSCHB1c2hLZXlzQhIKEF9sYXN0X21lc3NhZ2VfaWQ='); - -@$core.Deprecated('Use pushKeyDescriptor instead') -const PushKey$json = { - '1': 'PushKey', - '2': [ - {'1': 'id', '3': 1, '4': 1, '5': 3, '10': 'id'}, - {'1': 'key', '3': 2, '4': 1, '5': 12, '10': 'key'}, - { - '1': 'created_at_unix_timestamp', - '3': 3, - '4': 1, - '5': 3, - '10': 'createdAtUnixTimestamp' - }, - ], -}; - -/// Descriptor for `PushKey`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List pushKeyDescriptor = $convert.base64Decode( - 'CgdQdXNoS2V5Eg4KAmlkGAEgASgDUgJpZBIQCgNrZXkYAiABKAxSA2tleRI5ChljcmVhdGVkX2' - 'F0X3VuaXhfdGltZXN0YW1wGAMgASgDUhZjcmVhdGVkQXRVbml4VGltZXN0YW1w'); diff --git a/lib/src/model/protobuf/client/generated/push_notification.pbserver.dart b/lib/src/model/protobuf/client/generated/push_notification.pbserver.dart deleted file mode 100644 index 4dd1cedc..00000000 --- a/lib/src/model/protobuf/client/generated/push_notification.pbserver.dart +++ /dev/null @@ -1,13 +0,0 @@ -// -// Generated code. Do not modify. -// source: push_notification.proto -// -// @dart = 2.12 - -// ignore_for_file: annotate_overrides, camel_case_types, comment_references -// ignore_for_file: constant_identifier_names -// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes -// ignore_for_file: non_constant_identifier_names, prefer_final_fields -// ignore_for_file: unnecessary_import, unnecessary_this, unused_import - -export 'push_notification.pb.dart'; diff --git a/lib/src/model/protobuf/client/http_requests.proto b/lib/src/model/protobuf/client/http_requests.proto index 40ce0404..a3ed59ce 100644 --- a/lib/src/model/protobuf/client/http_requests.proto +++ b/lib/src/model/protobuf/client/http_requests.proto @@ -12,59 +12,3 @@ message UploadRequest { repeated bytes download_tokens = 2; repeated TextMessage messages_on_success = 3; } - -message SealedSenderMessageRequest { - reserved 4; - int64 recipient_user_id = 1; - bytes sealed_sender_message = 2; - bytes privacy_pass_token = 3; -} - -message SealedSenderMessageResponse { - string message_id = 1; -} - -// plaintext message send to the server -message UpdateGroupState { - message UpdateTBS { - uint64 version_id = 1; - bytes encrypted_group_state = 3; - bytes public_key = 4; - // public group key - optional bytes remove_admin = 5; - optional bytes add_admin = 6; - bytes nonce = 7; - } - UpdateTBS update = 1; - bytes signature = 2; -} - -message NewGroupState { - string group_id = 1; - uint64 version_id = 2; - bytes encrypted_group_state = 3; - bytes public_key = 4; -} - -message AppendGroupState { - message AppendTBS { - bytes encrypted_group_state_append = 1; - bytes public_key = 2; - string group_id = 3; - bytes nonce = 4; - } - bytes signature = 1; - AppendTBS appendTBS = 2; - uint64 versionId = 3; -} - -message GroupState { - uint64 version_id = 1; - bytes encrypted_group_state = 2; - repeated AppendGroupState appended_group_states = 3; -} - -// this is just a database helper to store multiple appends -message AppendGroupStateHelper { - repeated AppendGroupState appended_group_states = 1; -} diff --git a/lib/src/model/protobuf/client/push_notification.proto b/lib/src/model/protobuf/client/push_notification.proto deleted file mode 100644 index 61b0bc09..00000000 --- a/lib/src/model/protobuf/client/push_notification.proto +++ /dev/null @@ -1,52 +0,0 @@ -syntax = "proto3"; - -message EncryptedPushNotification { - int64 key_id = 1; - bytes nonce = 2; - bytes ciphertext = 3; - bytes mac = 4; -} - -enum PushKind { - REACTION = 0; - RESPONSE = 1; - TEXT = 2; - VIDEO = 3; - TWONLY = 4; - IMAGE = 5; - CONTACT_REQUEST = 6; - ACCEPT_REQUEST = 7; - STORED_MEDIA_FILE = 8; - TEST_NOTIFICATION = 9; - REOPENED_MEDIA = 10; - REACTION_TO_VIDEO = 11; - REACTION_TO_TEXT = 12; - REACTION_TO_IMAGE = 13; - REACTION_TO_AUDIO = 14; - ADDED_TO_GROUP = 15; - AUDIO = 16; -}; - -message PushNotification { - PushKind kind = 1; - optional string message_id = 2; - optional string additional_content = 3; -} - -message PushUsers { - repeated PushUser users = 1; -} - -message PushUser { - int64 user_id = 1; - string display_name = 2; - bool blocked = 3; - optional string last_message_id = 4; - repeated PushKey push_keys = 5; -} - -message PushKey { - int64 id = 1; - bytes key = 2; - int64 created_at_unix_timestamp = 3; -} \ No newline at end of file diff --git a/lib/src/services/api/utils.api.dart b/lib/src/services/api/utils.api.dart index 38023d31..68b7c257 100644 --- a/lib/src/services/api/utils.api.dart +++ b/lib/src/services/api/utils.api.dart @@ -6,8 +6,7 @@ import 'package:twonly/core/bridge/wrapper/key_manager.dart'; import 'package:twonly/locator.dart'; import 'package:twonly/src/database/tables/mediafiles.table.dart'; import 'package:twonly/src/database/twonly.db.dart'; -import 'package:twonly/src/model/protobuf/client/generated/messages.pbserver.dart' - hide Message; +import 'package:twonly/src/model/protobuf/client/generated/messages.pbserver.dart'; import 'package:twonly/src/utils/log.dart'; import 'package:twonly/src/utils/misc.dart'; import 'package:twonly/src/utils/secure_storage.dart'; diff --git a/lib/src/services/notifications/background.notifications.dart b/lib/src/services/notifications/background.notifications.dart index 63d607cc..8b436504 100644 --- a/lib/src/services/notifications/background.notifications.dart +++ b/lib/src/services/notifications/background.notifications.dart @@ -1,21 +1,7 @@ import 'dart:async'; -import 'dart:io'; import 'dart:math'; -import 'package:cryptography_flutter_plus/cryptography_flutter_plus.dart'; -import 'package:cryptography_plus/cryptography_plus.dart'; -import 'package:flutter/widgets.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart'; -import 'package:twonly/globals.dart'; -import 'package:twonly/locator.dart'; -import 'package:twonly/src/constants/routes.keys.dart'; -import 'package:twonly/src/localization/generated/app_localizations.dart'; -import 'package:twonly/src/localization/generated/app_localizations_de.dart'; -import 'package:twonly/src/localization/generated/app_localizations_en.dart'; -import 'package:twonly/src/model/protobuf/client/generated/push_notification.pb.dart'; -import 'package:twonly/src/providers/routing.provider.dart'; -import 'package:twonly/src/utils/log.dart'; -import 'package:twonly/src/utils/misc.dart'; final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); @@ -46,213 +32,3 @@ Future customLocalPushNotification(String title, String msg) async { notificationDetails, ); } - -Future tryDecryptMessage( - List key, - EncryptedPushNotification push, -) async { - try { - final chacha20 = FlutterChacha20.poly1305Aead(); - final secretKeyData = SecretKeyData(key); - - final secretBox = SecretBox( - push.ciphertext, - nonce: push.nonce, - mac: Mac(push.mac), - ); - - final plaintext = await chacha20.decrypt( - secretBox, - secretKey: secretKeyData, - ); - return PushNotification.fromBuffer(plaintext); - } catch (e) { - // this error is allowed to happen... - return null; - } -} - -Future showLocalPushNotification( - PushUser pushUser, - PushNotification pushNotification, { - String? groupId, - String? titleSuffix, -}) async { - String? title; - String? body; - - // do not show notification for blocked users... - if (pushUser.blocked) { - Log.info('Blocked a message from a blocked user!'); - return; - } - - var targetGroupId = groupId; - if (targetGroupId == null) { - try { - if (userService.isUserCreated) { - targetGroupId = getUUIDforDirectChat( - userService.currentUser.userId, - pushUser.userId.toInt(), - ); - } - } catch (_) {} - } - - if (targetGroupId != null) { - try { - final currentUri = routerProvider.routerDelegate.currentConfiguration.uri; - final isResumed = - WidgetsBinding.instance.lifecycleState == AppLifecycleState.resumed; - if (isResumed && currentUri.path.contains(targetGroupId)) { - Log.info( - 'Suppressing local push notification because chat with group $targetGroupId is currently open.', - ); - return; - } - } catch (e) { - Log.error('Error checking current route: $e'); - } - } - - title = pushUser.displayName; - if (titleSuffix != null && titleSuffix.isNotEmpty) { - title = '$title $titleSuffix'; - } - - body = getPushNotificationText(pushNotification); - if (body == '') { - Log.error('No push notification type defined!'); - } - - FilePathAndroidBitmap? styleInformation; - final avatarPath = await getAvatarIcon(pushUser.userId.toInt()); - if (avatarPath != null) { - styleInformation = FilePathAndroidBitmap(avatarPath); - } - - final lang = getLocalizations(); - - final androidNotificationDetails = AndroidNotificationDetails( - '0', - lang.notificationCategoryMessageTitle, - channelDescription: lang.notificationCategoryMessageDesc, - importance: Importance.max, - priority: Priority.max, - ticker: 'You got a new message.', - largeIcon: styleInformation, - icon: 'ic_launcher_foreground', - groupKey: 'com.twonly.messages', - ); - - const darwinNotificationDetails = DarwinNotificationDetails(); - final notificationDetails = NotificationDetails( - android: androidNotificationDetails, - iOS: darwinNotificationDetails, - ); - - String? payload; - - if (groupId != null && - (pushNotification.kind == PushKind.TEXT || - pushNotification.kind == PushKind.RESPONSE || - pushNotification.kind == PushKind.REACTION_TO_AUDIO || - pushNotification.kind == PushKind.STORED_MEDIA_FILE || - pushNotification.kind == PushKind.REACTION_TO_IMAGE || - pushNotification.kind == PushKind.REACTION_TO_TEXT || - pushNotification.kind == PushKind.REACTION_TO_VIDEO)) { - payload = Routes.chatsMessages(groupId); - } else { - payload = Routes.chats; - } - - await flutterLocalNotificationsPlugin.show( - // Invalid argument (id): must fit within the size of a 32-bit integer - pushUser.userId.toInt() % 2147483647, - title, - body, - notificationDetails, - payload: payload, - ); - - if (Platform.isAndroid) { - final summaryAndroidDetails = AndroidNotificationDetails( - '0', - lang.notificationCategoryMessageTitle, - channelDescription: lang.notificationCategoryMessageDesc, - importance: Importance.max, - priority: Priority.max, - groupKey: 'com.twonly.messages', - setAsGroupSummary: true, - icon: 'ic_launcher_foreground', - ); - final summaryNotificationDetails = NotificationDetails( - android: summaryAndroidDetails, - ); - await flutterLocalNotificationsPlugin.show( - 0, - lang.notificationCategoryMessageTitle, - '', - summaryNotificationDetails, - payload: Routes.chats, - ); - } -} - -Future getAvatarIcon(int contactId) async { - final avatarsDirectory = Directory('${AppEnvironment.cacheDir}/avatars'); - final filePath = '${avatarsDirectory.path}/$contactId.png'; - final file = File(filePath); - if (file.existsSync()) { - return filePath; - } - return null; -} - -AppLocalizations getLocalizations() { - final systemLanguage = Platform.localeName; - if (systemLanguage.contains('de')) return AppLocalizationsDe(); - return AppLocalizationsEn(); -} - -String getPushNotificationText(PushNotification pushNotification) { - final lang = getLocalizations(); - - var inGroup = ''; - - if (pushNotification.hasAdditionalContent()) { - inGroup = - ' ${lang.notificationFillerIn} ${pushNotification.additionalContent}'; - } - - final pushNotificationText = { - PushKind.TEXT.name: lang.notificationText(inGroup), - PushKind.TWONLY.name: lang.notificationTwonly(inGroup), - PushKind.VIDEO.name: lang.notificationVideo(inGroup), - PushKind.IMAGE.name: lang.notificationImage(inGroup), - PushKind.AUDIO.name: lang.notificationAudio(inGroup), - PushKind.CONTACT_REQUEST.name: lang.notificationContactRequest, - PushKind.ACCEPT_REQUEST.name: lang.notificationAcceptRequest, - PushKind.STORED_MEDIA_FILE.name: lang.notificationStoredMediaFile, - PushKind.REACTION.name: lang.notificationReaction, - PushKind.REOPENED_MEDIA.name: lang.notificationReopenedMedia, - PushKind.REACTION_TO_VIDEO.name: lang.notificationReactionToVideo( - pushNotification.additionalContent, - ), - PushKind.REACTION_TO_AUDIO.name: lang.notificationReactionToAudio( - pushNotification.additionalContent, - ), - PushKind.REACTION_TO_TEXT.name: lang.notificationReactionToText( - pushNotification.additionalContent, - ), - PushKind.REACTION_TO_IMAGE.name: lang.notificationReactionToImage( - pushNotification.additionalContent, - ), - PushKind.RESPONSE.name: lang.notificationResponse(inGroup), - PushKind.ADDED_TO_GROUP.name: lang.notificationAddedToGroup( - pushNotification.additionalContent, - ), - }; - - return pushNotificationText[pushNotification.kind.name] ?? ''; -} diff --git a/lib/src/visual/views/chats/chat_messages_components/entries/chat_media_entry.dart b/lib/src/visual/views/chats/chat_messages_components/entries/chat_media_entry.dart index 55653e82..dbbcc201 100644 --- a/lib/src/visual/views/chats/chat_messages_components/entries/chat_media_entry.dart +++ b/lib/src/visual/views/chats/chat_messages_components/entries/chat_media_entry.dart @@ -8,8 +8,7 @@ import 'package:twonly/src/database/tables/messages.table.dart'; import 'package:twonly/src/database/twonly.db.dart'; import 'package:twonly/src/model/memory_item.model.dart'; import 'package:twonly/src/model/protobuf/client/generated/data.pb.dart'; -import 'package:twonly/src/model/protobuf/client/generated/messages.pb.dart' - hide Message; +import 'package:twonly/src/model/protobuf/client/generated/messages.pb.dart'; import 'package:twonly/src/services/api/mediafiles/download.api.dart' as received; import 'package:twonly/src/services/mediafiles/mediafile.service.dart'; diff --git a/rust/build.rs b/rust/build.rs index d497f72e..778cbba7 100644 --- a/rust/build.rs +++ b/rust/build.rs @@ -26,17 +26,19 @@ fn main() -> Result<()> { .compile_protos(&websocket_protos, &[websocket_proto_root])?; prost_build::compile_protos(&["models/user_discovery.proto"], &["src/"])?; + let client_proto_root = "src/api/proto/client"; + let client_protos = [ + "src/api/proto/client/sealed_sender.proto", + "src/api/proto/client/groups.proto", + "src/api/proto/client/messages.proto", + "src/api/proto/client/data.proto", + ]; + for proto in &client_protos { + println!("cargo:rerun-if-changed={proto}"); + } prost_build::Config::new() .include_file("client_messages.rs") - .compile_protos( - &[ - "../lib/src/model/protobuf/client/messages.proto", - "../lib/src/model/protobuf/client/data.proto", - "../lib/src/model/protobuf/client/push_notification.proto", - "../lib/src/model/protobuf/client/groups.proto", - ], - &["../lib/src/model/protobuf/client/"], - )?; + .compile_protos(&client_protos, &[client_proto_root])?; prost_build::compile_protos( &["src/api/proto/api/http/http_requests.proto"], &["src/api/proto/"], diff --git a/lib/src/model/protobuf/client/data.proto b/rust/src/api/proto/client/data.proto similarity index 100% rename from lib/src/model/protobuf/client/data.proto rename to rust/src/api/proto/client/data.proto diff --git a/lib/src/model/protobuf/client/groups.proto b/rust/src/api/proto/client/groups.proto similarity index 99% rename from lib/src/model/protobuf/client/groups.proto rename to rust/src/api/proto/client/groups.proto index d4e370d5..28fc7e56 100644 --- a/lib/src/model/protobuf/client/groups.proto +++ b/rust/src/api/proto/client/groups.proto @@ -20,4 +20,4 @@ message EncryptedGroupStateEnvelop { bytes nonce = 1; bytes encrypted_group_state = 2; bytes mac = 3; -} \ No newline at end of file +} diff --git a/lib/src/model/protobuf/client/messages.proto b/rust/src/api/proto/client/messages.proto similarity index 64% rename from lib/src/model/protobuf/client/messages.proto rename to rust/src/api/proto/client/messages.proto index 1b48c29d..9962cf40 100644 --- a/lib/src/model/protobuf/client/messages.proto +++ b/rust/src/api/proto/client/messages.proto @@ -1,94 +1,5 @@ syntax = "proto3"; -message EncryptedMessageEnvelope { - // Fresh 32-byte X25519 public key generated for this envelope. The sender - // derives the encryption key from this ephemeral key pair and the recipient's - // public identity key using HKDF-SHA-256 with an empty salt and a 32-byte - // output. HKDF info must be the UTF-8 bytes of - // "twonly-message-envelope-encryption-v1" followed by ephemeral_public_key - // and the recipient's serialized public identity key. - bytes ephemeral_public_key = 1; - - // Fresh 24-byte XChaCha20-Poly1305 nonce. - bytes nonce = 2; - - // Serialized MessageEnvelope encrypted with XChaCha20-Poly1305. This includes - // the 16-byte Poly1305 authentication tag. The AEAD associated data is exactly - // the UTF-8 bytes of "twonly-message-envelope-encryption-v1". - bytes ciphertext = 3; -} - -message MessageEnvelope { - // The serialized MessageEnvelope is encrypted into EncryptedMessageEnvelope - // before it is sent to the server. - - // Exact serialized MessageEnvelopePayload bytes. The signature is calculated - // directly over these bytes. Keeping the serialized payload allows verification - // without relying on canonical protobuf serialization. - bytes signed_payload = 1; - - // Signature created with the sender's identity key. For a known contact, use - // the pinned public identity key. For an unknown sender, fetch the public key - // from the trusted server, verify this signature, and only then pin the key and - // process the raw message. - bytes signature = 2; -} - -message MessageEnvelopePayload { - // Domain-separation and protocol-version marker. The receiver must reject the - // payload unless this is exactly "twonly-message-envelope-v1". - string magic = 1; - - // The sender is protected by the encryption of the outer MessageEnvelope. - int64 from_user_id = 2; - - // Bind the sender's signature to the intended recipient. This prevents a - // recipient from re-encrypting a valid signed envelope for another user. The - // binding is required because raw_message is not always a Signal ciphertext - // and therefore is not always independently bound to a Signal session. The - // receiver must reject an envelope when this ID does not match its own user ID. - int64 recipient_user_id = 3; - - // The mandatory UUIDv4 receipt_id is covered by the envelope signature and is - // used by the receiver to reject replayed messages before processing them. - Message message = 4; - - // UTC Unix timestamp in seconds when the envelope was created. The receiver - // must reject envelopes older than 45 days or more than five minutes in the - // future. This field is covered by the envelope signature. - int64 created_at_unix_seconds = 5; -} - -message Message { - enum Type { - SENDER_DELIVERY_RECEIPT = 0; - PLAINTEXT_CONTENT = 1; - CIPHERTEXT = 2; - PREKEY_BUNDLE = 3; - TEST_NOTIFICATION = 4; - CIPHERTEXT_V2 = 5; - } - Type type = 1; - string receipt_id = 2; - optional bytes encrypted_content = 3; - optional PlaintextContent plaintext_content = 4; -} - -message PlaintextContent { - optional DecryptionErrorMessage decryption_error_message = 1; - optional RetryErrorMessage retry_control_error = 2; - - message RetryErrorMessage { } - - message DecryptionErrorMessage { - enum Type { - UNKNOWN = 0; - PREKEY_UNKNOWN = 1; - } - Type type = 1; - } -} - message EncryptedContent { optional string group_id = 2; diff --git a/rust/src/api/proto/client/sealed_sender.proto b/rust/src/api/proto/client/sealed_sender.proto new file mode 100644 index 00000000..9a0f8f03 --- /dev/null +++ b/rust/src/api/proto/client/sealed_sender.proto @@ -0,0 +1,90 @@ +syntax = "proto3"; + +message EncryptedMessageEnvelope { + // Fresh 32-byte X25519 public key generated for this envelope. The sender + // derives the encryption key from this ephemeral key pair and the recipient's + // public identity key using HKDF-SHA-256 with an empty salt and a 32-byte + // output. HKDF info must be the UTF-8 bytes of + // "twonly-message-envelope-encryption-v1" followed by ephemeral_public_key + // and the recipient's serialized public identity key. + bytes ephemeral_public_key = 1; + + // Fresh 24-byte XChaCha20-Poly1305 nonce. + bytes nonce = 2; + + // Serialized MessageEnvelope encrypted with XChaCha20-Poly1305. This includes + // the 16-byte Poly1305 authentication tag. The AEAD associated data is exactly + // the UTF-8 bytes of "twonly-message-envelope-encryption-v1". + bytes ciphertext = 3; +} + +message MessageEnvelope { + // The serialized MessageEnvelope is encrypted into EncryptedMessageEnvelope + // before it is sent to the server. + + // Exact serialized MessageEnvelopePayload bytes. The signature is calculated + // directly over these bytes. Keeping the serialized payload allows verification + // without relying on canonical protobuf serialization. + bytes signed_payload = 1; + + // Signature created with the sender's identity key. For a known contact, use + // the pinned public identity key. For an unknown sender, fetch the public key + // from the trusted server, verify this signature, and only then pin the key and + // process the raw message. + bytes signature = 2; +} + +message MessageEnvelopePayload { + // Domain-separation and protocol-version marker. The receiver must reject the + // payload unless this is exactly "twonly-message-envelope-v1". + string magic = 1; + + // The sender is protected by the encryption of the outer MessageEnvelope. + int64 from_user_id = 2; + + // Bind the sender's signature to the intended recipient. This prevents a + // recipient from re-encrypting a valid signed envelope for another user. The + // binding is required because raw_message is not always a Signal ciphertext + // and therefore is not always independently bound to a Signal session. The + // receiver must reject an envelope when this ID does not match its own user ID. + int64 recipient_user_id = 3; + + // The mandatory UUIDv4 receipt_id is covered by the envelope signature and is + // used by the receiver to reject replayed messages before processing them. + Message message = 4; + + // UTC Unix timestamp in seconds when the envelope was created. The receiver + // must reject envelopes older than 45 days or more than five minutes in the + // future. This field is covered by the envelope signature. + int64 created_at_unix_seconds = 5; +} + +message Message { + enum Type { + SENDER_DELIVERY_RECEIPT = 0; + PLAINTEXT_CONTENT = 1; + CIPHERTEXT = 2; + PREKEY_BUNDLE = 3; + TEST_NOTIFICATION = 4; + CIPHERTEXT_V2 = 5; + } + Type type = 1; + string receipt_id = 2; + optional bytes encrypted_content = 3; + optional PlaintextContent plaintext_content = 4; +} + +message PlaintextContent { + optional DecryptionErrorMessage decryption_error_message = 1; + optional RetryErrorMessage retry_control_error = 2; + + message RetryErrorMessage { } + + message DecryptionErrorMessage { + enum Type { + UNKNOWN = 0; + PREKEY_UNKNOWN = 1; + } + Type type = 1; + } +} diff --git a/test/mocks/test_client.dart b/test/mocks/test_client.dart index 69d6d16a..99112c78 100644 --- a/test/mocks/test_client.dart +++ b/test/mocks/test_client.dart @@ -1,15 +1,8 @@ import 'dart:async'; import 'dart:io'; -import 'package:collection/collection.dart'; -import 'package:drift/drift.dart' hide isNotNull, isNull; -import 'package:fixnum/fixnum.dart'; import 'package:flutter/foundation.dart'; import 'package:twonly/core/bridge/api.dart'; -import 'package:twonly/src/database/tables/messages.table.dart'; -import 'package:twonly/src/database/twonly.db.dart'; -import 'package:twonly/src/model/protobuf/client/generated/messages.pb.dart' - as pb; import 'package:twonly/src/services/api/api.service.dart'; import 'package:twonly/src/services/user.service.dart'; import 'package:twonly/src/utils/log.dart'; @@ -33,11 +26,11 @@ class TestClient { final timeStr = DateTime.now().millisecondsSinceEpoch.toString(); username = 't_${timeStr.substring(timeStr.length - 6)}$localIdSeed'; } + late final UserEnvironment env; late final ApiService api; final int localIdSeed; late String username; - Group? defaultGroup; int realUserId = 0; Future init({bool disablePqc = false}) async { @@ -82,207 +75,7 @@ class TestClient { }); } - Future initContact(TestClient other) async { - await run(() async { - await env.db.contactsDao.insertOnConflictUpdate( - ContactsCompanion.insert( - userId: Value(other.realUserId), - username: other.username, - accepted: const Value(true), - ), - ); - defaultGroup = await env.db.groupsDao.createNewDirectChat( - other.realUserId, - GroupsCompanion(groupName: Value(other.username)), - ); - - await RustApi.establishSignalSession(contactId: other.realUserId); - }); - } - Future run(Future Function() computation) { return runInZone(env, api, computation); } - - Future sendText(TestClient target, String text) async { - return run(() async { - final m = await env.db.messagesDao.insertMessage( - MessagesCompanion( - groupId: Value(defaultGroup!.groupId), - content: Value(text), - type: Value(MessageType.text.name), - ), - ); - await RustApi.sendEncryptedContent( - contactId: target.realUserId, - content: pb.EncryptedContent( - groupId: defaultGroup!.groupId, - textMessage: pb.EncryptedContent_TextMessage() - ..senderMessageId = m!.messageId - ..text = text, - ).writeToBuffer(), - messageId: m.messageId, - ); - return m; - }); - } - - Future sendEncryptedContent( - TestClient target, - pb.EncryptedContent content, - ) async { - await run(() async { - await RustApi.sendEncryptedContent( - contactId: target.realUserId, - content: content.writeToBuffer(), - ); - }); - } - - Future sendGroupJoin( - TestClient target, - String groupId, - List groupPublicKey, - ) async { - final content = pb.EncryptedContent() - ..groupId = groupId - ..groupJoin = (pb.EncryptedContent_GroupJoin() - ..groupPublicKey = groupPublicKey); - await sendEncryptedContent(target, content); - } - - Future sendResendGroupPublicKey( - TestClient target, - String groupId, - ) async { - final content = pb.EncryptedContent() - ..groupId = groupId - ..resendGroupPublicKey = pb.EncryptedContent_ResendGroupPublicKey(); - await sendEncryptedContent(target, content); - } - - Future sendErrorMessages( - TestClient target, - pb.EncryptedContent_ErrorMessages_Type type, - String receiptId, - ) async { - final content = pb.EncryptedContent() - ..errorMessages = (pb.EncryptedContent_ErrorMessages() - ..type = type - ..relatedReceiptId = receiptId); - await sendEncryptedContent(target, content); - } - - Future sendUserDiscoveryRequest( - TestClient target, - List version, - ) async { - final content = pb.EncryptedContent() - ..userDiscoveryRequest = (pb.EncryptedContent_UserDiscoveryRequest() - ..currentVersion = version); - await sendEncryptedContent(target, content); - } - - Future sendUserDiscoveryUpdate( - TestClient target, - List> messages, - ) async { - final content = pb.EncryptedContent() - ..userDiscoveryUpdate = (pb.EncryptedContent_UserDiscoveryUpdate() - ..messages.addAll(messages)); - await sendEncryptedContent(target, content); - } - - Future sendKeyVerificationProof( - TestClient target, - List mac, - ) async { - final content = pb.EncryptedContent() - ..keyVerificationProof = (pb.EncryptedContent_KeyVerificationProof() - ..calculatedMac = mac); - await sendEncryptedContent(target, content); - } - - Future sendDeliveryReceipt(TestClient target, String receiptId) async { - final msg = pb.Message() - ..type = pb.Message_Type.SENDER_DELIVERY_RECEIPT - ..receiptId = receiptId; - await RustApi.sendTextMessage( - userId: target.realUserId, - body: msg.writeToBuffer(), - ); - } - - Future sendReaction( - TestClient target, - String targetMessageId, - String emoji, { - bool remove = false, - }) async { - final content = pb.EncryptedContent() - ..groupId = defaultGroup!.groupId - ..reaction = (pb.EncryptedContent_Reaction() - ..targetMessageId = targetMessageId - ..emoji = emoji - ..remove = remove); - await sendEncryptedContent(target, content); - } - - Future sendMessageUpdate( - TestClient target, - String targetMessageId, - pb.EncryptedContent_MessageUpdate_Type type, { - String? text, - }) async { - final update = pb.EncryptedContent_MessageUpdate() - ..type = type - ..senderMessageId = targetMessageId - ..timestamp = Int64(DateTime.now().millisecondsSinceEpoch); - if (text != null) update.text = text; - final content = pb.EncryptedContent() - ..groupId = defaultGroup!.groupId - ..messageUpdate = update; - await sendEncryptedContent(target, content); - } - - Future sendMedia( - TestClient target, - String senderMessageId, - pb.EncryptedContent_Media_Type type, - ) async { - final content = pb.EncryptedContent() - ..groupId = defaultGroup!.groupId - ..media = (pb.EncryptedContent_Media() - ..senderMessageId = senderMessageId - ..type = type - ..requiresAuthentication = false - ..timestamp = Int64(DateTime.now().millisecondsSinceEpoch)); - await sendEncryptedContent(target, content); - } - - Future expectMessage(bool Function(Message) predicate) async { - for (var i = 0; i < 500; i++) { - final msg = await run(() async { - final msgs = await env.db.select(env.db.messages).get(); - return msgs.firstWhereOrNull(predicate); - }); - if (msg != null) return msg; - await Future.delayed(const Duration(milliseconds: 10)); - } - throw Exception('Message matching predicate not received'); - } - - Future expectReaction(String messageId, String emoji) async { - for (var i = 0; i < 500; i++) { - final reaction = await run(() async { - final reactions = await (env.db.select( - env.db.reactions, - )..where((t) => t.messageId.equals(messageId))).get(); - return reactions.firstWhereOrNull((r) => r.emoji == emoji); - }); - if (reaction != null) return reaction; - await Future.delayed(const Duration(milliseconds: 10)); - } - throw Exception('Reaction $emoji not received on message $messageId'); - } } diff --git a/test/mocks/workmanager.dart b/test/mocks/workmanager.dart deleted file mode 100644 index cca02a14..00000000 --- a/test/mocks/workmanager.dart +++ /dev/null @@ -1,29 +0,0 @@ -import 'package:workmanager_platform_interface/workmanager_platform_interface.dart'; - -class MockWorkmanagerPlatform extends WorkmanagerPlatform { - @override - Future initialize( - Function callbackDispatcher, { - bool isInDebugMode = false, - }) async {} - - @override - Future registerOneOffTask( - String uniqueName, - String taskName, { - Map? inputData, - Duration? initialDelay, - Constraints? constraints, - ExistingWorkPolicy? existingWorkPolicy, - BackoffPolicy? backoffPolicy, - Duration? backoffPolicyDelay, - String? tag, - OutOfQuotaPolicy? outOfQuotaPolicy, - }) async {} - - @override - Future cancelByUniqueName(String uniqueName) async {} - - @override - dynamic noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); -} diff --git a/test/services/api_and_c2c_test.dart b/test/services/api_and_c2c_test.dart deleted file mode 100644 index b443151f..00000000 --- a/test/services/api_and_c2c_test.dart +++ /dev/null @@ -1,242 +0,0 @@ -import 'dart:async'; -import 'dart:io'; - -import 'package:drift/drift.dart' hide isNotNull, isNull; -import 'package:flutter/services.dart'; -import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:twonly/core/bridge.dart' as bridge; -import 'package:twonly/core/frb_generated.dart'; -import 'package:twonly/globals.dart'; -import 'package:twonly/locator.dart'; -import 'package:twonly/src/callbacks/callbacks.dart'; -import 'package:twonly/src/database/tables/messages.table.dart'; -import 'package:twonly/src/database/twonly.db.dart'; -import 'package:twonly/src/model/protobuf/client/generated/messages.pb.dart' - as pb; -import 'package:twonly/src/services/api/api.service.dart'; -import 'package:twonly/src/services/user.service.dart'; -import 'package:workmanager/workmanager.dart'; - -import '../mocks/platform_channels.dart'; -import '../mocks/test_client.dart'; -import '../mocks/workmanager.dart'; - -void main() { - if (!Platform.isMacOS) { - return; - } - - TestWidgetsFlutterBinding.ensureInitialized(); - - late Directory tempDir; - - setUpAll(() async { - // Log.init(); - driftRuntimeOptions.dontWarnAboutMultipleDatabases = true; - WorkmanagerPlatform.instance = MockWorkmanagerPlatform(); - tempDir = Directory.systemTemp.createTempSync('twonly_messaging_test_'); - AppEnvironment.initTesting( - customCacheDir: tempDir.path, - customSupportDir: tempDir.path, - ); - - final dylibPath = - '${Directory.current.path}/rust/target/debug/librust_lib_twonly.dylib'; - if (File(dylibPath).existsSync()) { - await RustLib.init(externalLibrary: ExternalLibrary.open(dylibPath)); - } else { - await RustLib.init(); - } - await initFlutterCallbacksForRust(); - - await bridge.initializeTwonlyFlutter( - config: bridge.InitConfig( - databaseDir: tempDir.path, - dataDir: tempDir.path, - ), - ); - - if (locator.isRegistered()) await locator.unregister(); - if (locator.isRegistered()) { - await locator.unregister(); - } - if (locator.isRegistered()) { - await locator.unregister(); - } - - locator - ..registerFactory(() { - final db = Zone.current[#twonlyDB] as TwonlyDB?; - if (db != null) return db; - throw StateError('No TwonlyDB in active Zone.'); - }) - ..registerFactory(() { - final us = Zone.current[#userService] as UserService?; - if (us != null) return us; - throw StateError('No UserService in active Zone.'); - }) - ..registerFactory(() { - final api = Zone.current[#apiService] as ApiService?; - if (api != null) return api; - throw StateError('No ApiService in active Zone.'); - }); - }); - - tearDownAll(() async { - if (tempDir.existsSync()) { - try { - tempDir.deleteSync(recursive: true); - } catch (_) {} - } - }); - - group('C2C Messaging Protocol - Real API Stress Tests', () { - late TestClient clientA; - late TestClient clientB; - - setUp(() async { - setupPlatformChannelMocks(); - HttpOverrides.global = RealHttpOverrides(); - TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger - .setMockMethodCallHandler( - const MethodChannel('dev.fluttercommunity.plus/package_info'), - (call) async { - return { - 'appName': 'twonly', - 'packageName': 'eu.twonly.app', - 'version': '1.0.0', - 'buildNumber': '100', - }; - }, - ); - await Workmanager().initialize(() {}); - - clientA = TestClient(1001); - clientB = TestClient(2002); - - await clientA.init(); - await clientB.init(); - - await clientA.initContact(clientB); - await clientB.initContact(clientA); - }); - - tearDown(() async { - await clientA.run(() async => clientA.api.dispose()); - await clientB.run(() async => clientB.api.dispose()); - await clientA.env.db.close(); - await clientB.env.db.close(); - }); - - test('C2C: Text Message Send & Receive', () async { - const text = 'Hello User B!'; - await clientA.sendText(clientB, text); - - final receivedMsg = await clientB.expectMessage( - (m) => m.content == text && m.senderId == clientA.realUserId, - ); - - expect(receivedMsg.content, text); - expect(receivedMsg.senderId, clientA.realUserId); - expect(receivedMsg.type, MessageType.text.name); - }); - - test('C2C: GroupJoin & ResendGroupPublicKey', () async { - // clientA creates a fake group ID - const groupId = 'test-group-id'; - - // clientA asks clientB for public key - await clientA.sendResendGroupPublicKey(clientB, groupId); - - // We expect clientB to process it without crashing. - // Wait for it to settle by sending a text message and awaiting it. - await clientA.sendText(clientB, 'sync1'); - await clientB.expectMessage((m) => m.content == 'sync1'); - - // clientA sends GroupJoin - await clientA.sendGroupJoin(clientB, groupId, [1, 2, 3]); - - await clientA.sendText(clientB, 'sync2'); - await clientB.expectMessage((m) => m.content == 'sync2'); - }); - - test('C2C: ErrorMessages', () async { - await clientA.sendErrorMessages( - clientB, - pb.EncryptedContent_ErrorMessages_Type.SESSION_OUT_OF_SYNC, - 'fake-receipt', - ); - await clientA.sendText(clientB, 'sync3'); - await clientB.expectMessage((m) => m.content == 'sync3'); - }); - - test('C2C: UserDiscoveryRequest & Update', () async { - await clientA.sendUserDiscoveryRequest(clientB, [1]); - await clientA.sendUserDiscoveryUpdate(clientB, [ - [1, 2], - ]); - await clientA.sendText(clientB, 'sync4'); - await clientB.expectMessage((m) => m.content == 'sync4'); - }); - - test('C2C: KeyVerificationProof', () async { - await clientA.sendKeyVerificationProof(clientB, [0, 0, 0]); - await clientA.sendText(clientB, 'sync5'); - await clientB.expectMessage((m) => m.content == 'sync5'); - }); - - test('C2C: SENDER_DELIVERY_RECEIPT', () async { - await clientA.sendDeliveryReceipt(clientB, 'fake-receipt-999'); - await clientA.sendText(clientB, 'sync6'); - await clientB.expectMessage((m) => m.content == 'sync6'); - }); - - test('C2C: Reaction Send & Receive', () async { - final msgA = await clientA.sendText(clientB, 'Message to react to'); - await clientB.expectMessage((m) => m.content == 'Message to react to'); - - await clientB.sendReaction(clientA, msgA.messageId, '👍'); - final receivedReaction = await clientA.expectReaction( - msgA.messageId, - '👍', - ); - expect(receivedReaction.emoji, '👍'); - }); - - test('C2C: MessageUpdate (Edit & Delete)', () async { - final msgA = await clientA.sendText(clientB, 'Message to edit'); - await clientB.expectMessage((m) => m.content == 'Message to edit'); - - await clientA.sendMessageUpdate( - clientB, - msgA.messageId, - pb.EncryptedContent_MessageUpdate_Type.EDIT_TEXT, - text: 'Edited text', - ); - - final editedMsg = await clientB.expectMessage( - (m) => m.content == 'Edited text' && m.messageId == msgA.messageId, - ); - expect(editedMsg.content, 'Edited text'); - - await clientA.sendMessageUpdate( - clientB, - msgA.messageId, - pb.EncryptedContent_MessageUpdate_Type.DELETE, - ); - await clientA.sendText(clientB, 'sync7'); - await clientB.expectMessage((m) => m.content == 'sync7'); - }); - - test('C2C: Media Message', () async { - await clientA.sendMedia( - clientB, - 'media-msg-id', - pb.EncryptedContent_Media_Type.IMAGE, - ); - await clientA.sendText(clientB, 'sync8'); - await clientB.expectMessage((m) => m.content == 'sync8'); - }); - }); -}