diff --git a/lib/core/bridge/wrapper/signal.dart b/lib/core/bridge/wrapper/signal.dart new file mode 100644 index 00000000..6aaf439a --- /dev/null +++ b/lib/core/bridge/wrapper/signal.dart @@ -0,0 +1,57 @@ +// 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 '../../signal/engine.dart'; +import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; + +class RustSignal { + const RustSignal(); + + static Future decrypt({ + required String name, + required int deviceId, + required List ciphertext, + }) => RustLib.instance.api.crateBridgeWrapperSignalRustSignalDecrypt( + name: name, + deviceId: deviceId, + ciphertext: ciphertext, + ); + + static Future encrypt({ + required String name, + required int deviceId, + required List plaintext, + }) => RustLib.instance.api.crateBridgeWrapperSignalRustSignalEncrypt( + name: name, + deviceId: deviceId, + plaintext: plaintext, + ); + + static Future generateBundle() => + RustLib.instance.api.crateBridgeWrapperSignalRustSignalGenerateBundle(); + + static Future> generatePqcPrekeys() => RustLib.instance.api + .crateBridgeWrapperSignalRustSignalGeneratePqcPrekeys(); + + static Future processPrekeyBundle({ + required String name, + required int deviceId, + required FrbPreKeyBundle bundle, + }) => RustLib.instance.api + .crateBridgeWrapperSignalRustSignalProcessPrekeyBundle( + name: name, + deviceId: deviceId, + bundle: bundle, + ); + + @override + int get hashCode => 0; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is RustSignal && runtimeType == other.runtimeType; +} diff --git a/lib/core/frb_generated.dart b/lib/core/frb_generated.dart index cd992e17..67e16043 100644 --- a/lib/core/frb_generated.dart +++ b/lib/core/frb_generated.dart @@ -9,6 +9,7 @@ import 'bridge/callbacks/user_discovery.dart'; import 'bridge/wrapper.dart'; import 'bridge/wrapper/backup.dart'; import 'bridge/wrapper/key_manager.dart'; +import 'bridge/wrapper/signal.dart'; import 'bridge/wrapper/user_discovery.dart'; import 'dart:async'; import 'dart:convert'; @@ -18,6 +19,7 @@ import 'frb_generated.io.dart' import 'keys/backup_password_keys.dart'; import 'lib.dart'; import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; +import 'signal/engine.dart'; /// Main entrypoint of the Rust API class RustLib extends BaseEntrypoint { @@ -76,7 +78,7 @@ class RustLib extends BaseEntrypoint { String get codegenVersion => '2.12.0'; @override - int get rustContentHash => 1788847092; + int get rustContentHash => 1109927244; static const kDefaultExternalLibraryLoaderConfig = ExternalLibraryLoaderConfig( @@ -259,6 +261,29 @@ abstract class RustLibApi extends BaseApi { required List record, }); + Future crateBridgeWrapperSignalRustSignalDecrypt({ + required String name, + required int deviceId, + required List ciphertext, + }); + + Future crateBridgeWrapperSignalRustSignalEncrypt({ + required String name, + required int deviceId, + required List plaintext, + }); + + Future crateBridgeWrapperSignalRustSignalGenerateBundle(); + + Future> + crateBridgeWrapperSignalRustSignalGeneratePqcPrekeys(); + + Future crateBridgeWrapperSignalRustSignalProcessPrekeyBundle({ + required String name, + required int deviceId, + required FrbPreKeyBundle bundle, + }); + Future> crateBridgeWrapperRustUtilsGenerateShares({ required List secret, required int total, @@ -1651,6 +1676,183 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { argNames: ["signedPreKeyId", "record"], ); + @override + Future crateBridgeWrapperSignalRustSignalDecrypt({ + required String name, + required int deviceId, + required List ciphertext, + }) { + return handler.executeNormal( + NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_String(name, serializer); + sse_encode_u_32(deviceId, serializer); + sse_encode_list_prim_u_8_loose(ciphertext, serializer); + pdeCallFfi( + generalizedFrbRustBinding, + serializer, + funcId: 32, + port: port_, + ); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_list_prim_u_8_strict, + decodeErrorData: sse_decode_AnyhowException, + ), + constMeta: kCrateBridgeWrapperSignalRustSignalDecryptConstMeta, + argValues: [name, deviceId, ciphertext], + apiImpl: this, + ), + ); + } + + TaskConstMeta get kCrateBridgeWrapperSignalRustSignalDecryptConstMeta => + const TaskConstMeta( + debugName: "rust_signal_decrypt", + argNames: ["name", "deviceId", "ciphertext"], + ); + + @override + Future crateBridgeWrapperSignalRustSignalEncrypt({ + required String name, + required int deviceId, + required List plaintext, + }) { + return handler.executeNormal( + NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_String(name, serializer); + sse_encode_u_32(deviceId, serializer); + sse_encode_list_prim_u_8_loose(plaintext, serializer); + pdeCallFfi( + generalizedFrbRustBinding, + serializer, + funcId: 33, + port: port_, + ); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_list_prim_u_8_strict, + decodeErrorData: sse_decode_AnyhowException, + ), + constMeta: kCrateBridgeWrapperSignalRustSignalEncryptConstMeta, + argValues: [name, deviceId, plaintext], + apiImpl: this, + ), + ); + } + + TaskConstMeta get kCrateBridgeWrapperSignalRustSignalEncryptConstMeta => + const TaskConstMeta( + debugName: "rust_signal_encrypt", + argNames: ["name", "deviceId", "plaintext"], + ); + + @override + Future crateBridgeWrapperSignalRustSignalGenerateBundle() { + return handler.executeNormal( + NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + pdeCallFfi( + generalizedFrbRustBinding, + serializer, + funcId: 34, + port: port_, + ); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_frb_pre_key_bundle, + decodeErrorData: sse_decode_AnyhowException, + ), + constMeta: kCrateBridgeWrapperSignalRustSignalGenerateBundleConstMeta, + argValues: [], + apiImpl: this, + ), + ); + } + + TaskConstMeta + get kCrateBridgeWrapperSignalRustSignalGenerateBundleConstMeta => + const TaskConstMeta( + debugName: "rust_signal_generate_bundle", + argNames: [], + ); + + @override + Future> + crateBridgeWrapperSignalRustSignalGeneratePqcPrekeys() { + return handler.executeNormal( + NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + pdeCallFfi( + generalizedFrbRustBinding, + serializer, + funcId: 35, + port: port_, + ); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_list_frb_pqc_pre_key, + decodeErrorData: sse_decode_AnyhowException, + ), + constMeta: + kCrateBridgeWrapperSignalRustSignalGeneratePqcPrekeysConstMeta, + argValues: [], + apiImpl: this, + ), + ); + } + + TaskConstMeta + get kCrateBridgeWrapperSignalRustSignalGeneratePqcPrekeysConstMeta => + const TaskConstMeta( + debugName: "rust_signal_generate_pqc_prekeys", + argNames: [], + ); + + @override + Future crateBridgeWrapperSignalRustSignalProcessPrekeyBundle({ + required String name, + required int deviceId, + required FrbPreKeyBundle bundle, + }) { + return handler.executeNormal( + NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_String(name, serializer); + sse_encode_u_32(deviceId, serializer); + sse_encode_box_autoadd_frb_pre_key_bundle(bundle, serializer); + pdeCallFfi( + generalizedFrbRustBinding, + serializer, + funcId: 36, + port: port_, + ); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_unit, + decodeErrorData: sse_decode_AnyhowException, + ), + constMeta: + kCrateBridgeWrapperSignalRustSignalProcessPrekeyBundleConstMeta, + argValues: [name, deviceId, bundle], + apiImpl: this, + ), + ); + } + + TaskConstMeta + get kCrateBridgeWrapperSignalRustSignalProcessPrekeyBundleConstMeta => + const TaskConstMeta( + debugName: "rust_signal_process_prekey_bundle", + argNames: ["name", "deviceId", "bundle"], + ); + @override Future> crateBridgeWrapperRustUtilsGenerateShares({ required List secret, @@ -1667,7 +1869,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { pdeCallFfi( generalizedFrbRustBinding, serializer, - funcId: 32, + funcId: 37, port: port_, ); }, @@ -1702,7 +1904,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { pdeCallFfi( generalizedFrbRustBinding, serializer, - funcId: 33, + funcId: 38, port: port_, ); }, @@ -1738,7 +1940,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { pdeCallFfi( generalizedFrbRustBinding, serializer, - funcId: 34, + funcId: 39, port: port_, ); }, @@ -1775,7 +1977,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { pdeCallFfi( generalizedFrbRustBinding, serializer, - funcId: 35, + funcId: 40, port: port_, ); }, @@ -1813,7 +2015,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { pdeCallFfi( generalizedFrbRustBinding, serializer, - funcId: 36, + funcId: 41, port: port_, ); }, @@ -1851,7 +2053,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { pdeCallFfi( generalizedFrbRustBinding, serializer, - funcId: 37, + funcId: 42, port: port_, ); }, @@ -1889,7 +2091,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { pdeCallFfi( generalizedFrbRustBinding, serializer, - funcId: 38, + funcId: 43, port: port_, ); }, @@ -1928,7 +2130,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { pdeCallFfi( generalizedFrbRustBinding, serializer, - funcId: 39, + funcId: 44, port: port_, ); }, @@ -1967,7 +2169,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { pdeCallFfi( generalizedFrbRustBinding, serializer, - funcId: 40, + funcId: 45, port: port_, ); }, @@ -2012,7 +2214,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { pdeCallFfi( generalizedFrbRustBinding, serializer, - funcId: 41, + funcId: 46, port: port_, ); }, @@ -2064,7 +2266,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { pdeCallFfi( generalizedFrbRustBinding, serializer, - funcId: 42, + funcId: 47, port: port_, ); }, @@ -2105,7 +2307,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { pdeCallFfi( generalizedFrbRustBinding, serializer, - funcId: 43, + funcId: 48, port: port_, ); }, @@ -2143,7 +2345,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { pdeCallFfi( generalizedFrbRustBinding, serializer, - funcId: 44, + funcId: 49, port: port_, ); }, @@ -2181,7 +2383,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { pdeCallFfi( generalizedFrbRustBinding, serializer, - funcId: 45, + funcId: 50, port: port_, ); }, @@ -2219,7 +2421,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { pdeCallFfi( generalizedFrbRustBinding, serializer, - funcId: 46, + funcId: 51, port: port_, ); }, @@ -2257,7 +2459,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { pdeCallFfi( generalizedFrbRustBinding, serializer, - funcId: 47, + funcId: 52, port: port_, ); }, @@ -2299,7 +2501,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { pdeCallFfi( generalizedFrbRustBinding, serializer, - funcId: 48, + funcId: 53, port: port_, ); }, @@ -2339,7 +2541,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { pdeCallFfi( generalizedFrbRustBinding, serializer, - funcId: 49, + funcId: 54, port: port_, ); }, @@ -2978,6 +3180,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return dco_decode_backup_password_keys(raw); } + @protected + FrbPreKeyBundle dco_decode_box_autoadd_frb_pre_key_bundle(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_frb_pre_key_bundle(raw); + } + @protected PlatformInt64 dco_decode_box_autoadd_i_64(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -2996,6 +3204,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return dco_decode_other_promotion(raw); } + @protected + int dco_decode_box_autoadd_u_32(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw as int; + } + @protected UserDiscoveryStoreFlutter dco_decode_box_autoadd_user_discovery_store_flutter( dynamic raw, @@ -3021,6 +3235,42 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return FlutterUserDiscovery(); } + @protected + FrbPqcPreKey dco_decode_frb_pqc_pre_key(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 5) + throw Exception('unexpected arr length: expect 5 but see ${arr.length}'); + return FrbPqcPreKey( + eccPreKeyId: dco_decode_u_32(arr[0]), + eccPreKey: dco_decode_list_prim_u_8_strict(arr[1]), + kyberPreKeyId: dco_decode_u_32(arr[2]), + kyberPreKey: dco_decode_list_prim_u_8_strict(arr[3]), + kyberPreKeySignature: dco_decode_list_prim_u_8_strict(arr[4]), + ); + } + + @protected + FrbPreKeyBundle dco_decode_frb_pre_key_bundle(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 11) + throw Exception('unexpected arr length: expect 11 but see ${arr.length}'); + return FrbPreKeyBundle( + registrationId: dco_decode_u_32(arr[0]), + deviceId: dco_decode_u_32(arr[1]), + preKeyId: dco_decode_opt_box_autoadd_u_32(arr[2]), + preKeyPublic: dco_decode_opt_list_prim_u_8_strict(arr[3]), + signedPreKeyId: dco_decode_u_32(arr[4]), + signedPreKeyPublic: dco_decode_list_prim_u_8_strict(arr[5]), + signedPreKeySignature: dco_decode_list_prim_u_8_strict(arr[6]), + kyberPreKeyId: dco_decode_u_32(arr[7]), + kyberPreKeyPublic: dco_decode_list_prim_u_8_strict(arr[8]), + kyberPreKeySignature: dco_decode_list_prim_u_8_strict(arr[9]), + identityKey: dco_decode_list_prim_u_8_strict(arr[10]), + ); + } + @protected PlatformInt64 dco_decode_i_64(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -3045,6 +3295,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return dcoDecodeI64(raw); } + @protected + List dco_decode_list_frb_pqc_pre_key(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return (raw as List).map(dco_decode_frb_pqc_pre_key).toList(); + } + @protected List dco_decode_list_list_prim_u_8_strict(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -3096,6 +3352,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return raw == null ? null : dco_decode_box_autoadd_i_64(raw); } + @protected + int? dco_decode_opt_box_autoadd_u_32(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw == null ? null : dco_decode_box_autoadd_u_32(raw); + } + @protected List? dco_decode_opt_list_list_prim_u_8_strict(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -3200,6 +3462,15 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return RustKeyManager(); } + @protected + RustSignal dco_decode_rust_signal(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 0) + throw Exception('unexpected arr length: expect 0 but see ${arr.length}'); + return RustSignal(); + } + @protected RustUtils dco_decode_rust_utils(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -3347,6 +3618,14 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return (sse_decode_backup_password_keys(deserializer)); } + @protected + FrbPreKeyBundle sse_decode_box_autoadd_frb_pre_key_bundle( + SseDeserializer deserializer, + ) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_frb_pre_key_bundle(deserializer)); + } + @protected PlatformInt64 sse_decode_box_autoadd_i_64(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -3367,6 +3646,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return (sse_decode_other_promotion(deserializer)); } + @protected + int sse_decode_box_autoadd_u_32(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_u_32(deserializer)); + } + @protected UserDiscoveryStoreFlutter sse_decode_box_autoadd_user_discovery_store_flutter( SseDeserializer deserializer, @@ -3391,6 +3676,58 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return FlutterUserDiscovery(); } + @protected + FrbPqcPreKey sse_decode_frb_pqc_pre_key(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_eccPreKeyId = sse_decode_u_32(deserializer); + var var_eccPreKey = sse_decode_list_prim_u_8_strict(deserializer); + var var_kyberPreKeyId = sse_decode_u_32(deserializer); + var var_kyberPreKey = sse_decode_list_prim_u_8_strict(deserializer); + var var_kyberPreKeySignature = sse_decode_list_prim_u_8_strict( + deserializer, + ); + return FrbPqcPreKey( + eccPreKeyId: var_eccPreKeyId, + eccPreKey: var_eccPreKey, + kyberPreKeyId: var_kyberPreKeyId, + kyberPreKey: var_kyberPreKey, + kyberPreKeySignature: var_kyberPreKeySignature, + ); + } + + @protected + FrbPreKeyBundle sse_decode_frb_pre_key_bundle(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_registrationId = sse_decode_u_32(deserializer); + var var_deviceId = sse_decode_u_32(deserializer); + var var_preKeyId = sse_decode_opt_box_autoadd_u_32(deserializer); + var var_preKeyPublic = sse_decode_opt_list_prim_u_8_strict(deserializer); + var var_signedPreKeyId = sse_decode_u_32(deserializer); + var var_signedPreKeyPublic = sse_decode_list_prim_u_8_strict(deserializer); + var var_signedPreKeySignature = sse_decode_list_prim_u_8_strict( + deserializer, + ); + var var_kyberPreKeyId = sse_decode_u_32(deserializer); + var var_kyberPreKeyPublic = sse_decode_list_prim_u_8_strict(deserializer); + var var_kyberPreKeySignature = sse_decode_list_prim_u_8_strict( + deserializer, + ); + var var_identityKey = sse_decode_list_prim_u_8_strict(deserializer); + return FrbPreKeyBundle( + registrationId: var_registrationId, + deviceId: var_deviceId, + preKeyId: var_preKeyId, + preKeyPublic: var_preKeyPublic, + signedPreKeyId: var_signedPreKeyId, + signedPreKeyPublic: var_signedPreKeyPublic, + signedPreKeySignature: var_signedPreKeySignature, + kyberPreKeyId: var_kyberPreKeyId, + kyberPreKeyPublic: var_kyberPreKeyPublic, + kyberPreKeySignature: var_kyberPreKeySignature, + identityKey: var_identityKey, + ); + } + @protected PlatformInt64 sse_decode_i_64(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -3411,6 +3748,20 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return deserializer.buffer.getPlatformInt64(); } + @protected + List sse_decode_list_frb_pqc_pre_key( + SseDeserializer deserializer, + ) { + // Codec=Sse (Serialization based), see doc to use other codecs + + var len_ = sse_decode_i_32(deserializer); + var ans_ = []; + for (var idx_ = 0; idx_ < len_; ++idx_) { + ans_.add(sse_decode_frb_pqc_pre_key(deserializer)); + } + return ans_; + } + @protected List sse_decode_list_list_prim_u_8_strict( SseDeserializer deserializer, @@ -3503,6 +3854,17 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { } } + @protected + int? sse_decode_opt_box_autoadd_u_32(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + if (sse_decode_bool(deserializer)) { + return (sse_decode_box_autoadd_u_32(deserializer)); + } else { + return null; + } + } + @protected List? sse_decode_opt_list_list_prim_u_8_strict( SseDeserializer deserializer, @@ -3613,6 +3975,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return RustKeyManager(); } + @protected + RustSignal sse_decode_rust_signal(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return RustSignal(); + } + @protected RustUtils sse_decode_rust_utils(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -3946,6 +4314,15 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { sse_encode_backup_password_keys(self, serializer); } + @protected + void sse_encode_box_autoadd_frb_pre_key_bundle( + FrbPreKeyBundle self, + SseSerializer serializer, + ) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_frb_pre_key_bundle(self, serializer); + } + @protected void sse_encode_box_autoadd_i_64( PlatformInt64 self, @@ -3973,6 +4350,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { sse_encode_other_promotion(self, serializer); } + @protected + void sse_encode_box_autoadd_u_32(int self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_u_32(self, serializer); + } + @protected void sse_encode_box_autoadd_user_discovery_store_flutter( UserDiscoveryStoreFlutter self, @@ -3999,6 +4382,35 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { // Codec=Sse (Serialization based), see doc to use other codecs } + @protected + void sse_encode_frb_pqc_pre_key(FrbPqcPreKey self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_u_32(self.eccPreKeyId, serializer); + sse_encode_list_prim_u_8_strict(self.eccPreKey, serializer); + sse_encode_u_32(self.kyberPreKeyId, serializer); + sse_encode_list_prim_u_8_strict(self.kyberPreKey, serializer); + sse_encode_list_prim_u_8_strict(self.kyberPreKeySignature, serializer); + } + + @protected + void sse_encode_frb_pre_key_bundle( + FrbPreKeyBundle self, + SseSerializer serializer, + ) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_u_32(self.registrationId, serializer); + sse_encode_u_32(self.deviceId, serializer); + sse_encode_opt_box_autoadd_u_32(self.preKeyId, serializer); + sse_encode_opt_list_prim_u_8_strict(self.preKeyPublic, serializer); + sse_encode_u_32(self.signedPreKeyId, serializer); + sse_encode_list_prim_u_8_strict(self.signedPreKeyPublic, serializer); + sse_encode_list_prim_u_8_strict(self.signedPreKeySignature, serializer); + sse_encode_u_32(self.kyberPreKeyId, serializer); + sse_encode_list_prim_u_8_strict(self.kyberPreKeyPublic, serializer); + sse_encode_list_prim_u_8_strict(self.kyberPreKeySignature, serializer); + sse_encode_list_prim_u_8_strict(self.identityKey, serializer); + } + @protected void sse_encode_i_64(PlatformInt64 self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -4018,6 +4430,18 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { serializer.buffer.putPlatformInt64(self); } + @protected + void sse_encode_list_frb_pqc_pre_key( + List self, + SseSerializer serializer, + ) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_i_32(self.length, serializer); + for (final item in self) { + sse_encode_frb_pqc_pre_key(item, serializer); + } + } + @protected void sse_encode_list_list_prim_u_8_strict( List self, @@ -4112,6 +4536,16 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { } } + @protected + void sse_encode_opt_box_autoadd_u_32(int? self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + sse_encode_bool(self != null, serializer); + if (self != null) { + sse_encode_box_autoadd_u_32(self, serializer); + } + } + @protected void sse_encode_opt_list_list_prim_u_8_strict( List? self, @@ -4222,6 +4656,11 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { // Codec=Sse (Serialization based), see doc to use other codecs } + @protected + void sse_encode_rust_signal(RustSignal self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + } + @protected void sse_encode_rust_utils(RustUtils self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs diff --git a/lib/core/frb_generated.io.dart b/lib/core/frb_generated.io.dart index 6b1600a0..dd94d308 100644 --- a/lib/core/frb_generated.io.dart +++ b/lib/core/frb_generated.io.dart @@ -9,6 +9,7 @@ import 'bridge/callbacks/user_discovery.dart'; import 'bridge/wrapper.dart'; import 'bridge/wrapper/backup.dart'; import 'bridge/wrapper/key_manager.dart'; +import 'bridge/wrapper/signal.dart'; import 'bridge/wrapper/user_discovery.dart'; import 'dart:async'; import 'dart:convert'; @@ -17,6 +18,7 @@ import 'frb_generated.dart'; import 'keys/backup_password_keys.dart'; import 'lib.dart'; import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated_io.dart'; +import 'signal/engine.dart'; abstract class RustLibApiImplPlatform extends BaseApiImpl { RustLibApiImplPlatform({ @@ -130,6 +132,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected BackupPasswordKeys dco_decode_box_autoadd_backup_password_keys(dynamic raw); + @protected + FrbPreKeyBundle dco_decode_box_autoadd_frb_pre_key_bundle(dynamic raw); + @protected PlatformInt64 dco_decode_box_autoadd_i_64(dynamic raw); @@ -139,6 +144,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected OtherPromotion dco_decode_box_autoadd_other_promotion(dynamic raw); + @protected + int dco_decode_box_autoadd_u_32(dynamic raw); + @protected UserDiscoveryStoreFlutter dco_decode_box_autoadd_user_discovery_store_flutter( dynamic raw, @@ -152,6 +160,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected FlutterUserDiscovery dco_decode_flutter_user_discovery(dynamic raw); + @protected + FrbPqcPreKey dco_decode_frb_pqc_pre_key(dynamic raw); + + @protected + FrbPreKeyBundle dco_decode_frb_pre_key_bundle(dynamic raw); + @protected PlatformInt64 dco_decode_i_64(dynamic raw); @@ -161,6 +175,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected PlatformInt64 dco_decode_isize(dynamic raw); + @protected + List dco_decode_list_frb_pqc_pre_key(dynamic raw); + @protected List dco_decode_list_list_prim_u_8_strict(dynamic raw); @@ -186,6 +203,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected PlatformInt64? dco_decode_opt_box_autoadd_i_64(dynamic raw); + @protected + int? dco_decode_opt_box_autoadd_u_32(dynamic raw); + @protected List? dco_decode_opt_list_list_prim_u_8_strict(dynamic raw); @@ -220,6 +240,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected RustKeyManager dco_decode_rust_key_manager(dynamic raw); + @protected + RustSignal dco_decode_rust_signal(dynamic raw); + @protected RustUtils dco_decode_rust_utils(dynamic raw); @@ -288,6 +311,11 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { SseDeserializer deserializer, ); + @protected + FrbPreKeyBundle sse_decode_box_autoadd_frb_pre_key_bundle( + SseDeserializer deserializer, + ); + @protected PlatformInt64 sse_decode_box_autoadd_i_64(SseDeserializer deserializer); @@ -299,6 +327,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { SseDeserializer deserializer, ); + @protected + int sse_decode_box_autoadd_u_32(SseDeserializer deserializer); + @protected UserDiscoveryStoreFlutter sse_decode_box_autoadd_user_discovery_store_flutter( SseDeserializer deserializer, @@ -314,6 +345,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { SseDeserializer deserializer, ); + @protected + FrbPqcPreKey sse_decode_frb_pqc_pre_key(SseDeserializer deserializer); + + @protected + FrbPreKeyBundle sse_decode_frb_pre_key_bundle(SseDeserializer deserializer); + @protected PlatformInt64 sse_decode_i_64(SseDeserializer deserializer); @@ -323,6 +360,11 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected PlatformInt64 sse_decode_isize(SseDeserializer deserializer); + @protected + List sse_decode_list_frb_pqc_pre_key( + SseDeserializer deserializer, + ); + @protected List sse_decode_list_list_prim_u_8_strict( SseDeserializer deserializer, @@ -356,6 +398,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected PlatformInt64? sse_decode_opt_box_autoadd_i_64(SseDeserializer deserializer); + @protected + int? sse_decode_opt_box_autoadd_u_32(SseDeserializer deserializer); + @protected List? sse_decode_opt_list_list_prim_u_8_strict( SseDeserializer deserializer, @@ -400,6 +445,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected RustKeyManager sse_decode_rust_key_manager(SseDeserializer deserializer); + @protected + RustSignal sse_decode_rust_signal(SseDeserializer deserializer); + @protected RustUtils sse_decode_rust_utils(SseDeserializer deserializer); @@ -561,6 +609,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { SseSerializer serializer, ); + @protected + void sse_encode_box_autoadd_frb_pre_key_bundle( + FrbPreKeyBundle self, + SseSerializer serializer, + ); + @protected void sse_encode_box_autoadd_i_64( PlatformInt64 self, @@ -579,6 +633,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { SseSerializer serializer, ); + @protected + void sse_encode_box_autoadd_u_32(int self, SseSerializer serializer); + @protected void sse_encode_box_autoadd_user_discovery_store_flutter( UserDiscoveryStoreFlutter self, @@ -597,6 +654,15 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { SseSerializer serializer, ); + @protected + void sse_encode_frb_pqc_pre_key(FrbPqcPreKey self, SseSerializer serializer); + + @protected + void sse_encode_frb_pre_key_bundle( + FrbPreKeyBundle self, + SseSerializer serializer, + ); + @protected void sse_encode_i_64(PlatformInt64 self, SseSerializer serializer); @@ -606,6 +672,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected void sse_encode_isize(PlatformInt64 self, SseSerializer serializer); + @protected + void sse_encode_list_frb_pqc_pre_key( + List self, + SseSerializer serializer, + ); + @protected void sse_encode_list_list_prim_u_8_strict( List self, @@ -648,6 +720,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { SseSerializer serializer, ); + @protected + void sse_encode_opt_box_autoadd_u_32(int? self, SseSerializer serializer); + @protected void sse_encode_opt_list_list_prim_u_8_strict( List? self, @@ -708,6 +783,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { SseSerializer serializer, ); + @protected + void sse_encode_rust_signal(RustSignal self, SseSerializer serializer); + @protected void sse_encode_rust_utils(RustUtils self, SseSerializer serializer); diff --git a/lib/core/frb_generated.web.dart b/lib/core/frb_generated.web.dart index ed0ca4ee..5941a3aa 100644 --- a/lib/core/frb_generated.web.dart +++ b/lib/core/frb_generated.web.dart @@ -12,6 +12,7 @@ import 'bridge/callbacks/user_discovery.dart'; import 'bridge/wrapper.dart'; import 'bridge/wrapper/backup.dart'; import 'bridge/wrapper/key_manager.dart'; +import 'bridge/wrapper/signal.dart'; import 'bridge/wrapper/user_discovery.dart'; import 'dart:async'; import 'dart:convert'; @@ -19,6 +20,7 @@ import 'frb_generated.dart'; import 'keys/backup_password_keys.dart'; import 'lib.dart'; import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated_web.dart'; +import 'signal/engine.dart'; abstract class RustLibApiImplPlatform extends BaseApiImpl { RustLibApiImplPlatform({ @@ -132,6 +134,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected BackupPasswordKeys dco_decode_box_autoadd_backup_password_keys(dynamic raw); + @protected + FrbPreKeyBundle dco_decode_box_autoadd_frb_pre_key_bundle(dynamic raw); + @protected PlatformInt64 dco_decode_box_autoadd_i_64(dynamic raw); @@ -141,6 +146,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected OtherPromotion dco_decode_box_autoadd_other_promotion(dynamic raw); + @protected + int dco_decode_box_autoadd_u_32(dynamic raw); + @protected UserDiscoveryStoreFlutter dco_decode_box_autoadd_user_discovery_store_flutter( dynamic raw, @@ -154,6 +162,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected FlutterUserDiscovery dco_decode_flutter_user_discovery(dynamic raw); + @protected + FrbPqcPreKey dco_decode_frb_pqc_pre_key(dynamic raw); + + @protected + FrbPreKeyBundle dco_decode_frb_pre_key_bundle(dynamic raw); + @protected PlatformInt64 dco_decode_i_64(dynamic raw); @@ -163,6 +177,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected PlatformInt64 dco_decode_isize(dynamic raw); + @protected + List dco_decode_list_frb_pqc_pre_key(dynamic raw); + @protected List dco_decode_list_list_prim_u_8_strict(dynamic raw); @@ -188,6 +205,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected PlatformInt64? dco_decode_opt_box_autoadd_i_64(dynamic raw); + @protected + int? dco_decode_opt_box_autoadd_u_32(dynamic raw); + @protected List? dco_decode_opt_list_list_prim_u_8_strict(dynamic raw); @@ -222,6 +242,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected RustKeyManager dco_decode_rust_key_manager(dynamic raw); + @protected + RustSignal dco_decode_rust_signal(dynamic raw); + @protected RustUtils dco_decode_rust_utils(dynamic raw); @@ -290,6 +313,11 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { SseDeserializer deserializer, ); + @protected + FrbPreKeyBundle sse_decode_box_autoadd_frb_pre_key_bundle( + SseDeserializer deserializer, + ); + @protected PlatformInt64 sse_decode_box_autoadd_i_64(SseDeserializer deserializer); @@ -301,6 +329,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { SseDeserializer deserializer, ); + @protected + int sse_decode_box_autoadd_u_32(SseDeserializer deserializer); + @protected UserDiscoveryStoreFlutter sse_decode_box_autoadd_user_discovery_store_flutter( SseDeserializer deserializer, @@ -316,6 +347,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { SseDeserializer deserializer, ); + @protected + FrbPqcPreKey sse_decode_frb_pqc_pre_key(SseDeserializer deserializer); + + @protected + FrbPreKeyBundle sse_decode_frb_pre_key_bundle(SseDeserializer deserializer); + @protected PlatformInt64 sse_decode_i_64(SseDeserializer deserializer); @@ -325,6 +362,11 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected PlatformInt64 sse_decode_isize(SseDeserializer deserializer); + @protected + List sse_decode_list_frb_pqc_pre_key( + SseDeserializer deserializer, + ); + @protected List sse_decode_list_list_prim_u_8_strict( SseDeserializer deserializer, @@ -358,6 +400,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected PlatformInt64? sse_decode_opt_box_autoadd_i_64(SseDeserializer deserializer); + @protected + int? sse_decode_opt_box_autoadd_u_32(SseDeserializer deserializer); + @protected List? sse_decode_opt_list_list_prim_u_8_strict( SseDeserializer deserializer, @@ -402,6 +447,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected RustKeyManager sse_decode_rust_key_manager(SseDeserializer deserializer); + @protected + RustSignal sse_decode_rust_signal(SseDeserializer deserializer); + @protected RustUtils sse_decode_rust_utils(SseDeserializer deserializer); @@ -563,6 +611,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { SseSerializer serializer, ); + @protected + void sse_encode_box_autoadd_frb_pre_key_bundle( + FrbPreKeyBundle self, + SseSerializer serializer, + ); + @protected void sse_encode_box_autoadd_i_64( PlatformInt64 self, @@ -581,6 +635,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { SseSerializer serializer, ); + @protected + void sse_encode_box_autoadd_u_32(int self, SseSerializer serializer); + @protected void sse_encode_box_autoadd_user_discovery_store_flutter( UserDiscoveryStoreFlutter self, @@ -599,6 +656,15 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { SseSerializer serializer, ); + @protected + void sse_encode_frb_pqc_pre_key(FrbPqcPreKey self, SseSerializer serializer); + + @protected + void sse_encode_frb_pre_key_bundle( + FrbPreKeyBundle self, + SseSerializer serializer, + ); + @protected void sse_encode_i_64(PlatformInt64 self, SseSerializer serializer); @@ -608,6 +674,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected void sse_encode_isize(PlatformInt64 self, SseSerializer serializer); + @protected + void sse_encode_list_frb_pqc_pre_key( + List self, + SseSerializer serializer, + ); + @protected void sse_encode_list_list_prim_u_8_strict( List self, @@ -650,6 +722,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { SseSerializer serializer, ); + @protected + void sse_encode_opt_box_autoadd_u_32(int? self, SseSerializer serializer); + @protected void sse_encode_opt_list_list_prim_u_8_strict( List? self, @@ -710,6 +785,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { SseSerializer serializer, ); + @protected + void sse_encode_rust_signal(RustSignal self, SseSerializer serializer); + @protected void sse_encode_rust_utils(RustUtils self, SseSerializer serializer); diff --git a/lib/core/signal/engine.dart b/lib/core/signal/engine.dart new file mode 100644 index 00000000..4459a162 --- /dev/null +++ b/lib/core/signal/engine.dart @@ -0,0 +1,101 @@ +// 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 FrbPqcPreKey { + final int eccPreKeyId; + final Uint8List eccPreKey; + final int kyberPreKeyId; + final Uint8List kyberPreKey; + final Uint8List kyberPreKeySignature; + + const FrbPqcPreKey({ + 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 FrbPqcPreKey && + runtimeType == other.runtimeType && + eccPreKeyId == other.eccPreKeyId && + eccPreKey == other.eccPreKey && + kyberPreKeyId == other.kyberPreKeyId && + kyberPreKey == other.kyberPreKey && + kyberPreKeySignature == other.kyberPreKeySignature; +} + +class FrbPreKeyBundle { + final int registrationId; + final int deviceId; + final int? preKeyId; + final Uint8List? preKeyPublic; + final int signedPreKeyId; + final Uint8List signedPreKeyPublic; + final Uint8List signedPreKeySignature; + final int kyberPreKeyId; + final Uint8List kyberPreKeyPublic; + final Uint8List kyberPreKeySignature; + final Uint8List identityKey; + + const FrbPreKeyBundle({ + required this.registrationId, + required this.deviceId, + this.preKeyId, + this.preKeyPublic, + required this.signedPreKeyId, + required this.signedPreKeyPublic, + required this.signedPreKeySignature, + required this.kyberPreKeyId, + required this.kyberPreKeyPublic, + required this.kyberPreKeySignature, + required this.identityKey, + }); + + @override + int get hashCode => + registrationId.hashCode ^ + deviceId.hashCode ^ + preKeyId.hashCode ^ + preKeyPublic.hashCode ^ + signedPreKeyId.hashCode ^ + signedPreKeyPublic.hashCode ^ + signedPreKeySignature.hashCode ^ + kyberPreKeyId.hashCode ^ + kyberPreKeyPublic.hashCode ^ + kyberPreKeySignature.hashCode ^ + identityKey.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is FrbPreKeyBundle && + runtimeType == other.runtimeType && + registrationId == other.registrationId && + deviceId == other.deviceId && + preKeyId == other.preKeyId && + preKeyPublic == other.preKeyPublic && + signedPreKeyId == other.signedPreKeyId && + signedPreKeyPublic == other.signedPreKeyPublic && + signedPreKeySignature == other.signedPreKeySignature && + kyberPreKeyId == other.kyberPreKeyId && + kyberPreKeyPublic == other.kyberPreKeyPublic && + kyberPreKeySignature == other.kyberPreKeySignature && + identityKey == other.identityKey; +} diff --git a/lib/main.dart b/lib/main.dart index c375f023..a8c1ae87 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -175,13 +175,15 @@ Future postStartupTasks() async { // 2. Service initializations unawaited(finishStartedPreprocessing()); unawaited(createPushAvatars()); - unawaited(newsService.init().then((_) { - final lastDownload = newsService.lastDownloadedAt; - if (lastDownload == null || - DateTime.now().difference(lastDownload) >= const Duration(days: 7)) { - newsService.fetchFeed(); - } - })); + unawaited( + newsService.init().then((_) { + final lastDownload = newsService.lastDownloadedAt; + if (lastDownload == null || + DateTime.now().difference(lastDownload) >= const Duration(days: 7)) { + newsService.fetchFeed(); + } + }), + ); unawaited(UserDiscoveryService.verifyInitializationOnStartup()); diff --git a/lib/src/database/schemas/twonly_db/drift_schema_v25.json b/lib/src/database/schemas/twonly_db/drift_schema_v25.json new file mode 100644 index 00000000..a838bdbe --- /dev/null +++ b/lib/src/database/schemas/twonly_db/drift_schema_v25.json @@ -0,0 +1,3091 @@ +{ + "_meta": { + "description": "This file contains a serialized version of schema entities for drift.", + "version": "1.3.0" + }, + "options": { + "store_date_time_values_as_text": false + }, + "entities": [ + { + "id": 0, + "references": [], + "type": "table", + "data": { + "name": "contacts", + "was_declared_in_moor": false, + "columns": [ + { + "name": "user_id", + "getter_name": "userId", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "username", + "getter_name": "username", + "moor_type": "string", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "display_name", + "getter_name": "displayName", + "moor_type": "string", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "nick_name", + "getter_name": "nickName", + "moor_type": "string", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "avatar_svg_compressed", + "getter_name": "avatarSvgCompressed", + "moor_type": "blob", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "sender_profile_counter", + "getter_name": "senderProfileCounter", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "default_dart": "const Constant(0)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "accepted", + "getter_name": "accepted", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"accepted\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"accepted\" IN (0, 1))" + }, + "default_dart": "const Constant(false)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "deleted_by_user", + "getter_name": "deletedByUser", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"deleted_by_user\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"deleted_by_user\" IN (0, 1))" + }, + "default_dart": "const Constant(false)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "requested", + "getter_name": "requested", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"requested\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"requested\" IN (0, 1))" + }, + "default_dart": "const Constant(false)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "blocked", + "getter_name": "blocked", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"blocked\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"blocked\" IN (0, 1))" + }, + "default_dart": "const Constant(false)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "verified", + "getter_name": "verified", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"verified\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"verified\" IN (0, 1))" + }, + "default_dart": "const Constant(false)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "account_deleted", + "getter_name": "accountDeleted", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"account_deleted\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"account_deleted\" IN (0, 1))" + }, + "default_dart": "const Constant(false)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "created_at", + "getter_name": "createdAt", + "moor_type": "dateTime", + "nullable": false, + "customConstraints": null, + "default_dart": "currentDateAndTime", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "signal_version", + "getter_name": "signalVersion", + "moor_type": "string", + "nullable": false, + "customConstraints": null, + "default_dart": "const Constant('v1')", + "default_client_dart": null, + "dsl_features": [], + "type_converter": { + "dart_expr": "const EnumNameConverter(SignalVersion.values)", + "dart_type_name": "SignalVersion" + } + }, + { + "name": "user_discovery_version", + "getter_name": "userDiscoveryVersion", + "moor_type": "blob", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "user_discovery_excluded", + "getter_name": "userDiscoveryExcluded", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"user_discovery_excluded\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"user_discovery_excluded\" IN (0, 1))" + }, + "default_dart": "const Constant(false)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "user_discovery_manual_approved", + "getter_name": "userDiscoveryManualApproved", + "moor_type": "bool", + "nullable": true, + "customConstraints": null, + "defaultConstraints": "CHECK (\"user_discovery_manual_approved\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"user_discovery_manual_approved\" IN (0, 1))" + }, + "default_dart": "const Constant(false)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "recovery_is_trusted_friend", + "getter_name": "recoveryIsTrustedFriend", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"recovery_is_trusted_friend\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"recovery_is_trusted_friend\" IN (0, 1))" + }, + "default_dart": "const Constant(false)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "recovery_last_heartbeat", + "getter_name": "recoveryLastHeartbeat", + "moor_type": "dateTime", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "recovery_secret_share", + "getter_name": "recoverySecretShare", + "moor_type": "blob", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "recovery_contacts_secret_share", + "getter_name": "recoveryContactsSecretShare", + "moor_type": "blob", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "recovery_contacts_last_heartbeat", + "getter_name": "recoveryContactsLastHeartbeat", + "moor_type": "dateTime", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "recovery_contacts_threshold", + "getter_name": "recoveryContactsThreshold", + "moor_type": "int", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "ask_for_friend_promotions", + "getter_name": "askForFriendPromotions", + "moor_type": "bool", + "nullable": true, + "customConstraints": null, + "defaultConstraints": "CHECK (\"ask_for_friend_promotions\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"ask_for_friend_promotions\" IN (0, 1))" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "media_send_counter", + "getter_name": "mediaSendCounter", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "default_dart": "const Constant(0)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "media_received_counter", + "getter_name": "mediaReceivedCounter", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "default_dart": "const Constant(0)", + "default_client_dart": null, + "dsl_features": [] + } + ], + "is_virtual": false, + "without_rowid": false, + "constraints": [], + "explicit_pk": [ + "user_id" + ] + } + }, + { + "id": 1, + "references": [], + "type": "table", + "data": { + "name": "groups", + "was_declared_in_moor": false, + "columns": [ + { + "name": "group_id", + "getter_name": "groupId", + "moor_type": "string", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "is_group_admin", + "getter_name": "isGroupAdmin", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"is_group_admin\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"is_group_admin\" IN (0, 1))" + }, + "default_dart": "const Constant(false)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "is_direct_chat", + "getter_name": "isDirectChat", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"is_direct_chat\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"is_direct_chat\" IN (0, 1))" + }, + "default_dart": "const Constant(false)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "pinned", + "getter_name": "pinned", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"pinned\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"pinned\" IN (0, 1))" + }, + "default_dart": "const Constant(false)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "archived", + "getter_name": "archived", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"archived\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"archived\" IN (0, 1))" + }, + "default_dart": "const Constant(false)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "joined_group", + "getter_name": "joinedGroup", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"joined_group\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"joined_group\" IN (0, 1))" + }, + "default_dart": "const Constant(false)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "left_group", + "getter_name": "leftGroup", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"left_group\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"left_group\" IN (0, 1))" + }, + "default_dart": "const Constant(false)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "deleted_content", + "getter_name": "deletedContent", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"deleted_content\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"deleted_content\" IN (0, 1))" + }, + "default_dart": "const Constant(false)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "state_version_id", + "getter_name": "stateVersionId", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "default_dart": "const Constant(0)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "state_encryption_key", + "getter_name": "stateEncryptionKey", + "moor_type": "blob", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "my_group_private_key", + "getter_name": "myGroupPrivateKey", + "moor_type": "blob", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "group_name", + "getter_name": "groupName", + "moor_type": "string", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "draft_message", + "getter_name": "draftMessage", + "moor_type": "string", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "total_media_counter", + "getter_name": "totalMediaCounter", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "default_dart": "const Constant(0)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "also_best_friend", + "getter_name": "alsoBestFriend", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"also_best_friend\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"also_best_friend\" IN (0, 1))" + }, + "default_dart": "const Constant(false)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "delete_messages_after_milliseconds", + "getter_name": "deleteMessagesAfterMilliseconds", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "default_dart": "const Constant(86400000)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "created_at", + "getter_name": "createdAt", + "moor_type": "dateTime", + "nullable": false, + "customConstraints": null, + "default_dart": "currentDateAndTime", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "last_message_send", + "getter_name": "lastMessageSend", + "moor_type": "dateTime", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "last_message_received", + "getter_name": "lastMessageReceived", + "moor_type": "dateTime", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "last_flame_counter_change", + "getter_name": "lastFlameCounterChange", + "moor_type": "dateTime", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "last_flame_sync", + "getter_name": "lastFlameSync", + "moor_type": "dateTime", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "flame_counter", + "getter_name": "flameCounter", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "default_dart": "const Constant(0)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "max_flame_counter", + "getter_name": "maxFlameCounter", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "default_dart": "const Constant(0)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "max_flame_counter_from", + "getter_name": "maxFlameCounterFrom", + "moor_type": "dateTime", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "last_message_exchange", + "getter_name": "lastMessageExchange", + "moor_type": "dateTime", + "nullable": false, + "customConstraints": null, + "default_dart": "currentDateAndTime", + "default_client_dart": null, + "dsl_features": [] + } + ], + "is_virtual": false, + "without_rowid": false, + "constraints": [], + "explicit_pk": [ + "group_id" + ] + } + }, + { + "id": 2, + "references": [], + "type": "table", + "data": { + "name": "media_files", + "was_declared_in_moor": false, + "columns": [ + { + "name": "media_id", + "getter_name": "mediaId", + "moor_type": "string", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "type", + "getter_name": "type", + "moor_type": "string", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [], + "type_converter": { + "dart_expr": "const EnumNameConverter(MediaType.values)", + "dart_type_name": "MediaType" + } + }, + { + "name": "upload_state", + "getter_name": "uploadState", + "moor_type": "string", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [], + "type_converter": { + "dart_expr": "const EnumNameConverter(UploadState.values)", + "dart_type_name": "UploadState" + } + }, + { + "name": "cloud_state", + "getter_name": "cloudState", + "moor_type": "string", + "nullable": false, + "customConstraints": null, + "default_dart": "const Constant('none')", + "default_client_dart": null, + "dsl_features": [], + "type_converter": { + "dart_expr": "const EnumNameConverter(CloudState.values)", + "dart_type_name": "CloudState" + } + }, + { + "name": "blurhash", + "getter_name": "blurhash", + "moor_type": "string", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "download_state", + "getter_name": "downloadState", + "moor_type": "string", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [], + "type_converter": { + "dart_expr": "const EnumNameConverter(DownloadState.values)", + "dart_type_name": "DownloadState" + } + }, + { + "name": "requires_authentication", + "getter_name": "requiresAuthentication", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"requires_authentication\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"requires_authentication\" IN (0, 1))" + }, + "default_dart": "const Constant(false)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "stored", + "getter_name": "stored", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"stored\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"stored\" IN (0, 1))" + }, + "default_dart": "const Constant(false)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "is_draft_media", + "getter_name": "isDraftMedia", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"is_draft_media\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"is_draft_media\" IN (0, 1))" + }, + "default_dart": "const Constant(false)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "is_favorite", + "getter_name": "isFavorite", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"is_favorite\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"is_favorite\" IN (0, 1))" + }, + "default_dart": "const Constant(false)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "has_crop_analyzed", + "getter_name": "hasCropAnalyzed", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"has_crop_analyzed\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"has_crop_analyzed\" IN (0, 1))" + }, + "default_dart": "const Constant(false)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "pre_progressing_process", + "getter_name": "preProgressingProcess", + "moor_type": "int", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "reupload_requested_by", + "getter_name": "reuploadRequestedBy", + "moor_type": "string", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [], + "type_converter": { + "dart_expr": "IntListTypeConverter()", + "dart_type_name": "List" + } + }, + { + "name": "display_limit_in_milliseconds", + "getter_name": "displayLimitInMilliseconds", + "moor_type": "int", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "remove_audio", + "getter_name": "removeAudio", + "moor_type": "bool", + "nullable": true, + "customConstraints": null, + "defaultConstraints": "CHECK (\"remove_audio\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"remove_audio\" IN (0, 1))" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "download_token", + "getter_name": "downloadToken", + "moor_type": "blob", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "encryption_key", + "getter_name": "encryptionKey", + "moor_type": "blob", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "encryption_mac", + "getter_name": "encryptionMac", + "moor_type": "blob", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "encryption_nonce", + "getter_name": "encryptionNonce", + "moor_type": "blob", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "stored_file_hash", + "getter_name": "storedFileHash", + "moor_type": "blob", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "has_thumbnail", + "getter_name": "hasThumbnail", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"has_thumbnail\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"has_thumbnail\" IN (0, 1))" + }, + "default_dart": "const Constant(false)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "size_in_bytes", + "getter_name": "sizeInBytes", + "moor_type": "int", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "created_at", + "getter_name": "createdAt", + "moor_type": "dateTime", + "nullable": false, + "customConstraints": null, + "default_dart": "currentDateAndTime", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "created_at_month", + "getter_name": "createdAtMonth", + "moor_type": "string", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + } + ], + "is_virtual": false, + "without_rowid": false, + "constraints": [], + "explicit_pk": [ + "media_id" + ] + } + }, + { + "id": 3, + "references": [ + 1, + 0, + 2 + ], + "type": "table", + "data": { + "name": "messages", + "was_declared_in_moor": false, + "columns": [ + { + "name": "group_id", + "getter_name": "groupId", + "moor_type": "string", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "REFERENCES \"groups\" (group_id) ON DELETE CASCADE", + "dialectAwareDefaultConstraints": { + "sqlite": "REFERENCES \"groups\" (group_id) ON DELETE CASCADE" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + { + "foreign_key": { + "to": { + "table": "groups", + "column": "group_id" + }, + "initially_deferred": false, + "on_update": null, + "on_delete": "cascade" + } + } + ] + }, + { + "name": "message_id", + "getter_name": "messageId", + "moor_type": "string", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "sender_id", + "getter_name": "senderId", + "moor_type": "int", + "nullable": true, + "customConstraints": null, + "defaultConstraints": "REFERENCES contacts (user_id)", + "dialectAwareDefaultConstraints": { + "sqlite": "REFERENCES contacts (user_id)" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + { + "foreign_key": { + "to": { + "table": "contacts", + "column": "user_id" + }, + "initially_deferred": false, + "on_update": null, + "on_delete": null + } + } + ] + }, + { + "name": "type", + "getter_name": "type", + "moor_type": "string", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "content", + "getter_name": "content", + "moor_type": "string", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "media_id", + "getter_name": "mediaId", + "moor_type": "string", + "nullable": true, + "customConstraints": null, + "defaultConstraints": "REFERENCES media_files (media_id) ON DELETE SET NULL", + "dialectAwareDefaultConstraints": { + "sqlite": "REFERENCES media_files (media_id) ON DELETE SET NULL" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + { + "foreign_key": { + "to": { + "table": "media_files", + "column": "media_id" + }, + "initially_deferred": false, + "on_update": null, + "on_delete": "setNull" + } + } + ] + }, + { + "name": "additional_message_data", + "getter_name": "additionalMessageData", + "moor_type": "blob", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "media_stored", + "getter_name": "mediaStored", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"media_stored\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"media_stored\" IN (0, 1))" + }, + "default_dart": "const Constant(false)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "media_reopened", + "getter_name": "mediaReopened", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"media_reopened\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"media_reopened\" IN (0, 1))" + }, + "default_dart": "const Constant(false)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "download_token", + "getter_name": "downloadToken", + "moor_type": "blob", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "quotes_message_id", + "getter_name": "quotesMessageId", + "moor_type": "string", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "is_deleted_from_sender", + "getter_name": "isDeletedFromSender", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"is_deleted_from_sender\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"is_deleted_from_sender\" IN (0, 1))" + }, + "default_dart": "const Constant(false)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "opened_at", + "getter_name": "openedAt", + "moor_type": "dateTime", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "opened_by_all", + "getter_name": "openedByAll", + "moor_type": "dateTime", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "created_at", + "getter_name": "createdAt", + "moor_type": "dateTime", + "nullable": false, + "customConstraints": null, + "default_dart": "currentDateAndTime", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "modified_at", + "getter_name": "modifiedAt", + "moor_type": "dateTime", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "ack_by_user", + "getter_name": "ackByUser", + "moor_type": "dateTime", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "ack_by_server", + "getter_name": "ackByServer", + "moor_type": "dateTime", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + } + ], + "is_virtual": false, + "without_rowid": false, + "constraints": [], + "explicit_pk": [ + "message_id" + ] + } + }, + { + "id": 4, + "references": [ + 3, + 0 + ], + "type": "table", + "data": { + "name": "message_histories", + "was_declared_in_moor": false, + "columns": [ + { + "name": "id", + "getter_name": "id", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "PRIMARY KEY AUTOINCREMENT", + "dialectAwareDefaultConstraints": { + "sqlite": "PRIMARY KEY AUTOINCREMENT" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + "auto-increment" + ] + }, + { + "name": "message_id", + "getter_name": "messageId", + "moor_type": "string", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "REFERENCES messages (message_id) ON DELETE CASCADE", + "dialectAwareDefaultConstraints": { + "sqlite": "REFERENCES messages (message_id) ON DELETE CASCADE" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + { + "foreign_key": { + "to": { + "table": "messages", + "column": "message_id" + }, + "initially_deferred": false, + "on_update": null, + "on_delete": "cascade" + } + } + ] + }, + { + "name": "contact_id", + "getter_name": "contactId", + "moor_type": "int", + "nullable": true, + "customConstraints": null, + "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", + "dialectAwareDefaultConstraints": { + "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + { + "foreign_key": { + "to": { + "table": "contacts", + "column": "user_id" + }, + "initially_deferred": false, + "on_update": null, + "on_delete": "cascade" + } + } + ] + }, + { + "name": "content", + "getter_name": "content", + "moor_type": "string", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "created_at", + "getter_name": "createdAt", + "moor_type": "dateTime", + "nullable": false, + "customConstraints": null, + "default_dart": "currentDateAndTime", + "default_client_dart": null, + "dsl_features": [] + } + ], + "is_virtual": false, + "without_rowid": false, + "constraints": [] + } + }, + { + "id": 5, + "references": [ + 3, + 0 + ], + "type": "table", + "data": { + "name": "reactions", + "was_declared_in_moor": false, + "columns": [ + { + "name": "message_id", + "getter_name": "messageId", + "moor_type": "string", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "REFERENCES messages (message_id) ON DELETE CASCADE", + "dialectAwareDefaultConstraints": { + "sqlite": "REFERENCES messages (message_id) ON DELETE CASCADE" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + { + "foreign_key": { + "to": { + "table": "messages", + "column": "message_id" + }, + "initially_deferred": false, + "on_update": null, + "on_delete": "cascade" + } + } + ] + }, + { + "name": "emoji", + "getter_name": "emoji", + "moor_type": "string", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "sender_id", + "getter_name": "senderId", + "moor_type": "int", + "nullable": true, + "customConstraints": null, + "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", + "dialectAwareDefaultConstraints": { + "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + { + "foreign_key": { + "to": { + "table": "contacts", + "column": "user_id" + }, + "initially_deferred": false, + "on_update": null, + "on_delete": "cascade" + } + } + ] + }, + { + "name": "created_at", + "getter_name": "createdAt", + "moor_type": "dateTime", + "nullable": false, + "customConstraints": null, + "default_dart": "currentDateAndTime", + "default_client_dart": null, + "dsl_features": [] + } + ], + "is_virtual": false, + "without_rowid": false, + "constraints": [], + "explicit_pk": [ + "message_id", + "sender_id", + "emoji" + ] + } + }, + { + "id": 6, + "references": [ + 1, + 0 + ], + "type": "table", + "data": { + "name": "group_members", + "was_declared_in_moor": false, + "columns": [ + { + "name": "group_id", + "getter_name": "groupId", + "moor_type": "string", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "REFERENCES \"groups\" (group_id) ON DELETE CASCADE", + "dialectAwareDefaultConstraints": { + "sqlite": "REFERENCES \"groups\" (group_id) ON DELETE CASCADE" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + { + "foreign_key": { + "to": { + "table": "groups", + "column": "group_id" + }, + "initially_deferred": false, + "on_update": null, + "on_delete": "cascade" + } + } + ] + }, + { + "name": "contact_id", + "getter_name": "contactId", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "REFERENCES contacts (user_id)", + "dialectAwareDefaultConstraints": { + "sqlite": "REFERENCES contacts (user_id)" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + { + "foreign_key": { + "to": { + "table": "contacts", + "column": "user_id" + }, + "initially_deferred": false, + "on_update": null, + "on_delete": null + } + } + ] + }, + { + "name": "member_state", + "getter_name": "memberState", + "moor_type": "string", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [], + "type_converter": { + "dart_expr": "const EnumNameConverter(MemberState.values)", + "dart_type_name": "MemberState" + } + }, + { + "name": "group_public_key", + "getter_name": "groupPublicKey", + "moor_type": "blob", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "last_chat_opened", + "getter_name": "lastChatOpened", + "moor_type": "dateTime", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "last_type_indicator", + "getter_name": "lastTypeIndicator", + "moor_type": "dateTime", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "last_message", + "getter_name": "lastMessage", + "moor_type": "dateTime", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "created_at", + "getter_name": "createdAt", + "moor_type": "dateTime", + "nullable": false, + "customConstraints": null, + "default_dart": "currentDateAndTime", + "default_client_dart": null, + "dsl_features": [] + } + ], + "is_virtual": false, + "without_rowid": false, + "constraints": [], + "explicit_pk": [ + "group_id", + "contact_id" + ] + } + }, + { + "id": 7, + "references": [ + 0, + 3 + ], + "type": "table", + "data": { + "name": "receipts", + "was_declared_in_moor": false, + "columns": [ + { + "name": "receipt_id", + "getter_name": "receiptId", + "moor_type": "string", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "contact_id", + "getter_name": "contactId", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", + "dialectAwareDefaultConstraints": { + "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + { + "foreign_key": { + "to": { + "table": "contacts", + "column": "user_id" + }, + "initially_deferred": false, + "on_update": null, + "on_delete": "cascade" + } + } + ] + }, + { + "name": "message_id", + "getter_name": "messageId", + "moor_type": "string", + "nullable": true, + "customConstraints": null, + "defaultConstraints": "REFERENCES messages (message_id) ON DELETE CASCADE", + "dialectAwareDefaultConstraints": { + "sqlite": "REFERENCES messages (message_id) ON DELETE CASCADE" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + { + "foreign_key": { + "to": { + "table": "messages", + "column": "message_id" + }, + "initially_deferred": false, + "on_update": null, + "on_delete": "cascade" + } + } + ] + }, + { + "name": "message", + "getter_name": "message", + "moor_type": "blob", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "contact_will_sends_receipt", + "getter_name": "contactWillSendsReceipt", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"contact_will_sends_receipt\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"contact_will_sends_receipt\" IN (0, 1))" + }, + "default_dart": "const Constant(true)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "will_be_retried_by_media_upload", + "getter_name": "willBeRetriedByMediaUpload", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"will_be_retried_by_media_upload\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"will_be_retried_by_media_upload\" IN (0, 1))" + }, + "default_dart": "const Constant(false)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "mark_for_retry", + "getter_name": "markForRetry", + "moor_type": "dateTime", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "mark_for_retry_after_accepted", + "getter_name": "markForRetryAfterAccepted", + "moor_type": "dateTime", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "ack_by_server_at", + "getter_name": "ackByServerAt", + "moor_type": "dateTime", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "retry_count", + "getter_name": "retryCount", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "default_dart": "const Constant(0)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "last_retry", + "getter_name": "lastRetry", + "moor_type": "dateTime", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "created_at", + "getter_name": "createdAt", + "moor_type": "dateTime", + "nullable": false, + "customConstraints": null, + "default_dart": "currentDateAndTime", + "default_client_dart": null, + "dsl_features": [] + } + ], + "is_virtual": false, + "without_rowid": false, + "constraints": [], + "explicit_pk": [ + "receipt_id" + ] + } + }, + { + "id": 8, + "references": [], + "type": "table", + "data": { + "name": "received_receipts", + "was_declared_in_moor": false, + "columns": [ + { + "name": "receipt_id", + "getter_name": "receiptId", + "moor_type": "string", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "created_at", + "getter_name": "createdAt", + "moor_type": "dateTime", + "nullable": false, + "customConstraints": null, + "default_dart": "currentDateAndTime", + "default_client_dart": null, + "dsl_features": [] + } + ], + "is_virtual": false, + "without_rowid": false, + "constraints": [], + "explicit_pk": [ + "receipt_id" + ] + } + }, + { + "id": 9, + "references": [], + "type": "table", + "data": { + "name": "signal_identity_key_stores", + "was_declared_in_moor": false, + "columns": [ + { + "name": "device_id", + "getter_name": "deviceId", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "name", + "getter_name": "name", + "moor_type": "string", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "identity_key", + "getter_name": "identityKey", + "moor_type": "blob", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "created_at", + "getter_name": "createdAt", + "moor_type": "dateTime", + "nullable": false, + "customConstraints": null, + "default_dart": "currentDateAndTime", + "default_client_dart": null, + "dsl_features": [] + } + ], + "is_virtual": false, + "without_rowid": false, + "constraints": [], + "explicit_pk": [ + "device_id", + "name" + ] + } + }, + { + "id": 10, + "references": [], + "type": "table", + "data": { + "name": "signal_pre_key_stores", + "was_declared_in_moor": false, + "columns": [ + { + "name": "pre_key_id", + "getter_name": "preKeyId", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "pre_key", + "getter_name": "preKey", + "moor_type": "blob", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "created_at", + "getter_name": "createdAt", + "moor_type": "dateTime", + "nullable": false, + "customConstraints": null, + "default_dart": "currentDateAndTime", + "default_client_dart": null, + "dsl_features": [] + } + ], + "is_virtual": false, + "without_rowid": false, + "constraints": [], + "explicit_pk": [ + "pre_key_id" + ] + } + }, + { + "id": 11, + "references": [], + "type": "table", + "data": { + "name": "signal_sender_key_stores", + "was_declared_in_moor": false, + "columns": [ + { + "name": "sender_key_name", + "getter_name": "senderKeyName", + "moor_type": "string", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "sender_key", + "getter_name": "senderKey", + "moor_type": "blob", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + } + ], + "is_virtual": false, + "without_rowid": false, + "constraints": [], + "explicit_pk": [ + "sender_key_name" + ] + } + }, + { + "id": 12, + "references": [], + "type": "table", + "data": { + "name": "signal_session_stores", + "was_declared_in_moor": false, + "columns": [ + { + "name": "device_id", + "getter_name": "deviceId", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "name", + "getter_name": "name", + "moor_type": "string", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "session_record", + "getter_name": "sessionRecord", + "moor_type": "blob", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "created_at", + "getter_name": "createdAt", + "moor_type": "dateTime", + "nullable": false, + "customConstraints": null, + "default_dart": "currentDateAndTime", + "default_client_dart": null, + "dsl_features": [] + } + ], + "is_virtual": false, + "without_rowid": false, + "constraints": [], + "explicit_pk": [ + "device_id", + "name" + ] + } + }, + { + "id": 13, + "references": [], + "type": "table", + "data": { + "name": "signal_signed_pre_key_stores", + "was_declared_in_moor": false, + "columns": [ + { + "name": "signed_pre_key_id", + "getter_name": "signedPreKeyId", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "signed_pre_key", + "getter_name": "signedPreKey", + "moor_type": "blob", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "created_at", + "getter_name": "createdAt", + "moor_type": "dateTime", + "nullable": false, + "customConstraints": null, + "default_dart": "currentDateAndTime", + "default_client_dart": null, + "dsl_features": [] + } + ], + "is_virtual": false, + "without_rowid": false, + "constraints": [], + "explicit_pk": [ + "signed_pre_key_id" + ] + } + }, + { + "id": 14, + "references": [ + 3, + 0 + ], + "type": "table", + "data": { + "name": "message_actions", + "was_declared_in_moor": false, + "columns": [ + { + "name": "message_id", + "getter_name": "messageId", + "moor_type": "string", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "REFERENCES messages (message_id) ON DELETE CASCADE", + "dialectAwareDefaultConstraints": { + "sqlite": "REFERENCES messages (message_id) ON DELETE CASCADE" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + { + "foreign_key": { + "to": { + "table": "messages", + "column": "message_id" + }, + "initially_deferred": false, + "on_update": null, + "on_delete": "cascade" + } + } + ] + }, + { + "name": "contact_id", + "getter_name": "contactId", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", + "dialectAwareDefaultConstraints": { + "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + { + "foreign_key": { + "to": { + "table": "contacts", + "column": "user_id" + }, + "initially_deferred": false, + "on_update": null, + "on_delete": "cascade" + } + } + ] + }, + { + "name": "type", + "getter_name": "type", + "moor_type": "string", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [], + "type_converter": { + "dart_expr": "const EnumNameConverter(MessageActionType.values)", + "dart_type_name": "MessageActionType" + } + }, + { + "name": "action_at", + "getter_name": "actionAt", + "moor_type": "dateTime", + "nullable": false, + "customConstraints": null, + "default_dart": "currentDateAndTime", + "default_client_dart": null, + "dsl_features": [] + } + ], + "is_virtual": false, + "without_rowid": false, + "constraints": [], + "explicit_pk": [ + "message_id", + "contact_id", + "type" + ] + } + }, + { + "id": 15, + "references": [ + 1, + 0 + ], + "type": "table", + "data": { + "name": "group_histories", + "was_declared_in_moor": false, + "columns": [ + { + "name": "group_history_id", + "getter_name": "groupHistoryId", + "moor_type": "string", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "group_id", + "getter_name": "groupId", + "moor_type": "string", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "REFERENCES \"groups\" (group_id) ON DELETE CASCADE", + "dialectAwareDefaultConstraints": { + "sqlite": "REFERENCES \"groups\" (group_id) ON DELETE CASCADE" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + { + "foreign_key": { + "to": { + "table": "groups", + "column": "group_id" + }, + "initially_deferred": false, + "on_update": null, + "on_delete": "cascade" + } + } + ] + }, + { + "name": "contact_id", + "getter_name": "contactId", + "moor_type": "int", + "nullable": true, + "customConstraints": null, + "defaultConstraints": "REFERENCES contacts (user_id)", + "dialectAwareDefaultConstraints": { + "sqlite": "REFERENCES contacts (user_id)" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + { + "foreign_key": { + "to": { + "table": "contacts", + "column": "user_id" + }, + "initially_deferred": false, + "on_update": null, + "on_delete": null + } + } + ] + }, + { + "name": "affected_contact_id", + "getter_name": "affectedContactId", + "moor_type": "int", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "old_group_name", + "getter_name": "oldGroupName", + "moor_type": "string", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "new_group_name", + "getter_name": "newGroupName", + "moor_type": "string", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "new_delete_messages_after_milliseconds", + "getter_name": "newDeleteMessagesAfterMilliseconds", + "moor_type": "int", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "type", + "getter_name": "type", + "moor_type": "string", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [], + "type_converter": { + "dart_expr": "const EnumNameConverter(GroupActionType.values)", + "dart_type_name": "GroupActionType" + } + }, + { + "name": "action_at", + "getter_name": "actionAt", + "moor_type": "dateTime", + "nullable": false, + "customConstraints": null, + "default_dart": "currentDateAndTime", + "default_client_dart": null, + "dsl_features": [] + } + ], + "is_virtual": false, + "without_rowid": false, + "constraints": [], + "explicit_pk": [ + "group_history_id" + ] + } + }, + { + "id": 16, + "references": [ + 0 + ], + "type": "table", + "data": { + "name": "key_verifications", + "was_declared_in_moor": false, + "columns": [ + { + "name": "verification_id", + "getter_name": "verificationId", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "PRIMARY KEY AUTOINCREMENT", + "dialectAwareDefaultConstraints": { + "sqlite": "PRIMARY KEY AUTOINCREMENT" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + "auto-increment" + ] + }, + { + "name": "contact_id", + "getter_name": "contactId", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", + "dialectAwareDefaultConstraints": { + "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + { + "foreign_key": { + "to": { + "table": "contacts", + "column": "user_id" + }, + "initially_deferred": false, + "on_update": null, + "on_delete": "cascade" + } + } + ] + }, + { + "name": "type", + "getter_name": "type", + "moor_type": "string", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [], + "type_converter": { + "dart_expr": "const EnumNameConverter(VerificationType.values)", + "dart_type_name": "VerificationType" + } + }, + { + "name": "verified_by", + "getter_name": "verifiedBy", + "moor_type": "int", + "nullable": true, + "customConstraints": null, + "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", + "dialectAwareDefaultConstraints": { + "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + { + "foreign_key": { + "to": { + "table": "contacts", + "column": "user_id" + }, + "initially_deferred": false, + "on_update": null, + "on_delete": "cascade" + } + } + ] + }, + { + "name": "created_at", + "getter_name": "createdAt", + "moor_type": "dateTime", + "nullable": false, + "customConstraints": null, + "default_dart": "currentDateAndTime", + "default_client_dart": null, + "dsl_features": [] + } + ], + "is_virtual": false, + "without_rowid": false, + "constraints": [] + } + }, + { + "id": 17, + "references": [], + "type": "table", + "data": { + "name": "verification_tokens", + "was_declared_in_moor": false, + "columns": [ + { + "name": "token_id", + "getter_name": "tokenId", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "PRIMARY KEY AUTOINCREMENT", + "dialectAwareDefaultConstraints": { + "sqlite": "PRIMARY KEY AUTOINCREMENT" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + "auto-increment" + ] + }, + { + "name": "token", + "getter_name": "token", + "moor_type": "blob", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "created_at", + "getter_name": "createdAt", + "moor_type": "dateTime", + "nullable": false, + "customConstraints": null, + "default_dart": "currentDateAndTime", + "default_client_dart": null, + "dsl_features": [] + } + ], + "is_virtual": false, + "without_rowid": false, + "constraints": [] + } + }, + { + "id": 18, + "references": [], + "type": "table", + "data": { + "name": "user_discovery_announced_users", + "was_declared_in_moor": false, + "columns": [ + { + "name": "announced_user_id", + "getter_name": "announcedUserId", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "announced_public_key", + "getter_name": "announcedPublicKey", + "moor_type": "blob", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "public_id", + "getter_name": "publicId", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "UNIQUE", + "dialectAwareDefaultConstraints": { + "sqlite": "UNIQUE" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + "unique" + ] + }, + { + "name": "username", + "getter_name": "username", + "moor_type": "string", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "was_shown_to_the_user", + "getter_name": "wasShownToTheUser", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"was_shown_to_the_user\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"was_shown_to_the_user\" IN (0, 1))" + }, + "default_dart": "const Constant(false)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "is_hidden", + "getter_name": "isHidden", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"is_hidden\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"is_hidden\" IN (0, 1))" + }, + "default_dart": "const Constant(false)", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "was_asked_friends", + "getter_name": "wasAskedFriends", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"was_asked_friends\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"was_asked_friends\" IN (0, 1))" + }, + "default_dart": "const Constant(false)", + "default_client_dart": null, + "dsl_features": [] + } + ], + "is_virtual": false, + "without_rowid": false, + "constraints": [], + "explicit_pk": [ + "announced_user_id" + ] + } + }, + { + "id": 19, + "references": [ + 18, + 0 + ], + "type": "table", + "data": { + "name": "user_discovery_user_relations", + "was_declared_in_moor": false, + "columns": [ + { + "name": "announced_user_id", + "getter_name": "announcedUserId", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "REFERENCES user_discovery_announced_users (announced_user_id) ON DELETE CASCADE", + "dialectAwareDefaultConstraints": { + "sqlite": "REFERENCES user_discovery_announced_users (announced_user_id) ON DELETE CASCADE" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + { + "foreign_key": { + "to": { + "table": "user_discovery_announced_users", + "column": "announced_user_id" + }, + "initially_deferred": false, + "on_update": null, + "on_delete": "cascade" + } + } + ] + }, + { + "name": "from_contact_id", + "getter_name": "fromContactId", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", + "dialectAwareDefaultConstraints": { + "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + { + "foreign_key": { + "to": { + "table": "contacts", + "column": "user_id" + }, + "initially_deferred": false, + "on_update": null, + "on_delete": "cascade" + } + } + ] + }, + { + "name": "public_key_verified_timestamp", + "getter_name": "publicKeyVerifiedTimestamp", + "moor_type": "dateTime", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + } + ], + "is_virtual": false, + "without_rowid": false, + "constraints": [], + "explicit_pk": [ + "announced_user_id", + "from_contact_id" + ] + } + }, + { + "id": 20, + "references": [ + 0 + ], + "type": "table", + "data": { + "name": "user_discovery_other_promotions", + "was_declared_in_moor": false, + "columns": [ + { + "name": "from_contact_id", + "getter_name": "fromContactId", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", + "dialectAwareDefaultConstraints": { + "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + { + "foreign_key": { + "to": { + "table": "contacts", + "column": "user_id" + }, + "initially_deferred": false, + "on_update": null, + "on_delete": "cascade" + } + } + ] + }, + { + "name": "promotion_id", + "getter_name": "promotionId", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "public_id", + "getter_name": "publicId", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "threshold", + "getter_name": "threshold", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "announcement_share", + "getter_name": "announcementShare", + "moor_type": "blob", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "public_key_verified_timestamp", + "getter_name": "publicKeyVerifiedTimestamp", + "moor_type": "dateTime", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + } + ], + "is_virtual": false, + "without_rowid": false, + "constraints": [], + "explicit_pk": [ + "from_contact_id", + "public_id" + ] + } + }, + { + "id": 21, + "references": [ + 0 + ], + "type": "table", + "data": { + "name": "user_discovery_own_promotions", + "was_declared_in_moor": false, + "columns": [ + { + "name": "version_id", + "getter_name": "versionId", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "PRIMARY KEY AUTOINCREMENT", + "dialectAwareDefaultConstraints": { + "sqlite": "PRIMARY KEY AUTOINCREMENT" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + "auto-increment" + ] + }, + { + "name": "contact_id", + "getter_name": "contactId", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", + "dialectAwareDefaultConstraints": { + "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + { + "foreign_key": { + "to": { + "table": "contacts", + "column": "user_id" + }, + "initially_deferred": false, + "on_update": null, + "on_delete": "cascade" + } + } + ] + }, + { + "name": "promotion", + "getter_name": "promotion", + "moor_type": "blob", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + } + ], + "is_virtual": false, + "without_rowid": false, + "constraints": [] + } + }, + { + "id": 22, + "references": [ + 0 + ], + "type": "table", + "data": { + "name": "user_discovery_shares", + "was_declared_in_moor": false, + "columns": [ + { + "name": "share_id", + "getter_name": "shareId", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "PRIMARY KEY AUTOINCREMENT", + "dialectAwareDefaultConstraints": { + "sqlite": "PRIMARY KEY AUTOINCREMENT" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + "auto-increment" + ] + }, + { + "name": "share", + "getter_name": "share", + "moor_type": "blob", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "contact_id", + "getter_name": "contactId", + "moor_type": "int", + "nullable": true, + "customConstraints": null, + "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", + "dialectAwareDefaultConstraints": { + "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + { + "foreign_key": { + "to": { + "table": "contacts", + "column": "user_id" + }, + "initially_deferred": false, + "on_update": null, + "on_delete": "cascade" + } + } + ] + } + ], + "is_virtual": false, + "without_rowid": false, + "constraints": [] + } + }, + { + "id": 23, + "references": [], + "type": "table", + "data": { + "name": "shortcuts", + "was_declared_in_moor": false, + "columns": [ + { + "name": "id", + "getter_name": "id", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "PRIMARY KEY AUTOINCREMENT", + "dialectAwareDefaultConstraints": { + "sqlite": "PRIMARY KEY AUTOINCREMENT" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + "auto-increment" + ] + }, + { + "name": "emoji", + "getter_name": "emoji", + "moor_type": "string", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "UNIQUE", + "dialectAwareDefaultConstraints": { + "sqlite": "UNIQUE" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + "unique" + ] + }, + { + "name": "usage_counter", + "getter_name": "usageCounter", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "default_dart": "const Constant(0)", + "default_client_dart": null, + "dsl_features": [] + } + ], + "is_virtual": false, + "without_rowid": false, + "constraints": [] + } + }, + { + "id": 24, + "references": [ + 23, + 1 + ], + "type": "table", + "data": { + "name": "shortcut_members", + "was_declared_in_moor": false, + "columns": [ + { + "name": "shortcut_id", + "getter_name": "shortcutId", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "REFERENCES shortcuts (id) ON DELETE CASCADE", + "dialectAwareDefaultConstraints": { + "sqlite": "REFERENCES shortcuts (id) ON DELETE CASCADE" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + { + "foreign_key": { + "to": { + "table": "shortcuts", + "column": "id" + }, + "initially_deferred": false, + "on_update": null, + "on_delete": "cascade" + } + } + ] + }, + { + "name": "group_id", + "getter_name": "groupId", + "moor_type": "string", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "REFERENCES \"groups\" (group_id) ON DELETE CASCADE", + "dialectAwareDefaultConstraints": { + "sqlite": "REFERENCES \"groups\" (group_id) ON DELETE CASCADE" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + { + "foreign_key": { + "to": { + "table": "groups", + "column": "group_id" + }, + "initially_deferred": false, + "on_update": null, + "on_delete": "cascade" + } + } + ] + } + ], + "is_virtual": false, + "without_rowid": false, + "constraints": [], + "explicit_pk": [ + "shortcut_id", + "group_id" + ] + } + }, + { + "id": 25, + "references": [], + "type": "table", + "data": { + "name": "labels", + "was_declared_in_moor": false, + "columns": [ + { + "name": "id", + "getter_name": "id", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "PRIMARY KEY AUTOINCREMENT", + "dialectAwareDefaultConstraints": { + "sqlite": "PRIMARY KEY AUTOINCREMENT" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + "auto-increment" + ] + }, + { + "name": "name", + "getter_name": "name", + "moor_type": "string", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "text_color", + "getter_name": "textColor", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "background_color", + "getter_name": "backgroundColor", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "created_at", + "getter_name": "createdAt", + "moor_type": "dateTime", + "nullable": false, + "customConstraints": null, + "default_dart": "currentDateAndTime", + "default_client_dart": null, + "dsl_features": [] + } + ], + "is_virtual": false, + "without_rowid": false, + "constraints": [] + } + }, + { + "id": 26, + "references": [ + 0, + 25 + ], + "type": "table", + "data": { + "name": "contact_labels", + "was_declared_in_moor": false, + "columns": [ + { + "name": "contact_id", + "getter_name": "contactId", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", + "dialectAwareDefaultConstraints": { + "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + { + "foreign_key": { + "to": { + "table": "contacts", + "column": "user_id" + }, + "initially_deferred": false, + "on_update": null, + "on_delete": "cascade" + } + } + ] + }, + { + "name": "label_id", + "getter_name": "labelId", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "REFERENCES labels (id) ON DELETE CASCADE", + "dialectAwareDefaultConstraints": { + "sqlite": "REFERENCES labels (id) ON DELETE CASCADE" + }, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [ + { + "foreign_key": { + "to": { + "table": "labels", + "column": "id" + }, + "initially_deferred": false, + "on_update": null, + "on_delete": "cascade" + } + } + ] + } + ], + "is_virtual": false, + "without_rowid": false, + "constraints": [], + "explicit_pk": [ + "contact_id", + "label_id" + ] + } + } + ] +} \ No newline at end of file diff --git a/lib/src/database/signal/signal_signed_pre_key_store.dart b/lib/src/database/signal/signal_signed_pre_key_store.dart index 1c282bd9..1d4c8e4c 100644 --- a/lib/src/database/signal/signal_signed_pre_key_store.dart +++ b/lib/src/database/signal/signal_signed_pre_key_store.dart @@ -63,6 +63,7 @@ class SignalSignedPreKeyStore extends SignedPreKeyStore { .insert(companion, mode: InsertMode.insertOrReplace); } catch (e) { Log.error('$e'); + rethrow; } } diff --git a/lib/src/database/tables/contacts.table.dart b/lib/src/database/tables/contacts.table.dart index b456e534..820ba69d 100644 --- a/lib/src/database/tables/contacts.table.dart +++ b/lib/src/database/tables/contacts.table.dart @@ -1,5 +1,8 @@ import 'package:drift/drift.dart'; + +enum SignalVersion { v1, v2 } + @DataClassName('Contact') class Contacts extends Table { IntColumn get userId => integer()(); @@ -23,6 +26,9 @@ class Contacts extends Table { DateTimeColumn get createdAt => dateTime().withDefault(currentDateAndTime)(); + TextColumn get signalVersion => + textEnum().withDefault(const Constant('v1'))(); + // User Discovery BlobColumn get userDiscoveryVersion => blob().nullable()(); BoolColumn get userDiscoveryExcluded => diff --git a/lib/src/database/tables/groups.table.dart b/lib/src/database/tables/groups.table.dart index ab42b249..085d7b0f 100644 --- a/lib/src/database/tables/groups.table.dart +++ b/lib/src/database/tables/groups.table.dart @@ -31,7 +31,7 @@ class Groups extends Table { boolean().withDefault(const Constant(false))(); IntColumn get deleteMessagesAfterMilliseconds => integer().withDefault( - const Constant(defaultDeleteMessagesAfterMilliseconds), + const Constant(1000 * 60 * 60 * 24), )(); DateTimeColumn get createdAt => dateTime().withDefault(currentDateAndTime)(); diff --git a/lib/src/database/twonly.db.dart b/lib/src/database/twonly.db.dart index 4230e713..0f69e6ef 100644 --- a/lib/src/database/twonly.db.dart +++ b/lib/src/database/twonly.db.dart @@ -87,7 +87,7 @@ class TwonlyDB extends _$TwonlyDB { TwonlyDB.forTesting(DatabaseConnection super.connection); @override - int get schemaVersion => 24; + int get schemaVersion => 25; static QueryExecutor _openConnection() { final connection = driftDatabase( @@ -294,6 +294,9 @@ class TwonlyDB extends _$TwonlyDB { await m.createTable(schema.labels); await m.createTable(schema.contactLabels); }, + from24To25: (m, schema) async { + await m.addColumn(schema.contacts, schema.contacts.signalVersion); + }, )(m, from, to); }, ); diff --git a/lib/src/database/twonly.db.g.dart b/lib/src/database/twonly.db.g.dart index 22d5811e..3d84320a 100644 --- a/lib/src/database/twonly.db.g.dart +++ b/lib/src/database/twonly.db.g.dart @@ -174,6 +174,16 @@ class $ContactsTable extends Contacts with TableInfo<$ContactsTable, Contact> { requiredDuringInsert: false, defaultValue: currentDateAndTime, ); + @override + late final GeneratedColumnWithTypeConverter + signalVersion = GeneratedColumn( + 'signal_version', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: const Constant('v1'), + ).withConverter($ContactsTable.$convertersignalVersion); static const VerificationMeta _userDiscoveryVersionMeta = const VerificationMeta('userDiscoveryVersion'); @override @@ -337,6 +347,7 @@ class $ContactsTable extends Contacts with TableInfo<$ContactsTable, Contact> { verified, accountDeleted, createdAt, + signalVersion, userDiscoveryVersion, userDiscoveryExcluded, userDiscoveryManualApproved, @@ -626,6 +637,12 @@ class $ContactsTable extends Contacts with TableInfo<$ContactsTable, Contact> { DriftSqlType.dateTime, data['${effectivePrefix}created_at'], )!, + signalVersion: $ContactsTable.$convertersignalVersion.fromSql( + attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}signal_version'], + )!, + ), userDiscoveryVersion: attachedDatabase.typeMapping.read( DriftSqlType.blob, data['${effectivePrefix}user_discovery_version'], @@ -681,6 +698,11 @@ class $ContactsTable extends Contacts with TableInfo<$ContactsTable, Contact> { $ContactsTable createAlias(String alias) { return $ContactsTable(attachedDatabase, alias); } + + static JsonTypeConverter2 + $convertersignalVersion = const EnumNameConverter( + SignalVersion.values, + ); } class Contact extends DataClass implements Insertable { @@ -697,6 +719,7 @@ class Contact extends DataClass implements Insertable { final bool verified; final bool accountDeleted; final DateTime createdAt; + final SignalVersion signalVersion; final Uint8List? userDiscoveryVersion; final bool userDiscoveryExcluded; final bool? userDiscoveryManualApproved; @@ -723,6 +746,7 @@ class Contact extends DataClass implements Insertable { required this.verified, required this.accountDeleted, required this.createdAt, + required this.signalVersion, this.userDiscoveryVersion, required this.userDiscoveryExcluded, this.userDiscoveryManualApproved, @@ -758,6 +782,11 @@ class Contact extends DataClass implements Insertable { map['verified'] = Variable(verified); map['account_deleted'] = Variable(accountDeleted); map['created_at'] = Variable(createdAt); + { + map['signal_version'] = Variable( + $ContactsTable.$convertersignalVersion.toSql(signalVersion), + ); + } if (!nullToAbsent || userDiscoveryVersion != null) { map['user_discovery_version'] = Variable(userDiscoveryVersion); } @@ -820,6 +849,7 @@ class Contact extends DataClass implements Insertable { verified: Value(verified), accountDeleted: Value(accountDeleted), createdAt: Value(createdAt), + signalVersion: Value(signalVersion), userDiscoveryVersion: userDiscoveryVersion == null && nullToAbsent ? const Value.absent() : Value(userDiscoveryVersion), @@ -878,6 +908,9 @@ class Contact extends DataClass implements Insertable { verified: serializer.fromJson(json['verified']), accountDeleted: serializer.fromJson(json['accountDeleted']), createdAt: serializer.fromJson(json['createdAt']), + signalVersion: $ContactsTable.$convertersignalVersion.fromJson( + serializer.fromJson(json['signalVersion']), + ), userDiscoveryVersion: serializer.fromJson( json['userDiscoveryVersion'], ), @@ -931,6 +964,9 @@ class Contact extends DataClass implements Insertable { 'verified': serializer.toJson(verified), 'accountDeleted': serializer.toJson(accountDeleted), 'createdAt': serializer.toJson(createdAt), + 'signalVersion': serializer.toJson( + $ContactsTable.$convertersignalVersion.toJson(signalVersion), + ), 'userDiscoveryVersion': serializer.toJson( userDiscoveryVersion, ), @@ -976,6 +1012,7 @@ class Contact extends DataClass implements Insertable { bool? verified, bool? accountDeleted, DateTime? createdAt, + SignalVersion? signalVersion, Value userDiscoveryVersion = const Value.absent(), bool? userDiscoveryExcluded, Value userDiscoveryManualApproved = const Value.absent(), @@ -1004,6 +1041,7 @@ class Contact extends DataClass implements Insertable { verified: verified ?? this.verified, accountDeleted: accountDeleted ?? this.accountDeleted, createdAt: createdAt ?? this.createdAt, + signalVersion: signalVersion ?? this.signalVersion, userDiscoveryVersion: userDiscoveryVersion.present ? userDiscoveryVersion.value : this.userDiscoveryVersion, @@ -1059,6 +1097,9 @@ class Contact extends DataClass implements Insertable { ? data.accountDeleted.value : this.accountDeleted, createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + signalVersion: data.signalVersion.present + ? data.signalVersion.value + : this.signalVersion, userDiscoveryVersion: data.userDiscoveryVersion.present ? data.userDiscoveryVersion.value : this.userDiscoveryVersion, @@ -1114,6 +1155,7 @@ class Contact extends DataClass implements Insertable { ..write('verified: $verified, ') ..write('accountDeleted: $accountDeleted, ') ..write('createdAt: $createdAt, ') + ..write('signalVersion: $signalVersion, ') ..write('userDiscoveryVersion: $userDiscoveryVersion, ') ..write('userDiscoveryExcluded: $userDiscoveryExcluded, ') ..write('userDiscoveryManualApproved: $userDiscoveryManualApproved, ') @@ -1147,6 +1189,7 @@ class Contact extends DataClass implements Insertable { verified, accountDeleted, createdAt, + signalVersion, $driftBlobEquality.hash(userDiscoveryVersion), userDiscoveryExcluded, userDiscoveryManualApproved, @@ -1180,6 +1223,7 @@ class Contact extends DataClass implements Insertable { other.verified == this.verified && other.accountDeleted == this.accountDeleted && other.createdAt == this.createdAt && + other.signalVersion == this.signalVersion && $driftBlobEquality.equals( other.userDiscoveryVersion, this.userDiscoveryVersion, @@ -1219,6 +1263,7 @@ class ContactsCompanion extends UpdateCompanion { final Value verified; final Value accountDeleted; final Value createdAt; + final Value signalVersion; final Value userDiscoveryVersion; final Value userDiscoveryExcluded; final Value userDiscoveryManualApproved; @@ -1245,6 +1290,7 @@ class ContactsCompanion extends UpdateCompanion { this.verified = const Value.absent(), this.accountDeleted = const Value.absent(), this.createdAt = const Value.absent(), + this.signalVersion = const Value.absent(), this.userDiscoveryVersion = const Value.absent(), this.userDiscoveryExcluded = const Value.absent(), this.userDiscoveryManualApproved = const Value.absent(), @@ -1272,6 +1318,7 @@ class ContactsCompanion extends UpdateCompanion { this.verified = const Value.absent(), this.accountDeleted = const Value.absent(), this.createdAt = const Value.absent(), + this.signalVersion = const Value.absent(), this.userDiscoveryVersion = const Value.absent(), this.userDiscoveryExcluded = const Value.absent(), this.userDiscoveryManualApproved = const Value.absent(), @@ -1299,6 +1346,7 @@ class ContactsCompanion extends UpdateCompanion { Expression? verified, Expression? accountDeleted, Expression? createdAt, + Expression? signalVersion, Expression? userDiscoveryVersion, Expression? userDiscoveryExcluded, Expression? userDiscoveryManualApproved, @@ -1328,6 +1376,7 @@ class ContactsCompanion extends UpdateCompanion { if (verified != null) 'verified': verified, if (accountDeleted != null) 'account_deleted': accountDeleted, if (createdAt != null) 'created_at': createdAt, + if (signalVersion != null) 'signal_version': signalVersion, if (userDiscoveryVersion != null) 'user_discovery_version': userDiscoveryVersion, if (userDiscoveryExcluded != null) @@ -1368,6 +1417,7 @@ class ContactsCompanion extends UpdateCompanion { Value? verified, Value? accountDeleted, Value? createdAt, + Value? signalVersion, Value? userDiscoveryVersion, Value? userDiscoveryExcluded, Value? userDiscoveryManualApproved, @@ -1395,6 +1445,7 @@ class ContactsCompanion extends UpdateCompanion { verified: verified ?? this.verified, accountDeleted: accountDeleted ?? this.accountDeleted, createdAt: createdAt ?? this.createdAt, + signalVersion: signalVersion ?? this.signalVersion, userDiscoveryVersion: userDiscoveryVersion ?? this.userDiscoveryVersion, userDiscoveryExcluded: userDiscoveryExcluded ?? this.userDiscoveryExcluded, @@ -1462,6 +1513,11 @@ class ContactsCompanion extends UpdateCompanion { if (createdAt.present) { map['created_at'] = Variable(createdAt.value); } + if (signalVersion.present) { + map['signal_version'] = Variable( + $ContactsTable.$convertersignalVersion.toSql(signalVersion.value), + ); + } if (userDiscoveryVersion.present) { map['user_discovery_version'] = Variable( userDiscoveryVersion.value, @@ -1537,6 +1593,7 @@ class ContactsCompanion extends UpdateCompanion { ..write('verified: $verified, ') ..write('accountDeleted: $accountDeleted, ') ..write('createdAt: $createdAt, ') + ..write('signalVersion: $signalVersion, ') ..write('userDiscoveryVersion: $userDiscoveryVersion, ') ..write('userDiscoveryExcluded: $userDiscoveryExcluded, ') ..write('userDiscoveryManualApproved: $userDiscoveryManualApproved, ') @@ -1769,7 +1826,7 @@ class $GroupsTable extends Groups with TableInfo<$GroupsTable, Group> { false, type: DriftSqlType.int, requiredDuringInsert: false, - defaultValue: const Constant(defaultDeleteMessagesAfterMilliseconds), + defaultValue: const Constant(1000 * 60 * 60 * 24), ); static const VerificationMeta _createdAtMeta = const VerificationMeta( 'createdAt', @@ -14022,6 +14079,7 @@ typedef $$ContactsTableCreateCompanionBuilder = Value verified, Value accountDeleted, Value createdAt, + Value signalVersion, Value userDiscoveryVersion, Value userDiscoveryExcluded, Value userDiscoveryManualApproved, @@ -14050,6 +14108,7 @@ typedef $$ContactsTableUpdateCompanionBuilder = Value verified, Value accountDeleted, Value createdAt, + Value signalVersion, Value userDiscoveryVersion, Value userDiscoveryExcluded, Value userDiscoveryManualApproved, @@ -14429,6 +14488,12 @@ class $$ContactsTableFilterComposer builder: (column) => ColumnFilters(column), ); + ColumnWithTypeConverterFilters + get signalVersion => $composableBuilder( + column: $table.signalVersion, + builder: (column) => ColumnWithTypeConverterFilters(column), + ); + ColumnFilters get userDiscoveryVersion => $composableBuilder( column: $table.userDiscoveryVersion, builder: (column) => ColumnFilters(column), @@ -14874,6 +14939,11 @@ class $$ContactsTableOrderingComposer builder: (column) => ColumnOrderings(column), ); + ColumnOrderings get signalVersion => $composableBuilder( + column: $table.signalVersion, + builder: (column) => ColumnOrderings(column), + ); + ColumnOrderings get userDiscoveryVersion => $composableBuilder( column: $table.userDiscoveryVersion, builder: (column) => ColumnOrderings(column), @@ -14995,6 +15065,12 @@ class $$ContactsTableAnnotationComposer GeneratedColumn get createdAt => $composableBuilder(column: $table.createdAt, builder: (column) => column); + GeneratedColumnWithTypeConverter get signalVersion => + $composableBuilder( + column: $table.signalVersion, + builder: (column) => column, + ); + GeneratedColumn get userDiscoveryVersion => $composableBuilder( column: $table.userDiscoveryVersion, builder: (column) => column, @@ -15425,6 +15501,7 @@ class $$ContactsTableTableManager Value verified = const Value.absent(), Value accountDeleted = const Value.absent(), Value createdAt = const Value.absent(), + Value signalVersion = const Value.absent(), Value userDiscoveryVersion = const Value.absent(), Value userDiscoveryExcluded = const Value.absent(), Value userDiscoveryManualApproved = const Value.absent(), @@ -15453,6 +15530,7 @@ class $$ContactsTableTableManager verified: verified, accountDeleted: accountDeleted, createdAt: createdAt, + signalVersion: signalVersion, userDiscoveryVersion: userDiscoveryVersion, userDiscoveryExcluded: userDiscoveryExcluded, userDiscoveryManualApproved: userDiscoveryManualApproved, @@ -15481,6 +15559,7 @@ class $$ContactsTableTableManager Value verified = const Value.absent(), Value accountDeleted = const Value.absent(), Value createdAt = const Value.absent(), + Value signalVersion = const Value.absent(), Value userDiscoveryVersion = const Value.absent(), Value userDiscoveryExcluded = const Value.absent(), Value userDiscoveryManualApproved = const Value.absent(), @@ -15509,6 +15588,7 @@ class $$ContactsTableTableManager verified: verified, accountDeleted: accountDeleted, createdAt: createdAt, + signalVersion: signalVersion, userDiscoveryVersion: userDiscoveryVersion, userDiscoveryExcluded: userDiscoveryExcluded, userDiscoveryManualApproved: userDiscoveryManualApproved, diff --git a/lib/src/database/twonly.db.steps.dart b/lib/src/database/twonly.db.steps.dart index d67b8b97..fcf6ad0a 100644 --- a/lib/src/database/twonly.db.steps.dart +++ b/lib/src/database/twonly.db.steps.dart @@ -3,6 +3,7 @@ import 'package:drift/internal/versioned_schema.dart' as i0; import 'package:drift/drift.dart' as i1; import 'dart:typed_data' as i2; import 'package:drift/drift.dart'; // GENERATED BY drift_dev, DO NOT MODIFY. +import 'package:twonly/src/database/tables/groups.table.dart'; // ignore_for_file: type=lint,unused_import // @@ -12673,6 +12674,1519 @@ i1.GeneratedColumn _column_259(String aliasedName) => type: i1.DriftSqlType.int, $customConstraints: 'NOT NULL REFERENCES labels(id)ON DELETE CASCADE', ); + +final class Schema25 extends i0.VersionedSchema { + Schema25({required super.database}) : super(version: 25); + @override + late final List entities = [ + contacts, + groups, + mediaFiles, + messages, + messageHistories, + reactions, + groupMembers, + receipts, + receivedReceipts, + signalIdentityKeyStores, + signalPreKeyStores, + signalSenderKeyStores, + signalSessionStores, + signalSignedPreKeyStores, + messageActions, + groupHistories, + keyVerifications, + verificationTokens, + userDiscoveryAnnouncedUsers, + userDiscoveryUserRelations, + userDiscoveryOtherPromotions, + userDiscoveryOwnPromotions, + userDiscoveryShares, + shortcuts, + shortcutMembers, + labels, + contactLabels, + ]; + late final Shape61 contacts = Shape61( + source: i0.VersionedTable( + entityName: 'contacts', + withoutRowId: false, + isStrict: false, + tableConstraints: ['PRIMARY KEY(user_id)'], + columns: [ + _column_0, + _column_1, + _column_2, + _column_3, + _column_4, + _column_260, + _column_261, + _column_262, + _column_263, + _column_264, + _column_265, + _column_266, + _column_267, + _column_268, + _column_269, + _column_270, + _column_271, + _column_272, + _column_273, + _column_274, + _column_275, + _column_276, + _column_277, + _column_278, + _column_279, + _column_280, + ], + attachedDatabase: database, + ), + alias: null, + ); + late final Shape17 groups = Shape17( + source: i0.VersionedTable( + entityName: 'groups', + withoutRowId: false, + isStrict: false, + tableConstraints: ['PRIMARY KEY(group_id)'], + columns: [ + _column_13, + _column_281, + _column_282, + _column_283, + _column_284, + _column_285, + _column_286, + _column_287, + _column_288, + _column_22, + _column_23, + _column_24, + _column_100, + _column_289, + _column_290, + _column_291, + _column_267, + _column_28, + _column_29, + _column_30, + _column_31, + _column_292, + _column_293, + _column_34, + _column_294, + ], + attachedDatabase: database, + ), + alias: null, + ); + late final Shape62 mediaFiles = Shape62( + source: i0.VersionedTable( + entityName: 'media_files', + withoutRowId: false, + isStrict: false, + tableConstraints: ['PRIMARY KEY(media_id)'], + columns: [ + _column_36, + _column_37, + _column_38, + _column_295, + _column_296, + _column_39, + _column_297, + _column_298, + _column_299, + _column_300, + _column_301, + _column_302, + _column_43, + _column_44, + _column_45, + _column_46, + _column_47, + _column_48, + _column_49, + _column_102, + _column_303, + _column_304, + _column_267, + _column_305, + ], + attachedDatabase: database, + ), + alias: null, + ); + late final Shape21 messages = Shape21( + source: i0.VersionedTable( + entityName: 'messages', + withoutRowId: false, + isStrict: false, + tableConstraints: ['PRIMARY KEY(message_id)'], + columns: [ + _column_50, + _column_51, + _column_52, + _column_37, + _column_53, + _column_54, + _column_105, + _column_306, + _column_307, + _column_46, + _column_57, + _column_308, + _column_59, + _column_60, + _column_267, + _column_61, + _column_62, + _column_63, + ], + attachedDatabase: database, + ), + alias: null, + ); + late final Shape4 messageHistories = Shape4( + source: i0.VersionedTable( + entityName: 'message_histories', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [_column_64, _column_65, _column_309, _column_53, _column_267], + attachedDatabase: database, + ), + alias: null, + ); + late final Shape5 reactions = Shape5( + source: i0.VersionedTable( + entityName: 'reactions', + withoutRowId: false, + isStrict: false, + tableConstraints: ['PRIMARY KEY(message_id, sender_id, emoji)'], + columns: [_column_65, _column_67, _column_68, _column_267], + attachedDatabase: database, + ), + alias: null, + ); + late final Shape63 groupMembers = Shape63( + source: i0.VersionedTable( + entityName: 'group_members', + withoutRowId: false, + isStrict: false, + tableConstraints: ['PRIMARY KEY(group_id, contact_id)'], + columns: [ + _column_50, + _column_69, + _column_70, + _column_71, + _column_310, + _column_311, + _column_72, + _column_267, + ], + attachedDatabase: database, + ), + alias: null, + ); + late final Shape64 receipts = Shape64( + source: i0.VersionedTable( + entityName: 'receipts', + withoutRowId: false, + isStrict: false, + tableConstraints: ['PRIMARY KEY(receipt_id)'], + columns: [ + _column_73, + _column_74, + _column_75, + _column_76, + _column_312, + _column_313, + _column_103, + _column_104, + _column_78, + _column_314, + _column_80, + _column_267, + ], + attachedDatabase: database, + ), + alias: null, + ); + late final Shape8 receivedReceipts = Shape8( + source: i0.VersionedTable( + entityName: 'received_receipts', + withoutRowId: false, + isStrict: false, + tableConstraints: ['PRIMARY KEY(receipt_id)'], + columns: [_column_73, _column_267], + attachedDatabase: database, + ), + alias: null, + ); + late final Shape9 signalIdentityKeyStores = Shape9( + source: i0.VersionedTable( + entityName: 'signal_identity_key_stores', + withoutRowId: false, + isStrict: false, + tableConstraints: ['PRIMARY KEY(device_id, name)'], + columns: [_column_81, _column_82, _column_83, _column_267], + attachedDatabase: database, + ), + alias: null, + ); + late final Shape10 signalPreKeyStores = Shape10( + source: i0.VersionedTable( + entityName: 'signal_pre_key_stores', + withoutRowId: false, + isStrict: false, + tableConstraints: ['PRIMARY KEY(pre_key_id)'], + columns: [_column_84, _column_85, _column_267], + attachedDatabase: database, + ), + alias: null, + ); + late final Shape11 signalSenderKeyStores = Shape11( + source: i0.VersionedTable( + entityName: 'signal_sender_key_stores', + withoutRowId: false, + isStrict: false, + tableConstraints: ['PRIMARY KEY(sender_key_name)'], + columns: [_column_86, _column_87], + attachedDatabase: database, + ), + alias: null, + ); + late final Shape12 signalSessionStores = Shape12( + source: i0.VersionedTable( + entityName: 'signal_session_stores', + withoutRowId: false, + isStrict: false, + tableConstraints: ['PRIMARY KEY(device_id, name)'], + columns: [_column_81, _column_82, _column_88, _column_267], + attachedDatabase: database, + ), + alias: null, + ); + late final Shape65 signalSignedPreKeyStores = Shape65( + source: i0.VersionedTable( + entityName: 'signal_signed_pre_key_stores', + withoutRowId: false, + isStrict: false, + tableConstraints: ['PRIMARY KEY(signed_pre_key_id)'], + columns: [_column_89, _column_90, _column_267], + attachedDatabase: database, + ), + alias: null, + ); + late final Shape15 messageActions = Shape15( + source: i0.VersionedTable( + entityName: 'message_actions', + withoutRowId: false, + isStrict: false, + tableConstraints: ['PRIMARY KEY(message_id, contact_id, type)'], + columns: [_column_65, _column_74, _column_37, _column_315], + attachedDatabase: database, + ), + alias: null, + ); + late final Shape16 groupHistories = Shape16( + source: i0.VersionedTable( + entityName: 'group_histories', + withoutRowId: false, + isStrict: false, + tableConstraints: ['PRIMARY KEY(group_history_id)'], + columns: [ + _column_94, + _column_50, + _column_95, + _column_101, + _column_97, + _column_98, + _column_99, + _column_37, + _column_315, + ], + attachedDatabase: database, + ), + alias: null, + ); + late final Shape66 keyVerifications = Shape66( + source: i0.VersionedTable( + entityName: 'key_verifications', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [_column_316, _column_74, _column_37, _column_317, _column_267], + attachedDatabase: database, + ), + alias: null, + ); + late final Shape67 verificationTokens = Shape67( + source: i0.VersionedTable( + entityName: 'verification_tokens', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [_column_318, _column_319, _column_267], + attachedDatabase: database, + ), + alias: null, + ); + late final Shape68 userDiscoveryAnnouncedUsers = Shape68( + source: i0.VersionedTable( + entityName: 'user_discovery_announced_users', + withoutRowId: false, + isStrict: false, + tableConstraints: ['PRIMARY KEY(announced_user_id)'], + columns: [ + _column_320, + _column_321, + _column_322, + _column_323, + _column_324, + _column_325, + _column_326, + ], + attachedDatabase: database, + ), + alias: null, + ); + late final Shape69 userDiscoveryUserRelations = Shape69( + source: i0.VersionedTable( + entityName: 'user_discovery_user_relations', + withoutRowId: false, + isStrict: false, + tableConstraints: ['PRIMARY KEY(announced_user_id, from_contact_id)'], + columns: [_column_327, _column_328, _column_329], + attachedDatabase: database, + ), + alias: null, + ); + late final Shape70 userDiscoveryOtherPromotions = Shape70( + source: i0.VersionedTable( + entityName: 'user_discovery_other_promotions', + withoutRowId: false, + isStrict: false, + tableConstraints: ['PRIMARY KEY(from_contact_id, public_id)'], + columns: [ + _column_328, + _column_330, + _column_331, + _column_332, + _column_333, + _column_329, + ], + attachedDatabase: database, + ), + alias: null, + ); + late final Shape45 userDiscoveryOwnPromotions = Shape45( + source: i0.VersionedTable( + entityName: 'user_discovery_own_promotions', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [_column_334, _column_74, _column_335], + attachedDatabase: database, + ), + alias: null, + ); + late final Shape46 userDiscoveryShares = Shape46( + source: i0.VersionedTable( + entityName: 'user_discovery_shares', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [_column_336, _column_337, _column_309], + attachedDatabase: database, + ), + alias: null, + ); + late final Shape47 shortcuts = Shape47( + source: i0.VersionedTable( + entityName: 'shortcuts', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [_column_64, _column_338, _column_339], + attachedDatabase: database, + ), + alias: null, + ); + late final Shape48 shortcutMembers = Shape48( + source: i0.VersionedTable( + entityName: 'shortcut_members', + withoutRowId: false, + isStrict: false, + tableConstraints: ['PRIMARY KEY(shortcut_id, group_id)'], + columns: [_column_340, _column_50], + attachedDatabase: database, + ), + alias: null, + ); + late final Shape71 labels = Shape71( + source: i0.VersionedTable( + entityName: 'labels', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [_column_64, _column_82, _column_341, _column_342, _column_267], + attachedDatabase: database, + ), + alias: null, + ); + late final Shape60 contactLabels = Shape60( + source: i0.VersionedTable( + entityName: 'contact_labels', + withoutRowId: false, + isStrict: false, + tableConstraints: ['PRIMARY KEY(contact_id, label_id)'], + columns: [_column_74, _column_343], + attachedDatabase: database, + ), + alias: null, + ); +} + +class Shape61 extends i0.VersionedTable { + Shape61({required super.source, required super.alias}) : super.aliased(); + i1.GeneratedColumn get userId => + columnsByName['user_id']! as i1.GeneratedColumn; + i1.GeneratedColumn get username => + columnsByName['username']! as i1.GeneratedColumn; + i1.GeneratedColumn get displayName => + columnsByName['display_name']! as i1.GeneratedColumn; + i1.GeneratedColumn get nickName => + columnsByName['nick_name']! as i1.GeneratedColumn; + i1.GeneratedColumn get avatarSvgCompressed => + columnsByName['avatar_svg_compressed']! + as i1.GeneratedColumn; + i1.GeneratedColumn get senderProfileCounter => + columnsByName['sender_profile_counter']! as i1.GeneratedColumn; + i1.GeneratedColumn get accepted => + columnsByName['accepted']! as i1.GeneratedColumn; + i1.GeneratedColumn get deletedByUser => + columnsByName['deleted_by_user']! as i1.GeneratedColumn; + i1.GeneratedColumn get requested => + columnsByName['requested']! as i1.GeneratedColumn; + i1.GeneratedColumn get blocked => + columnsByName['blocked']! as i1.GeneratedColumn; + i1.GeneratedColumn get verified => + columnsByName['verified']! as i1.GeneratedColumn; + i1.GeneratedColumn get accountDeleted => + columnsByName['account_deleted']! as i1.GeneratedColumn; + i1.GeneratedColumn get createdAt => + columnsByName['created_at']! as i1.GeneratedColumn; + i1.GeneratedColumn get signalVersion => + columnsByName['signal_version']! as i1.GeneratedColumn; + i1.GeneratedColumn get userDiscoveryVersion => + columnsByName['user_discovery_version']! + as i1.GeneratedColumn; + i1.GeneratedColumn get userDiscoveryExcluded => + columnsByName['user_discovery_excluded']! as i1.GeneratedColumn; + i1.GeneratedColumn get userDiscoveryManualApproved => + columnsByName['user_discovery_manual_approved']! + as i1.GeneratedColumn; + i1.GeneratedColumn get recoveryIsTrustedFriend => + columnsByName['recovery_is_trusted_friend']! as i1.GeneratedColumn; + i1.GeneratedColumn get recoveryLastHeartbeat => + columnsByName['recovery_last_heartbeat']! as i1.GeneratedColumn; + i1.GeneratedColumn get recoverySecretShare => + columnsByName['recovery_secret_share']! + as i1.GeneratedColumn; + i1.GeneratedColumn get recoveryContactsSecretShare => + columnsByName['recovery_contacts_secret_share']! + as i1.GeneratedColumn; + i1.GeneratedColumn get recoveryContactsLastHeartbeat => + columnsByName['recovery_contacts_last_heartbeat']! + as i1.GeneratedColumn; + i1.GeneratedColumn get recoveryContactsThreshold => + columnsByName['recovery_contacts_threshold']! as i1.GeneratedColumn; + i1.GeneratedColumn get askForFriendPromotions => + columnsByName['ask_for_friend_promotions']! as i1.GeneratedColumn; + i1.GeneratedColumn get mediaSendCounter => + columnsByName['media_send_counter']! as i1.GeneratedColumn; + i1.GeneratedColumn get mediaReceivedCounter => + columnsByName['media_received_counter']! as i1.GeneratedColumn; +} + +i1.GeneratedColumn _column_260(String aliasedName) => + i1.GeneratedColumn( + 'sender_profile_counter', + aliasedName, + false, + type: i1.DriftSqlType.int, + defaultValue: const Constant(0), + ); +i1.GeneratedColumn _column_261(String aliasedName) => + i1.GeneratedColumn( + 'accepted', + aliasedName, + false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("accepted" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); +i1.GeneratedColumn _column_262(String aliasedName) => + i1.GeneratedColumn( + 'deleted_by_user', + aliasedName, + false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("deleted_by_user" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); +i1.GeneratedColumn _column_263(String aliasedName) => + i1.GeneratedColumn( + 'requested', + aliasedName, + false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("requested" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); +i1.GeneratedColumn _column_264(String aliasedName) => + i1.GeneratedColumn( + 'blocked', + aliasedName, + false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("blocked" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); +i1.GeneratedColumn _column_265(String aliasedName) => + i1.GeneratedColumn( + 'verified', + aliasedName, + false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("verified" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); +i1.GeneratedColumn _column_266(String aliasedName) => + i1.GeneratedColumn( + 'account_deleted', + aliasedName, + false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("account_deleted" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); +i1.GeneratedColumn _column_267(String aliasedName) => + i1.GeneratedColumn( + 'created_at', + aliasedName, + false, + type: i1.DriftSqlType.dateTime, + defaultValue: currentDateAndTime, + ); +i1.GeneratedColumn _column_268(String aliasedName) => + i1.GeneratedColumn( + 'signal_version', + aliasedName, + false, + type: i1.DriftSqlType.string, + defaultValue: const Constant('v1'), + ); +i1.GeneratedColumn _column_269(String aliasedName) => + i1.GeneratedColumn( + 'user_discovery_version', + aliasedName, + true, + type: i1.DriftSqlType.blob, + ); +i1.GeneratedColumn _column_270(String aliasedName) => + i1.GeneratedColumn( + 'user_discovery_excluded', + aliasedName, + false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("user_discovery_excluded" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); +i1.GeneratedColumn _column_271(String aliasedName) => + i1.GeneratedColumn( + 'user_discovery_manual_approved', + aliasedName, + true, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("user_discovery_manual_approved" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); +i1.GeneratedColumn _column_272(String aliasedName) => + i1.GeneratedColumn( + 'recovery_is_trusted_friend', + aliasedName, + false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("recovery_is_trusted_friend" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); +i1.GeneratedColumn _column_273(String aliasedName) => + i1.GeneratedColumn( + 'recovery_last_heartbeat', + aliasedName, + true, + type: i1.DriftSqlType.dateTime, + ); +i1.GeneratedColumn _column_274(String aliasedName) => + i1.GeneratedColumn( + 'recovery_secret_share', + aliasedName, + true, + type: i1.DriftSqlType.blob, + ); +i1.GeneratedColumn _column_275(String aliasedName) => + i1.GeneratedColumn( + 'recovery_contacts_secret_share', + aliasedName, + true, + type: i1.DriftSqlType.blob, + ); +i1.GeneratedColumn _column_276(String aliasedName) => + i1.GeneratedColumn( + 'recovery_contacts_last_heartbeat', + aliasedName, + true, + type: i1.DriftSqlType.dateTime, + ); +i1.GeneratedColumn _column_277(String aliasedName) => + i1.GeneratedColumn( + 'recovery_contacts_threshold', + aliasedName, + true, + type: i1.DriftSqlType.int, + ); +i1.GeneratedColumn _column_278(String aliasedName) => + i1.GeneratedColumn( + 'ask_for_friend_promotions', + aliasedName, + true, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("ask_for_friend_promotions" IN (0, 1))', + ), + ); +i1.GeneratedColumn _column_279(String aliasedName) => + i1.GeneratedColumn( + 'media_send_counter', + aliasedName, + false, + type: i1.DriftSqlType.int, + defaultValue: const Constant(0), + ); +i1.GeneratedColumn _column_280(String aliasedName) => + i1.GeneratedColumn( + 'media_received_counter', + aliasedName, + false, + type: i1.DriftSqlType.int, + defaultValue: const Constant(0), + ); +i1.GeneratedColumn _column_281(String aliasedName) => + i1.GeneratedColumn( + 'is_group_admin', + aliasedName, + false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("is_group_admin" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); +i1.GeneratedColumn _column_282(String aliasedName) => + i1.GeneratedColumn( + 'is_direct_chat', + aliasedName, + false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("is_direct_chat" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); +i1.GeneratedColumn _column_283(String aliasedName) => + i1.GeneratedColumn( + 'pinned', + aliasedName, + false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("pinned" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); +i1.GeneratedColumn _column_284(String aliasedName) => + i1.GeneratedColumn( + 'archived', + aliasedName, + false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("archived" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); +i1.GeneratedColumn _column_285(String aliasedName) => + i1.GeneratedColumn( + 'joined_group', + aliasedName, + false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("joined_group" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); +i1.GeneratedColumn _column_286(String aliasedName) => + i1.GeneratedColumn( + 'left_group', + aliasedName, + false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("left_group" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); +i1.GeneratedColumn _column_287(String aliasedName) => + i1.GeneratedColumn( + 'deleted_content', + aliasedName, + false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("deleted_content" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); +i1.GeneratedColumn _column_288(String aliasedName) => + i1.GeneratedColumn( + 'state_version_id', + aliasedName, + false, + type: i1.DriftSqlType.int, + defaultValue: const Constant(0), + ); +i1.GeneratedColumn _column_289(String aliasedName) => + i1.GeneratedColumn( + 'total_media_counter', + aliasedName, + false, + type: i1.DriftSqlType.int, + defaultValue: const Constant(0), + ); +i1.GeneratedColumn _column_290(String aliasedName) => + i1.GeneratedColumn( + 'also_best_friend', + aliasedName, + false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("also_best_friend" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); +i1.GeneratedColumn _column_291(String aliasedName) => + i1.GeneratedColumn( + 'delete_messages_after_milliseconds', + aliasedName, + false, + type: i1.DriftSqlType.int, + defaultValue: const Constant(defaultDeleteMessagesAfterMilliseconds), + ); +i1.GeneratedColumn _column_292(String aliasedName) => + i1.GeneratedColumn( + 'flame_counter', + aliasedName, + false, + type: i1.DriftSqlType.int, + defaultValue: const Constant(0), + ); +i1.GeneratedColumn _column_293(String aliasedName) => + i1.GeneratedColumn( + 'max_flame_counter', + aliasedName, + false, + type: i1.DriftSqlType.int, + defaultValue: const Constant(0), + ); +i1.GeneratedColumn _column_294(String aliasedName) => + i1.GeneratedColumn( + 'last_message_exchange', + aliasedName, + false, + type: i1.DriftSqlType.dateTime, + defaultValue: currentDateAndTime, + ); + +class Shape62 extends i0.VersionedTable { + Shape62({required super.source, required super.alias}) : super.aliased(); + i1.GeneratedColumn get mediaId => + columnsByName['media_id']! as i1.GeneratedColumn; + i1.GeneratedColumn get type => + columnsByName['type']! as i1.GeneratedColumn; + i1.GeneratedColumn get uploadState => + columnsByName['upload_state']! as i1.GeneratedColumn; + i1.GeneratedColumn get cloudState => + columnsByName['cloud_state']! as i1.GeneratedColumn; + i1.GeneratedColumn get blurhash => + columnsByName['blurhash']! as i1.GeneratedColumn; + i1.GeneratedColumn get downloadState => + columnsByName['download_state']! as i1.GeneratedColumn; + i1.GeneratedColumn get requiresAuthentication => + columnsByName['requires_authentication']! as i1.GeneratedColumn; + i1.GeneratedColumn get stored => + columnsByName['stored']! as i1.GeneratedColumn; + i1.GeneratedColumn get isDraftMedia => + columnsByName['is_draft_media']! as i1.GeneratedColumn; + i1.GeneratedColumn get isFavorite => + columnsByName['is_favorite']! as i1.GeneratedColumn; + i1.GeneratedColumn get hasCropAnalyzed => + columnsByName['has_crop_analyzed']! as i1.GeneratedColumn; + i1.GeneratedColumn get preProgressingProcess => + columnsByName['pre_progressing_process']! as i1.GeneratedColumn; + i1.GeneratedColumn get reuploadRequestedBy => + columnsByName['reupload_requested_by']! as i1.GeneratedColumn; + i1.GeneratedColumn get displayLimitInMilliseconds => + columnsByName['display_limit_in_milliseconds']! + as i1.GeneratedColumn; + i1.GeneratedColumn get removeAudio => + columnsByName['remove_audio']! as i1.GeneratedColumn; + i1.GeneratedColumn get downloadToken => + columnsByName['download_token']! as i1.GeneratedColumn; + i1.GeneratedColumn get encryptionKey => + columnsByName['encryption_key']! as i1.GeneratedColumn; + i1.GeneratedColumn get encryptionMac => + columnsByName['encryption_mac']! as i1.GeneratedColumn; + i1.GeneratedColumn get encryptionNonce => + columnsByName['encryption_nonce']! as i1.GeneratedColumn; + i1.GeneratedColumn get storedFileHash => + columnsByName['stored_file_hash']! as i1.GeneratedColumn; + i1.GeneratedColumn get hasThumbnail => + columnsByName['has_thumbnail']! as i1.GeneratedColumn; + i1.GeneratedColumn get sizeInBytes => + columnsByName['size_in_bytes']! as i1.GeneratedColumn; + i1.GeneratedColumn get createdAt => + columnsByName['created_at']! as i1.GeneratedColumn; + i1.GeneratedColumn get createdAtMonth => + columnsByName['created_at_month']! as i1.GeneratedColumn; +} + +i1.GeneratedColumn _column_295(String aliasedName) => + i1.GeneratedColumn( + 'cloud_state', + aliasedName, + false, + type: i1.DriftSqlType.string, + defaultValue: const Constant('none'), + ); +i1.GeneratedColumn _column_296(String aliasedName) => + i1.GeneratedColumn( + 'blurhash', + aliasedName, + true, + type: i1.DriftSqlType.string, + ); +i1.GeneratedColumn _column_297(String aliasedName) => + i1.GeneratedColumn( + 'requires_authentication', + aliasedName, + false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("requires_authentication" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); +i1.GeneratedColumn _column_298(String aliasedName) => + i1.GeneratedColumn( + 'stored', + aliasedName, + false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("stored" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); +i1.GeneratedColumn _column_299(String aliasedName) => + i1.GeneratedColumn( + 'is_draft_media', + aliasedName, + false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("is_draft_media" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); +i1.GeneratedColumn _column_300(String aliasedName) => + i1.GeneratedColumn( + 'is_favorite', + aliasedName, + false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("is_favorite" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); +i1.GeneratedColumn _column_301(String aliasedName) => + i1.GeneratedColumn( + 'has_crop_analyzed', + aliasedName, + false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("has_crop_analyzed" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); +i1.GeneratedColumn _column_302(String aliasedName) => + i1.GeneratedColumn( + 'pre_progressing_process', + aliasedName, + true, + type: i1.DriftSqlType.int, + ); +i1.GeneratedColumn _column_303(String aliasedName) => + i1.GeneratedColumn( + 'has_thumbnail', + aliasedName, + false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("has_thumbnail" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); +i1.GeneratedColumn _column_304(String aliasedName) => + i1.GeneratedColumn( + 'size_in_bytes', + aliasedName, + true, + type: i1.DriftSqlType.int, + ); +i1.GeneratedColumn _column_305(String aliasedName) => + i1.GeneratedColumn( + 'created_at_month', + aliasedName, + true, + type: i1.DriftSqlType.string, + ); +i1.GeneratedColumn _column_306(String aliasedName) => + i1.GeneratedColumn( + 'media_stored', + aliasedName, + false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("media_stored" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); +i1.GeneratedColumn _column_307(String aliasedName) => + i1.GeneratedColumn( + 'media_reopened', + aliasedName, + false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("media_reopened" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); +i1.GeneratedColumn _column_308(String aliasedName) => + i1.GeneratedColumn( + 'is_deleted_from_sender', + aliasedName, + false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("is_deleted_from_sender" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); +i1.GeneratedColumn _column_309(String aliasedName) => + i1.GeneratedColumn( + 'contact_id', + aliasedName, + true, + type: i1.DriftSqlType.int, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'REFERENCES contacts (user_id) ON DELETE CASCADE', + ), + ); + +class Shape63 extends i0.VersionedTable { + Shape63({required super.source, required super.alias}) : super.aliased(); + i1.GeneratedColumn get groupId => + columnsByName['group_id']! as i1.GeneratedColumn; + i1.GeneratedColumn get contactId => + columnsByName['contact_id']! as i1.GeneratedColumn; + i1.GeneratedColumn get memberState => + columnsByName['member_state']! as i1.GeneratedColumn; + i1.GeneratedColumn get groupPublicKey => + columnsByName['group_public_key']! as i1.GeneratedColumn; + i1.GeneratedColumn get lastChatOpened => + columnsByName['last_chat_opened']! as i1.GeneratedColumn; + i1.GeneratedColumn get lastTypeIndicator => + columnsByName['last_type_indicator']! as i1.GeneratedColumn; + i1.GeneratedColumn get lastMessage => + columnsByName['last_message']! as i1.GeneratedColumn; + i1.GeneratedColumn get createdAt => + columnsByName['created_at']! as i1.GeneratedColumn; +} + +i1.GeneratedColumn _column_310(String aliasedName) => + i1.GeneratedColumn( + 'last_chat_opened', + aliasedName, + true, + type: i1.DriftSqlType.dateTime, + ); +i1.GeneratedColumn _column_311(String aliasedName) => + i1.GeneratedColumn( + 'last_type_indicator', + aliasedName, + true, + type: i1.DriftSqlType.dateTime, + ); + +class Shape64 extends i0.VersionedTable { + Shape64({required super.source, required super.alias}) : super.aliased(); + i1.GeneratedColumn get receiptId => + columnsByName['receipt_id']! as i1.GeneratedColumn; + i1.GeneratedColumn get contactId => + columnsByName['contact_id']! as i1.GeneratedColumn; + i1.GeneratedColumn get messageId => + columnsByName['message_id']! as i1.GeneratedColumn; + i1.GeneratedColumn get message => + columnsByName['message']! as i1.GeneratedColumn; + i1.GeneratedColumn get contactWillSendsReceipt => + columnsByName['contact_will_sends_receipt']! as i1.GeneratedColumn; + i1.GeneratedColumn get willBeRetriedByMediaUpload => + columnsByName['will_be_retried_by_media_upload']! + as i1.GeneratedColumn; + i1.GeneratedColumn get markForRetry => + columnsByName['mark_for_retry']! as i1.GeneratedColumn; + i1.GeneratedColumn get markForRetryAfterAccepted => + columnsByName['mark_for_retry_after_accepted']! + as i1.GeneratedColumn; + i1.GeneratedColumn get ackByServerAt => + columnsByName['ack_by_server_at']! as i1.GeneratedColumn; + i1.GeneratedColumn get retryCount => + columnsByName['retry_count']! as i1.GeneratedColumn; + i1.GeneratedColumn get lastRetry => + columnsByName['last_retry']! as i1.GeneratedColumn; + i1.GeneratedColumn get createdAt => + columnsByName['created_at']! as i1.GeneratedColumn; +} + +i1.GeneratedColumn _column_312(String aliasedName) => + i1.GeneratedColumn( + 'contact_will_sends_receipt', + aliasedName, + false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("contact_will_sends_receipt" IN (0, 1))', + ), + defaultValue: const Constant(true), + ); +i1.GeneratedColumn _column_313(String aliasedName) => + i1.GeneratedColumn( + 'will_be_retried_by_media_upload', + aliasedName, + false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("will_be_retried_by_media_upload" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); +i1.GeneratedColumn _column_314(String aliasedName) => + i1.GeneratedColumn( + 'retry_count', + aliasedName, + false, + type: i1.DriftSqlType.int, + defaultValue: const Constant(0), + ); + +class Shape65 extends i0.VersionedTable { + Shape65({required super.source, required super.alias}) : super.aliased(); + i1.GeneratedColumn get signedPreKeyId => + columnsByName['signed_pre_key_id']! as i1.GeneratedColumn; + i1.GeneratedColumn get signedPreKey => + columnsByName['signed_pre_key']! as i1.GeneratedColumn; + i1.GeneratedColumn get createdAt => + columnsByName['created_at']! as i1.GeneratedColumn; +} + +i1.GeneratedColumn _column_315(String aliasedName) => + i1.GeneratedColumn( + 'action_at', + aliasedName, + false, + type: i1.DriftSqlType.dateTime, + defaultValue: currentDateAndTime, + ); + +class Shape66 extends i0.VersionedTable { + Shape66({required super.source, required super.alias}) : super.aliased(); + i1.GeneratedColumn get verificationId => + columnsByName['verification_id']! as i1.GeneratedColumn; + i1.GeneratedColumn get contactId => + columnsByName['contact_id']! as i1.GeneratedColumn; + i1.GeneratedColumn get type => + columnsByName['type']! as i1.GeneratedColumn; + i1.GeneratedColumn get verifiedBy => + columnsByName['verified_by']! as i1.GeneratedColumn; + i1.GeneratedColumn get createdAt => + columnsByName['created_at']! as i1.GeneratedColumn; +} + +i1.GeneratedColumn _column_316(String aliasedName) => + i1.GeneratedColumn( + 'verification_id', + aliasedName, + false, + hasAutoIncrement: true, + type: i1.DriftSqlType.int, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'PRIMARY KEY AUTOINCREMENT', + ), + ); +i1.GeneratedColumn _column_317(String aliasedName) => + i1.GeneratedColumn( + 'verified_by', + aliasedName, + true, + type: i1.DriftSqlType.int, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'REFERENCES contacts (user_id) ON DELETE CASCADE', + ), + ); + +class Shape67 extends i0.VersionedTable { + Shape67({required super.source, required super.alias}) : super.aliased(); + i1.GeneratedColumn get tokenId => + columnsByName['token_id']! as i1.GeneratedColumn; + i1.GeneratedColumn get token => + columnsByName['token']! as i1.GeneratedColumn; + i1.GeneratedColumn get createdAt => + columnsByName['created_at']! as i1.GeneratedColumn; +} + +i1.GeneratedColumn _column_318(String aliasedName) => + i1.GeneratedColumn( + 'token_id', + aliasedName, + false, + hasAutoIncrement: true, + type: i1.DriftSqlType.int, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'PRIMARY KEY AUTOINCREMENT', + ), + ); +i1.GeneratedColumn _column_319(String aliasedName) => + i1.GeneratedColumn( + 'token', + aliasedName, + false, + type: i1.DriftSqlType.blob, + ); + +class Shape68 extends i0.VersionedTable { + Shape68({required super.source, required super.alias}) : super.aliased(); + i1.GeneratedColumn get announcedUserId => + columnsByName['announced_user_id']! as i1.GeneratedColumn; + i1.GeneratedColumn get announcedPublicKey => + columnsByName['announced_public_key']! + as i1.GeneratedColumn; + i1.GeneratedColumn get publicId => + columnsByName['public_id']! as i1.GeneratedColumn; + i1.GeneratedColumn get username => + columnsByName['username']! as i1.GeneratedColumn; + i1.GeneratedColumn get wasShownToTheUser => + columnsByName['was_shown_to_the_user']! as i1.GeneratedColumn; + i1.GeneratedColumn get isHidden => + columnsByName['is_hidden']! as i1.GeneratedColumn; + i1.GeneratedColumn get wasAskedFriends => + columnsByName['was_asked_friends']! as i1.GeneratedColumn; +} + +i1.GeneratedColumn _column_320(String aliasedName) => + i1.GeneratedColumn( + 'announced_user_id', + aliasedName, + false, + type: i1.DriftSqlType.int, + ); +i1.GeneratedColumn _column_321(String aliasedName) => + i1.GeneratedColumn( + 'announced_public_key', + aliasedName, + false, + type: i1.DriftSqlType.blob, + ); +i1.GeneratedColumn _column_322(String aliasedName) => + i1.GeneratedColumn( + 'public_id', + aliasedName, + false, + type: i1.DriftSqlType.int, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways('UNIQUE'), + ); +i1.GeneratedColumn _column_323(String aliasedName) => + i1.GeneratedColumn( + 'username', + aliasedName, + true, + type: i1.DriftSqlType.string, + ); +i1.GeneratedColumn _column_324(String aliasedName) => + i1.GeneratedColumn( + 'was_shown_to_the_user', + aliasedName, + false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("was_shown_to_the_user" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); +i1.GeneratedColumn _column_325(String aliasedName) => + i1.GeneratedColumn( + 'is_hidden', + aliasedName, + false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("is_hidden" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); +i1.GeneratedColumn _column_326(String aliasedName) => + i1.GeneratedColumn( + 'was_asked_friends', + aliasedName, + false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("was_asked_friends" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + +class Shape69 extends i0.VersionedTable { + Shape69({required super.source, required super.alias}) : super.aliased(); + i1.GeneratedColumn get announcedUserId => + columnsByName['announced_user_id']! as i1.GeneratedColumn; + i1.GeneratedColumn get fromContactId => + columnsByName['from_contact_id']! as i1.GeneratedColumn; + i1.GeneratedColumn get publicKeyVerifiedTimestamp => + columnsByName['public_key_verified_timestamp']! + as i1.GeneratedColumn; +} + +i1.GeneratedColumn _column_327( + String aliasedName, +) => i1.GeneratedColumn( + 'announced_user_id', + aliasedName, + false, + type: i1.DriftSqlType.int, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'REFERENCES user_discovery_announced_users (announced_user_id) ON DELETE CASCADE', + ), +); +i1.GeneratedColumn _column_328(String aliasedName) => + i1.GeneratedColumn( + 'from_contact_id', + aliasedName, + false, + type: i1.DriftSqlType.int, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'REFERENCES contacts (user_id) ON DELETE CASCADE', + ), + ); +i1.GeneratedColumn _column_329(String aliasedName) => + i1.GeneratedColumn( + 'public_key_verified_timestamp', + aliasedName, + true, + type: i1.DriftSqlType.dateTime, + ); + +class Shape70 extends i0.VersionedTable { + Shape70({required super.source, required super.alias}) : super.aliased(); + i1.GeneratedColumn get fromContactId => + columnsByName['from_contact_id']! as i1.GeneratedColumn; + i1.GeneratedColumn get promotionId => + columnsByName['promotion_id']! as i1.GeneratedColumn; + i1.GeneratedColumn get publicId => + columnsByName['public_id']! as i1.GeneratedColumn; + i1.GeneratedColumn get threshold => + columnsByName['threshold']! as i1.GeneratedColumn; + i1.GeneratedColumn get announcementShare => + columnsByName['announcement_share']! as i1.GeneratedColumn; + i1.GeneratedColumn get publicKeyVerifiedTimestamp => + columnsByName['public_key_verified_timestamp']! + as i1.GeneratedColumn; +} + +i1.GeneratedColumn _column_330(String aliasedName) => + i1.GeneratedColumn( + 'promotion_id', + aliasedName, + false, + type: i1.DriftSqlType.int, + ); +i1.GeneratedColumn _column_331(String aliasedName) => + i1.GeneratedColumn( + 'public_id', + aliasedName, + false, + type: i1.DriftSqlType.int, + ); +i1.GeneratedColumn _column_332(String aliasedName) => + i1.GeneratedColumn( + 'threshold', + aliasedName, + false, + type: i1.DriftSqlType.int, + ); +i1.GeneratedColumn _column_333(String aliasedName) => + i1.GeneratedColumn( + 'announcement_share', + aliasedName, + false, + type: i1.DriftSqlType.blob, + ); +i1.GeneratedColumn _column_334(String aliasedName) => + i1.GeneratedColumn( + 'version_id', + aliasedName, + false, + hasAutoIncrement: true, + type: i1.DriftSqlType.int, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'PRIMARY KEY AUTOINCREMENT', + ), + ); +i1.GeneratedColumn _column_335(String aliasedName) => + i1.GeneratedColumn( + 'promotion', + aliasedName, + false, + type: i1.DriftSqlType.blob, + ); +i1.GeneratedColumn _column_336(String aliasedName) => + i1.GeneratedColumn( + 'share_id', + aliasedName, + false, + hasAutoIncrement: true, + type: i1.DriftSqlType.int, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'PRIMARY KEY AUTOINCREMENT', + ), + ); +i1.GeneratedColumn _column_337(String aliasedName) => + i1.GeneratedColumn( + 'share', + aliasedName, + false, + type: i1.DriftSqlType.blob, + ); +i1.GeneratedColumn _column_338(String aliasedName) => + i1.GeneratedColumn( + 'emoji', + aliasedName, + false, + type: i1.DriftSqlType.string, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways('UNIQUE'), + ); +i1.GeneratedColumn _column_339(String aliasedName) => + i1.GeneratedColumn( + 'usage_counter', + aliasedName, + false, + type: i1.DriftSqlType.int, + defaultValue: const Constant(0), + ); +i1.GeneratedColumn _column_340(String aliasedName) => + i1.GeneratedColumn( + 'shortcut_id', + aliasedName, + false, + type: i1.DriftSqlType.int, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'REFERENCES shortcuts (id) ON DELETE CASCADE', + ), + ); + +class Shape71 extends i0.VersionedTable { + Shape71({required super.source, required super.alias}) : super.aliased(); + i1.GeneratedColumn get id => + columnsByName['id']! as i1.GeneratedColumn; + i1.GeneratedColumn get name => + columnsByName['name']! as i1.GeneratedColumn; + i1.GeneratedColumn get textColor => + columnsByName['text_color']! as i1.GeneratedColumn; + i1.GeneratedColumn get backgroundColor => + columnsByName['background_color']! as i1.GeneratedColumn; + i1.GeneratedColumn get createdAt => + columnsByName['created_at']! as i1.GeneratedColumn; +} + +i1.GeneratedColumn _column_341(String aliasedName) => + i1.GeneratedColumn( + 'text_color', + aliasedName, + false, + type: i1.DriftSqlType.int, + ); +i1.GeneratedColumn _column_342(String aliasedName) => + i1.GeneratedColumn( + 'background_color', + aliasedName, + false, + type: i1.DriftSqlType.int, + ); +i1.GeneratedColumn _column_343(String aliasedName) => + i1.GeneratedColumn( + 'label_id', + aliasedName, + false, + type: i1.DriftSqlType.int, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'REFERENCES labels (id) ON DELETE CASCADE', + ), + ); i0.MigrationStepWithVersion migrationSteps({ required Future Function(i1.Migrator m, Schema2 schema) from1To2, required Future Function(i1.Migrator m, Schema3 schema) from2To3, @@ -12697,6 +14211,7 @@ i0.MigrationStepWithVersion migrationSteps({ required Future Function(i1.Migrator m, Schema22 schema) from21To22, required Future Function(i1.Migrator m, Schema23 schema) from22To23, required Future Function(i1.Migrator m, Schema24 schema) from23To24, + required Future Function(i1.Migrator m, Schema25 schema) from24To25, }) { return (currentVersion, database) async { switch (currentVersion) { @@ -12815,6 +14330,11 @@ i0.MigrationStepWithVersion migrationSteps({ final migrator = i1.Migrator(database, schema); await from23To24(migrator, schema); return 24; + case 24: + final schema = Schema25(database: database); + final migrator = i1.Migrator(database, schema); + await from24To25(migrator, schema); + return 25; default: throw ArgumentError.value('Unknown migration from $currentVersion'); } @@ -12845,6 +14365,7 @@ i1.OnUpgrade stepByStep({ required Future Function(i1.Migrator m, Schema22 schema) from21To22, required Future Function(i1.Migrator m, Schema23 schema) from22To23, required Future Function(i1.Migrator m, Schema24 schema) from23To24, + required Future Function(i1.Migrator m, Schema25 schema) from24To25, }) => i0.VersionedSchema.stepByStepHelper( step: migrationSteps( from1To2: from1To2, @@ -12870,5 +14391,6 @@ i1.OnUpgrade stepByStep({ from21To22: from21To22, from22To23: from22To23, from23To24: from23To24, + from24To25: from24To25, ), ); diff --git a/lib/src/model/json/userdata.model.dart b/lib/src/model/json/userdata.model.dart index 23aad0ba..875ab4f8 100644 --- a/lib/src/model/json/userdata.model.dart +++ b/lib/src/model/json/userdata.model.dart @@ -106,6 +106,8 @@ class UserData { DateTime? signalLastSignedPreKeyUpdated; + DateTime? signalLastPqcPreKeysUploaded; + @JsonKey(defaultValue: false) bool allowErrorTrackingViaSentry = false; diff --git a/lib/src/model/json/userdata.model.g.dart b/lib/src/model/json/userdata.model.g.dart index f2848958..b1449373 100644 --- a/lib/src/model/json/userdata.model.g.dart +++ b/lib/src/model/json/userdata.model.g.dart @@ -67,6 +67,10 @@ UserData _$UserDataFromJson(Map json) => json['signalLastSignedPreKeyUpdated'] == null ? null : DateTime.parse(json['signalLastSignedPreKeyUpdated'] as String) + ..signalLastPqcPreKeysUploaded = + json['signalLastPqcPreKeysUploaded'] == null + ? null + : DateTime.parse(json['signalLastPqcPreKeysUploaded'] as String) ..allowErrorTrackingViaSentry = json['allowErrorTrackingViaSentry'] as bool? ?? false ..screenLockEnabled = json['screenLockEnabled'] as bool? ?? false @@ -158,6 +162,8 @@ Map _$UserDataToJson(UserData instance) => { 'myBestFriendGroupId': instance.myBestFriendGroupId, 'signalLastSignedPreKeyUpdated': instance.signalLastSignedPreKeyUpdated ?.toIso8601String(), + 'signalLastPqcPreKeysUploaded': instance.signalLastPqcPreKeysUploaded + ?.toIso8601String(), 'allowErrorTrackingViaSentry': instance.allowErrorTrackingViaSentry, 'screenLockEnabled': instance.screenLockEnabled, 'isCloudBackupEnabled': instance.isCloudBackupEnabled, diff --git a/lib/src/model/protobuf/api/websocket/client_to_server.pb.dart b/lib/src/model/protobuf/api/websocket/client_to_server.pb.dart index 96ada9c8..51fb7fc9 100644 --- a/lib/src/model/protobuf/api/websocket/client_to_server.pb.dart +++ b/lib/src/model/protobuf/api/websocket/client_to_server.pb.dart @@ -2059,6 +2059,250 @@ class ApplicationData_UpdateSignedPreKey extends $pb.GeneratedMessage { void clearSignedPrekeySignature() => $_clearField(3); } +class ApplicationData_PqcPreKey extends $pb.GeneratedMessage { + factory ApplicationData_PqcPreKey({ + $fixnum.Int64? eccPreKeyId, + $core.List<$core.int>? eccPreKey, + $fixnum.Int64? kyberPreKeyId, + $core.List<$core.int>? kyberPreKey, + $core.List<$core.int>? kyberPreKeySignature, + }) { + final result = create(); + if (eccPreKeyId != null) result.eccPreKeyId = eccPreKeyId; + if (eccPreKey != null) result.eccPreKey = eccPreKey; + if (kyberPreKeyId != null) result.kyberPreKeyId = kyberPreKeyId; + if (kyberPreKey != null) result.kyberPreKey = kyberPreKey; + if (kyberPreKeySignature != null) + result.kyberPreKeySignature = kyberPreKeySignature; + return result; + } + + ApplicationData_PqcPreKey._(); + + factory ApplicationData_PqcPreKey.fromBuffer($core.List<$core.int> data, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(data, registry); + factory ApplicationData_PqcPreKey.fromJson($core.String json, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(json, registry); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'ApplicationData.PqcPreKey', + package: + const $pb.PackageName(_omitMessageNames ? '' : 'client_to_server'), + createEmptyInstance: create) + ..aInt64(1, _omitFieldNames ? '' : 'eccPreKeyId') + ..a<$core.List<$core.int>>( + 2, _omitFieldNames ? '' : 'eccPreKey', $pb.PbFieldType.OY) + ..aInt64(3, _omitFieldNames ? '' : 'kyberPreKeyId') + ..a<$core.List<$core.int>>( + 4, _omitFieldNames ? '' : 'kyberPreKey', $pb.PbFieldType.OY) + ..a<$core.List<$core.int>>( + 5, _omitFieldNames ? '' : 'kyberPreKeySignature', $pb.PbFieldType.OY) + ..hasRequiredFields = false; + + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + ApplicationData_PqcPreKey clone() => deepCopy(); + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + ApplicationData_PqcPreKey copyWith( + void Function(ApplicationData_PqcPreKey) updates) => + super.copyWith((message) => updates(message as ApplicationData_PqcPreKey)) + as ApplicationData_PqcPreKey; + + @$core.override + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static ApplicationData_PqcPreKey create() => ApplicationData_PqcPreKey._(); + @$core.override + ApplicationData_PqcPreKey createEmptyInstance() => create(); + @$core.pragma('dart2js:noInline') + static ApplicationData_PqcPreKey getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); + static ApplicationData_PqcPreKey? _defaultInstance; + + @$pb.TagNumber(1) + $fixnum.Int64 get eccPreKeyId => $_getI64(0); + @$pb.TagNumber(1) + set eccPreKeyId($fixnum.Int64 value) => $_setInt64(0, value); + @$pb.TagNumber(1) + $core.bool hasEccPreKeyId() => $_has(0); + @$pb.TagNumber(1) + void clearEccPreKeyId() => $_clearField(1); + + @$pb.TagNumber(2) + $core.List<$core.int> get eccPreKey => $_getN(1); + @$pb.TagNumber(2) + set eccPreKey($core.List<$core.int> value) => $_setBytes(1, value); + @$pb.TagNumber(2) + $core.bool hasEccPreKey() => $_has(1); + @$pb.TagNumber(2) + void clearEccPreKey() => $_clearField(2); + + @$pb.TagNumber(3) + $fixnum.Int64 get kyberPreKeyId => $_getI64(2); + @$pb.TagNumber(3) + set kyberPreKeyId($fixnum.Int64 value) => $_setInt64(2, value); + @$pb.TagNumber(3) + $core.bool hasKyberPreKeyId() => $_has(2); + @$pb.TagNumber(3) + void clearKyberPreKeyId() => $_clearField(3); + + @$pb.TagNumber(4) + $core.List<$core.int> get kyberPreKey => $_getN(3); + @$pb.TagNumber(4) + set kyberPreKey($core.List<$core.int> value) => $_setBytes(3, value); + @$pb.TagNumber(4) + $core.bool hasKyberPreKey() => $_has(3); + @$pb.TagNumber(4) + void clearKyberPreKey() => $_clearField(4); + + @$pb.TagNumber(5) + $core.List<$core.int> get kyberPreKeySignature => $_getN(4); + @$pb.TagNumber(5) + set kyberPreKeySignature($core.List<$core.int> value) => $_setBytes(4, value); + @$pb.TagNumber(5) + $core.bool hasKyberPreKeySignature() => $_has(4); + @$pb.TagNumber(5) + void clearKyberPreKeySignature() => $_clearField(5); +} + +class ApplicationData_UploadPqcPreKeys extends $pb.GeneratedMessage { + factory ApplicationData_UploadPqcPreKeys({ + $fixnum.Int64? eccSignedPrekeyId, + $core.List<$core.int>? eccSignedPrekey, + $core.List<$core.int>? eccSignedPrekeySignature, + $fixnum.Int64? kyberSignedPrekeyId, + $core.List<$core.int>? kyberSignedPrekey, + $core.List<$core.int>? kyberSignedPrekeySignature, + $core.Iterable? prekeys, + }) { + final result = create(); + if (eccSignedPrekeyId != null) result.eccSignedPrekeyId = eccSignedPrekeyId; + if (eccSignedPrekey != null) result.eccSignedPrekey = eccSignedPrekey; + if (eccSignedPrekeySignature != null) + result.eccSignedPrekeySignature = eccSignedPrekeySignature; + if (kyberSignedPrekeyId != null) + result.kyberSignedPrekeyId = kyberSignedPrekeyId; + if (kyberSignedPrekey != null) result.kyberSignedPrekey = kyberSignedPrekey; + if (kyberSignedPrekeySignature != null) + result.kyberSignedPrekeySignature = kyberSignedPrekeySignature; + if (prekeys != null) result.prekeys.addAll(prekeys); + return result; + } + + ApplicationData_UploadPqcPreKeys._(); + + factory ApplicationData_UploadPqcPreKeys.fromBuffer( + $core.List<$core.int> data, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(data, registry); + factory ApplicationData_UploadPqcPreKeys.fromJson($core.String json, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(json, registry); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'ApplicationData.UploadPqcPreKeys', + package: + const $pb.PackageName(_omitMessageNames ? '' : 'client_to_server'), + createEmptyInstance: create) + ..aInt64(1, _omitFieldNames ? '' : 'eccSignedPrekeyId') + ..a<$core.List<$core.int>>( + 2, _omitFieldNames ? '' : 'eccSignedPrekey', $pb.PbFieldType.OY) + ..a<$core.List<$core.int>>(3, + _omitFieldNames ? '' : 'eccSignedPrekeySignature', $pb.PbFieldType.OY) + ..aInt64(4, _omitFieldNames ? '' : 'kyberSignedPrekeyId') + ..a<$core.List<$core.int>>( + 5, _omitFieldNames ? '' : 'kyberSignedPrekey', $pb.PbFieldType.OY) + ..a<$core.List<$core.int>>(6, + _omitFieldNames ? '' : 'kyberSignedPrekeySignature', $pb.PbFieldType.OY) + ..pPM(7, _omitFieldNames ? '' : 'prekeys', + subBuilder: ApplicationData_PqcPreKey.create) + ..hasRequiredFields = false; + + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + ApplicationData_UploadPqcPreKeys clone() => deepCopy(); + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + ApplicationData_UploadPqcPreKeys copyWith( + void Function(ApplicationData_UploadPqcPreKeys) updates) => + super.copyWith( + (message) => updates(message as ApplicationData_UploadPqcPreKeys)) + as ApplicationData_UploadPqcPreKeys; + + @$core.override + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static ApplicationData_UploadPqcPreKeys create() => + ApplicationData_UploadPqcPreKeys._(); + @$core.override + ApplicationData_UploadPqcPreKeys createEmptyInstance() => create(); + @$core.pragma('dart2js:noInline') + static ApplicationData_UploadPqcPreKeys getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor( + create); + static ApplicationData_UploadPqcPreKeys? _defaultInstance; + + @$pb.TagNumber(1) + $fixnum.Int64 get eccSignedPrekeyId => $_getI64(0); + @$pb.TagNumber(1) + set eccSignedPrekeyId($fixnum.Int64 value) => $_setInt64(0, value); + @$pb.TagNumber(1) + $core.bool hasEccSignedPrekeyId() => $_has(0); + @$pb.TagNumber(1) + void clearEccSignedPrekeyId() => $_clearField(1); + + @$pb.TagNumber(2) + $core.List<$core.int> get eccSignedPrekey => $_getN(1); + @$pb.TagNumber(2) + set eccSignedPrekey($core.List<$core.int> value) => $_setBytes(1, value); + @$pb.TagNumber(2) + $core.bool hasEccSignedPrekey() => $_has(1); + @$pb.TagNumber(2) + void clearEccSignedPrekey() => $_clearField(2); + + @$pb.TagNumber(3) + $core.List<$core.int> get eccSignedPrekeySignature => $_getN(2); + @$pb.TagNumber(3) + set eccSignedPrekeySignature($core.List<$core.int> value) => + $_setBytes(2, value); + @$pb.TagNumber(3) + $core.bool hasEccSignedPrekeySignature() => $_has(2); + @$pb.TagNumber(3) + void clearEccSignedPrekeySignature() => $_clearField(3); + + @$pb.TagNumber(4) + $fixnum.Int64 get kyberSignedPrekeyId => $_getI64(3); + @$pb.TagNumber(4) + set kyberSignedPrekeyId($fixnum.Int64 value) => $_setInt64(3, value); + @$pb.TagNumber(4) + $core.bool hasKyberSignedPrekeyId() => $_has(3); + @$pb.TagNumber(4) + void clearKyberSignedPrekeyId() => $_clearField(4); + + @$pb.TagNumber(5) + $core.List<$core.int> get kyberSignedPrekey => $_getN(4); + @$pb.TagNumber(5) + set kyberSignedPrekey($core.List<$core.int> value) => $_setBytes(4, value); + @$pb.TagNumber(5) + $core.bool hasKyberSignedPrekey() => $_has(4); + @$pb.TagNumber(5) + void clearKyberSignedPrekey() => $_clearField(5); + + @$pb.TagNumber(6) + $core.List<$core.int> get kyberSignedPrekeySignature => $_getN(5); + @$pb.TagNumber(6) + set kyberSignedPrekeySignature($core.List<$core.int> value) => + $_setBytes(5, value); + @$pb.TagNumber(6) + $core.bool hasKyberSignedPrekeySignature() => $_has(5); + @$pb.TagNumber(6) + void clearKyberSignedPrekeySignature() => $_clearField(6); + + @$pb.TagNumber(7) + $pb.PbList get prekeys => $_getList(6); +} + class ApplicationData_DownloadDone extends $pb.GeneratedMessage { factory ApplicationData_DownloadDone({ $core.List<$core.int>? downloadToken, @@ -3085,6 +3329,7 @@ enum ApplicationData_ApplicationData { getMemoriesUsage, deleteMemory, disableMemoriesBackup, + uploadPqcPrekeys, notSet } @@ -3117,6 +3362,7 @@ class ApplicationData extends $pb.GeneratedMessage { ApplicationData_GetMemoriesUsage? getMemoriesUsage, ApplicationData_DeleteMemory? deleteMemory, ApplicationData_DisableMemoriesBackup? disableMemoriesBackup, + ApplicationData_UploadPqcPreKeys? uploadPqcPrekeys, }) { final result = create(); if (textMessage != null) result.textMessage = textMessage; @@ -3157,6 +3403,7 @@ class ApplicationData extends $pb.GeneratedMessage { if (deleteMemory != null) result.deleteMemory = deleteMemory; if (disableMemoriesBackup != null) result.disableMemoriesBackup = disableMemoriesBackup; + if (uploadPqcPrekeys != null) result.uploadPqcPrekeys = uploadPqcPrekeys; return result; } @@ -3198,6 +3445,7 @@ class ApplicationData extends $pb.GeneratedMessage { 37: ApplicationData_ApplicationData.getMemoriesUsage, 38: ApplicationData_ApplicationData.deleteMemory, 39: ApplicationData_ApplicationData.disableMemoriesBackup, + 40: ApplicationData_ApplicationData.uploadPqcPrekeys, 0: ApplicationData_ApplicationData.notSet }; static final $pb.BuilderInfo _i = $pb.BuilderInfo( @@ -3232,7 +3480,8 @@ class ApplicationData extends $pb.GeneratedMessage { 36, 37, 38, - 39 + 39, + 40 ]) ..aOM(1, _omitFieldNames ? '' : 'textMessage', protoName: 'textMessage', @@ -3327,6 +3576,9 @@ class ApplicationData extends $pb.GeneratedMessage { ..aOM( 39, _omitFieldNames ? '' : 'disableMemoriesBackup', subBuilder: ApplicationData_DisableMemoriesBackup.create) + ..aOM( + 40, _omitFieldNames ? '' : 'uploadPqcPrekeys', + subBuilder: ApplicationData_UploadPqcPreKeys.create) ..hasRequiredFields = false; @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') @@ -3375,6 +3627,7 @@ class ApplicationData extends $pb.GeneratedMessage { @$pb.TagNumber(37) @$pb.TagNumber(38) @$pb.TagNumber(39) + @$pb.TagNumber(40) ApplicationData_ApplicationData whichApplicationData() => _ApplicationData_ApplicationDataByTag[$_whichOneof(0)]!; @$pb.TagNumber(1) @@ -3404,6 +3657,7 @@ class ApplicationData extends $pb.GeneratedMessage { @$pb.TagNumber(37) @$pb.TagNumber(38) @$pb.TagNumber(39) + @$pb.TagNumber(40) void clearApplicationData() => $_clearField($_whichOneof(0)); @$pb.TagNumber(1) @@ -3737,6 +3991,18 @@ class ApplicationData extends $pb.GeneratedMessage { @$pb.TagNumber(39) ApplicationData_DisableMemoriesBackup ensureDisableMemoriesBackup() => $_ensure(26); + + @$pb.TagNumber(40) + ApplicationData_UploadPqcPreKeys get uploadPqcPrekeys => $_getN(27); + @$pb.TagNumber(40) + set uploadPqcPrekeys(ApplicationData_UploadPqcPreKeys value) => + $_setField(40, value); + @$pb.TagNumber(40) + $core.bool hasUploadPqcPrekeys() => $_has(27); + @$pb.TagNumber(40) + void clearUploadPqcPrekeys() => $_clearField(40); + @$pb.TagNumber(40) + ApplicationData_UploadPqcPreKeys ensureUploadPqcPrekeys() => $_ensure(27); } class Response_PreKey extends $pb.GeneratedMessage { @@ -3857,16 +4123,68 @@ class Response_Prekeys extends $pb.GeneratedMessage { $pb.PbList get prekeys => $_getList(0); } -enum Response_Ok_Ok { none, prekeys, notSet } +class Response_PqcPrekeys extends $pb.GeneratedMessage { + factory Response_PqcPrekeys({ + $core.Iterable? prekeys, + }) { + final result = create(); + if (prekeys != null) result.prekeys.addAll(prekeys); + return result; + } + + Response_PqcPrekeys._(); + + factory Response_PqcPrekeys.fromBuffer($core.List<$core.int> data, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(data, registry); + factory Response_PqcPrekeys.fromJson($core.String json, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(json, registry); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Response.PqcPrekeys', + package: + const $pb.PackageName(_omitMessageNames ? '' : 'client_to_server'), + createEmptyInstance: create) + ..pPM(1, _omitFieldNames ? '' : 'prekeys', + subBuilder: ApplicationData_PqcPreKey.create) + ..hasRequiredFields = false; + + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + Response_PqcPrekeys clone() => deepCopy(); + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + Response_PqcPrekeys copyWith(void Function(Response_PqcPrekeys) updates) => + super.copyWith((message) => updates(message as Response_PqcPrekeys)) + as Response_PqcPrekeys; + + @$core.override + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Response_PqcPrekeys create() => Response_PqcPrekeys._(); + @$core.override + Response_PqcPrekeys createEmptyInstance() => create(); + @$core.pragma('dart2js:noInline') + static Response_PqcPrekeys getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); + static Response_PqcPrekeys? _defaultInstance; + + @$pb.TagNumber(1) + $pb.PbList get prekeys => $_getList(0); +} + +enum Response_Ok_Ok { none, prekeys, prekeysPqc, notSet } class Response_Ok extends $pb.GeneratedMessage { factory Response_Ok({ $core.bool? none, Response_Prekeys? prekeys, + Response_PqcPrekeys? prekeysPqc, }) { final result = create(); if (none != null) result.none = none; if (prekeys != null) result.prekeys = prekeys; + if (prekeysPqc != null) result.prekeysPqc = prekeysPqc; return result; } @@ -3882,6 +4200,7 @@ class Response_Ok extends $pb.GeneratedMessage { static const $core.Map<$core.int, Response_Ok_Ok> _Response_Ok_OkByTag = { 1: Response_Ok_Ok.none, 2: Response_Ok_Ok.prekeys, + 3: Response_Ok_Ok.prekeysPqc, 0: Response_Ok_Ok.notSet }; static final $pb.BuilderInfo _i = $pb.BuilderInfo( @@ -3889,10 +4208,12 @@ class Response_Ok extends $pb.GeneratedMessage { package: const $pb.PackageName(_omitMessageNames ? '' : 'client_to_server'), createEmptyInstance: create) - ..oo(0, [1, 2]) + ..oo(0, [1, 2, 3]) ..aOB(1, _omitFieldNames ? '' : 'None', protoName: 'None') ..aOM(2, _omitFieldNames ? '' : 'prekeys', subBuilder: Response_Prekeys.create) + ..aOM(3, _omitFieldNames ? '' : 'prekeysPqc', + subBuilder: Response_PqcPrekeys.create) ..hasRequiredFields = false; @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') @@ -3916,9 +4237,11 @@ class Response_Ok extends $pb.GeneratedMessage { @$pb.TagNumber(1) @$pb.TagNumber(2) + @$pb.TagNumber(3) Response_Ok_Ok whichOk() => _Response_Ok_OkByTag[$_whichOneof(0)]!; @$pb.TagNumber(1) @$pb.TagNumber(2) + @$pb.TagNumber(3) void clearOk() => $_clearField($_whichOneof(0)); @$pb.TagNumber(1) @@ -3940,6 +4263,17 @@ class Response_Ok extends $pb.GeneratedMessage { void clearPrekeys() => $_clearField(2); @$pb.TagNumber(2) Response_Prekeys ensurePrekeys() => $_ensure(1); + + @$pb.TagNumber(3) + Response_PqcPrekeys get prekeysPqc => $_getN(2); + @$pb.TagNumber(3) + set prekeysPqc(Response_PqcPrekeys value) => $_setField(3, value); + @$pb.TagNumber(3) + $core.bool hasPrekeysPqc() => $_has(2); + @$pb.TagNumber(3) + void clearPrekeysPqc() => $_clearField(3); + @$pb.TagNumber(3) + Response_PqcPrekeys ensurePrekeysPqc() => $_ensure(2); } enum Response_Response { ok, error, notSet } diff --git a/lib/src/model/protobuf/api/websocket/client_to_server.pbjson.dart b/lib/src/model/protobuf/api/websocket/client_to_server.pbjson.dart index 7245b957..a7aa3f2c 100644 --- a/lib/src/model/protobuf/api/websocket/client_to_server.pbjson.dart +++ b/lib/src/model/protobuf/api/websocket/client_to_server.pbjson.dart @@ -724,6 +724,15 @@ const ApplicationData$json = { '9': 0, '10': 'disableMemoriesBackup' }, + { + '1': 'upload_pqc_prekeys', + '3': 40, + '4': 1, + '5': 11, + '6': '.client_to_server.ApplicationData.UploadPqcPreKeys', + '9': 0, + '10': 'uploadPqcPrekeys' + }, ], '3': [ ApplicationData_TextMessage$json, @@ -737,6 +746,8 @@ const ApplicationData$json = { ApplicationData_GetPrekeysByUserId$json, ApplicationData_GetSignedPreKeyByUserId$json, ApplicationData_UpdateSignedPreKey$json, + ApplicationData_PqcPreKey$json, + ApplicationData_UploadPqcPreKeys$json, ApplicationData_DownloadDone$json, ApplicationData_ReportUser$json, ApplicationData_IPAPurchase$json, @@ -868,6 +879,81 @@ const ApplicationData_UpdateSignedPreKey$json = { ], }; +@$core.Deprecated('Use applicationDataDescriptor instead') +const ApplicationData_PqcPreKey$json = { + '1': 'PqcPreKey', + '2': [ + {'1': 'ecc_pre_key_id', '3': 1, '4': 1, '5': 3, '10': 'eccPreKeyId'}, + {'1': 'ecc_pre_key', '3': 2, '4': 1, '5': 12, '10': 'eccPreKey'}, + {'1': 'kyber_pre_key_id', '3': 3, '4': 1, '5': 3, '10': 'kyberPreKeyId'}, + {'1': 'kyber_pre_key', '3': 4, '4': 1, '5': 12, '10': 'kyberPreKey'}, + { + '1': 'kyber_pre_key_signature', + '3': 5, + '4': 1, + '5': 12, + '10': 'kyberPreKeySignature' + }, + ], +}; + +@$core.Deprecated('Use applicationDataDescriptor instead') +const ApplicationData_UploadPqcPreKeys$json = { + '1': 'UploadPqcPreKeys', + '2': [ + { + '1': 'ecc_signed_prekey_id', + '3': 1, + '4': 1, + '5': 3, + '10': 'eccSignedPrekeyId' + }, + { + '1': 'ecc_signed_prekey', + '3': 2, + '4': 1, + '5': 12, + '10': 'eccSignedPrekey' + }, + { + '1': 'ecc_signed_prekey_signature', + '3': 3, + '4': 1, + '5': 12, + '10': 'eccSignedPrekeySignature' + }, + { + '1': 'kyber_signed_prekey_id', + '3': 4, + '4': 1, + '5': 3, + '10': 'kyberSignedPrekeyId' + }, + { + '1': 'kyber_signed_prekey', + '3': 5, + '4': 1, + '5': 12, + '10': 'kyberSignedPrekey' + }, + { + '1': 'kyber_signed_prekey_signature', + '3': 6, + '4': 1, + '5': 12, + '10': 'kyberSignedPrekeySignature' + }, + { + '1': 'prekeys', + '3': 7, + '4': 3, + '5': 11, + '6': '.client_to_server.ApplicationData.PqcPreKey', + '10': 'prekeys' + }, + ], +}; + @$core.Deprecated('Use applicationDataDescriptor instead') const ApplicationData_DownloadDone$json = { '1': 'DownloadDone', @@ -1073,38 +1159,51 @@ final $typed_data.Uint8List applicationDataDescriptor = $convert.base64Decode( 'CzIuLmNsaWVudF90b19zZXJ2ZXIuQXBwbGljYXRpb25EYXRhLkRlbGV0ZU1lbW9yeUgAUgxkZW' 'xldGVNZW1vcnkScQoXZGlzYWJsZV9tZW1vcmllc19iYWNrdXAYJyABKAsyNy5jbGllbnRfdG9f' 'c2VydmVyLkFwcGxpY2F0aW9uRGF0YS5EaXNhYmxlTWVtb3JpZXNCYWNrdXBIAFIVZGlzYWJsZU' - '1lbW9yaWVzQmFja3VwGmoKC1RleHRNZXNzYWdlEhcKB3VzZXJfaWQYASABKANSBnVzZXJJZBIS' - 'CgRib2R5GAMgASgMUgRib2R5EiAKCXB1c2hfZGF0YRgEIAEoDEgAUghwdXNoRGF0YYgBAUIMCg' - 'pfcHVzaF9kYXRhGi8KEUdldFVzZXJCeVVzZXJuYW1lEhoKCHVzZXJuYW1lGAEgASgJUgh1c2Vy' - 'bmFtZRosCg5DaGFuZ2VVc2VybmFtZRIaCgh1c2VybmFtZRgBIAEoCVIIdXNlcm5hbWUaNQoUVX' - 'BkYXRlR29vZ2xlRmNtVG9rZW4SHQoKZ29vZ2xlX2ZjbRgBIAEoCVIJZ29vZ2xlRmNtGiYKC0dl' - 'dFVzZXJCeUlkEhcKB3VzZXJfaWQYASABKANSBnVzZXJJZBoTChFHZXRBdmFpbGFibGVQbGFucx' - 'oVChNHZXRDdXJyZW50UGxhbkluZm9zGi8KFFJlbW92ZUFkZGl0aW9uYWxVc2VyEhcKB3VzZXJf' - 'aWQYASABKANSBnVzZXJJZBotChJHZXRQcmVrZXlzQnlVc2VySWQSFwoHdXNlcl9pZBgBIAEoA1' - 'IGdXNlcklkGjIKF0dldFNpZ25lZFByZUtleUJ5VXNlcklkEhcKB3VzZXJfaWQYASABKANSBnVz' - 'ZXJJZBqbAQoSVXBkYXRlU2lnbmVkUHJlS2V5EigKEHNpZ25lZF9wcmVrZXlfaWQYASABKANSDn' - 'NpZ25lZFByZWtleUlkEiMKDXNpZ25lZF9wcmVrZXkYAiABKAxSDHNpZ25lZFByZWtleRI2Chdz' - 'aWduZWRfcHJla2V5X3NpZ25hdHVyZRgDIAEoDFIVc2lnbmVkUHJla2V5U2lnbmF0dXJlGjUKDE' - 'Rvd25sb2FkRG9uZRIlCg5kb3dubG9hZF90b2tlbhgBIAEoDFINZG93bmxvYWRUb2tlbhpOCgpS' - 'ZXBvcnRVc2VyEigKEHJlcG9ydGVkX3VzZXJfaWQYASABKANSDnJlcG9ydGVkVXNlcklkEhYKBn' - 'JlYXNvbhgCIAEoCVIGcmVhc29uGnEKC0lQQVB1cmNoYXNlEh0KCnByb2R1Y3RfaWQYASABKAlS' - 'CXByb2R1Y3RJZBIWCgZzb3VyY2UYAiABKAlSBnNvdXJjZRIrChF2ZXJpZmljYXRpb25fZGF0YR' - 'gDIAEoCVIQdmVyaWZpY2F0aW9uRGF0YRoPCg1JUEFGb3JjZUNoZWNrGg8KDURlbGV0ZUFjY291' - 'bnQaLAoRQWRkQWRkaXRpb25hbFVzZXISFwoHdXNlcl9pZBgBIAEoA1IGdXNlcklkGjAKDVNldE' - 'xvZ2luVG9rZW4SHwoLbG9naW5fdG9rZW4YASABKAxSCmxvZ2luVG9rZW4ajgEKHFJlZ2lzdGVy' - 'UGFzc3dvcmRMZXNzUmVjb3ZlcnkSLgoSZW5jcnlwdGVkU2VydmVyS2V5GAEgASgMUhJlbmNyeX' - 'B0ZWRTZXJ2ZXJLZXkSKwoOcGluVW5sb2NrVG9rZW4YAiABKAxIAFIOcGluVW5sb2NrVG9rZW6I' - 'AQFCEQoPX3BpblVubG9ja1Rva2VuGnAKGFBhc3N3b3JkbGVzc05vdGlmaWNhdGlvbhInCg9ub3' - 'RpZmljYXRpb25faWQYASABKAlSDm5vdGlmaWNhdGlvbklkEisKEWVuY3J5cHRlZF9tZXNzYWdl' - 'GAIgASgMUhBlbmNyeXB0ZWRNZXNzYWdlGmsKFVJlcXVlc3RNZW1vcmllc1VwbG9hZBISCgRzaX' - 'plGAEgASgDUgRzaXplEiMKDW9yaWdpbmFsX2RhdGUYAiABKANSDG9yaWdpbmFsRGF0ZRIZCght' - 'ZWRpYV9pZBgDIAEoCVIHbWVkaWFJZBoyChVDb25maXJtTWVtb3JpZXNVcGxvYWQSGQoIbWVkaW' - 'FfaWQYASABKAlSB21lZGlhSWQaSAoPR2V0TWVtb3JpZXNMaXN0Eh8KC29mZnNldF9kYXRlGAEg' - 'ASgDUgpvZmZzZXREYXRlEhQKBWxpbWl0GAIgASgDUgVsaW1pdBpJCg5HZXRNZW1vcmllc1VybB' - 'IZCghtZWRpYV9pZBgBIAEoCVIHbWVkaWFJZBIcCgl0aHVtYm5haWwYAiABKAhSCXRodW1ibmFp' - 'bBoSChBHZXRNZW1vcmllc1VzYWdlGikKDERlbGV0ZU1lbW9yeRIZCghtZWRpYV9pZBgBIAEoCV' - 'IHbWVkaWFJZBoXChVEaXNhYmxlTWVtb3JpZXNCYWNrdXBCEQoPQXBwbGljYXRpb25EYXRhSgQI' - 'CRAKSgQICxAMSgQIDRASSgQIExAU'); + '1lbW9yaWVzQmFja3VwEmIKEnVwbG9hZF9wcWNfcHJla2V5cxgoIAEoCzIyLmNsaWVudF90b19z' + 'ZXJ2ZXIuQXBwbGljYXRpb25EYXRhLlVwbG9hZFBxY1ByZUtleXNIAFIQdXBsb2FkUHFjUHJla2' + 'V5cxpqCgtUZXh0TWVzc2FnZRIXCgd1c2VyX2lkGAEgASgDUgZ1c2VySWQSEgoEYm9keRgDIAEo' + 'DFIEYm9keRIgCglwdXNoX2RhdGEYBCABKAxIAFIIcHVzaERhdGGIAQFCDAoKX3B1c2hfZGF0YR' + 'ovChFHZXRVc2VyQnlVc2VybmFtZRIaCgh1c2VybmFtZRgBIAEoCVIIdXNlcm5hbWUaLAoOQ2hh' + 'bmdlVXNlcm5hbWUSGgoIdXNlcm5hbWUYASABKAlSCHVzZXJuYW1lGjUKFFVwZGF0ZUdvb2dsZU' + 'ZjbVRva2VuEh0KCmdvb2dsZV9mY20YASABKAlSCWdvb2dsZUZjbRomCgtHZXRVc2VyQnlJZBIX' + 'Cgd1c2VyX2lkGAEgASgDUgZ1c2VySWQaEwoRR2V0QXZhaWxhYmxlUGxhbnMaFQoTR2V0Q3Vycm' + 'VudFBsYW5JbmZvcxovChRSZW1vdmVBZGRpdGlvbmFsVXNlchIXCgd1c2VyX2lkGAEgASgDUgZ1' + 'c2VySWQaLQoSR2V0UHJla2V5c0J5VXNlcklkEhcKB3VzZXJfaWQYASABKANSBnVzZXJJZBoyCh' + 'dHZXRTaWduZWRQcmVLZXlCeVVzZXJJZBIXCgd1c2VyX2lkGAEgASgDUgZ1c2VySWQamwEKElVw' + 'ZGF0ZVNpZ25lZFByZUtleRIoChBzaWduZWRfcHJla2V5X2lkGAEgASgDUg5zaWduZWRQcmVrZX' + 'lJZBIjCg1zaWduZWRfcHJla2V5GAIgASgMUgxzaWduZWRQcmVrZXkSNgoXc2lnbmVkX3ByZWtl' + 'eV9zaWduYXR1cmUYAyABKAxSFXNpZ25lZFByZWtleVNpZ25hdHVyZRrUAQoJUHFjUHJlS2V5Ei' + 'MKDmVjY19wcmVfa2V5X2lkGAEgASgDUgtlY2NQcmVLZXlJZBIeCgtlY2NfcHJlX2tleRgCIAEo' + 'DFIJZWNjUHJlS2V5EicKEGt5YmVyX3ByZV9rZXlfaWQYAyABKANSDWt5YmVyUHJlS2V5SWQSIg' + 'oNa3liZXJfcHJlX2tleRgEIAEoDFILa3liZXJQcmVLZXkSNQoXa3liZXJfcHJlX2tleV9zaWdu' + 'YXR1cmUYBSABKAxSFGt5YmVyUHJlS2V5U2lnbmF0dXJlGp0DChBVcGxvYWRQcWNQcmVLZXlzEi' + '8KFGVjY19zaWduZWRfcHJla2V5X2lkGAEgASgDUhFlY2NTaWduZWRQcmVrZXlJZBIqChFlY2Nf' + 'c2lnbmVkX3ByZWtleRgCIAEoDFIPZWNjU2lnbmVkUHJla2V5Ej0KG2VjY19zaWduZWRfcHJla2' + 'V5X3NpZ25hdHVyZRgDIAEoDFIYZWNjU2lnbmVkUHJla2V5U2lnbmF0dXJlEjMKFmt5YmVyX3Np' + 'Z25lZF9wcmVrZXlfaWQYBCABKANSE2t5YmVyU2lnbmVkUHJla2V5SWQSLgoTa3liZXJfc2lnbm' + 'VkX3ByZWtleRgFIAEoDFIRa3liZXJTaWduZWRQcmVrZXkSQQoda3liZXJfc2lnbmVkX3ByZWtl' + 'eV9zaWduYXR1cmUYBiABKAxSGmt5YmVyU2lnbmVkUHJla2V5U2lnbmF0dXJlEkUKB3ByZWtleX' + 'MYByADKAsyKy5jbGllbnRfdG9fc2VydmVyLkFwcGxpY2F0aW9uRGF0YS5QcWNQcmVLZXlSB3By' + 'ZWtleXMaNQoMRG93bmxvYWREb25lEiUKDmRvd25sb2FkX3Rva2VuGAEgASgMUg1kb3dubG9hZF' + 'Rva2VuGk4KClJlcG9ydFVzZXISKAoQcmVwb3J0ZWRfdXNlcl9pZBgBIAEoA1IOcmVwb3J0ZWRV' + 'c2VySWQSFgoGcmVhc29uGAIgASgJUgZyZWFzb24acQoLSVBBUHVyY2hhc2USHQoKcHJvZHVjdF' + '9pZBgBIAEoCVIJcHJvZHVjdElkEhYKBnNvdXJjZRgCIAEoCVIGc291cmNlEisKEXZlcmlmaWNh' + 'dGlvbl9kYXRhGAMgASgJUhB2ZXJpZmljYXRpb25EYXRhGg8KDUlQQUZvcmNlQ2hlY2saDwoNRG' + 'VsZXRlQWNjb3VudBosChFBZGRBZGRpdGlvbmFsVXNlchIXCgd1c2VyX2lkGAEgASgDUgZ1c2Vy' + 'SWQaMAoNU2V0TG9naW5Ub2tlbhIfCgtsb2dpbl90b2tlbhgBIAEoDFIKbG9naW5Ub2tlbhqOAQ' + 'ocUmVnaXN0ZXJQYXNzd29yZExlc3NSZWNvdmVyeRIuChJlbmNyeXB0ZWRTZXJ2ZXJLZXkYASAB' + 'KAxSEmVuY3J5cHRlZFNlcnZlcktleRIrCg5waW5VbmxvY2tUb2tlbhgCIAEoDEgAUg5waW5Vbm' + 'xvY2tUb2tlbogBAUIRCg9fcGluVW5sb2NrVG9rZW4acAoYUGFzc3dvcmRsZXNzTm90aWZpY2F0' + 'aW9uEicKD25vdGlmaWNhdGlvbl9pZBgBIAEoCVIObm90aWZpY2F0aW9uSWQSKwoRZW5jcnlwdG' + 'VkX21lc3NhZ2UYAiABKAxSEGVuY3J5cHRlZE1lc3NhZ2UaawoVUmVxdWVzdE1lbW9yaWVzVXBs' + 'b2FkEhIKBHNpemUYASABKANSBHNpemUSIwoNb3JpZ2luYWxfZGF0ZRgCIAEoA1IMb3JpZ2luYW' + 'xEYXRlEhkKCG1lZGlhX2lkGAMgASgJUgdtZWRpYUlkGjIKFUNvbmZpcm1NZW1vcmllc1VwbG9h' + 'ZBIZCghtZWRpYV9pZBgBIAEoCVIHbWVkaWFJZBpICg9HZXRNZW1vcmllc0xpc3QSHwoLb2Zmc2' + 'V0X2RhdGUYASABKANSCm9mZnNldERhdGUSFAoFbGltaXQYAiABKANSBWxpbWl0GkkKDkdldE1l' + 'bW9yaWVzVXJsEhkKCG1lZGlhX2lkGAEgASgJUgdtZWRpYUlkEhwKCXRodW1ibmFpbBgCIAEoCF' + 'IJdGh1bWJuYWlsGhIKEEdldE1lbW9yaWVzVXNhZ2UaKQoMRGVsZXRlTWVtb3J5EhkKCG1lZGlh' + 'X2lkGAEgASgJUgdtZWRpYUlkGhcKFURpc2FibGVNZW1vcmllc0JhY2t1cEIRCg9BcHBsaWNhdG' + 'lvbkRhdGFKBAgJEApKBAgLEAxKBAgNEBJKBAgTEBQ='); @$core.Deprecated('Use responseDescriptor instead') const Response$json = { @@ -1129,7 +1228,12 @@ const Response$json = { '10': 'error' }, ], - '3': [Response_PreKey$json, Response_Prekeys$json, Response_Ok$json], + '3': [ + Response_PreKey$json, + Response_Prekeys$json, + Response_PqcPrekeys$json, + Response_Ok$json + ], '8': [ {'1': 'Response'}, ], @@ -1159,6 +1263,21 @@ const Response_Prekeys$json = { ], }; +@$core.Deprecated('Use responseDescriptor instead') +const Response_PqcPrekeys$json = { + '1': 'PqcPrekeys', + '2': [ + { + '1': 'prekeys', + '3': 1, + '4': 3, + '5': 11, + '6': '.client_to_server.ApplicationData.PqcPreKey', + '10': 'prekeys' + }, + ], +}; + @$core.Deprecated('Use responseDescriptor instead') const Response_Ok$json = { '1': 'Ok', @@ -1173,6 +1292,15 @@ const Response_Ok$json = { '9': 0, '10': 'prekeys' }, + { + '1': 'prekeys_pqc', + '3': 3, + '4': 1, + '5': 11, + '6': '.client_to_server.Response.PqcPrekeys', + '9': 0, + '10': 'prekeysPqc' + }, ], '8': [ {'1': 'Ok'}, @@ -1185,5 +1313,8 @@ final $typed_data.Uint8List responseDescriptor = $convert.base64Decode( 'ICb2sSKAoFZXJyb3IYAiABKA4yEC5lcnJvci5FcnJvckNvZGVIAFIFZXJyb3IaMAoGUHJlS2V5' 'Eg4KAmlkGAEgASgDUgJpZBIWCgZwcmVrZXkYAiABKAxSBnByZWtleRpGCgdQcmVrZXlzEjsKB3' 'ByZWtleXMYASADKAsyIS5jbGllbnRfdG9fc2VydmVyLlJlc3BvbnNlLlByZUtleVIHcHJla2V5' - 'cxpgCgJPaxIUCgROb25lGAEgASgISABSBE5vbmUSPgoHcHJla2V5cxgCIAEoCzIiLmNsaWVudF' - '90b19zZXJ2ZXIuUmVzcG9uc2UuUHJla2V5c0gAUgdwcmVrZXlzQgQKAk9rQgoKCFJlc3BvbnNl'); + 'cxpTCgpQcWNQcmVrZXlzEkUKB3ByZWtleXMYASADKAsyKy5jbGllbnRfdG9fc2VydmVyLkFwcG' + 'xpY2F0aW9uRGF0YS5QcWNQcmVLZXlSB3ByZWtleXMaqgEKAk9rEhQKBE5vbmUYASABKAhIAFIE' + 'Tm9uZRI+CgdwcmVrZXlzGAIgASgLMiIuY2xpZW50X3RvX3NlcnZlci5SZXNwb25zZS5QcmVrZX' + 'lzSABSB3ByZWtleXMSSAoLcHJla2V5c19wcWMYAyABKAsyJS5jbGllbnRfdG9fc2VydmVyLlJl' + 'c3BvbnNlLlBxY1ByZWtleXNIAFIKcHJla2V5c1BxY0IECgJPa0IKCghSZXNwb25zZQ=='); diff --git a/lib/src/model/protobuf/api/websocket/server_to_client.pb.dart b/lib/src/model/protobuf/api/websocket/server_to_client.pb.dart index 134ca666..0d1053aa 100644 --- a/lib/src/model/protobuf/api/websocket/server_to_client.pb.dart +++ b/lib/src/model/protobuf/api/websocket/server_to_client.pb.dart @@ -95,6 +95,7 @@ enum V0_Kind { requestNewPreKeys, error, newMessages, + requestNewPqcPreKeys, notSet } @@ -106,6 +107,7 @@ class V0 extends $pb.GeneratedMessage { $core.bool? requestNewPreKeys, $0.ErrorCode? error, NewMessages? newMessages, + $core.bool? requestNewPqcPreKeys, }) { final result = create(); if (seq != null) result.seq = seq; @@ -114,6 +116,8 @@ class V0 extends $pb.GeneratedMessage { if (requestNewPreKeys != null) result.requestNewPreKeys = requestNewPreKeys; if (error != null) result.error = error; if (newMessages != null) result.newMessages = newMessages; + if (requestNewPqcPreKeys != null) + result.requestNewPqcPreKeys = requestNewPqcPreKeys; return result; } @@ -132,6 +136,7 @@ class V0 extends $pb.GeneratedMessage { 4: V0_Kind.requestNewPreKeys, 6: V0_Kind.error, 7: V0_Kind.newMessages, + 8: V0_Kind.requestNewPqcPreKeys, 0: V0_Kind.notSet }; static final $pb.BuilderInfo _i = $pb.BuilderInfo( @@ -139,7 +144,7 @@ class V0 extends $pb.GeneratedMessage { package: const $pb.PackageName(_omitMessageNames ? '' : 'server_to_client'), createEmptyInstance: create) - ..oo(0, [2, 3, 4, 6, 7]) + ..oo(0, [2, 3, 4, 6, 7, 8]) ..a<$fixnum.Int64>(1, _omitFieldNames ? '' : 'seq', $pb.PbFieldType.OU6, defaultOrMaker: $fixnum.Int64.ZERO) ..aOM(2, _omitFieldNames ? '' : 'response', @@ -152,6 +157,8 @@ class V0 extends $pb.GeneratedMessage { enumValues: $0.ErrorCode.values) ..aOM(7, _omitFieldNames ? '' : 'newMessages', protoName: 'newMessages', subBuilder: NewMessages.create) + ..aOB(8, _omitFieldNames ? '' : 'RequestNewPqcPreKeys', + protoName: 'RequestNewPqcPreKeys') ..hasRequiredFields = false; @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') @@ -177,12 +184,14 @@ class V0 extends $pb.GeneratedMessage { @$pb.TagNumber(4) @$pb.TagNumber(6) @$pb.TagNumber(7) + @$pb.TagNumber(8) V0_Kind whichKind() => _V0_KindByTag[$_whichOneof(0)]!; @$pb.TagNumber(2) @$pb.TagNumber(3) @$pb.TagNumber(4) @$pb.TagNumber(6) @$pb.TagNumber(7) + @$pb.TagNumber(8) void clearKind() => $_clearField($_whichOneof(0)); @$pb.TagNumber(1) @@ -244,6 +253,15 @@ class V0 extends $pb.GeneratedMessage { void clearNewMessages() => $_clearField(7); @$pb.TagNumber(7) NewMessages ensureNewMessages() => $_ensure(5); + + @$pb.TagNumber(8) + $core.bool get requestNewPqcPreKeys => $_getBF(6); + @$pb.TagNumber(8) + set requestNewPqcPreKeys($core.bool value) => $_setBool(6, value); + @$pb.TagNumber(8) + $core.bool hasRequestNewPqcPreKeys() => $_has(6); + @$pb.TagNumber(8) + void clearRequestNewPqcPreKeys() => $_clearField(8); } class NewMessage extends $pb.GeneratedMessage { @@ -830,45 +848,6 @@ class Response_AdditionalAccount extends $pb.GeneratedMessage { void clearPlanId() => $_clearField(3); } -class Response_Deprecated extends $pb.GeneratedMessage { - factory Response_Deprecated() => create(); - - Response_Deprecated._(); - - factory Response_Deprecated.fromBuffer($core.List<$core.int> data, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(data, registry); - factory Response_Deprecated.fromJson($core.String json, - [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(json, registry); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - _omitMessageNames ? '' : 'Response.Deprecated', - package: - const $pb.PackageName(_omitMessageNames ? '' : 'server_to_client'), - createEmptyInstance: create) - ..hasRequiredFields = false; - - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - Response_Deprecated clone() => deepCopy(); - @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') - Response_Deprecated copyWith(void Function(Response_Deprecated) updates) => - super.copyWith((message) => updates(message as Response_Deprecated)) - as Response_Deprecated; - - @$core.override - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static Response_Deprecated create() => Response_Deprecated._(); - @$core.override - Response_Deprecated createEmptyInstance() => create(); - @$core.pragma('dart2js:noInline') - static Response_Deprecated getDefault() => _defaultInstance ??= - $pb.GeneratedMessage.$_defaultFor(create); - static Response_Deprecated? _defaultInstance; -} - class Response_Transaction extends $pb.GeneratedMessage { factory Response_Transaction() => create(); @@ -1196,6 +1175,252 @@ class Response_SignedPreKey extends $pb.GeneratedMessage { void clearSignedPrekeySignature() => $_clearField(3); } +class Response_PqcPreKey extends $pb.GeneratedMessage { + factory Response_PqcPreKey({ + $fixnum.Int64? eccPreKeyId, + $core.List<$core.int>? eccPreKey, + $fixnum.Int64? kyberPreKeyId, + $core.List<$core.int>? kyberPreKey, + $core.List<$core.int>? kyberPreKeySignature, + }) { + final result = create(); + if (eccPreKeyId != null) result.eccPreKeyId = eccPreKeyId; + if (eccPreKey != null) result.eccPreKey = eccPreKey; + if (kyberPreKeyId != null) result.kyberPreKeyId = kyberPreKeyId; + if (kyberPreKey != null) result.kyberPreKey = kyberPreKey; + if (kyberPreKeySignature != null) + result.kyberPreKeySignature = kyberPreKeySignature; + return result; + } + + Response_PqcPreKey._(); + + factory Response_PqcPreKey.fromBuffer($core.List<$core.int> data, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(data, registry); + factory Response_PqcPreKey.fromJson($core.String json, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(json, registry); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Response.PqcPreKey', + package: + const $pb.PackageName(_omitMessageNames ? '' : 'server_to_client'), + createEmptyInstance: create) + ..aInt64(1, _omitFieldNames ? '' : 'eccPreKeyId') + ..a<$core.List<$core.int>>( + 2, _omitFieldNames ? '' : 'eccPreKey', $pb.PbFieldType.OY) + ..aInt64(3, _omitFieldNames ? '' : 'kyberPreKeyId') + ..a<$core.List<$core.int>>( + 4, _omitFieldNames ? '' : 'kyberPreKey', $pb.PbFieldType.OY) + ..a<$core.List<$core.int>>( + 5, _omitFieldNames ? '' : 'kyberPreKeySignature', $pb.PbFieldType.OY) + ..hasRequiredFields = false; + + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + Response_PqcPreKey clone() => deepCopy(); + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + Response_PqcPreKey copyWith(void Function(Response_PqcPreKey) updates) => + super.copyWith((message) => updates(message as Response_PqcPreKey)) + as Response_PqcPreKey; + + @$core.override + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Response_PqcPreKey create() => Response_PqcPreKey._(); + @$core.override + Response_PqcPreKey createEmptyInstance() => create(); + @$core.pragma('dart2js:noInline') + static Response_PqcPreKey getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); + static Response_PqcPreKey? _defaultInstance; + + @$pb.TagNumber(1) + $fixnum.Int64 get eccPreKeyId => $_getI64(0); + @$pb.TagNumber(1) + set eccPreKeyId($fixnum.Int64 value) => $_setInt64(0, value); + @$pb.TagNumber(1) + $core.bool hasEccPreKeyId() => $_has(0); + @$pb.TagNumber(1) + void clearEccPreKeyId() => $_clearField(1); + + @$pb.TagNumber(2) + $core.List<$core.int> get eccPreKey => $_getN(1); + @$pb.TagNumber(2) + set eccPreKey($core.List<$core.int> value) => $_setBytes(1, value); + @$pb.TagNumber(2) + $core.bool hasEccPreKey() => $_has(1); + @$pb.TagNumber(2) + void clearEccPreKey() => $_clearField(2); + + @$pb.TagNumber(3) + $fixnum.Int64 get kyberPreKeyId => $_getI64(2); + @$pb.TagNumber(3) + set kyberPreKeyId($fixnum.Int64 value) => $_setInt64(2, value); + @$pb.TagNumber(3) + $core.bool hasKyberPreKeyId() => $_has(2); + @$pb.TagNumber(3) + void clearKyberPreKeyId() => $_clearField(3); + + @$pb.TagNumber(4) + $core.List<$core.int> get kyberPreKey => $_getN(3); + @$pb.TagNumber(4) + set kyberPreKey($core.List<$core.int> value) => $_setBytes(3, value); + @$pb.TagNumber(4) + $core.bool hasKyberPreKey() => $_has(3); + @$pb.TagNumber(4) + void clearKyberPreKey() => $_clearField(4); + + @$pb.TagNumber(5) + $core.List<$core.int> get kyberPreKeySignature => $_getN(4); + @$pb.TagNumber(5) + set kyberPreKeySignature($core.List<$core.int> value) => $_setBytes(4, value); + @$pb.TagNumber(5) + $core.bool hasKyberPreKeySignature() => $_has(4); + @$pb.TagNumber(5) + void clearKyberPreKeySignature() => $_clearField(5); +} + +class Response_PqcBundle extends $pb.GeneratedMessage { + factory Response_PqcBundle({ + $fixnum.Int64? eccSignedPrekeyId, + $core.List<$core.int>? eccSignedPrekey, + $core.List<$core.int>? eccSignedPrekeySignature, + $fixnum.Int64? kyberSignedPrekeyId, + $core.List<$core.int>? kyberSignedPrekey, + $core.List<$core.int>? kyberSignedPrekeySignature, + Response_PqcPreKey? prekey, + }) { + final result = create(); + if (eccSignedPrekeyId != null) result.eccSignedPrekeyId = eccSignedPrekeyId; + if (eccSignedPrekey != null) result.eccSignedPrekey = eccSignedPrekey; + if (eccSignedPrekeySignature != null) + result.eccSignedPrekeySignature = eccSignedPrekeySignature; + if (kyberSignedPrekeyId != null) + result.kyberSignedPrekeyId = kyberSignedPrekeyId; + if (kyberSignedPrekey != null) result.kyberSignedPrekey = kyberSignedPrekey; + if (kyberSignedPrekeySignature != null) + result.kyberSignedPrekeySignature = kyberSignedPrekeySignature; + if (prekey != null) result.prekey = prekey; + return result; + } + + Response_PqcBundle._(); + + factory Response_PqcBundle.fromBuffer($core.List<$core.int> data, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(data, registry); + factory Response_PqcBundle.fromJson($core.String json, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(json, registry); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Response.PqcBundle', + package: + const $pb.PackageName(_omitMessageNames ? '' : 'server_to_client'), + createEmptyInstance: create) + ..aInt64(1, _omitFieldNames ? '' : 'eccSignedPrekeyId') + ..a<$core.List<$core.int>>( + 2, _omitFieldNames ? '' : 'eccSignedPrekey', $pb.PbFieldType.OY) + ..a<$core.List<$core.int>>(3, + _omitFieldNames ? '' : 'eccSignedPrekeySignature', $pb.PbFieldType.OY) + ..aInt64(4, _omitFieldNames ? '' : 'kyberSignedPrekeyId') + ..a<$core.List<$core.int>>( + 5, _omitFieldNames ? '' : 'kyberSignedPrekey', $pb.PbFieldType.OY) + ..a<$core.List<$core.int>>(6, + _omitFieldNames ? '' : 'kyberSignedPrekeySignature', $pb.PbFieldType.OY) + ..aOM(7, _omitFieldNames ? '' : 'prekey', + subBuilder: Response_PqcPreKey.create) + ..hasRequiredFields = false; + + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + Response_PqcBundle clone() => deepCopy(); + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + Response_PqcBundle copyWith(void Function(Response_PqcBundle) updates) => + super.copyWith((message) => updates(message as Response_PqcBundle)) + as Response_PqcBundle; + + @$core.override + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Response_PqcBundle create() => Response_PqcBundle._(); + @$core.override + Response_PqcBundle createEmptyInstance() => create(); + @$core.pragma('dart2js:noInline') + static Response_PqcBundle getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); + static Response_PqcBundle? _defaultInstance; + + @$pb.TagNumber(1) + $fixnum.Int64 get eccSignedPrekeyId => $_getI64(0); + @$pb.TagNumber(1) + set eccSignedPrekeyId($fixnum.Int64 value) => $_setInt64(0, value); + @$pb.TagNumber(1) + $core.bool hasEccSignedPrekeyId() => $_has(0); + @$pb.TagNumber(1) + void clearEccSignedPrekeyId() => $_clearField(1); + + @$pb.TagNumber(2) + $core.List<$core.int> get eccSignedPrekey => $_getN(1); + @$pb.TagNumber(2) + set eccSignedPrekey($core.List<$core.int> value) => $_setBytes(1, value); + @$pb.TagNumber(2) + $core.bool hasEccSignedPrekey() => $_has(1); + @$pb.TagNumber(2) + void clearEccSignedPrekey() => $_clearField(2); + + @$pb.TagNumber(3) + $core.List<$core.int> get eccSignedPrekeySignature => $_getN(2); + @$pb.TagNumber(3) + set eccSignedPrekeySignature($core.List<$core.int> value) => + $_setBytes(2, value); + @$pb.TagNumber(3) + $core.bool hasEccSignedPrekeySignature() => $_has(2); + @$pb.TagNumber(3) + void clearEccSignedPrekeySignature() => $_clearField(3); + + @$pb.TagNumber(4) + $fixnum.Int64 get kyberSignedPrekeyId => $_getI64(3); + @$pb.TagNumber(4) + set kyberSignedPrekeyId($fixnum.Int64 value) => $_setInt64(3, value); + @$pb.TagNumber(4) + $core.bool hasKyberSignedPrekeyId() => $_has(3); + @$pb.TagNumber(4) + void clearKyberSignedPrekeyId() => $_clearField(4); + + @$pb.TagNumber(5) + $core.List<$core.int> get kyberSignedPrekey => $_getN(4); + @$pb.TagNumber(5) + set kyberSignedPrekey($core.List<$core.int> value) => $_setBytes(4, value); + @$pb.TagNumber(5) + $core.bool hasKyberSignedPrekey() => $_has(4); + @$pb.TagNumber(5) + void clearKyberSignedPrekey() => $_clearField(5); + + @$pb.TagNumber(6) + $core.List<$core.int> get kyberSignedPrekeySignature => $_getN(5); + @$pb.TagNumber(6) + set kyberSignedPrekeySignature($core.List<$core.int> value) => + $_setBytes(5, value); + @$pb.TagNumber(6) + $core.bool hasKyberSignedPrekeySignature() => $_has(5); + @$pb.TagNumber(6) + void clearKyberSignedPrekeySignature() => $_clearField(6); + + @$pb.TagNumber(7) + Response_PqcPreKey get prekey => $_getN(6); + @$pb.TagNumber(7) + set prekey(Response_PqcPreKey value) => $_setField(7, value); + @$pb.TagNumber(7) + $core.bool hasPrekey() => $_has(6); + @$pb.TagNumber(7) + void clearPrekey() => $_clearField(7); + @$pb.TagNumber(7) + Response_PqcPreKey ensurePrekey() => $_ensure(6); +} + class Response_UserData extends $pb.GeneratedMessage { factory Response_UserData({ $fixnum.Int64? userId, @@ -1206,6 +1431,7 @@ class Response_UserData extends $pb.GeneratedMessage { $fixnum.Int64? signedPrekeyId, $core.List<$core.int>? username, $fixnum.Int64? registrationId, + Response_PqcBundle? pqcBundle, }) { final result = create(); if (userId != null) result.userId = userId; @@ -1217,6 +1443,7 @@ class Response_UserData extends $pb.GeneratedMessage { if (signedPrekeyId != null) result.signedPrekeyId = signedPrekeyId; if (username != null) result.username = username; if (registrationId != null) result.registrationId = registrationId; + if (pqcBundle != null) result.pqcBundle = pqcBundle; return result; } @@ -1247,6 +1474,8 @@ class Response_UserData extends $pb.GeneratedMessage { ..a<$core.List<$core.int>>( 7, _omitFieldNames ? '' : 'username', $pb.PbFieldType.OY) ..aInt64(8, _omitFieldNames ? '' : 'registrationId') + ..aOM(9, _omitFieldNames ? '' : 'pqcBundle', + subBuilder: Response_PqcBundle.create) ..hasRequiredFields = false; @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') @@ -1334,6 +1563,17 @@ class Response_UserData extends $pb.GeneratedMessage { $core.bool hasRegistrationId() => $_has(7); @$pb.TagNumber(8) void clearRegistrationId() => $_clearField(8); + + @$pb.TagNumber(9) + Response_PqcBundle get pqcBundle => $_getN(8); + @$pb.TagNumber(9) + set pqcBundle(Response_PqcBundle value) => $_setField(9, value); + @$pb.TagNumber(9) + $core.bool hasPqcBundle() => $_has(8); + @$pb.TagNumber(9) + void clearPqcBundle() => $_clearField(9); + @$pb.TagNumber(9) + Response_PqcBundle ensurePqcBundle() => $_ensure(8); } class Response_UploadToken extends $pb.GeneratedMessage { @@ -2074,11 +2314,9 @@ enum Response_Ok_Ok { uploadtoken, userdata, authtoken, - deprecated7, authenticated, plans, planballance, - deprecated11, addaccountsinvites, downloadtokens, signedprekey, @@ -2100,11 +2338,9 @@ class Response_Ok extends $pb.GeneratedMessage { Response_UploadToken? uploadtoken, Response_UserData? userdata, $core.List<$core.int>? authtoken, - Response_Deprecated? deprecated7, Response_Authenticated? authenticated, Response_Plans? plans, Response_PlanBallance? planballance, - Response_Deprecated? deprecated11, Response_AddAccountsInvites? addaccountsinvites, Response_DownloadTokens? downloadtokens, Response_SignedPreKey? signedprekey, @@ -2123,11 +2359,9 @@ class Response_Ok extends $pb.GeneratedMessage { if (uploadtoken != null) result.uploadtoken = uploadtoken; if (userdata != null) result.userdata = userdata; if (authtoken != null) result.authtoken = authtoken; - if (deprecated7 != null) result.deprecated7 = deprecated7; if (authenticated != null) result.authenticated = authenticated; if (plans != null) result.plans = plans; if (planballance != null) result.planballance = planballance; - if (deprecated11 != null) result.deprecated11 = deprecated11; if (addaccountsinvites != null) result.addaccountsinvites = addaccountsinvites; if (downloadtokens != null) result.downloadtokens = downloadtokens; @@ -2162,11 +2396,9 @@ class Response_Ok extends $pb.GeneratedMessage { 4: Response_Ok_Ok.uploadtoken, 5: Response_Ok_Ok.userdata, 6: Response_Ok_Ok.authtoken, - 7: Response_Ok_Ok.deprecated7, 8: Response_Ok_Ok.authenticated, 9: Response_Ok_Ok.plans, 10: Response_Ok_Ok.planballance, - 11: Response_Ok_Ok.deprecated11, 12: Response_Ok_Ok.addaccountsinvites, 13: Response_Ok_Ok.downloadtokens, 14: Response_Ok_Ok.signedprekey, @@ -2184,29 +2416,8 @@ class Response_Ok extends $pb.GeneratedMessage { package: const $pb.PackageName(_omitMessageNames ? '' : 'server_to_client'), createEmptyInstance: create) - ..oo(0, [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21 - ]) + ..oo( + 0, [1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]) ..aOB(1, _omitFieldNames ? '' : 'None', protoName: 'None') ..aInt64(2, _omitFieldNames ? '' : 'userid') ..a<$core.List<$core.int>>( @@ -2217,16 +2428,12 @@ class Response_Ok extends $pb.GeneratedMessage { subBuilder: Response_UserData.create) ..a<$core.List<$core.int>>( 6, _omitFieldNames ? '' : 'authtoken', $pb.PbFieldType.OY) - ..aOM(7, _omitFieldNames ? '' : 'deprecated7', - protoName: 'deprecated_7', subBuilder: Response_Deprecated.create) ..aOM(8, _omitFieldNames ? '' : 'authenticated', subBuilder: Response_Authenticated.create) ..aOM(9, _omitFieldNames ? '' : 'plans', subBuilder: Response_Plans.create) ..aOM(10, _omitFieldNames ? '' : 'planballance', subBuilder: Response_PlanBallance.create) - ..aOM(11, _omitFieldNames ? '' : 'deprecated11', - protoName: 'deprecated_11', subBuilder: Response_Deprecated.create) ..aOM( 12, _omitFieldNames ? '' : 'addaccountsinvites', subBuilder: Response_AddAccountsInvites.create) @@ -2279,11 +2486,9 @@ class Response_Ok extends $pb.GeneratedMessage { @$pb.TagNumber(4) @$pb.TagNumber(5) @$pb.TagNumber(6) - @$pb.TagNumber(7) @$pb.TagNumber(8) @$pb.TagNumber(9) @$pb.TagNumber(10) - @$pb.TagNumber(11) @$pb.TagNumber(12) @$pb.TagNumber(13) @$pb.TagNumber(14) @@ -2301,11 +2506,9 @@ class Response_Ok extends $pb.GeneratedMessage { @$pb.TagNumber(4) @$pb.TagNumber(5) @$pb.TagNumber(6) - @$pb.TagNumber(7) @$pb.TagNumber(8) @$pb.TagNumber(9) @$pb.TagNumber(10) - @$pb.TagNumber(11) @$pb.TagNumber(12) @$pb.TagNumber(13) @$pb.TagNumber(14) @@ -2376,175 +2579,153 @@ class Response_Ok extends $pb.GeneratedMessage { @$pb.TagNumber(6) void clearAuthtoken() => $_clearField(6); - @$pb.TagNumber(7) - Response_Deprecated get deprecated7 => $_getN(6); - @$pb.TagNumber(7) - set deprecated7(Response_Deprecated value) => $_setField(7, value); - @$pb.TagNumber(7) - $core.bool hasDeprecated7() => $_has(6); - @$pb.TagNumber(7) - void clearDeprecated7() => $_clearField(7); - @$pb.TagNumber(7) - Response_Deprecated ensureDeprecated7() => $_ensure(6); - @$pb.TagNumber(8) - Response_Authenticated get authenticated => $_getN(7); + Response_Authenticated get authenticated => $_getN(6); @$pb.TagNumber(8) set authenticated(Response_Authenticated value) => $_setField(8, value); @$pb.TagNumber(8) - $core.bool hasAuthenticated() => $_has(7); + $core.bool hasAuthenticated() => $_has(6); @$pb.TagNumber(8) void clearAuthenticated() => $_clearField(8); @$pb.TagNumber(8) - Response_Authenticated ensureAuthenticated() => $_ensure(7); + Response_Authenticated ensureAuthenticated() => $_ensure(6); @$pb.TagNumber(9) - Response_Plans get plans => $_getN(8); + Response_Plans get plans => $_getN(7); @$pb.TagNumber(9) set plans(Response_Plans value) => $_setField(9, value); @$pb.TagNumber(9) - $core.bool hasPlans() => $_has(8); + $core.bool hasPlans() => $_has(7); @$pb.TagNumber(9) void clearPlans() => $_clearField(9); @$pb.TagNumber(9) - Response_Plans ensurePlans() => $_ensure(8); + Response_Plans ensurePlans() => $_ensure(7); @$pb.TagNumber(10) - Response_PlanBallance get planballance => $_getN(9); + Response_PlanBallance get planballance => $_getN(8); @$pb.TagNumber(10) set planballance(Response_PlanBallance value) => $_setField(10, value); @$pb.TagNumber(10) - $core.bool hasPlanballance() => $_has(9); + $core.bool hasPlanballance() => $_has(8); @$pb.TagNumber(10) void clearPlanballance() => $_clearField(10); @$pb.TagNumber(10) - Response_PlanBallance ensurePlanballance() => $_ensure(9); - - @$pb.TagNumber(11) - Response_Deprecated get deprecated11 => $_getN(10); - @$pb.TagNumber(11) - set deprecated11(Response_Deprecated value) => $_setField(11, value); - @$pb.TagNumber(11) - $core.bool hasDeprecated11() => $_has(10); - @$pb.TagNumber(11) - void clearDeprecated11() => $_clearField(11); - @$pb.TagNumber(11) - Response_Deprecated ensureDeprecated11() => $_ensure(10); + Response_PlanBallance ensurePlanballance() => $_ensure(8); @$pb.TagNumber(12) - Response_AddAccountsInvites get addaccountsinvites => $_getN(11); + Response_AddAccountsInvites get addaccountsinvites => $_getN(9); @$pb.TagNumber(12) set addaccountsinvites(Response_AddAccountsInvites value) => $_setField(12, value); @$pb.TagNumber(12) - $core.bool hasAddaccountsinvites() => $_has(11); + $core.bool hasAddaccountsinvites() => $_has(9); @$pb.TagNumber(12) void clearAddaccountsinvites() => $_clearField(12); @$pb.TagNumber(12) - Response_AddAccountsInvites ensureAddaccountsinvites() => $_ensure(11); + Response_AddAccountsInvites ensureAddaccountsinvites() => $_ensure(9); @$pb.TagNumber(13) - Response_DownloadTokens get downloadtokens => $_getN(12); + Response_DownloadTokens get downloadtokens => $_getN(10); @$pb.TagNumber(13) set downloadtokens(Response_DownloadTokens value) => $_setField(13, value); @$pb.TagNumber(13) - $core.bool hasDownloadtokens() => $_has(12); + $core.bool hasDownloadtokens() => $_has(10); @$pb.TagNumber(13) void clearDownloadtokens() => $_clearField(13); @$pb.TagNumber(13) - Response_DownloadTokens ensureDownloadtokens() => $_ensure(12); + Response_DownloadTokens ensureDownloadtokens() => $_ensure(10); @$pb.TagNumber(14) - Response_SignedPreKey get signedprekey => $_getN(13); + Response_SignedPreKey get signedprekey => $_getN(11); @$pb.TagNumber(14) set signedprekey(Response_SignedPreKey value) => $_setField(14, value); @$pb.TagNumber(14) - $core.bool hasSignedprekey() => $_has(13); + $core.bool hasSignedprekey() => $_has(11); @$pb.TagNumber(14) void clearSignedprekey() => $_clearField(14); @$pb.TagNumber(14) - Response_SignedPreKey ensureSignedprekey() => $_ensure(13); + Response_SignedPreKey ensureSignedprekey() => $_ensure(11); @$pb.TagNumber(15) - Response_ProofOfWork get proofOfWork => $_getN(14); + Response_ProofOfWork get proofOfWork => $_getN(12); @$pb.TagNumber(15) set proofOfWork(Response_ProofOfWork value) => $_setField(15, value); @$pb.TagNumber(15) - $core.bool hasProofOfWork() => $_has(14); + $core.bool hasProofOfWork() => $_has(12); @$pb.TagNumber(15) void clearProofOfWork() => $_clearField(15); @$pb.TagNumber(15) - Response_ProofOfWork ensureProofOfWork() => $_ensure(14); + Response_ProofOfWork ensureProofOfWork() => $_ensure(12); @$pb.TagNumber(16) - $core.List<$core.int> get passwordlessRecoveryServerKey => $_getN(15); + $core.List<$core.int> get passwordlessRecoveryServerKey => $_getN(13); @$pb.TagNumber(16) set passwordlessRecoveryServerKey($core.List<$core.int> value) => - $_setBytes(15, value); + $_setBytes(13, value); @$pb.TagNumber(16) - $core.bool hasPasswordlessRecoveryServerKey() => $_has(15); + $core.bool hasPasswordlessRecoveryServerKey() => $_has(13); @$pb.TagNumber(16) void clearPasswordlessRecoveryServerKey() => $_clearField(16); @$pb.TagNumber(17) Response_PasswordlessNotificationMessages - get passwordlessNotificationMessages => $_getN(16); + get passwordlessNotificationMessages => $_getN(14); @$pb.TagNumber(17) set passwordlessNotificationMessages( Response_PasswordlessNotificationMessages value) => $_setField(17, value); @$pb.TagNumber(17) - $core.bool hasPasswordlessNotificationMessages() => $_has(16); + $core.bool hasPasswordlessNotificationMessages() => $_has(14); @$pb.TagNumber(17) void clearPasswordlessNotificationMessages() => $_clearField(17); @$pb.TagNumber(17) Response_PasswordlessNotificationMessages - ensurePasswordlessNotificationMessages() => $_ensure(16); + ensurePasswordlessNotificationMessages() => $_ensure(14); @$pb.TagNumber(18) - Response_MemoriesUploadUrls get memoriesUploadUrls => $_getN(17); + Response_MemoriesUploadUrls get memoriesUploadUrls => $_getN(15); @$pb.TagNumber(18) set memoriesUploadUrls(Response_MemoriesUploadUrls value) => $_setField(18, value); @$pb.TagNumber(18) - $core.bool hasMemoriesUploadUrls() => $_has(17); + $core.bool hasMemoriesUploadUrls() => $_has(15); @$pb.TagNumber(18) void clearMemoriesUploadUrls() => $_clearField(18); @$pb.TagNumber(18) - Response_MemoriesUploadUrls ensureMemoriesUploadUrls() => $_ensure(17); + Response_MemoriesUploadUrls ensureMemoriesUploadUrls() => $_ensure(15); @$pb.TagNumber(19) - Response_MemoriesList get memoriesList => $_getN(18); + Response_MemoriesList get memoriesList => $_getN(16); @$pb.TagNumber(19) set memoriesList(Response_MemoriesList value) => $_setField(19, value); @$pb.TagNumber(19) - $core.bool hasMemoriesList() => $_has(18); + $core.bool hasMemoriesList() => $_has(16); @$pb.TagNumber(19) void clearMemoriesList() => $_clearField(19); @$pb.TagNumber(19) - Response_MemoriesList ensureMemoriesList() => $_ensure(18); + Response_MemoriesList ensureMemoriesList() => $_ensure(16); @$pb.TagNumber(20) - Response_MemoriesUrl get memoriesUrl => $_getN(19); + Response_MemoriesUrl get memoriesUrl => $_getN(17); @$pb.TagNumber(20) set memoriesUrl(Response_MemoriesUrl value) => $_setField(20, value); @$pb.TagNumber(20) - $core.bool hasMemoriesUrl() => $_has(19); + $core.bool hasMemoriesUrl() => $_has(17); @$pb.TagNumber(20) void clearMemoriesUrl() => $_clearField(20); @$pb.TagNumber(20) - Response_MemoriesUrl ensureMemoriesUrl() => $_ensure(19); + Response_MemoriesUrl ensureMemoriesUrl() => $_ensure(17); @$pb.TagNumber(21) - Response_MemoriesUsage get memoriesUsage => $_getN(20); + Response_MemoriesUsage get memoriesUsage => $_getN(18); @$pb.TagNumber(21) set memoriesUsage(Response_MemoriesUsage value) => $_setField(21, value); @$pb.TagNumber(21) - $core.bool hasMemoriesUsage() => $_has(20); + $core.bool hasMemoriesUsage() => $_has(18); @$pb.TagNumber(21) void clearMemoriesUsage() => $_clearField(21); @$pb.TagNumber(21) - Response_MemoriesUsage ensureMemoriesUsage() => $_ensure(20); + Response_MemoriesUsage ensureMemoriesUsage() => $_ensure(18); } enum Response_Response { ok, error, notSet } diff --git a/lib/src/model/protobuf/api/websocket/server_to_client.pbjson.dart b/lib/src/model/protobuf/api/websocket/server_to_client.pbjson.dart index d918a21a..42b93650 100644 --- a/lib/src/model/protobuf/api/websocket/server_to_client.pbjson.dart +++ b/lib/src/model/protobuf/api/websocket/server_to_client.pbjson.dart @@ -79,6 +79,14 @@ const V0$json = { '9': 0, '10': 'RequestNewPreKeys' }, + { + '1': 'RequestNewPqcPreKeys', + '3': 8, + '4': 1, + '5': 8, + '9': 0, + '10': 'RequestNewPqcPreKeys' + }, { '1': 'error', '3': 6, @@ -100,8 +108,9 @@ final $typed_data.Uint8List v0Descriptor = $convert.base64Decode( 'llbnQuUmVzcG9uc2VIAFIIcmVzcG9uc2USPgoKbmV3TWVzc2FnZRgDIAEoCzIcLnNlcnZlcl90' 'b19jbGllbnQuTmV3TWVzc2FnZUgAUgpuZXdNZXNzYWdlEkEKC25ld01lc3NhZ2VzGAcgASgLMh' '0uc2VydmVyX3RvX2NsaWVudC5OZXdNZXNzYWdlc0gAUgtuZXdNZXNzYWdlcxIuChFSZXF1ZXN0' - 'TmV3UHJlS2V5cxgEIAEoCEgAUhFSZXF1ZXN0TmV3UHJlS2V5cxIoCgVlcnJvchgGIAEoDjIQLm' - 'Vycm9yLkVycm9yQ29kZUgAUgVlcnJvckIGCgRLaW5k'); + 'TmV3UHJlS2V5cxgEIAEoCEgAUhFSZXF1ZXN0TmV3UHJlS2V5cxI0ChRSZXF1ZXN0TmV3UHFjUH' + 'JlS2V5cxgIIAEoCEgAUhRSZXF1ZXN0TmV3UHFjUHJlS2V5cxIoCgVlcnJvchgGIAEoDjIQLmVy' + 'cm9yLkVycm9yQ29kZUgAUgVlcnJvckIGCgRLaW5k'); @$core.Deprecated('Use newMessageDescriptor instead') const NewMessage$json = { @@ -167,11 +176,12 @@ const Response$json = { Response_AddAccountsInvite$json, Response_AddAccountsInvites$json, Response_AdditionalAccount$json, - Response_Deprecated$json, Response_Transaction$json, Response_PlanBallance$json, Response_PreKey$json, Response_SignedPreKey$json, + Response_PqcPreKey$json, + Response_PqcBundle$json, Response_UserData$json, Response_UploadToken$json, Response_DownloadTokens$json, @@ -306,11 +316,6 @@ const Response_AdditionalAccount$json = { ], }; -@$core.Deprecated('Use responseDescriptor instead') -const Response_Deprecated$json = { - '1': 'Deprecated', -}; - @$core.Deprecated('Use responseDescriptor instead') const Response_Transaction$json = { '1': 'Transaction', @@ -420,6 +425,86 @@ const Response_SignedPreKey$json = { ], }; +@$core.Deprecated('Use responseDescriptor instead') +const Response_PqcPreKey$json = { + '1': 'PqcPreKey', + '2': [ + {'1': 'ecc_pre_key_id', '3': 1, '4': 1, '5': 3, '10': 'eccPreKeyId'}, + {'1': 'ecc_pre_key', '3': 2, '4': 1, '5': 12, '10': 'eccPreKey'}, + {'1': 'kyber_pre_key_id', '3': 3, '4': 1, '5': 3, '10': 'kyberPreKeyId'}, + {'1': 'kyber_pre_key', '3': 4, '4': 1, '5': 12, '10': 'kyberPreKey'}, + { + '1': 'kyber_pre_key_signature', + '3': 5, + '4': 1, + '5': 12, + '10': 'kyberPreKeySignature' + }, + ], +}; + +@$core.Deprecated('Use responseDescriptor instead') +const Response_PqcBundle$json = { + '1': 'PqcBundle', + '2': [ + { + '1': 'ecc_signed_prekey_id', + '3': 1, + '4': 1, + '5': 3, + '10': 'eccSignedPrekeyId' + }, + { + '1': 'ecc_signed_prekey', + '3': 2, + '4': 1, + '5': 12, + '10': 'eccSignedPrekey' + }, + { + '1': 'ecc_signed_prekey_signature', + '3': 3, + '4': 1, + '5': 12, + '10': 'eccSignedPrekeySignature' + }, + { + '1': 'kyber_signed_prekey_id', + '3': 4, + '4': 1, + '5': 3, + '10': 'kyberSignedPrekeyId' + }, + { + '1': 'kyber_signed_prekey', + '3': 5, + '4': 1, + '5': 12, + '10': 'kyberSignedPrekey' + }, + { + '1': 'kyber_signed_prekey_signature', + '3': 6, + '4': 1, + '5': 12, + '10': 'kyberSignedPrekeySignature' + }, + { + '1': 'prekey', + '3': 7, + '4': 1, + '5': 11, + '6': '.server_to_client.Response.PqcPreKey', + '9': 0, + '10': 'prekey', + '17': true + }, + ], + '8': [ + {'1': '_prekey'}, + ], +}; + @$core.Deprecated('Use responseDescriptor instead') const Response_UserData$json = { '1': 'UserData', @@ -487,6 +572,16 @@ const Response_UserData$json = { '10': 'registrationId', '17': true }, + { + '1': 'pqc_bundle', + '3': 9, + '4': 1, + '5': 11, + '6': '.server_to_client.Response.PqcBundle', + '9': 6, + '10': 'pqcBundle', + '17': true + }, ], '8': [ {'1': '_username'}, @@ -495,6 +590,7 @@ const Response_UserData$json = { {'1': '_signed_prekey_signature'}, {'1': '_signed_prekey_id'}, {'1': '_registration_id'}, + {'1': '_pqc_bundle'}, ], }; @@ -687,15 +783,6 @@ const Response_Ok$json = { '10': 'userdata' }, {'1': 'authtoken', '3': 6, '4': 1, '5': 12, '9': 0, '10': 'authtoken'}, - { - '1': 'deprecated_7', - '3': 7, - '4': 1, - '5': 11, - '6': '.server_to_client.Response.Deprecated', - '9': 0, - '10': 'deprecated7' - }, { '1': 'authenticated', '3': 8, @@ -723,15 +810,6 @@ const Response_Ok$json = { '9': 0, '10': 'planballance' }, - { - '1': 'deprecated_11', - '3': 11, - '4': 1, - '5': 11, - '6': '.server_to_client.Response.Deprecated', - '9': 0, - '10': 'deprecated11' - }, { '1': 'addaccountsinvites', '3': 12, @@ -825,6 +903,10 @@ const Response_Ok$json = { '8': [ {'1': 'Ok'}, ], + '9': [ + {'1': 7, '2': 8}, + {'1': 11, '2': 12}, + ], }; /// Descriptor for `Response`. Decode as a `google.protobuf.DescriptorProto`. @@ -846,79 +928,89 @@ final $typed_data.Uint8List responseDescriptor = $convert.base64Decode( 'cGxhbklkEh8KC2ludml0ZV9jb2RlGAIgASgJUgppbnZpdGVDb2RlGlwKEkFkZEFjY291bnRzSW' '52aXRlcxJGCgdpbnZpdGVzGAEgAygLMiwuc2VydmVyX3RvX2NsaWVudC5SZXNwb25zZS5BZGRB' 'Y2NvdW50c0ludml0ZVIHaW52aXRlcxpFChFBZGRpdGlvbmFsQWNjb3VudBIXCgd1c2VyX2lkGA' - 'EgASgDUgZ1c2VySWQSFwoHcGxhbl9pZBgDIAEoCVIGcGxhbklkGgwKCkRlcHJlY2F0ZWQaDQoL' - 'VHJhbnNhY3Rpb24alwUKDFBsYW5CYWxsYW5jZRJACh11c2VkX2RhaWx5X21lZGlhX3VwbG9hZF' - '9saW1pdBgBIAEoA1IZdXNlZERhaWx5TWVkaWFVcGxvYWRMaW1pdBI+Chx1c2VkX3VwbG9hZF9t' - 'ZWRpYV9zaXplX2xpbWl0GAIgASgDUhh1c2VkVXBsb2FkTWVkaWFTaXplTGltaXQSMwoTcGF5bW' - 'VudF9wZXJpb2RfZGF5cxgDIAEoA0gAUhFwYXltZW50UGVyaW9kRGF5c4gBARJLCiBsYXN0X3Bh' - 'eW1lbnRfZG9uZV91bml4X3RpbWVzdGFtcBgEIAEoA0gBUhxsYXN0UGF5bWVudERvbmVVbml4VG' - 'ltZXN0YW1wiAEBEkoKDHRyYW5zYWN0aW9ucxgFIAMoCzImLnNlcnZlcl90b19jbGllbnQuUmVz' - 'cG9uc2UuVHJhbnNhY3Rpb25SDHRyYW5zYWN0aW9ucxJdChNhZGRpdGlvbmFsX2FjY291bnRzGA' - 'YgAygLMiwuc2VydmVyX3RvX2NsaWVudC5SZXNwb25zZS5BZGRpdGlvbmFsQWNjb3VudFISYWRk' - 'aXRpb25hbEFjY291bnRzEiYKDGF1dG9fcmVuZXdhbBgHIAEoCEgCUgthdXRvUmVuZXdhbIgBAR' - 'JCChthZGRpdGlvbmFsX2FjY291bnRfb3duZXJfaWQYCCABKANIA1IYYWRkaXRpb25hbEFjY291' - 'bnRPd25lcklkiAEBQhYKFF9wYXltZW50X3BlcmlvZF9kYXlzQiMKIV9sYXN0X3BheW1lbnRfZG' - '9uZV91bml4X3RpbWVzdGFtcEIPCg1fYXV0b19yZW5ld2FsQh4KHF9hZGRpdGlvbmFsX2FjY291' - 'bnRfb3duZXJfaWQaMAoGUHJlS2V5Eg4KAmlkGAEgASgDUgJpZBIWCgZwcmVrZXkYAiABKAxSBn' - 'ByZWtleRqVAQoMU2lnbmVkUHJlS2V5EigKEHNpZ25lZF9wcmVrZXlfaWQYASABKANSDnNpZ25l' - 'ZFByZWtleUlkEiMKDXNpZ25lZF9wcmVrZXkYAiABKAxSDHNpZ25lZFByZWtleRI2ChdzaWduZW' - 'RfcHJla2V5X3NpZ25hdHVyZRgDIAEoDFIVc2lnbmVkUHJla2V5U2lnbmF0dXJlGvYDCghVc2Vy' - 'RGF0YRIXCgd1c2VyX2lkGAEgASgDUgZ1c2VySWQSOwoHcHJla2V5cxgCIAMoCzIhLnNlcnZlcl' - '90b19jbGllbnQuUmVzcG9uc2UuUHJlS2V5UgdwcmVrZXlzEh8KCHVzZXJuYW1lGAcgASgMSABS' - 'CHVzZXJuYW1liAEBEjMKE3B1YmxpY19pZGVudGl0eV9rZXkYAyABKAxIAVIRcHVibGljSWRlbn' - 'RpdHlLZXmIAQESKAoNc2lnbmVkX3ByZWtleRgEIAEoDEgCUgxzaWduZWRQcmVrZXmIAQESOwoX' - 'c2lnbmVkX3ByZWtleV9zaWduYXR1cmUYBSABKAxIA1IVc2lnbmVkUHJla2V5U2lnbmF0dXJliA' - 'EBEi0KEHNpZ25lZF9wcmVrZXlfaWQYBiABKANIBFIOc2lnbmVkUHJla2V5SWSIAQESLAoPcmVn' - 'aXN0cmF0aW9uX2lkGAggASgDSAVSDnJlZ2lzdHJhdGlvbklkiAEBQgsKCV91c2VybmFtZUIWCh' - 'RfcHVibGljX2lkZW50aXR5X2tleUIQCg5fc2lnbmVkX3ByZWtleUIaChhfc2lnbmVkX3ByZWtl' - 'eV9zaWduYXR1cmVCEwoRX3NpZ25lZF9wcmVrZXlfaWRCEgoQX3JlZ2lzdHJhdGlvbl9pZBpZCg' - 'tVcGxvYWRUb2tlbhIhCgx1cGxvYWRfdG9rZW4YASABKAxSC3VwbG9hZFRva2VuEicKD2Rvd25s' - 'b2FkX3Rva2VucxgCIAMoDFIOZG93bmxvYWRUb2tlbnMaOQoORG93bmxvYWRUb2tlbnMSJwoPZG' - '93bmxvYWRfdG9rZW5zGAEgAygMUg5kb3dubG9hZFRva2VucxpFCgtQcm9vZk9mV29yaxIWCgZw' - 'cmVmaXgYASABKAlSBnByZWZpeBIeCgpkaWZmaWN1bHR5GAIgASgDUgpkaWZmaWN1bHR5Gl4KH1' - 'Bhc3N3b3JkbGVzc05vdGlmaWNhdGlvbk1lc3NhZ2USDgoCaWQYASABKANSAmlkEisKEWVuY3J5' - 'cHRlZF9tZXNzYWdlGAIgASgMUhBlbmNyeXB0ZWRNZXNzYWdlGnoKIFBhc3N3b3JkbGVzc05vdG' - 'lmaWNhdGlvbk1lc3NhZ2VzElYKCG1lc3NhZ2VzGAEgAygLMjouc2VydmVyX3RvX2NsaWVudC5S' - 'ZXNwb25zZS5QYXNzd29yZGxlc3NOb3RpZmljYXRpb25NZXNzYWdlUghtZXNzYWdlcxqqAQoNUH' - 'Jlc2lnbmVkUG9zdBIQCgN1cmwYASABKAlSA3VybBJMCgZmaWVsZHMYAiADKAsyNC5zZXJ2ZXJf' - 'dG9fY2xpZW50LlJlc3BvbnNlLlByZXNpZ25lZFBvc3QuRmllbGRzRW50cnlSBmZpZWxkcxo5Cg' - 'tGaWVsZHNFbnRyeRIQCgNrZXkYASABKAlSA2tleRIUCgV2YWx1ZRgCIAEoCVIFdmFsdWU6AjgB' - 'Gs8BChJNZW1vcmllc1VwbG9hZFVybHMSGQoIbWVkaWFfaWQYASABKAlSB21lZGlhSWQSUwoQdG' - 'h1bWJuYWlsX3VwbG9hZBgCIAEoCzIoLnNlcnZlcl90b19jbGllbnQuUmVzcG9uc2UuUHJlc2ln' - 'bmVkUG9zdFIPdGh1bWJuYWlsVXBsb2FkEkkKC2Z1bGxfdXBsb2FkGAMgASgLMiguc2VydmVyX3' - 'RvX2NsaWVudC5SZXNwb25zZS5QcmVzaWduZWRQb3N0UgpmdWxsVXBsb2FkGoEBCglNZWRpYUl0' - 'ZW0SGQoIbWVkaWFfaWQYASABKAlSB21lZGlhSWQSIwoNb3JpZ2luYWxfZGF0ZRgCIAEoA1IMb3' - 'JpZ2luYWxEYXRlEjQKFnRodW1ibmFpbF9kb3dubG9hZF91cmwYAyABKAlSFHRodW1ibmFpbERv' - 'd25sb2FkVXJsGkoKDE1lbW9yaWVzTGlzdBI6CgVpdGVtcxgBIAMoCzIkLnNlcnZlcl90b19jbG' - 'llbnQuUmVzcG9uc2UuTWVkaWFJdGVtUgVpdGVtcxo5CgtNZW1vcmllc1VybBIqChFmdWxsX2Rv' - 'd25sb2FkX3VybBgBIAEoCVIPZnVsbERvd25sb2FkVXJsGmcKDU1lbW9yaWVzVXNhZ2USGwoJbW' - 'F4X2J5dGVzGAEgASgDUghtYXhCeXRlcxIjCg1jdXJyZW50X2J5dGVzGAIgASgDUgxjdXJyZW50' - 'Qnl0ZXMSFAoFY291bnQYAyABKANSBWNvdW50GoMMCgJPaxIUCgROb25lGAEgASgISABSBE5vbm' - 'USGAoGdXNlcmlkGAIgASgDSABSBnVzZXJpZBImCg1hdXRoY2hhbGxlbmdlGAMgASgMSABSDWF1' - 'dGhjaGFsbGVuZ2USSgoLdXBsb2FkdG9rZW4YBCABKAsyJi5zZXJ2ZXJfdG9fY2xpZW50LlJlc3' - 'BvbnNlLlVwbG9hZFRva2VuSABSC3VwbG9hZHRva2VuEkEKCHVzZXJkYXRhGAUgASgLMiMuc2Vy' - 'dmVyX3RvX2NsaWVudC5SZXNwb25zZS5Vc2VyRGF0YUgAUgh1c2VyZGF0YRIeCglhdXRodG9rZW' - '4YBiABKAxIAFIJYXV0aHRva2VuEkoKDGRlcHJlY2F0ZWRfNxgHIAEoCzIlLnNlcnZlcl90b19j' - 'bGllbnQuUmVzcG9uc2UuRGVwcmVjYXRlZEgAUgtkZXByZWNhdGVkNxJQCg1hdXRoZW50aWNhdG' - 'VkGAggASgLMiguc2VydmVyX3RvX2NsaWVudC5SZXNwb25zZS5BdXRoZW50aWNhdGVkSABSDWF1' - 'dGhlbnRpY2F0ZWQSOAoFcGxhbnMYCSABKAsyIC5zZXJ2ZXJfdG9fY2xpZW50LlJlc3BvbnNlLl' - 'BsYW5zSABSBXBsYW5zEk0KDHBsYW5iYWxsYW5jZRgKIAEoCzInLnNlcnZlcl90b19jbGllbnQu' - 'UmVzcG9uc2UuUGxhbkJhbGxhbmNlSABSDHBsYW5iYWxsYW5jZRJMCg1kZXByZWNhdGVkXzExGA' - 'sgASgLMiUuc2VydmVyX3RvX2NsaWVudC5SZXNwb25zZS5EZXByZWNhdGVkSABSDGRlcHJlY2F0' - 'ZWQxMRJfChJhZGRhY2NvdW50c2ludml0ZXMYDCABKAsyLS5zZXJ2ZXJfdG9fY2xpZW50LlJlc3' - 'BvbnNlLkFkZEFjY291bnRzSW52aXRlc0gAUhJhZGRhY2NvdW50c2ludml0ZXMSUwoOZG93bmxv' - 'YWR0b2tlbnMYDSABKAsyKS5zZXJ2ZXJfdG9fY2xpZW50LlJlc3BvbnNlLkRvd25sb2FkVG9rZW' - '5zSABSDmRvd25sb2FkdG9rZW5zEk0KDHNpZ25lZHByZWtleRgOIAEoCzInLnNlcnZlcl90b19j' - 'bGllbnQuUmVzcG9uc2UuU2lnbmVkUHJlS2V5SABSDHNpZ25lZHByZWtleRJKCgtwcm9vZk9mV2' - '9yaxgPIAEoCzImLnNlcnZlcl90b19jbGllbnQuUmVzcG9uc2UuUHJvb2ZPZldvcmtIAFILcHJv' - 'b2ZPZldvcmsSSQogcGFzc3dvcmRsZXNzX3JlY292ZXJ5X3NlcnZlcl9rZXkYECABKAxIAFIdcG' - 'Fzc3dvcmRsZXNzUmVjb3ZlcnlTZXJ2ZXJLZXkSiwEKInBhc3N3b3JkbGVzc19ub3RpZmljYXRp' - 'b25fbWVzc2FnZXMYESABKAsyOy5zZXJ2ZXJfdG9fY2xpZW50LlJlc3BvbnNlLlBhc3N3b3JkbG' - 'Vzc05vdGlmaWNhdGlvbk1lc3NhZ2VzSABSIHBhc3N3b3JkbGVzc05vdGlmaWNhdGlvbk1lc3Nh' - 'Z2VzEmEKFG1lbW9yaWVzX3VwbG9hZF91cmxzGBIgASgLMi0uc2VydmVyX3RvX2NsaWVudC5SZX' - 'Nwb25zZS5NZW1vcmllc1VwbG9hZFVybHNIAFISbWVtb3JpZXNVcGxvYWRVcmxzEk4KDW1lbW9y' - 'aWVzX2xpc3QYEyABKAsyJy5zZXJ2ZXJfdG9fY2xpZW50LlJlc3BvbnNlLk1lbW9yaWVzTGlzdE' - 'gAUgxtZW1vcmllc0xpc3QSSwoMbWVtb3JpZXNfdXJsGBQgASgLMiYuc2VydmVyX3RvX2NsaWVu' - 'dC5SZXNwb25zZS5NZW1vcmllc1VybEgAUgttZW1vcmllc1VybBJRCg5tZW1vcmllc191c2FnZR' - 'gVIAEoCzIoLnNlcnZlcl90b19jbGllbnQuUmVzcG9uc2UuTWVtb3JpZXNVc2FnZUgAUg1tZW1v' - 'cmllc1VzYWdlQgQKAk9rQgoKCFJlc3BvbnNl'); + 'EgASgDUgZ1c2VySWQSFwoHcGxhbl9pZBgDIAEoCVIGcGxhbklkGg0KC1RyYW5zYWN0aW9uGpcF' + 'CgxQbGFuQmFsbGFuY2USQAoddXNlZF9kYWlseV9tZWRpYV91cGxvYWRfbGltaXQYASABKANSGX' + 'VzZWREYWlseU1lZGlhVXBsb2FkTGltaXQSPgocdXNlZF91cGxvYWRfbWVkaWFfc2l6ZV9saW1p' + 'dBgCIAEoA1IYdXNlZFVwbG9hZE1lZGlhU2l6ZUxpbWl0EjMKE3BheW1lbnRfcGVyaW9kX2RheX' + 'MYAyABKANIAFIRcGF5bWVudFBlcmlvZERheXOIAQESSwogbGFzdF9wYXltZW50X2RvbmVfdW5p' + 'eF90aW1lc3RhbXAYBCABKANIAVIcbGFzdFBheW1lbnREb25lVW5peFRpbWVzdGFtcIgBARJKCg' + 'x0cmFuc2FjdGlvbnMYBSADKAsyJi5zZXJ2ZXJfdG9fY2xpZW50LlJlc3BvbnNlLlRyYW5zYWN0' + 'aW9uUgx0cmFuc2FjdGlvbnMSXQoTYWRkaXRpb25hbF9hY2NvdW50cxgGIAMoCzIsLnNlcnZlcl' + '90b19jbGllbnQuUmVzcG9uc2UuQWRkaXRpb25hbEFjY291bnRSEmFkZGl0aW9uYWxBY2NvdW50' + 'cxImCgxhdXRvX3JlbmV3YWwYByABKAhIAlILYXV0b1JlbmV3YWyIAQESQgobYWRkaXRpb25hbF' + '9hY2NvdW50X293bmVyX2lkGAggASgDSANSGGFkZGl0aW9uYWxBY2NvdW50T3duZXJJZIgBAUIW' + 'ChRfcGF5bWVudF9wZXJpb2RfZGF5c0IjCiFfbGFzdF9wYXltZW50X2RvbmVfdW5peF90aW1lc3' + 'RhbXBCDwoNX2F1dG9fcmVuZXdhbEIeChxfYWRkaXRpb25hbF9hY2NvdW50X293bmVyX2lkGjAK' + 'BlByZUtleRIOCgJpZBgBIAEoA1ICaWQSFgoGcHJla2V5GAIgASgMUgZwcmVrZXkalQEKDFNpZ2' + '5lZFByZUtleRIoChBzaWduZWRfcHJla2V5X2lkGAEgASgDUg5zaWduZWRQcmVrZXlJZBIjCg1z' + 'aWduZWRfcHJla2V5GAIgASgMUgxzaWduZWRQcmVrZXkSNgoXc2lnbmVkX3ByZWtleV9zaWduYX' + 'R1cmUYAyABKAxSFXNpZ25lZFByZWtleVNpZ25hdHVyZRrUAQoJUHFjUHJlS2V5EiMKDmVjY19w' + 'cmVfa2V5X2lkGAEgASgDUgtlY2NQcmVLZXlJZBIeCgtlY2NfcHJlX2tleRgCIAEoDFIJZWNjUH' + 'JlS2V5EicKEGt5YmVyX3ByZV9rZXlfaWQYAyABKANSDWt5YmVyUHJlS2V5SWQSIgoNa3liZXJf' + 'cHJlX2tleRgEIAEoDFILa3liZXJQcmVLZXkSNQoXa3liZXJfcHJlX2tleV9zaWduYXR1cmUYBS' + 'ABKAxSFGt5YmVyUHJlS2V5U2lnbmF0dXJlGp0DCglQcWNCdW5kbGUSLwoUZWNjX3NpZ25lZF9w' + 'cmVrZXlfaWQYASABKANSEWVjY1NpZ25lZFByZWtleUlkEioKEWVjY19zaWduZWRfcHJla2V5GA' + 'IgASgMUg9lY2NTaWduZWRQcmVrZXkSPQobZWNjX3NpZ25lZF9wcmVrZXlfc2lnbmF0dXJlGAMg' + 'ASgMUhhlY2NTaWduZWRQcmVrZXlTaWduYXR1cmUSMwoWa3liZXJfc2lnbmVkX3ByZWtleV9pZB' + 'gEIAEoA1ITa3liZXJTaWduZWRQcmVrZXlJZBIuChNreWJlcl9zaWduZWRfcHJla2V5GAUgASgM' + 'UhFreWJlclNpZ25lZFByZWtleRJBCh1reWJlcl9zaWduZWRfcHJla2V5X3NpZ25hdHVyZRgGIA' + 'EoDFIaa3liZXJTaWduZWRQcmVrZXlTaWduYXR1cmUSQQoGcHJla2V5GAcgASgLMiQuc2VydmVy' + 'X3RvX2NsaWVudC5SZXNwb25zZS5QcWNQcmVLZXlIAFIGcHJla2V5iAEBQgkKB19wcmVrZXkazw' + 'QKCFVzZXJEYXRhEhcKB3VzZXJfaWQYASABKANSBnVzZXJJZBI7CgdwcmVrZXlzGAIgAygLMiEu' + 'c2VydmVyX3RvX2NsaWVudC5SZXNwb25zZS5QcmVLZXlSB3ByZWtleXMSHwoIdXNlcm5hbWUYBy' + 'ABKAxIAFIIdXNlcm5hbWWIAQESMwoTcHVibGljX2lkZW50aXR5X2tleRgDIAEoDEgBUhFwdWJs' + 'aWNJZGVudGl0eUtleYgBARIoCg1zaWduZWRfcHJla2V5GAQgASgMSAJSDHNpZ25lZFByZWtleY' + 'gBARI7ChdzaWduZWRfcHJla2V5X3NpZ25hdHVyZRgFIAEoDEgDUhVzaWduZWRQcmVrZXlTaWdu' + 'YXR1cmWIAQESLQoQc2lnbmVkX3ByZWtleV9pZBgGIAEoA0gEUg5zaWduZWRQcmVrZXlJZIgBAR' + 'IsCg9yZWdpc3RyYXRpb25faWQYCCABKANIBVIOcmVnaXN0cmF0aW9uSWSIAQESSAoKcHFjX2J1' + 'bmRsZRgJIAEoCzIkLnNlcnZlcl90b19jbGllbnQuUmVzcG9uc2UuUHFjQnVuZGxlSAZSCXBxY0' + 'J1bmRsZYgBAUILCglfdXNlcm5hbWVCFgoUX3B1YmxpY19pZGVudGl0eV9rZXlCEAoOX3NpZ25l' + 'ZF9wcmVrZXlCGgoYX3NpZ25lZF9wcmVrZXlfc2lnbmF0dXJlQhMKEV9zaWduZWRfcHJla2V5X2' + 'lkQhIKEF9yZWdpc3RyYXRpb25faWRCDQoLX3BxY19idW5kbGUaWQoLVXBsb2FkVG9rZW4SIQoM' + 'dXBsb2FkX3Rva2VuGAEgASgMUgt1cGxvYWRUb2tlbhInCg9kb3dubG9hZF90b2tlbnMYAiADKA' + 'xSDmRvd25sb2FkVG9rZW5zGjkKDkRvd25sb2FkVG9rZW5zEicKD2Rvd25sb2FkX3Rva2VucxgB' + 'IAMoDFIOZG93bmxvYWRUb2tlbnMaRQoLUHJvb2ZPZldvcmsSFgoGcHJlZml4GAEgASgJUgZwcm' + 'VmaXgSHgoKZGlmZmljdWx0eRgCIAEoA1IKZGlmZmljdWx0eRpeCh9QYXNzd29yZGxlc3NOb3Rp' + 'ZmljYXRpb25NZXNzYWdlEg4KAmlkGAEgASgDUgJpZBIrChFlbmNyeXB0ZWRfbWVzc2FnZRgCIA' + 'EoDFIQZW5jcnlwdGVkTWVzc2FnZRp6CiBQYXNzd29yZGxlc3NOb3RpZmljYXRpb25NZXNzYWdl' + 'cxJWCghtZXNzYWdlcxgBIAMoCzI6LnNlcnZlcl90b19jbGllbnQuUmVzcG9uc2UuUGFzc3dvcm' + 'RsZXNzTm90aWZpY2F0aW9uTWVzc2FnZVIIbWVzc2FnZXMaqgEKDVByZXNpZ25lZFBvc3QSEAoD' + 'dXJsGAEgASgJUgN1cmwSTAoGZmllbGRzGAIgAygLMjQuc2VydmVyX3RvX2NsaWVudC5SZXNwb2' + '5zZS5QcmVzaWduZWRQb3N0LkZpZWxkc0VudHJ5UgZmaWVsZHMaOQoLRmllbGRzRW50cnkSEAoD' + 'a2V5GAEgASgJUgNrZXkSFAoFdmFsdWUYAiABKAlSBXZhbHVlOgI4ARrPAQoSTWVtb3JpZXNVcG' + 'xvYWRVcmxzEhkKCG1lZGlhX2lkGAEgASgJUgdtZWRpYUlkElMKEHRodW1ibmFpbF91cGxvYWQY' + 'AiABKAsyKC5zZXJ2ZXJfdG9fY2xpZW50LlJlc3BvbnNlLlByZXNpZ25lZFBvc3RSD3RodW1ibm' + 'FpbFVwbG9hZBJJCgtmdWxsX3VwbG9hZBgDIAEoCzIoLnNlcnZlcl90b19jbGllbnQuUmVzcG9u' + 'c2UuUHJlc2lnbmVkUG9zdFIKZnVsbFVwbG9hZBqBAQoJTWVkaWFJdGVtEhkKCG1lZGlhX2lkGA' + 'EgASgJUgdtZWRpYUlkEiMKDW9yaWdpbmFsX2RhdGUYAiABKANSDG9yaWdpbmFsRGF0ZRI0ChZ0' + 'aHVtYm5haWxfZG93bmxvYWRfdXJsGAMgASgJUhR0aHVtYm5haWxEb3dubG9hZFVybBpKCgxNZW' + '1vcmllc0xpc3QSOgoFaXRlbXMYASADKAsyJC5zZXJ2ZXJfdG9fY2xpZW50LlJlc3BvbnNlLk1l' + 'ZGlhSXRlbVIFaXRlbXMaOQoLTWVtb3JpZXNVcmwSKgoRZnVsbF9kb3dubG9hZF91cmwYASABKA' + 'lSD2Z1bGxEb3dubG9hZFVybBpnCg1NZW1vcmllc1VzYWdlEhsKCW1heF9ieXRlcxgBIAEoA1II' + 'bWF4Qnl0ZXMSIwoNY3VycmVudF9ieXRlcxgCIAEoA1IMY3VycmVudEJ5dGVzEhQKBWNvdW50GA' + 'MgASgDUgVjb3VudBr1CgoCT2sSFAoETm9uZRgBIAEoCEgAUgROb25lEhgKBnVzZXJpZBgCIAEo' + 'A0gAUgZ1c2VyaWQSJgoNYXV0aGNoYWxsZW5nZRgDIAEoDEgAUg1hdXRoY2hhbGxlbmdlEkoKC3' + 'VwbG9hZHRva2VuGAQgASgLMiYuc2VydmVyX3RvX2NsaWVudC5SZXNwb25zZS5VcGxvYWRUb2tl' + 'bkgAUgt1cGxvYWR0b2tlbhJBCgh1c2VyZGF0YRgFIAEoCzIjLnNlcnZlcl90b19jbGllbnQuUm' + 'VzcG9uc2UuVXNlckRhdGFIAFIIdXNlcmRhdGESHgoJYXV0aHRva2VuGAYgASgMSABSCWF1dGh0' + 'b2tlbhJQCg1hdXRoZW50aWNhdGVkGAggASgLMiguc2VydmVyX3RvX2NsaWVudC5SZXNwb25zZS' + '5BdXRoZW50aWNhdGVkSABSDWF1dGhlbnRpY2F0ZWQSOAoFcGxhbnMYCSABKAsyIC5zZXJ2ZXJf' + 'dG9fY2xpZW50LlJlc3BvbnNlLlBsYW5zSABSBXBsYW5zEk0KDHBsYW5iYWxsYW5jZRgKIAEoCz' + 'InLnNlcnZlcl90b19jbGllbnQuUmVzcG9uc2UuUGxhbkJhbGxhbmNlSABSDHBsYW5iYWxsYW5j' + 'ZRJfChJhZGRhY2NvdW50c2ludml0ZXMYDCABKAsyLS5zZXJ2ZXJfdG9fY2xpZW50LlJlc3Bvbn' + 'NlLkFkZEFjY291bnRzSW52aXRlc0gAUhJhZGRhY2NvdW50c2ludml0ZXMSUwoOZG93bmxvYWR0' + 'b2tlbnMYDSABKAsyKS5zZXJ2ZXJfdG9fY2xpZW50LlJlc3BvbnNlLkRvd25sb2FkVG9rZW5zSA' + 'BSDmRvd25sb2FkdG9rZW5zEk0KDHNpZ25lZHByZWtleRgOIAEoCzInLnNlcnZlcl90b19jbGll' + 'bnQuUmVzcG9uc2UuU2lnbmVkUHJlS2V5SABSDHNpZ25lZHByZWtleRJKCgtwcm9vZk9mV29yax' + 'gPIAEoCzImLnNlcnZlcl90b19jbGllbnQuUmVzcG9uc2UuUHJvb2ZPZldvcmtIAFILcHJvb2ZP' + 'ZldvcmsSSQogcGFzc3dvcmRsZXNzX3JlY292ZXJ5X3NlcnZlcl9rZXkYECABKAxIAFIdcGFzc3' + 'dvcmRsZXNzUmVjb3ZlcnlTZXJ2ZXJLZXkSiwEKInBhc3N3b3JkbGVzc19ub3RpZmljYXRpb25f' + 'bWVzc2FnZXMYESABKAsyOy5zZXJ2ZXJfdG9fY2xpZW50LlJlc3BvbnNlLlBhc3N3b3JkbGVzc0' + '5vdGlmaWNhdGlvbk1lc3NhZ2VzSABSIHBhc3N3b3JkbGVzc05vdGlmaWNhdGlvbk1lc3NhZ2Vz' + 'EmEKFG1lbW9yaWVzX3VwbG9hZF91cmxzGBIgASgLMi0uc2VydmVyX3RvX2NsaWVudC5SZXNwb2' + '5zZS5NZW1vcmllc1VwbG9hZFVybHNIAFISbWVtb3JpZXNVcGxvYWRVcmxzEk4KDW1lbW9yaWVz' + 'X2xpc3QYEyABKAsyJy5zZXJ2ZXJfdG9fY2xpZW50LlJlc3BvbnNlLk1lbW9yaWVzTGlzdEgAUg' + 'xtZW1vcmllc0xpc3QSSwoMbWVtb3JpZXNfdXJsGBQgASgLMiYuc2VydmVyX3RvX2NsaWVudC5S' + 'ZXNwb25zZS5NZW1vcmllc1VybEgAUgttZW1vcmllc1VybBJRCg5tZW1vcmllc191c2FnZRgVIA' + 'EoCzIoLnNlcnZlcl90b19jbGllbnQuUmVzcG9uc2UuTWVtb3JpZXNVc2FnZUgAUg1tZW1vcmll' + 'c1VzYWdlQgQKAk9rSgQIBxAISgQICxAMQgoKCFJlc3BvbnNl'); diff --git a/lib/src/model/protobuf/client/generated/messages.pbenum.dart b/lib/src/model/protobuf/client/generated/messages.pbenum.dart index 699b8ee9..d2a36442 100644 --- a/lib/src/model/protobuf/client/generated/messages.pbenum.dart +++ b/lib/src/model/protobuf/client/generated/messages.pbenum.dart @@ -25,6 +25,8 @@ class Message_Type extends $pb.ProtobufEnum { 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, @@ -32,10 +34,11 @@ class Message_Type extends $pb.ProtobufEnum { CIPHERTEXT, PREKEY_BUNDLE, TEST_NOTIFICATION, + CIPHERTEXT_V2, ]; static final $core.List _byValue = - $pb.ProtobufEnum.$_initByValueList(values, 4); + $pb.ProtobufEnum.$_initByValueList(values, 5); static Message_Type? valueOf($core.int value) => value < 0 || value >= _byValue.length ? null : _byValue[value]; diff --git a/lib/src/model/protobuf/client/generated/messages.pbjson.dart b/lib/src/model/protobuf/client/generated/messages.pbjson.dart index 229661ab..57b06a13 100644 --- a/lib/src/model/protobuf/client/generated/messages.pbjson.dart +++ b/lib/src/model/protobuf/client/generated/messages.pbjson.dart @@ -57,6 +57,7 @@ const Message_Type$json = { {'1': 'CIPHERTEXT', '2': 2}, {'1': 'PREKEY_BUNDLE', '2': 3}, {'1': 'TEST_NOTIFICATION', '2': 4}, + {'1': 'CIPHERTEXT_V2', '2': 5}, ], }; @@ -65,10 +66,10 @@ final $typed_data.Uint8List messageDescriptor = $convert.base64Decode( 'CgdNZXNzYWdlEiEKBHR5cGUYASABKA4yDS5NZXNzYWdlLlR5cGVSBHR5cGUSHQoKcmVjZWlwdF' '9pZBgCIAEoCVIJcmVjZWlwdElkEjAKEWVuY3J5cHRlZF9jb250ZW50GAMgASgMSABSEGVuY3J5' 'cHRlZENvbnRlbnSIAQESQwoRcGxhaW50ZXh0X2NvbnRlbnQYBCABKAsyES5QbGFpbnRleHRDb2' - '50ZW50SAFSEHBsYWludGV4dENvbnRlbnSIAQEidAoEVHlwZRIbChdTRU5ERVJfREVMSVZFUllf' - 'UkVDRUlQVBAAEhUKEVBMQUlOVEVYVF9DT05URU5UEAESDgoKQ0lQSEVSVEVYVBACEhEKDVBSRU' - 'tFWV9CVU5ETEUQAxIVChFURVNUX05PVElGSUNBVElPThAEQhQKEl9lbmNyeXB0ZWRfY29udGVu' - 'dEIUChJfcGxhaW50ZXh0X2NvbnRlbnQ='); + '50ZW50SAFSEHBsYWludGV4dENvbnRlbnSIAQEihwEKBFR5cGUSGwoXU0VOREVSX0RFTElWRVJZ' + 'X1JFQ0VJUFQQABIVChFQTEFJTlRFWFRfQ09OVEVOVBABEg4KCkNJUEhFUlRFWFQQAhIRCg1QUk' + 'VLRVlfQlVORExFEAMSFQoRVEVTVF9OT1RJRklDQVRJT04QBBIRCg1DSVBIRVJURVhUX1YyEAVC' + 'FAoSX2VuY3J5cHRlZF9jb250ZW50QhQKEl9wbGFpbnRleHRfY29udGVudA=='); @$core.Deprecated('Use plaintextContentDescriptor instead') const PlaintextContent$json = { diff --git a/lib/src/model/protobuf/client/messages.proto b/lib/src/model/protobuf/client/messages.proto index a209bab2..0b6276ef 100644 --- a/lib/src/model/protobuf/client/messages.proto +++ b/lib/src/model/protobuf/client/messages.proto @@ -7,6 +7,7 @@ message Message { CIPHERTEXT = 2; PREKEY_BUNDLE = 3; TEST_NOTIFICATION = 4; + CIPHERTEXT_V2 = 5; } Type type = 1; string receipt_id = 2; diff --git a/lib/src/services/api/api.service.dart b/lib/src/services/api/api.service.dart index ccec7ac1..c86d04da 100644 --- a/lib/src/services/api/api.service.dart +++ b/lib/src/services/api/api.service.dart @@ -19,6 +19,8 @@ import 'package:twonly/core/bridge/wrapper/key_manager.dart'; import 'package:twonly/globals.dart'; import 'package:twonly/locator.dart'; import 'package:twonly/src/database/twonly.db.dart'; +import 'package:twonly/src/model/protobuf/api/websocket/client_to_server.pb.dart' + as client; import 'package:twonly/src/model/protobuf/api/websocket/client_to_server.pbserver.dart'; import 'package:twonly/src/model/protobuf/api/websocket/error.pb.dart'; import 'package:twonly/src/model/protobuf/api/websocket/server_to_client.pb.dart' @@ -625,7 +627,13 @@ class ApiService { final signalStore = await getSignalStoreFromIdentity(signalIdentity); - final signedPreKey = (await signalStore.loadSignedPreKeys())[0]; + final signedPreKeysList = await signalStore.loadSignedPreKeys(); + if (signedPreKeysList.isEmpty) { + throw Exception( + 'Signal Signed PreKeys list is empty. Database insertion likely failed due to lack of storage space or a corrupted database.', + ); + } + final signedPreKey = signedPreKeysList[0]; final loginToken = await RustKeyManager.getLoginToken(); @@ -992,6 +1000,28 @@ class ApiService { return sendRequestSync(req); } + Future uploadPqcPreKeys( + int eccSignedPreKeyId, + Uint8List eccSignedPreKey, + Uint8List eccSignedPreKeySignature, + int kyberSignedPreKeyId, + Uint8List kyberSignedPreKey, + Uint8List kyberSignedPreKeySignature, + List prekeys, + ) async { + final get = ApplicationData_UploadPqcPreKeys() + ..eccSignedPrekeyId = Int64(eccSignedPreKeyId) + ..eccSignedPrekey = eccSignedPreKey + ..eccSignedPrekeySignature = eccSignedPreKeySignature + ..kyberSignedPrekeyId = Int64(kyberSignedPreKeyId) + ..kyberSignedPrekey = kyberSignedPreKey + ..kyberSignedPrekeySignature = kyberSignedPreKeySignature + ..prekeys.addAll(prekeys); + final appData = ApplicationData()..uploadPqcPrekeys = get; + final req = createClientToServerFromApplicationData(appData); + return sendRequestSync(req); + } + Future loadPlanBalance({bool useCache = true}) async { final ballance = await getPlanBallance(); if (ballance != null) { diff --git a/lib/src/services/api/client2client/prekeys.c2c.dart b/lib/src/services/api/client2client/prekeys.c2c.dart index 4f2ed1c5..fc0eacda 100644 --- a/lib/src/services/api/client2client/prekeys.c2c.dart +++ b/lib/src/services/api/client2client/prekeys.c2c.dart @@ -1,4 +1,5 @@ import 'package:fixnum/fixnum.dart'; +import 'package:twonly/core/bridge/wrapper/signal.dart'; import 'package:twonly/src/model/protobuf/api/websocket/client_to_server.pb.dart' as client; import 'package:twonly/src/services/signal/identity.signal.dart'; @@ -18,3 +19,25 @@ Future handleRequestNewPreKey() async { final ok = client.Response_Ok()..prekeys = prekeys; return client.Response()..ok = ok; } + +Future handleRequestNewPqcPreKey() async { + final pqcKeys = await RustSignal.generatePqcPrekeys(); + if (pqcKeys.isEmpty) return null; + + final prekeysList = []; + for (final pqcKey in pqcKeys) { + prekeysList.add( + client.ApplicationData_PqcPreKey( + eccPreKeyId: Int64(pqcKey.eccPreKeyId), + eccPreKey: pqcKey.eccPreKey, + kyberPreKeyId: Int64(pqcKey.kyberPreKeyId), + kyberPreKey: pqcKey.kyberPreKey, + kyberPreKeySignature: pqcKey.kyberPreKeySignature, + ), + ); + } + + final prekeys = client.Response_PqcPrekeys(prekeys: prekeysList); + final ok = client.Response_Ok()..prekeysPqc = prekeys; + return client.Response()..ok = ok; +} diff --git a/lib/src/services/api/messages.api.dart b/lib/src/services/api/messages.api.dart index c180451b..c46a4c36 100644 --- a/lib/src/services/api/messages.api.dart +++ b/lib/src/services/api/messages.api.dart @@ -5,10 +5,10 @@ import 'dart:io'; import 'package:clock/clock.dart'; import 'package:drift/drift.dart'; import 'package:fixnum/fixnum.dart'; -import 'package:libsignal_protocol_dart/libsignal_protocol_dart.dart'; import 'package:mutex/mutex.dart'; import 'package:twonly/locator.dart'; import 'package:twonly/src/database/daos/contacts.dao.dart'; +import 'package:twonly/src/database/tables/contacts.table.dart'; import 'package:twonly/src/database/tables/messages.table.dart'; import 'package:twonly/src/database/twonly.db.dart'; import 'package:twonly/src/model/protobuf/api/websocket/error.pb.dart'; @@ -176,11 +176,11 @@ Future<(Uint8List, Uint8List?)?> _tryToSendCompleteMessageInternal({ } if (message.type == pb.Message_Type.CIPHERTEXT) { - final cipherText = await signalEncryptMessage( + final encryptResult = await signalEncryptMessage( receipt.contactId, Uint8List.fromList(message.encryptedContent), ); - if (cipherText == null) { + if (encryptResult == null) { Log.error( '[${receipt.receiptId}] Could not encrypt the message for user ${receipt.contactId}. Aborting and trying again.', ); @@ -194,16 +194,31 @@ Future<(Uint8List, Uint8List?)?> _tryToSendCompleteMessageInternal({ await twonlyDB.receiptsDao.deleteReceipt(receipt.receiptId); return null; } - message.encryptedContent = cipherText.serialize(); - switch (cipherText.getType()) { - case CiphertextMessage.prekeyType: - message.type = pb.Message_Type.PREKEY_BUNDLE; - case CiphertextMessage.whisperType: - message.type = pb.Message_Type.CIPHERTEXT; - default: - Log.error('Invalid ciphertext type: ${cipherText.getType()}.'); - return null; + message + ..encryptedContent = encryptResult.ciphertext + ..type = encryptResult.type; + } else if (message.type == pb.Message_Type.CIPHERTEXT_V2) { + final encryptResult = await signalEncryptMessageV2( + receipt.contactId, + Uint8List.fromList(message.encryptedContent), + ); + if (encryptResult == null) { + Log.error( + '[${receipt.receiptId}] Could not encrypt the message (V2) for user ${receipt.contactId}. Aborting and trying again.', + ); + if (receipt.messageId != null) { + await twonlyDB.messagesDao.handleMessageAckByServer( + receipt.contactId, + receipt.messageId!, + clock.now(), + ); + } + await twonlyDB.receiptsDao.deleteReceipt(receipt.receiptId); + return null; } + message + ..encryptedContent = encryptResult.ciphertext + ..type = encryptResult.type; } if (onlyReturnEncryptedData) { @@ -482,8 +497,11 @@ Future<(Uint8List, Uint8List?)?> sendCipherText( } } + final contact = await twonlyDB.contactsDao.getContactById(contactId); + final isV2 = contact?.signalVersion == SignalVersion.v2; + final response = pb.Message() - ..type = pb.Message_Type.CIPHERTEXT + ..type = isV2 ? pb.Message_Type.CIPHERTEXT_V2 : pb.Message_Type.CIPHERTEXT ..encryptedContent = encryptedContent.writeToBuffer(); var retryCounter = 0; diff --git a/lib/src/services/api/server_messages.api.dart b/lib/src/services/api/server_messages.api.dart index 88bfd3e0..77498eb5 100644 --- a/lib/src/services/api/server_messages.api.dart +++ b/lib/src/services/api/server_messages.api.dart @@ -49,6 +49,8 @@ Future handleServerMessage(server.ServerToClient msg) async { try { if (msg.v0.hasRequestNewPreKeys()) { response = await handleRequestNewPreKey(); + } else if (msg.v0.hasRequestNewPqcPreKeys()) { + response = (await handleRequestNewPqcPreKey()) ?? response; } else if (msg.v0.hasNewMessage()) { Log.info('Got 1 message from the server.'); await handleClient2ClientMessage(msg.v0.newMessage); @@ -190,6 +192,7 @@ Future _handleClient2ClientMessage( } case Message_Type.CIPHERTEXT: + case Message_Type.CIPHERTEXT_V2: case Message_Type.PREKEY_BUNDLE: if (message.hasEncryptedContent()) { Value? receiptIdDB; @@ -297,12 +300,23 @@ Future<(EncryptedContent?, PlaintextContent?)> handleEncryptedMessageRaw( Set? brokenSessionsInCurrentBatch, }) async { Log.info('[$receiptId] calling signalDecryptMessage'); - var (encryptedContent, decryptionErrorType) = await signalDecryptMessage( - fromUserId, - encryptedContentRaw, - messageType.value, - brokenSessionsInCurrentBatch: brokenSessionsInCurrentBatch, - ); + EncryptedContent? encryptedContent; + PlaintextContent_DecryptionErrorMessage_Type? decryptionErrorType; + + if (messageType == Message_Type.CIPHERTEXT_V2) { + (encryptedContent, decryptionErrorType) = await signalDecryptMessageV2( + fromUserId, + encryptedContentRaw, + brokenSessionsInCurrentBatch: brokenSessionsInCurrentBatch, + ); + } else { + (encryptedContent, decryptionErrorType) = await signalDecryptMessageV1( + fromUserId, + encryptedContentRaw, + messageType.value, + brokenSessionsInCurrentBatch: brokenSessionsInCurrentBatch, + ); + } if (encryptedContent == null) { return ( diff --git a/lib/src/services/api/utils.api.dart b/lib/src/services/api/utils.api.dart index c292b0e5..b51906cc 100644 --- a/lib/src/services/api/utils.api.dart +++ b/lib/src/services/api/utils.api.dart @@ -33,7 +33,12 @@ class Result { } DateTime fromTimestamp(Int64 timeStamp) { - return DateTime.fromMillisecondsSinceEpoch(timeStamp.toInt()); + final date = DateTime.fromMillisecondsSinceEpoch(timeStamp.toInt()); + final now = DateTime.now(); + if (date.isAfter(now)) { + return now; + } + return date; } // ignore: strict_raw_type diff --git a/lib/src/services/signal/encryption.signal.dart b/lib/src/services/signal/encryption.signal.dart index 5c29910e..2cd65a36 100644 --- a/lib/src/services/signal/encryption.signal.dart +++ b/lib/src/services/signal/encryption.signal.dart @@ -3,23 +3,48 @@ import 'dart:typed_data'; import 'package:libsignal_protocol_dart/libsignal_protocol_dart.dart'; // ignore: implementation_imports import 'package:libsignal_protocol_dart/src/invalid_message_exception.dart'; -import 'package:twonly/src/model/protobuf/client/generated/messages.pb.dart'; +import 'package:twonly/core/bridge/wrapper/signal.dart'; +import 'package:twonly/src/model/protobuf/client/generated/messages.pb.dart' + as pb; import 'package:twonly/src/services/api/messages.api.dart'; import 'package:twonly/src/services/signal/protocol_state.signal.dart'; import 'package:twonly/src/services/signal/session.signal.dart'; import 'package:twonly/src/services/signal/utils.signal.dart'; import 'package:twonly/src/utils/log.dart'; -Future signalEncryptMessage( +class SignalEncryptResult { + SignalEncryptResult(this.ciphertext, this.type); + final Uint8List ciphertext; + final pb.Message_Type type; +} + +Future signalEncryptMessage( int target, Uint8List plaintextContent, ) async { - return lockingSignalProtocol.protect(() async { - return _signalEncryptMessage(target, plaintextContent); + return lockingSignalProtocol.protect(() async { + return _signalEncryptMessageV1(target, plaintextContent); }); } -Future _signalEncryptMessage( +Future signalEncryptMessageV2( + int target, + Uint8List plaintextContent, +) async { + try { + final res = await RustSignal.encrypt( + name: target.toString(), + deviceId: 1, + plaintext: plaintextContent, + ); + return SignalEncryptResult(res, pb.Message_Type.CIPHERTEXT_V2); + } catch (e) { + Log.error('Could not encrypt message (V2) for target $target: $e'); + return null; + } +} + +Future _signalEncryptMessageV1( int target, Uint8List plaintextContent, ) async { @@ -27,28 +52,93 @@ Future _signalEncryptMessage( final signalStore = (await getSignalStore())!; final address = getSignalAddress(target); final session = SessionCipher.fromStore(signalStore, address); - return await session.encrypt(plaintextContent); + final cipherText = await session.encrypt(plaintextContent); + + pb.Message_Type type; + switch (cipherText.getType()) { + case CiphertextMessage.prekeyType: + type = pb.Message_Type.PREKEY_BUNDLE; + case CiphertextMessage.whisperType: + type = pb.Message_Type.CIPHERTEXT; + default: + Log.error('Invalid ciphertext type: ${cipherText.getType()}.'); + return null; + } + + return SignalEncryptResult(cipherText.serialize(), type); } catch (e) { - Log.error('Could not encrypt message for target $target: $e'); + Log.error('Could not encrypt message (V1) for target $target: $e'); return null; } } -Future<(EncryptedContent?, PlaintextContent_DecryptionErrorMessage_Type?)> -signalDecryptMessage( +Future<(pb.EncryptedContent?, pb.PlaintextContent_DecryptionErrorMessage_Type?)> +signalDecryptMessageV2( int fromUserId, - Uint8List encryptedContentRaw, - int type, { + Uint8List encryptedContentRaw, { Set? brokenSessionsInCurrentBatch, }) async { - // Hold the lock only for the cryptographic operation, not for network I/O - Log.info('Acquiring lockingSignalProtocol for $fromUserId'); + Log.info('Acquiring lockingSignalProtocol for $fromUserId (V2)'); final ( decryptedContent, errorType, needsResync, ) = await lockingSignalProtocol.protect(() async { - Log.info('Lock acquired for $fromUserId'); + Log.info('Lock acquired for $fromUserId (V2)'); + try { + final plaintext = await RustSignal.decrypt( + name: fromUserId.toString(), + deviceId: 1, + ciphertext: encryptedContentRaw, + ); + recordResyncAttempt(fromUserId, success: true); + return (pb.EncryptedContent.fromBuffer(plaintext), null, false); + } catch (e) { + Log.error('Could not decrypt message (V2) from $fromUserId: $e'); + return ( + null, + pb.PlaintextContent_DecryptionErrorMessage_Type.UNKNOWN, + true, // Needs resync on failure + ); + } + }); + + Log.info('Released lockingSignalProtocol for $fromUserId (V2)'); + + if (needsResync) { + brokenSessionsInCurrentBatch?.add(fromUserId); + if (shouldAttemptResync(fromUserId)) { + if (await handleSessionResync(fromUserId)) { + recordResyncAttempt(fromUserId, success: false); + await sendCipherText( + fromUserId, + pb.EncryptedContent( + errorMessages: pb.EncryptedContent_ErrorMessages( + type: pb.EncryptedContent_ErrorMessages_Type.SESSION_OUT_OF_SYNC, + ), + ), + ); + } + } + } + + return (decryptedContent, errorType); +} + +Future<(pb.EncryptedContent?, pb.PlaintextContent_DecryptionErrorMessage_Type?)> +signalDecryptMessageV1( + int fromUserId, + Uint8List encryptedContentRaw, + int type, { + Set? brokenSessionsInCurrentBatch, +}) async { + Log.info('Acquiring lockingSignalProtocol for $fromUserId (V1)'); + final ( + decryptedContent, + errorType, + needsResync, + ) = await lockingSignalProtocol.protect(() async { + Log.info('Lock acquired for $fromUserId (V1)'); try { final session = SessionCipher.fromStore( (await getSignalStore())!, @@ -70,18 +160,18 @@ signalDecryptMessage( Log.error('Unknown Message Decryption Type: $type'); return ( null, - PlaintextContent_DecryptionErrorMessage_Type.UNKNOWN, + pb.PlaintextContent_DecryptionErrorMessage_Type.UNKNOWN, false, ); } recordResyncAttempt(fromUserId, success: true); - return (EncryptedContent.fromBuffer(plaintext), null, false); + return (pb.EncryptedContent.fromBuffer(plaintext), null, false); } on InvalidKeyIdException catch (e) { Log.warn(e); return ( null, - PlaintextContent_DecryptionErrorMessage_Type.PREKEY_UNKNOWN, + pb.PlaintextContent_DecryptionErrorMessage_Type.PREKEY_UNKNOWN, false, ); } on DuplicateMessageException catch (e) { @@ -91,27 +181,27 @@ signalDecryptMessage( Log.info(e); return ( null, - PlaintextContent_DecryptionErrorMessage_Type.UNKNOWN, + pb.PlaintextContent_DecryptionErrorMessage_Type.UNKNOWN, false, ); } on InvalidMessageException catch (e) { Log.warn(e); return ( null, - PlaintextContent_DecryptionErrorMessage_Type.UNKNOWN, + pb.PlaintextContent_DecryptionErrorMessage_Type.UNKNOWN, true, ); } catch (e) { Log.error(e); return ( null, - PlaintextContent_DecryptionErrorMessage_Type.UNKNOWN, + pb.PlaintextContent_DecryptionErrorMessage_Type.UNKNOWN, false, ); } }); - Log.info('Released lockingSignalProtocol for $fromUserId'); + Log.info('Released lockingSignalProtocol for $fromUserId (V1)'); // Handle session resync OUTSIDE the lock to avoid holding it during // network round-trips (which can block for up to 60 seconds) @@ -127,9 +217,9 @@ signalDecryptMessage( // session await sendCipherText( fromUserId, - EncryptedContent( - errorMessages: EncryptedContent_ErrorMessages( - type: EncryptedContent_ErrorMessages_Type.SESSION_OUT_OF_SYNC, + pb.EncryptedContent( + errorMessages: pb.EncryptedContent_ErrorMessages( + type: pb.EncryptedContent_ErrorMessages_Type.SESSION_OUT_OF_SYNC, ), ), ); diff --git a/lib/src/services/signal/identity.signal.dart b/lib/src/services/signal/identity.signal.dart index 4bc5feb1..6e018a63 100644 --- a/lib/src/services/signal/identity.signal.dart +++ b/lib/src/services/signal/identity.signal.dart @@ -1,7 +1,9 @@ import 'dart:typed_data'; + import 'package:clock/clock.dart'; import 'package:libsignal_protocol_dart/libsignal_protocol_dart.dart'; import 'package:twonly/core/bridge/wrapper/key_manager.dart'; +import 'package:twonly/core/bridge/wrapper/signal.dart'; import 'package:twonly/locator.dart'; import 'package:twonly/src/database/signal/signal_signed_pre_key_store.dart'; import 'package:twonly/src/model/json/signal_identity.model.dart'; @@ -13,39 +15,61 @@ import 'package:twonly/src/utils/log.dart'; class SignalIdentityService { static Future onAuthenticated() async { - if (userService.currentUser.signalLastSignedPreKeyUpdated != null) { - final fortyEightHoursAgo = clock.now().subtract( - const Duration(hours: 48), - ); - final isYoungerThan48Hours = - (userService.currentUser.signalLastSignedPreKeyUpdated!).isAfter( - fortyEightHoursAgo, - ); - if (isYoungerThan48Hours) { - // The key does live for 48 hours then it expires and a new key is generated. - return; + final now = clock.now(); + final fortyEightHoursAgo = now.subtract(const Duration(hours: 48)); + final oneWeekAgo = now.subtract(const Duration(days: 7)); + + if (userService.currentUser.signalLastSignedPreKeyUpdated == null || + !userService.currentUser.signalLastSignedPreKeyUpdated!.isAfter( + fortyEightHoursAgo, + )) { + final signedPreKey = await _getNewSignalSignedPreKey(); + if (signedPreKey == null) { + Log.error('could not generate a new signed pre key!'); + } else { + await UserService.update((user) { + user.signalLastSignedPreKeyUpdated = now; + }); + final res = await apiService.updateSignedPreKey( + signedPreKey.id, + signedPreKey.getKeyPair().publicKey.serialize(), + signedPreKey.signature, + ); + if (res.isError) { + Log.error('could not update the signed pre key: ${res.error}'); + await UserService.update((user) { + user.signalLastSignedPreKeyUpdated = null; + }); + } else { + Log.info('updated signed pre key'); + } } } - final signedPreKey = await _getNewSignalSignedPreKey(); - if (signedPreKey == null) { - Log.error('could not generate a new signed pre key!'); - return; - } - await UserService.update((user) { - user.signalLastSignedPreKeyUpdated = clock.now(); - }); - final res = await apiService.updateSignedPreKey( - signedPreKey.id, - signedPreKey.getKeyPair().publicKey.serialize(), - signedPreKey.signature, - ); - if (res.isError) { - Log.error('could not update the signed pre key: ${res.error}'); - await UserService.update((user) { - user.signalLastSignedPreKeyUpdated = null; - }); - } else { - Log.info('updated signed pre key'); + + if (userService.currentUser.signalLastPqcPreKeysUploaded == null || + !userService.currentUser.signalLastPqcPreKeysUploaded!.isAfter( + oneWeekAgo, + )) { + final bundle = await RustSignal.generateBundle(); + + final pqcRes = await apiService.uploadPqcPreKeys( + bundle.signedPreKeyId, + bundle.signedPreKeyPublic, + bundle.signedPreKeySignature, + bundle.kyberPreKeyId, + bundle.kyberPreKeyPublic, + bundle.kyberPreKeySignature, + [], + ); + + if (pqcRes.isError) { + Log.warn('could not update the pqc signed pre key: ${pqcRes.error}'); + } else { + Log.info('updated pqc signed pre key'); + await UserService.update((user) { + user.signalLastPqcPreKeysUploaded = now; + }); + } } } } diff --git a/lib/src/services/signal/session.signal.dart b/lib/src/services/signal/session.signal.dart index a26d4b4c..d2f55c96 100644 --- a/lib/src/services/signal/session.signal.dart +++ b/lib/src/services/signal/session.signal.dart @@ -1,7 +1,12 @@ import 'dart:typed_data'; +import 'package:drift/drift.dart' as drift; import 'package:libsignal_protocol_dart/libsignal_protocol_dart.dart'; +import 'package:twonly/core/bridge/wrapper/signal.dart'; +import 'package:twonly/core/signal/engine.dart'; import 'package:twonly/locator.dart'; +import 'package:twonly/src/database/tables/contacts.table.dart'; +import 'package:twonly/src/database/twonly.db.dart'; import 'package:twonly/src/model/protobuf/api/websocket/server_to_client.pb.dart'; import 'package:twonly/src/services/signal/consts.signal.dart'; import 'package:twonly/src/services/signal/protocol_state.signal.dart'; @@ -15,6 +20,92 @@ Future processSignalUserData(Response_UserData userData) async { } Future _processSignalUserData(Response_UserData userData) async { + if (userData.hasPqcBundle()) { + return _processSignalUserDataV2(userData); + } + return _processSignalUserDataV1(userData); +} + +Future _processSignalUserDataV2(Response_UserData userData) async { + try { + final tempIdentityKey = IdentityKey( + Curve.decodePoint( + DjbECPublicKey( + Uint8List.fromList(userData.publicIdentityKey), + ).serialize(), + 1, + ), + ); + + int? tempEccPreKeyId; + Uint8List? tempEccPreKeyPublic; + if (userData.pqcBundle.hasPrekey()) { + tempEccPreKeyId = userData.pqcBundle.prekey.eccPreKeyId.toInt(); + tempEccPreKeyPublic = Uint8List.fromList( + userData.pqcBundle.prekey.eccPreKey, + ); + } else if (userData.prekeys.isNotEmpty) { + tempEccPreKeyId = userData.prekeys.first.id.toInt(); + tempEccPreKeyPublic = Curve.decodePoint( + DjbECPublicKey( + Uint8List.fromList(userData.prekeys.first.prekey), + ).serialize(), + 1, + ).serialize(); + } + + final tempKyberPreKeyId = userData.pqcBundle.hasPrekey() + ? userData.pqcBundle.prekey.kyberPreKeyId.toInt() + : userData.pqcBundle.kyberSignedPrekeyId.toInt(); + final tempKyberPreKeyPublic = userData.pqcBundle.hasPrekey() + ? Uint8List.fromList(userData.pqcBundle.prekey.kyberPreKey) + : Uint8List.fromList(userData.pqcBundle.kyberSignedPrekey); + final tempKyberPreKeySignature = userData.pqcBundle.hasPrekey() + ? Uint8List.fromList(userData.pqcBundle.prekey.kyberPreKeySignature) + : Uint8List.fromList(userData.pqcBundle.kyberSignedPrekeySignature); + + final rustBundle = FrbPreKeyBundle( + registrationId: userData.registrationId.toInt(), + deviceId: 1, + preKeyId: tempEccPreKeyId, + preKeyPublic: tempEccPreKeyPublic, + signedPreKeyId: userData.pqcBundle.eccSignedPrekeyId.toInt(), + signedPreKeyPublic: Uint8List.fromList( + userData.pqcBundle.eccSignedPrekey, + ), + signedPreKeySignature: Uint8List.fromList( + userData.pqcBundle.eccSignedPrekeySignature, + ), + identityKey: tempIdentityKey.publicKey.serialize(), + kyberPreKeyId: tempKyberPreKeyId, + kyberPreKeyPublic: tempKyberPreKeyPublic, + kyberPreKeySignature: tempKyberPreKeySignature, + ); + + await RustSignal.processPrekeyBundle( + name: userData.userId.toString(), + deviceId: 1, + bundle: rustBundle, + ); + + final contact = await twonlyDB.contactsDao.getContactById( + userData.userId.toInt(), + ); + if (contact != null && contact.signalVersion != SignalVersion.v2) { + await twonlyDB.contactsDao.updateContact( + contact.userId, + const ContactsCompanion(signalVersion: drift.Value(SignalVersion.v2)), + ); + } + + return true; + } catch (e) { + Log.error('could not process pqc bundle: $e'); + return false; + } +} + +Future _processSignalUserDataV1(Response_UserData userData) async { final SignalProtocolStore? signalStore = await getSignalStore(); if (signalStore == null) { diff --git a/lib/src/utils/storage.dart b/lib/src/utils/storage.dart index b6e4e283..ae28a451 100644 --- a/lib/src/utils/storage.dart +++ b/lib/src/utils/storage.dart @@ -1,11 +1,27 @@ +import 'dart:async'; +import 'dart:ui'; + import 'package:path_provider/path_provider.dart'; +import 'package:twonly/locator.dart'; +import 'package:twonly/src/database/twonly.db.dart'; import 'package:twonly/src/utils/secure_storage.dart'; Future deleteLocalUserData() async { + await twonlyDB.close(); + // Wait for the background drift isolate to potentially shut down + await Future.delayed(const Duration(milliseconds: 200)); + + // Remove port mappings to prevent connecting to an old, detached isolate that holds a deleted DB file. + IsolateNameServer.removePortNameMapping('drift-db/twonly'); + IsolateNameServer.removePortNameMapping('drift-db/twonly/control'); + final appDir = await getApplicationSupportDirectory(); if (appDir.existsSync()) { appDir.deleteSync(recursive: true); } await SecureStorage.instance.deleteAll(); + locator + ..unregister() + ..registerLazySingleton(TwonlyDB.new); return true; } diff --git a/lib/src/visual/views/contact/contact.view.dart b/lib/src/visual/views/contact/contact.view.dart index f5f25bb3..b5dde0d7 100644 --- a/lib/src/visual/views/contact/contact.view.dart +++ b/lib/src/visual/views/contact/contact.view.dart @@ -7,6 +7,7 @@ import 'package:go_router/go_router.dart'; import 'package:twonly/locator.dart'; import 'package:twonly/src/constants/routes.keys.dart'; import 'package:twonly/src/database/daos/contacts.dao.dart'; +import 'package:twonly/src/database/tables/contacts.table.dart'; import 'package:twonly/src/database/twonly.db.dart'; import 'package:twonly/src/utils/misc.dart'; import 'package:twonly/src/visual/components/alert.dialog.dart'; @@ -273,6 +274,21 @@ class _ContactViewState extends State { text: context.lang.contactRemove, onTap: () => handleUserRemoveRequest(contact), ), + if (userService.currentUser.isDeveloper) ...[ + const Divider(), + Padding( + padding: const EdgeInsets.symmetric(vertical: 12), + child: Center( + child: Text( + 'Encryption: ${switch (contact.signalVersion) { + SignalVersion.v1 => 'Signal Protocol (v1)', + SignalVersion.v2 => 'PQXDH (v2)', + }}', + style: const TextStyle(color: Colors.grey), + ), + ), + ), + ], ], ), ); diff --git a/lib/src/visual/views/onboarding/register.view.dart b/lib/src/visual/views/onboarding/register.view.dart index d30926f1..9d4f638b 100644 --- a/lib/src/visual/views/onboarding/register.view.dart +++ b/lib/src/visual/views/onboarding/register.view.dart @@ -170,6 +170,7 @@ class _RegisterViewState extends State { widget.callbackOnSuccess(); } catch (e, stack) { Log.error('Error creating new user', error: e, stackTrace: stack); + await deleteLocalUserData(); if (mounted) { setState(() { _isTryingToRegister = false; diff --git a/pubspec.lock b/pubspec.lock index 7d2ea56e..90bbb4de 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1108,18 +1108,18 @@ packages: dependency: "direct main" description: name: in_app_purchase - sha256: "5cddd7f463f3bddb1d37a72b95066e840d5822d66291331d7f8f05ce32c24b6c" + sha256: "0e9510b80b0074e89ab0a8e0fc901439b779dc9ae575ab8d419253c6e1627716" url: "https://pub.dev" source: hosted - version: "3.2.3" + version: "3.3.0" in_app_purchase_android: dependency: transitive description: name: in_app_purchase_android - sha256: "634bee4734b17fe55f370f0ac07a22431a9666e0f3a870c6d20350856e8bbf71" + sha256: c04e2cad0470fc868cb0ea06477648f003220b1b6612909db83528ca83ac0905 url: "https://pub.dev" source: hosted - version: "0.4.0+10" + version: "0.5.2" in_app_purchase_platform_interface: dependency: "direct dev" description: @@ -2253,5 +2253,5 @@ packages: source: hosted version: "3.1.3" sdks: - dart: ">=3.11.0 <4.0.0" - flutter: ">=3.38.4" + dart: ">=3.12.0 <4.0.0" + flutter: ">=3.44.0" diff --git a/pubspec.yaml b/pubspec.yaml index 19785c7c..d67ae8d4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -38,7 +38,7 @@ dependencies: url_launcher: ^6.3.2 vector_graphics: ^1.1.19 video_player: ^2.10.1 - in_app_purchase: ^3.2.3 + in_app_purchase: ^3.3.0 go_router: ^17.1.0 diff --git a/rust/src/bridge/mod.rs b/rust/src/bridge/mod.rs index 31a00057..002cb8a1 100644 --- a/rust/src/bridge/mod.rs +++ b/rust/src/bridge/mod.rs @@ -13,6 +13,7 @@ use crate::error::Result; use crate::error::TwonlyError; use crate::keys::KeyManager; use crate::secure_storage::SecureStorage; +use crate::signal::engine::RustSignalEngine; use crate::user_discovery::UserDiscovery; use crate::utils::Shared; use flutter_rust_bridge::frb; @@ -52,6 +53,7 @@ pub(crate) struct TwonlyFlutter { pub(crate) rust_db: Arc, pub(crate) secure_storage: SecureStorage, pub(crate) key_manager: Arc>, + pub(crate) signal_engine: Arc>>, } pub(super) fn get_twonly_flutter() -> Result<&'static TwonlyFlutter> { diff --git a/rust/src/bridge/wrapper/key_manager.rs b/rust/src/bridge/wrapper/key_manager.rs index f57f8ad5..3899e4f8 100644 --- a/rust/src/bridge/wrapper/key_manager.rs +++ b/rust/src/bridge/wrapper/key_manager.rs @@ -3,6 +3,7 @@ use std::collections::HashMap; use crate::bridge::get_twonly_flutter; use crate::error::{Result, TwonlyError}; use crate::keys::SignalIdentityKey; +use crate::signal::engine::RustSignalEngine; pub struct RustKeyManager {} @@ -19,9 +20,21 @@ impl RustKeyManager { pub async fn set_user_id(user_id: i64) -> Result<()> { let ctx = get_twonly_flutter()?; - let mut key_manager = ctx.key_manager.lock().await; - key_manager.user_id = Some(user_id); - key_manager.store_to_keychain(&ctx.secure_storage)?; + { + let mut key_manager = ctx.key_manager.lock().await; + key_manager.user_id = Some(user_id); + key_manager.store_to_keychain(&ctx.secure_storage)?; + } + + let mut guard = ctx.signal_engine.lock().await; + match RustSignalEngine::new(user_id.to_string()).await { + Ok(engine) => *guard = Some(engine), + Err(e) => { + tracing::warn!("Failed to initialize Signal engine on set_user_id: {}. It will be initialized later.", e); + *guard = None; + } + } + Ok(()) } @@ -31,14 +44,31 @@ impl RustKeyManager { signed_pre_key_store: HashMap>, ) -> Result<()> { let ctx = get_twonly_flutter()?; - let mut key_manager = ctx.key_manager.lock().await; - key_manager.signal_identity = Some(SignalIdentityKey { - identity_key_pair_structure, - registration_id, - pre_key_store: signed_pre_key_store, - pqc_identity_key: None, - }); - key_manager.store_to_keychain(&ctx.secure_storage)?; + let user_id = { + let mut key_manager = ctx.key_manager.lock().await; + key_manager.signal_identity = Some(SignalIdentityKey { + identity_key_pair_structure, + registration_id, + pre_key_store: signed_pre_key_store, + }); + key_manager.store_to_keychain(&ctx.secure_storage)?; + key_manager.user_id + }; + + if let Some(user_id) = user_id { + let mut guard = ctx.signal_engine.lock().await; + match RustSignalEngine::new(user_id.to_string()).await { + Ok(engine) => *guard = Some(engine), + Err(e) => { + tracing::warn!( + "Failed to initialize Signal engine on import_signal_identity: {}.", + e + ); + *guard = None; + } + } + } + Ok(()) } diff --git a/rust/src/bridge/wrapper/mod.rs b/rust/src/bridge/wrapper/mod.rs index 756bf38c..3dd80cae 100644 --- a/rust/src/bridge/wrapper/mod.rs +++ b/rust/src/bridge/wrapper/mod.rs @@ -1,5 +1,6 @@ pub mod backup; pub mod key_manager; +pub mod signal; pub mod user_discovery; use crate::error::Result; diff --git a/rust/src/bridge/wrapper/signal.rs b/rust/src/bridge/wrapper/signal.rs new file mode 100644 index 00000000..3c163117 --- /dev/null +++ b/rust/src/bridge/wrapper/signal.rs @@ -0,0 +1,45 @@ +use crate::bridge::get_twonly_flutter; +use crate::error::{Result, TwonlyError}; +use crate::signal::engine::{FrbPqcPreKey, FrbPreKeyBundle}; + +pub struct RustSignal {} + +impl RustSignal { + pub async fn generate_bundle() -> Result { + let guard = get_twonly_flutter()?.signal_engine.lock().await; + let engine = guard.as_ref().ok_or(TwonlyError::Initialization)?; + engine + .generate_bundle() + .await + } + + pub async fn generate_pqc_prekeys() -> Result> { + let guard = get_twonly_flutter()?.signal_engine.lock().await; + let engine = guard.as_ref().ok_or(TwonlyError::Initialization)?; + engine.generate_pqc_prekeys().await + } + + pub async fn process_prekey_bundle( + name: String, + device_id: u32, + bundle: FrbPreKeyBundle, + ) -> Result<()> { + let guard = get_twonly_flutter()?.signal_engine.lock().await; + let engine = guard.as_ref().ok_or(TwonlyError::Initialization)?; + engine.process_prekey_bundle(name, device_id, bundle).await + } + + pub async fn encrypt(name: String, device_id: u32, plaintext: Vec) -> Result> { + let guard = get_twonly_flutter()?.signal_engine.lock().await; + let engine = guard.as_ref().ok_or(TwonlyError::Initialization)?; + Ok(engine.encrypt_message(name, device_id, plaintext).await?) + } + + pub async fn decrypt(name: String, device_id: u32, ciphertext: Vec) -> Result> { + let guard = get_twonly_flutter()?.signal_engine.lock().await; + let engine = guard.as_ref().ok_or(TwonlyError::Initialization)?; + engine + .decrypt_message(name.clone(), device_id, ciphertext.clone()) + .await + } +} diff --git a/rust/src/context.rs b/rust/src/context.rs index b0e92bb3..54943756 100644 --- a/rust/src/context.rs +++ b/rust/src/context.rs @@ -1,3 +1,4 @@ +use crate::signal::engine::RustSignalEngine; use crate::user_discovery::UserDiscovery; use crate::{ bridge::{ @@ -132,6 +133,17 @@ impl Context { rust_db_key.zeroize(); if is_flutter { + let mut signal_engine = Arc::default(); + if let Some(user_id) = key_manager.user_id { + if let Some(signal_identity) = &key_manager.signal_identity { + signal_engine = Arc::new(Mutex::new(Some(RustSignalEngine::new_with_pool( + rust_db.pool.clone(), + signal_identity.identity_key_pair_structure.clone(), + signal_identity.registration_id as u32, + user_id.to_string(), + )?))); + } + } Ok(Context::Flutter(TwonlyFlutter { config, secure_storage, @@ -141,6 +153,7 @@ impl Context { UserDiscoveryStoreFlutter {}, UserDiscoveryUtilsFlutter {}, )?), + signal_engine, })) } else { Ok(Context::Standalone(TwonlyStandalone { diff --git a/rust/src/frb_generated.rs b/rust/src/frb_generated.rs index 884c55e8..de359247 100644 --- a/rust/src/frb_generated.rs +++ b/rust/src/frb_generated.rs @@ -40,7 +40,7 @@ flutter_rust_bridge::frb_generated_boilerplate!( default_rust_auto_opaque = RustAutoOpaqueMoi, ); pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_VERSION: &str = "2.12.0"; -pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_CONTENT_HASH: i32 = 1788847092; +pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_CONTENT_HASH: i32 = 1109927244; // Section: executor @@ -711,6 +711,210 @@ let api_record = >::sse_decode(&mut deserializer);deserializer.end(); mo })().await) } }) } +fn wire__crate__bridge__wrapper__signal__rust_signal_decrypt_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "rust_signal_decrypt", + port: Some(port_), + mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + }, + move || { + let message = unsafe { + flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire( + ptr_, + rust_vec_len_, + data_len_, + ) + }; + let mut deserializer = + flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let api_name = ::sse_decode(&mut deserializer); + let api_device_id = ::sse_decode(&mut deserializer); + let api_ciphertext = >::sse_decode(&mut deserializer); + deserializer.end(); + move |context| async move { + transform_result_sse::<_, flutter_rust_bridge::for_generated::anyhow::Error>( + (move || async move { + let output_ok = crate::bridge::wrapper::signal::RustSignal::decrypt( + api_name, + api_device_id, + api_ciphertext, + ) + .await?; + Ok(output_ok) + })() + .await, + ) + } + }, + ) +} +fn wire__crate__bridge__wrapper__signal__rust_signal_encrypt_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "rust_signal_encrypt", + port: Some(port_), + mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + }, + move || { + let message = unsafe { + flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire( + ptr_, + rust_vec_len_, + data_len_, + ) + }; + let mut deserializer = + flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let api_name = ::sse_decode(&mut deserializer); + let api_device_id = ::sse_decode(&mut deserializer); + let api_plaintext = >::sse_decode(&mut deserializer); + deserializer.end(); + move |context| async move { + transform_result_sse::<_, flutter_rust_bridge::for_generated::anyhow::Error>( + (move || async move { + let output_ok = crate::bridge::wrapper::signal::RustSignal::encrypt( + api_name, + api_device_id, + api_plaintext, + ) + .await?; + Ok(output_ok) + })() + .await, + ) + } + }, + ) +} +fn wire__crate__bridge__wrapper__signal__rust_signal_generate_bundle_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "rust_signal_generate_bundle", + port: Some(port_), + mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + }, + move || { + let message = unsafe { + flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire( + ptr_, + rust_vec_len_, + data_len_, + ) + }; + let mut deserializer = + flutter_rust_bridge::for_generated::SseDeserializer::new(message); + deserializer.end(); + move |context| async move { + transform_result_sse::<_, flutter_rust_bridge::for_generated::anyhow::Error>( + (move || async move { + let output_ok = + crate::bridge::wrapper::signal::RustSignal::generate_bundle().await?; + Ok(output_ok) + })() + .await, + ) + } + }, + ) +} +fn wire__crate__bridge__wrapper__signal__rust_signal_generate_pqc_prekeys_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "rust_signal_generate_pqc_prekeys", + port: Some(port_), + mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + }, + move || { + let message = unsafe { + flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire( + ptr_, + rust_vec_len_, + data_len_, + ) + }; + let mut deserializer = + flutter_rust_bridge::for_generated::SseDeserializer::new(message); + deserializer.end(); + move |context| async move { + transform_result_sse::<_, flutter_rust_bridge::for_generated::anyhow::Error>( + (move || async move { + let output_ok = + crate::bridge::wrapper::signal::RustSignal::generate_pqc_prekeys() + .await?; + Ok(output_ok) + })() + .await, + ) + } + }, + ) +} +fn wire__crate__bridge__wrapper__signal__rust_signal_process_prekey_bundle_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "rust_signal_process_prekey_bundle", + port: Some(port_), + mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + }, + move || { + let message = unsafe { + flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire( + ptr_, + rust_vec_len_, + data_len_, + ) + }; + let mut deserializer = + flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let api_name = ::sse_decode(&mut deserializer); + let api_device_id = ::sse_decode(&mut deserializer); + let api_bundle = + ::sse_decode(&mut deserializer); + deserializer.end(); + move |context| async move { + transform_result_sse::<_, flutter_rust_bridge::for_generated::anyhow::Error>( + (move || async move { + let output_ok = + crate::bridge::wrapper::signal::RustSignal::process_prekey_bundle( + api_name, + api_device_id, + api_bundle, + ) + .await?; + Ok(output_ok) + })() + .await, + ) + } + }, + ) +} fn wire__crate__bridge__wrapper__rust_utils_generate_shares_impl( port_: flutter_rust_bridge::for_generated::MessagePort, ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, @@ -1600,6 +1804,54 @@ impl SseDecode for crate::bridge::wrapper::user_discovery::FlutterUserDiscovery } } +impl SseDecode for crate::signal::engine::FrbPqcPreKey { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_eccPreKeyId = ::sse_decode(deserializer); + let mut var_eccPreKey = >::sse_decode(deserializer); + let mut var_kyberPreKeyId = ::sse_decode(deserializer); + let mut var_kyberPreKey = >::sse_decode(deserializer); + let mut var_kyberPreKeySignature = >::sse_decode(deserializer); + return crate::signal::engine::FrbPqcPreKey { + ecc_pre_key_id: var_eccPreKeyId, + ecc_pre_key: var_eccPreKey, + kyber_pre_key_id: var_kyberPreKeyId, + kyber_pre_key: var_kyberPreKey, + kyber_pre_key_signature: var_kyberPreKeySignature, + }; + } +} + +impl SseDecode for crate::signal::engine::FrbPreKeyBundle { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_registrationId = ::sse_decode(deserializer); + let mut var_deviceId = ::sse_decode(deserializer); + let mut var_preKeyId = >::sse_decode(deserializer); + let mut var_preKeyPublic = >>::sse_decode(deserializer); + let mut var_signedPreKeyId = ::sse_decode(deserializer); + let mut var_signedPreKeyPublic = >::sse_decode(deserializer); + let mut var_signedPreKeySignature = >::sse_decode(deserializer); + let mut var_kyberPreKeyId = ::sse_decode(deserializer); + let mut var_kyberPreKeyPublic = >::sse_decode(deserializer); + let mut var_kyberPreKeySignature = >::sse_decode(deserializer); + let mut var_identityKey = >::sse_decode(deserializer); + return crate::signal::engine::FrbPreKeyBundle { + registration_id: var_registrationId, + device_id: var_deviceId, + pre_key_id: var_preKeyId, + pre_key_public: var_preKeyPublic, + signed_pre_key_id: var_signedPreKeyId, + signed_pre_key_public: var_signedPreKeyPublic, + signed_pre_key_signature: var_signedPreKeySignature, + kyber_pre_key_id: var_kyberPreKeyId, + kyber_pre_key_public: var_kyberPreKeyPublic, + kyber_pre_key_signature: var_kyberPreKeySignature, + identity_key: var_identityKey, + }; + } +} + impl SseDecode for i64 { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -1626,6 +1878,20 @@ impl SseDecode for isize { } } +impl SseDecode for Vec { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut len_ = ::sse_decode(deserializer); + let mut ans_ = Vec::with_capacity(len_ as usize); + for idx_ in 0..len_ { + ans_.push(::sse_decode( + deserializer, + )); + } + return ans_; + } +} + impl SseDecode for Vec> { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -1707,6 +1973,17 @@ impl SseDecode for Option { } } +impl SseDecode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + if (::sse_decode(deserializer)) { + return Some(::sse_decode(deserializer)); + } else { + return None; + } + } +} + impl SseDecode for Option>> { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -1810,6 +2087,13 @@ impl SseDecode for crate::bridge::wrapper::key_manager::RustKeyManager { } } +impl SseDecode for crate::bridge::wrapper::signal::RustSignal { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + return crate::bridge::wrapper::signal::RustSignal {}; + } +} + impl SseDecode for crate::bridge::wrapper::RustUtils { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -1912,24 +2196,29 @@ fn pde_ffi_dispatcher_primary_impl( 29 => wire__crate__bridge__wrapper__key_manager__rust_key_manager_serialize_impl(port, ptr, rust_vec_len, data_len), 30 => wire__crate__bridge__wrapper__key_manager__rust_key_manager_set_user_id_impl(port, ptr, rust_vec_len, data_len), 31 => wire__crate__bridge__wrapper__key_manager__rust_key_manager_store_signed_prekey_impl(port, ptr, rust_vec_len, data_len), -32 => wire__crate__bridge__wrapper__rust_utils_generate_shares_impl(port, ptr, rust_vec_len, data_len), -33 => wire__crate__bridge__wrapper__rust_utils_recover_secret_impl(port, ptr, rust_vec_len, data_len), -34 => wire__crate__bridge__callbacks__user_discovery__user_discovery_store_flutter_get_announced_user_by_public_id_impl(port, ptr, rust_vec_len, data_len), -35 => wire__crate__bridge__callbacks__user_discovery__user_discovery_store_flutter_get_config_impl(port, ptr, rust_vec_len, data_len), -36 => wire__crate__bridge__callbacks__user_discovery__user_discovery_store_flutter_get_contact_promotion_impl(port, ptr, rust_vec_len, data_len), -37 => wire__crate__bridge__callbacks__user_discovery__user_discovery_store_flutter_get_contact_version_impl(port, ptr, rust_vec_len, data_len), -38 => wire__crate__bridge__callbacks__user_discovery__user_discovery_store_flutter_get_other_promotions_by_public_id_impl(port, ptr, rust_vec_len, data_len), -39 => wire__crate__bridge__callbacks__user_discovery__user_discovery_store_flutter_get_own_promotions_after_version_impl(port, ptr, rust_vec_len, data_len), -40 => wire__crate__bridge__callbacks__user_discovery__user_discovery_store_flutter_get_share_for_contact_impl(port, ptr, rust_vec_len, data_len), -41 => wire__crate__bridge__callbacks__user_discovery__user_discovery_store_flutter_push_new_user_relation_impl(port, ptr, rust_vec_len, data_len), -42 => wire__crate__bridge__callbacks__user_discovery__user_discovery_store_flutter_push_own_promotion_and_clear_old_version_impl(port, ptr, rust_vec_len, data_len), -43 => wire__crate__bridge__callbacks__user_discovery__user_discovery_store_flutter_set_contact_version_impl(port, ptr, rust_vec_len, data_len), -44 => wire__crate__bridge__callbacks__user_discovery__user_discovery_store_flutter_set_shares_impl(port, ptr, rust_vec_len, data_len), -45 => wire__crate__bridge__callbacks__user_discovery__user_discovery_store_flutter_store_other_promotion_impl(port, ptr, rust_vec_len, data_len), -46 => wire__crate__bridge__callbacks__user_discovery__user_discovery_store_flutter_update_config_impl(port, ptr, rust_vec_len, data_len), -47 => wire__crate__bridge__callbacks__user_discovery__user_discovery_utils_flutter_sign_data_impl(port, ptr, rust_vec_len, data_len), -48 => wire__crate__bridge__callbacks__user_discovery__user_discovery_utils_flutter_verify_signature_impl(port, ptr, rust_vec_len, data_len), -49 => wire__crate__bridge__callbacks__user_discovery__user_discovery_utils_flutter_verify_stored_pubkey_impl(port, ptr, rust_vec_len, data_len), +32 => wire__crate__bridge__wrapper__signal__rust_signal_decrypt_impl(port, ptr, rust_vec_len, data_len), +33 => wire__crate__bridge__wrapper__signal__rust_signal_encrypt_impl(port, ptr, rust_vec_len, data_len), +34 => wire__crate__bridge__wrapper__signal__rust_signal_generate_bundle_impl(port, ptr, rust_vec_len, data_len), +35 => wire__crate__bridge__wrapper__signal__rust_signal_generate_pqc_prekeys_impl(port, ptr, rust_vec_len, data_len), +36 => wire__crate__bridge__wrapper__signal__rust_signal_process_prekey_bundle_impl(port, ptr, rust_vec_len, data_len), +37 => wire__crate__bridge__wrapper__rust_utils_generate_shares_impl(port, ptr, rust_vec_len, data_len), +38 => wire__crate__bridge__wrapper__rust_utils_recover_secret_impl(port, ptr, rust_vec_len, data_len), +39 => wire__crate__bridge__callbacks__user_discovery__user_discovery_store_flutter_get_announced_user_by_public_id_impl(port, ptr, rust_vec_len, data_len), +40 => wire__crate__bridge__callbacks__user_discovery__user_discovery_store_flutter_get_config_impl(port, ptr, rust_vec_len, data_len), +41 => wire__crate__bridge__callbacks__user_discovery__user_discovery_store_flutter_get_contact_promotion_impl(port, ptr, rust_vec_len, data_len), +42 => wire__crate__bridge__callbacks__user_discovery__user_discovery_store_flutter_get_contact_version_impl(port, ptr, rust_vec_len, data_len), +43 => wire__crate__bridge__callbacks__user_discovery__user_discovery_store_flutter_get_other_promotions_by_public_id_impl(port, ptr, rust_vec_len, data_len), +44 => wire__crate__bridge__callbacks__user_discovery__user_discovery_store_flutter_get_own_promotions_after_version_impl(port, ptr, rust_vec_len, data_len), +45 => wire__crate__bridge__callbacks__user_discovery__user_discovery_store_flutter_get_share_for_contact_impl(port, ptr, rust_vec_len, data_len), +46 => wire__crate__bridge__callbacks__user_discovery__user_discovery_store_flutter_push_new_user_relation_impl(port, ptr, rust_vec_len, data_len), +47 => wire__crate__bridge__callbacks__user_discovery__user_discovery_store_flutter_push_own_promotion_and_clear_old_version_impl(port, ptr, rust_vec_len, data_len), +48 => wire__crate__bridge__callbacks__user_discovery__user_discovery_store_flutter_set_contact_version_impl(port, ptr, rust_vec_len, data_len), +49 => wire__crate__bridge__callbacks__user_discovery__user_discovery_store_flutter_set_shares_impl(port, ptr, rust_vec_len, data_len), +50 => wire__crate__bridge__callbacks__user_discovery__user_discovery_store_flutter_store_other_promotion_impl(port, ptr, rust_vec_len, data_len), +51 => wire__crate__bridge__callbacks__user_discovery__user_discovery_store_flutter_update_config_impl(port, ptr, rust_vec_len, data_len), +52 => wire__crate__bridge__callbacks__user_discovery__user_discovery_utils_flutter_sign_data_impl(port, ptr, rust_vec_len, data_len), +53 => wire__crate__bridge__callbacks__user_discovery__user_discovery_utils_flutter_verify_signature_impl(port, ptr, rust_vec_len, data_len), +54 => wire__crate__bridge__callbacks__user_discovery__user_discovery_utils_flutter_verify_stored_pubkey_impl(port, ptr, rust_vec_len, data_len), _ => unreachable!(), } } @@ -2011,6 +2300,60 @@ impl flutter_rust_bridge::IntoIntoDart flutter_rust_bridge::for_generated::DartAbi { + [ + self.ecc_pre_key_id.into_into_dart().into_dart(), + self.ecc_pre_key.into_into_dart().into_dart(), + self.kyber_pre_key_id.into_into_dart().into_dart(), + self.kyber_pre_key.into_into_dart().into_dart(), + self.kyber_pre_key_signature.into_into_dart().into_dart(), + ] + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for crate::signal::engine::FrbPqcPreKey +{ +} +impl flutter_rust_bridge::IntoIntoDart + for crate::signal::engine::FrbPqcPreKey +{ + fn into_into_dart(self) -> crate::signal::engine::FrbPqcPreKey { + self + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for crate::signal::engine::FrbPreKeyBundle { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [ + self.registration_id.into_into_dart().into_dart(), + self.device_id.into_into_dart().into_dart(), + self.pre_key_id.into_into_dart().into_dart(), + self.pre_key_public.into_into_dart().into_dart(), + self.signed_pre_key_id.into_into_dart().into_dart(), + self.signed_pre_key_public.into_into_dart().into_dart(), + self.signed_pre_key_signature.into_into_dart().into_dart(), + self.kyber_pre_key_id.into_into_dart().into_dart(), + self.kyber_pre_key_public.into_into_dart().into_dart(), + self.kyber_pre_key_signature.into_into_dart().into_dart(), + self.identity_key.into_into_dart().into_dart(), + ] + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for crate::signal::engine::FrbPreKeyBundle +{ +} +impl flutter_rust_bridge::IntoIntoDart + for crate::signal::engine::FrbPreKeyBundle +{ + fn into_into_dart(self) -> crate::signal::engine::FrbPreKeyBundle { + self + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs impl flutter_rust_bridge::IntoDart for crate::bridge::InitConfig { fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { [ @@ -2106,6 +2449,23 @@ impl flutter_rust_bridge::IntoIntoDart flutter_rust_bridge::for_generated::DartAbi { + Vec::::new().into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for crate::bridge::wrapper::signal::RustSignal +{ +} +impl flutter_rust_bridge::IntoIntoDart + for crate::bridge::wrapper::signal::RustSignal +{ + fn into_into_dart(self) -> crate::bridge::wrapper::signal::RustSignal { + self + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs impl flutter_rust_bridge::IntoDart for crate::bridge::wrapper::RustUtils { fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { Vec::::new().into_dart() @@ -2229,6 +2589,34 @@ impl SseEncode for crate::bridge::wrapper::user_discovery::FlutterUserDiscovery fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {} } +impl SseEncode for crate::signal::engine::FrbPqcPreKey { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.ecc_pre_key_id, serializer); + >::sse_encode(self.ecc_pre_key, serializer); + ::sse_encode(self.kyber_pre_key_id, serializer); + >::sse_encode(self.kyber_pre_key, serializer); + >::sse_encode(self.kyber_pre_key_signature, serializer); + } +} + +impl SseEncode for crate::signal::engine::FrbPreKeyBundle { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.registration_id, serializer); + ::sse_encode(self.device_id, serializer); + >::sse_encode(self.pre_key_id, serializer); + >>::sse_encode(self.pre_key_public, serializer); + ::sse_encode(self.signed_pre_key_id, serializer); + >::sse_encode(self.signed_pre_key_public, serializer); + >::sse_encode(self.signed_pre_key_signature, serializer); + ::sse_encode(self.kyber_pre_key_id, serializer); + >::sse_encode(self.kyber_pre_key_public, serializer); + >::sse_encode(self.kyber_pre_key_signature, serializer); + >::sse_encode(self.identity_key, serializer); + } +} + impl SseEncode for i64 { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { @@ -2254,6 +2642,16 @@ impl SseEncode for isize { } } +impl SseEncode for Vec { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.len() as _, serializer); + for item in self { + ::sse_encode(item, serializer); + } + } +} + impl SseEncode for Vec> { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { @@ -2324,6 +2722,16 @@ impl SseEncode for Option { } } +impl SseEncode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.is_some(), serializer); + if let Some(value) = self { + ::sse_encode(value, serializer); + } + } +} + impl SseEncode for Option>> { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { @@ -2405,6 +2813,11 @@ impl SseEncode for crate::bridge::wrapper::key_manager::RustKeyManager { fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {} } +impl SseEncode for crate::bridge::wrapper::signal::RustSignal { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {} +} + impl SseEncode for crate::bridge::wrapper::RustUtils { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {} diff --git a/rust/src/keys/identity_key/signal_identity_key.rs b/rust/src/keys/identity_key/signal_identity_key.rs index 01ad8dfd..36aac3db 100644 --- a/rust/src/keys/identity_key/signal_identity_key.rs +++ b/rust/src/keys/identity_key/signal_identity_key.rs @@ -8,7 +8,6 @@ pub(crate) struct SignalIdentityKey { pub(crate) identity_key_pair_structure: Vec, pub(crate) registration_id: i64, pub(crate) pre_key_store: HashMap>, - pub(crate) pqc_identity_key: Option>, } impl SignalIdentityKey {} @@ -21,9 +20,6 @@ impl Zeroize for SignalIdentityKey { value.zeroize(); } self.pre_key_store.clear(); - if let Some(pqc) = &mut self.pqc_identity_key { - pqc.zeroize(); - } } } diff --git a/rust/src/signal/assert_send.rs b/rust/src/signal/assert_send.rs new file mode 100644 index 00000000..4cfcb625 --- /dev/null +++ b/rust/src/signal/assert_send.rs @@ -0,0 +1,24 @@ +use std::future::Future; +use std::pin::Pin; +use std::task::{Context, Poll}; + +pub struct AssertSendFuture(F); + +unsafe impl Send for AssertSendFuture {} +unsafe impl Sync for AssertSendFuture {} + +impl Future for AssertSendFuture { + type Output = F::Output; + + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + unsafe { self.map_unchecked_mut(|s| &mut s.0) }.poll(cx) + } +} + +pub trait AssertSendFutureExt: Sized + Future { + fn assert_send(self) -> AssertSendFuture { + AssertSendFuture(self) + } +} + +impl AssertSendFutureExt for F {} diff --git a/rust/src/signal/engine.rs b/rust/src/signal/engine.rs index ed4a6830..debfa415 100644 --- a/rust/src/signal/engine.rs +++ b/rust/src/signal/engine.rs @@ -1,15 +1,18 @@ use crate::error::{Result, TwonlyError}; use libsignal_protocol::{ - message_encrypt, process_prekey_bundle, DeviceId, GenericSignedPreKey, IdentityKey, - IdentityKeyPair, IdentityKeyStore, KyberPreKeyId, KyberPreKeyStore, PreKeyBundle, PreKeyId, - PreKeySignalMessage, PreKeyStore, ProtocolAddress, PublicKey, SignalMessage, SignedPreKeyId, - SignedPreKeyStore, Timestamp, + message_encrypt, process_prekey_bundle, CiphertextMessageType, DeviceId, GenericSignedPreKey, + IdentityKey, IdentityKeyPair, IdentityKeyStore, KyberPreKeyId, KyberPreKeyStore, PreKeyBundle, + PreKeyId, PreKeySignalMessage, PreKeyStore, ProtocolAddress, PublicKey, SignalMessage, + SignedPreKeyId, SignedPreKeyStore, Timestamp, }; use std::sync::Arc; use std::time::{SystemTime, UNIX_EPOCH}; use tokio::sync::Mutex; +use crate::bridge::get_twonly_flutter; +use crate::signal::assert_send::AssertSendFutureExt; use crate::signal::store::DbSignalProtocolStore; +use rand::SeedableRng; pub struct RustSignalEngine { store: Arc>, @@ -30,9 +33,17 @@ pub struct FrbPreKeyBundle { pub identity_key: Vec, } +pub struct FrbPqcPreKey { + pub ecc_pre_key_id: u32, + pub ecc_pre_key: Vec, + pub kyber_pre_key_id: u32, + pub kyber_pre_key: Vec, + pub kyber_pre_key_signature: Vec, +} + impl RustSignalEngine { pub async fn new(local_name: String) -> Result { - let twonly = crate::bridge::get_twonly_flutter()?; + let twonly = get_twonly_flutter()?; let pool = twonly.rust_db.pool.clone(); let km = twonly.key_manager.lock().await; @@ -75,20 +86,53 @@ impl RustSignalEngine { } pub fn generate_identity_key_pair() -> Result> { - let mut csprng = rand::rng(); + let mut csprng = rand::rngs::StdRng::from_os_rng(); let key_pair = IdentityKeyPair::generate(&mut csprng); Ok(key_pair.serialize().to_vec()) } - pub async fn generate_bundle( - &self, - pre_key_id: u32, - signed_pre_key_id: u32, - kyber_pre_key_id: u32, - ) -> Result { + pub async fn generate_bundle(&self) -> Result { let mut store_guard = self.store.lock().await; let store = &mut *store_guard; - let mut csprng = rand::rng(); + let mut csprng = rand::rngs::StdRng::from_os_rng(); + + let pre_key_id: u32 = { + let id: u32 = + sqlx::query_scalar("SELECT COALESCE(MAX(pre_key_id), 0) FROM signal_pre_keys") + .fetch_one(&store.pool) + .await?; + if id > 16_777_215 { + 1 + } else { + id + 1 + } + }; + + let signed_pre_key_id: u32 = { + let id: u32 = sqlx::query_scalar( + "SELECT COALESCE(MAX(signed_pre_key_id), 0) FROM signal_signed_pre_keys", + ) + .fetch_one(&store.pool) + .await?; + if id > 16_777_215 { + 1 + } else { + id + 1 + } + }; + + let kyber_pre_key_id: u32 = { + let id: u32 = sqlx::query_scalar( + "SELECT COALESCE(MAX(kyber_pre_key_id), 0) FROM signal_kyber_pre_keys", + ) + .fetch_one(&store.pool) + .await?; + if id > 16_777_215 { + 1 + } else { + id + 1 + } + }; let pre_key_pair = libsignal_protocol::KeyPair::generate(&mut csprng); store @@ -97,6 +141,7 @@ impl RustSignalEngine { pre_key_id.into(), &libsignal_protocol::PreKeyRecord::new(pre_key_id.into(), &pre_key_pair), ) + .assert_send() .await .map_err(|e| TwonlyError::Signal(e.to_string()))?; @@ -104,6 +149,7 @@ impl RustSignalEngine { let signature = store .identity_store .get_identity_key_pair() + .assert_send() .await .map_err(|e| TwonlyError::Signal(e.to_string()))? .private_key() @@ -129,6 +175,7 @@ impl RustSignalEngine { &signature, ), ) + .assert_send() .await .map_err(|e| TwonlyError::Signal(e.to_string()))?; @@ -139,6 +186,7 @@ impl RustSignalEngine { let kyber_signature = store .identity_store .get_identity_key_pair() + .assert_send() .await .map_err(|e| TwonlyError::Signal(e.to_string()))? .private_key() @@ -161,6 +209,7 @@ impl RustSignalEngine { &kyber_sig_arr, ), ) + .assert_send() .await .map_err(|e| TwonlyError::Signal(e.to_string()))?; @@ -168,6 +217,7 @@ impl RustSignalEngine { registration_id: store .identity_store .get_local_registration_id() + .assert_send() .await .map_err(|e| TwonlyError::Signal(e.to_string()))?, device_id: 1, @@ -182,6 +232,7 @@ impl RustSignalEngine { identity_key: store .identity_store .get_identity_key_pair() + .assert_send() .await .map_err(|e| TwonlyError::Signal(e.to_string()))? .identity_key() @@ -190,6 +241,108 @@ impl RustSignalEngine { }) } + pub async fn generate_pqc_prekeys(&self) -> Result> { + let mut store_guard = self.store.lock().await; + let store = &mut *store_guard; + let mut csprng = rand::rngs::StdRng::from_os_rng(); + let mut prekeys = vec![]; + + let timestamp = Timestamp::from_epoch_millis( + SystemTime::now() + .duration_since(UNIX_EPOCH) + .map_err(|e| TwonlyError::Signal(e.to_string()))? + .as_millis() as u64, + ); + + let mut kyber_pre_key_id: u32 = { + let id = sqlx::query_scalar( + "SELECT COALESCE(MAX(kyber_pre_key_id), 0) FROM signal_kyber_pre_keys", + ) + .fetch_one(&store.pool) + .await?; + + if id > 16_777_215 { + 1 + } else { + id + } + }; + + let mut pre_key_id: u32 = { + let id = + sqlx::query_scalar("SELECT COALESCE(MAX(pre_key_id), 0) FROM signal_pre_keys") + .fetch_one(&store.pool) + .await?; + + if id > 16_777_215 { + 1 + } else { + id + } + }; + + for _ in 0..30 { + kyber_pre_key_id += 1; + pre_key_id += 1; + let kyber_key_pair = libsignal_protocol::kem::KeyPair::generate( + libsignal_protocol::kem::KeyType::Kyber1024, + &mut csprng, + ); + + let kyber_pre_key_signature = store + .identity_store + .get_identity_key_pair() + .assert_send() + .await + .map_err(|e| TwonlyError::Signal(e.to_string()))? + .private_key() + .calculate_signature_for_multipart_message( + &[&kyber_key_pair.public_key.serialize()], + &mut csprng, + ) + .map_err(|e| TwonlyError::Signal(e.to_string()))?; + + let kyber_sig_arr: [u8; 64] = kyber_pre_key_signature[..] + .try_into() + .map_err(|e: std::array::TryFromSliceError| TwonlyError::Signal(e.to_string()))?; + + let record = libsignal_protocol::KyberPreKeyRecord::new( + kyber_pre_key_id.into(), + timestamp, + &kyber_key_pair, + &kyber_sig_arr, + ); + + store + .kyber_pre_key_store + .save_kyber_pre_key(kyber_pre_key_id.into(), &record) + .assert_send() + .await + .map_err(|e| TwonlyError::Signal(e.to_string()))?; + + let ecc_key_par = libsignal_protocol::KeyPair::generate(&mut csprng); + + let record = libsignal_protocol::PreKeyRecord::new(pre_key_id.into(), &ecc_key_par); + + store + .pre_key_store + .save_pre_key(pre_key_id.into(), &record) + .assert_send() + .await + .map_err(|e| TwonlyError::Signal(e.to_string()))?; + + prekeys.push(FrbPqcPreKey { + kyber_pre_key_id, + kyber_pre_key: kyber_key_pair.public_key.serialize().to_vec(), + kyber_pre_key_signature: kyber_pre_key_signature.to_vec(), + ecc_pre_key_id: pre_key_id, + ecc_pre_key: ecc_key_par.public_key.serialize().to_vec(), + }); + } + + Ok(prekeys) + } + pub async fn process_prekey_bundle( &self, name: String, @@ -226,7 +379,7 @@ impl RustSignalEngine { _ => None, }; - let mut csprng = rand::rng(); + let mut csprng = rand::rngs::StdRng::from_os_rng(); let pre_key_bundle = PreKeyBundle::new( bundle.registration_id, @@ -254,6 +407,7 @@ impl RustSignalEngine { SystemTime::now(), &mut csprng, ) + .assert_send() .await .map_err(|e| TwonlyError::Signal(e.to_string()))?; @@ -278,7 +432,7 @@ impl RustSignalEngine { .map_err(|_| TwonlyError::Generic("Invalid device id 1".to_string()))?, ); - let mut csprng = rand::rng(); + let mut csprng = rand::rngs::StdRng::from_os_rng(); let now = SystemTime::now(); let ciphertext = message_encrypt( @@ -290,18 +444,23 @@ impl RustSignalEngine { now, &mut csprng, ) + .assert_send() .await .map_err(|e| TwonlyError::Signal(e.to_string()))?; - Ok(ciphertext.serialize().to_vec()) + let serialized = ciphertext.serialize(); + let mut res = Vec::with_capacity(serialized.len() + 1); + res.extend_from_slice(&serialized); + res.push(ciphertext.message_type() as u8); + + Ok(res) } pub async fn decrypt_message( &self, name: String, device_id: u32, - ciphertext_bytes: Vec, - is_prekey_message: bool, + ciphertext: Vec, ) -> Result> { let mut store_guard = self.store.lock().await; let store = &mut *store_guard; @@ -312,42 +471,151 @@ impl RustSignalEngine { let local_address = ProtocolAddress::new( self.local_name.clone(), DeviceId::try_from(1) - .map_err(|_| TwonlyError::Generic("Invalid device id 1".to_string()))?, + .map_err(|_| TwonlyError::Signal("Invalid device id 1".to_string()))?, ); - let plaintext = if is_prekey_message { - let message = PreKeySignalMessage::try_from(&ciphertext_bytes[..]) - .map_err(|e| TwonlyError::Signal(e.to_string()))?; - let mut csprng = rand::rng(); - libsignal_protocol::message_decrypt_prekey( - &message, - &remote_address, - &local_address, - &mut store.session_store, - &mut store.identity_store, - &mut store.pre_key_store, - &store.signed_pre_key_store, - &mut store.kyber_pre_key_store, - &mut csprng, - ) - .await - .map_err(|e| TwonlyError::Signal(e.to_string()))? - } else { - let message = SignalMessage::try_from(&ciphertext_bytes[..]) - .map_err(|e| TwonlyError::Signal(e.to_string()))?; - let mut csprng = rand::rng(); - libsignal_protocol::message_decrypt_signal( - &message, - &remote_address, - &local_address, - &mut store.session_store, - &mut store.identity_store, - &mut csprng, - ) - .await - .map_err(|e| TwonlyError::Signal(e.to_string()))? + let (msg_type, ciphertext) = ciphertext + .split_last() + .ok_or(TwonlyError::Generic("Invalid ciphertext".to_string()))?; + + let msg_type = CiphertextMessageType::try_from(*msg_type) + .map_err(|_| TwonlyError::Signal("Invalid message type".to_string()))?; + + let mut csprng = rand::rngs::StdRng::from_os_rng(); + + let plaintext = match msg_type { + CiphertextMessageType::Whisper => { + let message = SignalMessage::try_from(ciphertext) + .map_err(|e| TwonlyError::Signal(e.to_string()))?; + libsignal_protocol::message_decrypt_signal( + &message, + &remote_address, + &local_address, + &mut store.session_store, + &mut store.identity_store, + &mut csprng, + ) + .assert_send() + .await + .map_err(|e| TwonlyError::Signal(e.to_string()))? + } + CiphertextMessageType::PreKey => { + let message = PreKeySignalMessage::try_from(ciphertext) + .map_err(|e| TwonlyError::Signal(e.to_string()))?; + libsignal_protocol::message_decrypt_prekey( + &message, + &remote_address, + &local_address, + &mut store.session_store, + &mut store.identity_store, + &mut store.pre_key_store, + &store.signed_pre_key_store, + &mut store.kyber_pre_key_store, + &mut csprng, + ) + .assert_send() + .await + .map_err(|e| TwonlyError::Signal(e.to_string()))? + } + _ => { + return Err(TwonlyError::Signal("Invalid message type".to_string())); + } }; Ok(plaintext.to_vec()) } } + +#[cfg(test)] +mod tests { + use super::*; + use libsignal_protocol::IdentityKeyPair; + use rand::rngs::StdRng; + use tempfile::tempdir; + + async fn create_test_engine(name: &str) -> (RustSignalEngine, tempfile::TempDir) { + let dir = tempdir().unwrap(); + let db_path = dir.path().join(format!("{}.db", name)); + + let _db_url = format!("sqlite://{}?mode=rwc", db_path.to_str().unwrap()); + // create the file manually just to be sure + std::fs::File::create(&db_path).unwrap(); + + let db = + crate::database::Database::new(&db_path.to_str().unwrap().to_string(), None, false) + .await + .unwrap(); + db.run_migrations().await.unwrap(); + let pool = db.pool.clone(); + + let mut csprng = StdRng::from_os_rng(); + let identity_key_pair = IdentityKeyPair::generate(&mut csprng); + + let store = + DbSignalProtocolStore::new(pool, identity_key_pair, rand::Rng::random(&mut csprng)); + + ( + RustSignalEngine { + store: Arc::new(Mutex::new(store)), + local_name: name.to_string(), + }, + dir, + ) + } + + #[tokio::test] + async fn test_generate_pqc_prekeys() { + let (engine, _dir) = create_test_engine("alice").await; + let prekeys = engine.generate_pqc_prekeys().await.unwrap(); + assert_eq!(prekeys.len(), 50); + for prekey in prekeys { + assert!(prekey.ecc_pre_key.len() > 0); + assert!(prekey.kyber_pre_key.len() > 0); + assert!(prekey.kyber_pre_key_signature.len() > 0); + } + } + + #[tokio::test] + async fn test_v2_end_to_end_encryption() { + let (alice_engine, _alice_dir) = create_test_engine("alice").await; + let (bob_engine, _bob_dir) = create_test_engine("bob").await; + + // Bob generates a V2 bundle + let bob_bundle = bob_engine.generate_bundle().await.unwrap(); + + let bundle = FrbPreKeyBundle { + registration_id: bob_bundle.registration_id, + device_id: bob_bundle.device_id, + pre_key_id: bob_bundle.pre_key_id, + pre_key_public: bob_bundle.pre_key_public, + signed_pre_key_id: bob_bundle.signed_pre_key_id, + signed_pre_key_public: bob_bundle.signed_pre_key_public, + signed_pre_key_signature: bob_bundle.signed_pre_key_signature, + identity_key: bob_bundle.identity_key, + kyber_pre_key_id: bob_bundle.kyber_pre_key_id, + kyber_pre_key_public: bob_bundle.kyber_pre_key_public, + kyber_pre_key_signature: bob_bundle.kyber_pre_key_signature, + }; + + // Alice processes Bob's bundle + alice_engine + .process_prekey_bundle("bob".to_string(), 1, bundle) + .await + .unwrap(); + + // Alice encrypts a message + let plaintext = b"Hello Post-Quantum World!"; + let ciphertext = alice_engine + .encrypt_message("bob".to_string(), 1, plaintext.to_vec()) + .await + .unwrap(); + + // Bob decrypts the message + let decrypted = bob_engine + .decrypt_message("alice".to_string(), 1, ciphertext) + .await + .unwrap(); + + assert_eq!(plaintext.to_vec(), decrypted); + } +} diff --git a/rust/src/signal/mod.rs b/rust/src/signal/mod.rs index 7aeb7fa5..24e12826 100644 --- a/rust/src/signal/mod.rs +++ b/rust/src/signal/mod.rs @@ -1,2 +1,3 @@ +pub mod assert_send; pub mod engine; pub mod store; diff --git a/rust/src/signal/store.rs b/rust/src/signal/store.rs index 267f087e..c547b8d8 100644 --- a/rust/src/signal/store.rs +++ b/rust/src/signal/store.rs @@ -13,6 +13,7 @@ pub struct DbSignalProtocolStore { pub signed_pre_key_store: DbSignedPreKeyStore, pub kyber_pre_key_store: DbKyberPreKeyStore, pub session_store: DbSessionStore, + pub pool: SqlitePool, } impl DbSignalProtocolStore { @@ -22,6 +23,7 @@ impl DbSignalProtocolStore { local_registration_id: u32, ) -> Self { Self { + pool: pool.clone(), identity_store: DbIdentityKeyStore { pool: pool.clone(), identity_key_pair, diff --git a/rust/tests/pqxdh_tests.rs b/rust/tests/pqxdh_tests.rs index feb308cd..c262e3bd 100644 --- a/rust/tests/pqxdh_tests.rs +++ b/rust/tests/pqxdh_tests.rs @@ -31,7 +31,7 @@ async fn test_twonly_api_100_messages() -> Result<(), Box )?; // 4. Bob generates a bundle - let bob_bundle = bob_engine.generate_bundle(1, 1, 1).await?; + let bob_bundle = bob_engine.generate_bundle().await?; // 5. Alice processes Bob's bundle alice_engine @@ -48,9 +48,8 @@ async fn test_twonly_api_100_messages() -> Result<(), Box .encrypt_message("bob".to_string(), 1, plaintext.clone()) .await?; - let is_prekey = i == 1; // Only the first message is a PreKeySignalMessage let decrypted = bob_engine - .decrypt_message("alice".to_string(), 1, ciphertext, is_prekey) + .decrypt_message("alice".to_string(), 1, ciphertext) .await?; assert_eq!(plaintext, decrypted); @@ -62,7 +61,7 @@ async fn test_twonly_api_100_messages() -> Result<(), Box .await?; let decrypted = alice_engine - .decrypt_message("bob".to_string(), 1, ciphertext, false) + .decrypt_message("bob".to_string(), 1, ciphertext) .await?; assert_eq!(plaintext, decrypted); diff --git a/test/drift/twonly_db/generated/schema.dart b/test/drift/twonly_db/generated/schema.dart index 904ebc13..3014477c 100644 --- a/test/drift/twonly_db/generated/schema.dart +++ b/test/drift/twonly_db/generated/schema.dart @@ -28,6 +28,7 @@ import 'schema_v21.dart' as v21; import 'schema_v22.dart' as v22; import 'schema_v23.dart' as v23; import 'schema_v24.dart' as v24; +import 'schema_v25.dart' as v25; class GeneratedHelper implements SchemaInstantiationHelper { @override @@ -81,6 +82,8 @@ class GeneratedHelper implements SchemaInstantiationHelper { return v23.DatabaseAtV23(db); case 24: return v24.DatabaseAtV24(db); + case 25: + return v25.DatabaseAtV25(db); default: throw MissingSchemaException(version, versions); } @@ -111,5 +114,6 @@ class GeneratedHelper implements SchemaInstantiationHelper { 22, 23, 24, + 25, ]; } diff --git a/test/drift/twonly_db/generated/schema_v25.dart b/test/drift/twonly_db/generated/schema_v25.dart new file mode 100644 index 00000000..75366f90 --- /dev/null +++ b/test/drift/twonly_db/generated/schema_v25.dart @@ -0,0 +1,11328 @@ +// dart format width=80 +import 'dart:typed_data' as i2; +// GENERATED BY drift_dev, DO NOT MODIFY. +// ignore_for_file: type=lint,unused_import +// +import 'package:drift/drift.dart'; + +class Contacts extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Contacts(this.attachedDatabase, [this._alias]); + late final GeneratedColumn userId = GeneratedColumn( + 'user_id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: false, + ); + late final GeneratedColumn username = GeneratedColumn( + 'username', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + late final GeneratedColumn displayName = GeneratedColumn( + 'display_name', + aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + ); + late final GeneratedColumn nickName = GeneratedColumn( + 'nick_name', + aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + ); + late final GeneratedColumn avatarSvgCompressed = + GeneratedColumn( + 'avatar_svg_compressed', + aliasedName, + true, + type: DriftSqlType.blob, + requiredDuringInsert: false, + ); + late final GeneratedColumn senderProfileCounter = GeneratedColumn( + 'sender_profile_counter', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultValue: const Constant(0), + ); + late final GeneratedColumn accepted = GeneratedColumn( + 'accepted', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("accepted" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + late final GeneratedColumn deletedByUser = GeneratedColumn( + 'deleted_by_user', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("deleted_by_user" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + late final GeneratedColumn requested = GeneratedColumn( + 'requested', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("requested" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + late final GeneratedColumn blocked = GeneratedColumn( + 'blocked', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("blocked" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + late final GeneratedColumn verified = GeneratedColumn( + 'verified', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("verified" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + late final GeneratedColumn accountDeleted = GeneratedColumn( + 'account_deleted', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("account_deleted" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: currentDateAndTime, + ); + late final GeneratedColumn signalVersion = GeneratedColumn( + 'signal_version', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: const Constant('v1'), + ); + late final GeneratedColumn userDiscoveryVersion = + GeneratedColumn( + 'user_discovery_version', + aliasedName, + true, + type: DriftSqlType.blob, + requiredDuringInsert: false, + ); + late final GeneratedColumn userDiscoveryExcluded = + GeneratedColumn( + 'user_discovery_excluded', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("user_discovery_excluded" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + late final GeneratedColumn userDiscoveryManualApproved = + GeneratedColumn( + 'user_discovery_manual_approved', + aliasedName, + true, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("user_discovery_manual_approved" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + late final GeneratedColumn recoveryIsTrustedFriend = + GeneratedColumn( + 'recovery_is_trusted_friend', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("recovery_is_trusted_friend" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + late final GeneratedColumn recoveryLastHeartbeat = + GeneratedColumn( + 'recovery_last_heartbeat', + aliasedName, + true, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + ); + late final GeneratedColumn recoverySecretShare = + GeneratedColumn( + 'recovery_secret_share', + aliasedName, + true, + type: DriftSqlType.blob, + requiredDuringInsert: false, + ); + late final GeneratedColumn recoveryContactsSecretShare = + GeneratedColumn( + 'recovery_contacts_secret_share', + aliasedName, + true, + type: DriftSqlType.blob, + requiredDuringInsert: false, + ); + late final GeneratedColumn recoveryContactsLastHeartbeat = + GeneratedColumn( + 'recovery_contacts_last_heartbeat', + aliasedName, + true, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + ); + late final GeneratedColumn recoveryContactsThreshold = + GeneratedColumn( + 'recovery_contacts_threshold', + aliasedName, + true, + type: DriftSqlType.int, + requiredDuringInsert: false, + ); + late final GeneratedColumn askForFriendPromotions = + GeneratedColumn( + 'ask_for_friend_promotions', + aliasedName, + true, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("ask_for_friend_promotions" IN (0, 1))', + ), + ); + late final GeneratedColumn mediaSendCounter = GeneratedColumn( + 'media_send_counter', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultValue: const Constant(0), + ); + late final GeneratedColumn mediaReceivedCounter = GeneratedColumn( + 'media_received_counter', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultValue: const Constant(0), + ); + @override + List get $columns => [ + userId, + username, + displayName, + nickName, + avatarSvgCompressed, + senderProfileCounter, + accepted, + deletedByUser, + requested, + blocked, + verified, + accountDeleted, + createdAt, + signalVersion, + userDiscoveryVersion, + userDiscoveryExcluded, + userDiscoveryManualApproved, + recoveryIsTrustedFriend, + recoveryLastHeartbeat, + recoverySecretShare, + recoveryContactsSecretShare, + recoveryContactsLastHeartbeat, + recoveryContactsThreshold, + askForFriendPromotions, + mediaSendCounter, + mediaReceivedCounter, + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'contacts'; + @override + Set get $primaryKey => {userId}; + @override + ContactsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ContactsData( + userId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}user_id'], + )!, + username: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}username'], + )!, + displayName: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}display_name'], + ), + nickName: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}nick_name'], + ), + avatarSvgCompressed: attachedDatabase.typeMapping.read( + DriftSqlType.blob, + data['${effectivePrefix}avatar_svg_compressed'], + ), + senderProfileCounter: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}sender_profile_counter'], + )!, + accepted: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}accepted'], + )!, + deletedByUser: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}deleted_by_user'], + )!, + requested: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}requested'], + )!, + blocked: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}blocked'], + )!, + verified: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}verified'], + )!, + accountDeleted: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}account_deleted'], + )!, + createdAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}created_at'], + )!, + signalVersion: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}signal_version'], + )!, + userDiscoveryVersion: attachedDatabase.typeMapping.read( + DriftSqlType.blob, + data['${effectivePrefix}user_discovery_version'], + ), + userDiscoveryExcluded: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}user_discovery_excluded'], + )!, + userDiscoveryManualApproved: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}user_discovery_manual_approved'], + ), + recoveryIsTrustedFriend: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}recovery_is_trusted_friend'], + )!, + recoveryLastHeartbeat: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}recovery_last_heartbeat'], + ), + recoverySecretShare: attachedDatabase.typeMapping.read( + DriftSqlType.blob, + data['${effectivePrefix}recovery_secret_share'], + ), + recoveryContactsSecretShare: attachedDatabase.typeMapping.read( + DriftSqlType.blob, + data['${effectivePrefix}recovery_contacts_secret_share'], + ), + recoveryContactsLastHeartbeat: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}recovery_contacts_last_heartbeat'], + ), + recoveryContactsThreshold: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}recovery_contacts_threshold'], + ), + askForFriendPromotions: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}ask_for_friend_promotions'], + ), + mediaSendCounter: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}media_send_counter'], + )!, + mediaReceivedCounter: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}media_received_counter'], + )!, + ); + } + + @override + Contacts createAlias(String alias) { + return Contacts(attachedDatabase, alias); + } +} + +class ContactsData extends DataClass implements Insertable { + final int userId; + final String username; + final String? displayName; + final String? nickName; + final i2.Uint8List? avatarSvgCompressed; + final int senderProfileCounter; + final bool accepted; + final bool deletedByUser; + final bool requested; + final bool blocked; + final bool verified; + final bool accountDeleted; + final DateTime createdAt; + final String signalVersion; + final i2.Uint8List? userDiscoveryVersion; + final bool userDiscoveryExcluded; + final bool? userDiscoveryManualApproved; + final bool recoveryIsTrustedFriend; + final DateTime? recoveryLastHeartbeat; + final i2.Uint8List? recoverySecretShare; + final i2.Uint8List? recoveryContactsSecretShare; + final DateTime? recoveryContactsLastHeartbeat; + final int? recoveryContactsThreshold; + final bool? askForFriendPromotions; + final int mediaSendCounter; + final int mediaReceivedCounter; + const ContactsData({ + required this.userId, + required this.username, + this.displayName, + this.nickName, + this.avatarSvgCompressed, + required this.senderProfileCounter, + required this.accepted, + required this.deletedByUser, + required this.requested, + required this.blocked, + required this.verified, + required this.accountDeleted, + required this.createdAt, + required this.signalVersion, + this.userDiscoveryVersion, + required this.userDiscoveryExcluded, + this.userDiscoveryManualApproved, + required this.recoveryIsTrustedFriend, + this.recoveryLastHeartbeat, + this.recoverySecretShare, + this.recoveryContactsSecretShare, + this.recoveryContactsLastHeartbeat, + this.recoveryContactsThreshold, + this.askForFriendPromotions, + required this.mediaSendCounter, + required this.mediaReceivedCounter, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['user_id'] = Variable(userId); + map['username'] = Variable(username); + if (!nullToAbsent || displayName != null) { + map['display_name'] = Variable(displayName); + } + if (!nullToAbsent || nickName != null) { + map['nick_name'] = Variable(nickName); + } + if (!nullToAbsent || avatarSvgCompressed != null) { + map['avatar_svg_compressed'] = Variable( + avatarSvgCompressed, + ); + } + map['sender_profile_counter'] = Variable(senderProfileCounter); + map['accepted'] = Variable(accepted); + map['deleted_by_user'] = Variable(deletedByUser); + map['requested'] = Variable(requested); + map['blocked'] = Variable(blocked); + map['verified'] = Variable(verified); + map['account_deleted'] = Variable(accountDeleted); + map['created_at'] = Variable(createdAt); + map['signal_version'] = Variable(signalVersion); + if (!nullToAbsent || userDiscoveryVersion != null) { + map['user_discovery_version'] = Variable( + userDiscoveryVersion, + ); + } + map['user_discovery_excluded'] = Variable(userDiscoveryExcluded); + if (!nullToAbsent || userDiscoveryManualApproved != null) { + map['user_discovery_manual_approved'] = Variable( + userDiscoveryManualApproved, + ); + } + map['recovery_is_trusted_friend'] = Variable(recoveryIsTrustedFriend); + if (!nullToAbsent || recoveryLastHeartbeat != null) { + map['recovery_last_heartbeat'] = Variable( + recoveryLastHeartbeat, + ); + } + if (!nullToAbsent || recoverySecretShare != null) { + map['recovery_secret_share'] = Variable( + recoverySecretShare, + ); + } + if (!nullToAbsent || recoveryContactsSecretShare != null) { + map['recovery_contacts_secret_share'] = Variable( + recoveryContactsSecretShare, + ); + } + if (!nullToAbsent || recoveryContactsLastHeartbeat != null) { + map['recovery_contacts_last_heartbeat'] = Variable( + recoveryContactsLastHeartbeat, + ); + } + if (!nullToAbsent || recoveryContactsThreshold != null) { + map['recovery_contacts_threshold'] = Variable( + recoveryContactsThreshold, + ); + } + if (!nullToAbsent || askForFriendPromotions != null) { + map['ask_for_friend_promotions'] = Variable(askForFriendPromotions); + } + map['media_send_counter'] = Variable(mediaSendCounter); + map['media_received_counter'] = Variable(mediaReceivedCounter); + return map; + } + + ContactsCompanion toCompanion(bool nullToAbsent) { + return ContactsCompanion( + userId: Value(userId), + username: Value(username), + displayName: displayName == null && nullToAbsent + ? const Value.absent() + : Value(displayName), + nickName: nickName == null && nullToAbsent + ? const Value.absent() + : Value(nickName), + avatarSvgCompressed: avatarSvgCompressed == null && nullToAbsent + ? const Value.absent() + : Value(avatarSvgCompressed), + senderProfileCounter: Value(senderProfileCounter), + accepted: Value(accepted), + deletedByUser: Value(deletedByUser), + requested: Value(requested), + blocked: Value(blocked), + verified: Value(verified), + accountDeleted: Value(accountDeleted), + createdAt: Value(createdAt), + signalVersion: Value(signalVersion), + userDiscoveryVersion: userDiscoveryVersion == null && nullToAbsent + ? const Value.absent() + : Value(userDiscoveryVersion), + userDiscoveryExcluded: Value(userDiscoveryExcluded), + userDiscoveryManualApproved: + userDiscoveryManualApproved == null && nullToAbsent + ? const Value.absent() + : Value(userDiscoveryManualApproved), + recoveryIsTrustedFriend: Value(recoveryIsTrustedFriend), + recoveryLastHeartbeat: recoveryLastHeartbeat == null && nullToAbsent + ? const Value.absent() + : Value(recoveryLastHeartbeat), + recoverySecretShare: recoverySecretShare == null && nullToAbsent + ? const Value.absent() + : Value(recoverySecretShare), + recoveryContactsSecretShare: + recoveryContactsSecretShare == null && nullToAbsent + ? const Value.absent() + : Value(recoveryContactsSecretShare), + recoveryContactsLastHeartbeat: + recoveryContactsLastHeartbeat == null && nullToAbsent + ? const Value.absent() + : Value(recoveryContactsLastHeartbeat), + recoveryContactsThreshold: + recoveryContactsThreshold == null && nullToAbsent + ? const Value.absent() + : Value(recoveryContactsThreshold), + askForFriendPromotions: askForFriendPromotions == null && nullToAbsent + ? const Value.absent() + : Value(askForFriendPromotions), + mediaSendCounter: Value(mediaSendCounter), + mediaReceivedCounter: Value(mediaReceivedCounter), + ); + } + + factory ContactsData.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ContactsData( + userId: serializer.fromJson(json['userId']), + username: serializer.fromJson(json['username']), + displayName: serializer.fromJson(json['displayName']), + nickName: serializer.fromJson(json['nickName']), + avatarSvgCompressed: serializer.fromJson( + json['avatarSvgCompressed'], + ), + senderProfileCounter: serializer.fromJson( + json['senderProfileCounter'], + ), + accepted: serializer.fromJson(json['accepted']), + deletedByUser: serializer.fromJson(json['deletedByUser']), + requested: serializer.fromJson(json['requested']), + blocked: serializer.fromJson(json['blocked']), + verified: serializer.fromJson(json['verified']), + accountDeleted: serializer.fromJson(json['accountDeleted']), + createdAt: serializer.fromJson(json['createdAt']), + signalVersion: serializer.fromJson(json['signalVersion']), + userDiscoveryVersion: serializer.fromJson( + json['userDiscoveryVersion'], + ), + userDiscoveryExcluded: serializer.fromJson( + json['userDiscoveryExcluded'], + ), + userDiscoveryManualApproved: serializer.fromJson( + json['userDiscoveryManualApproved'], + ), + recoveryIsTrustedFriend: serializer.fromJson( + json['recoveryIsTrustedFriend'], + ), + recoveryLastHeartbeat: serializer.fromJson( + json['recoveryLastHeartbeat'], + ), + recoverySecretShare: serializer.fromJson( + json['recoverySecretShare'], + ), + recoveryContactsSecretShare: serializer.fromJson( + json['recoveryContactsSecretShare'], + ), + recoveryContactsLastHeartbeat: serializer.fromJson( + json['recoveryContactsLastHeartbeat'], + ), + recoveryContactsThreshold: serializer.fromJson( + json['recoveryContactsThreshold'], + ), + askForFriendPromotions: serializer.fromJson( + json['askForFriendPromotions'], + ), + mediaSendCounter: serializer.fromJson(json['mediaSendCounter']), + mediaReceivedCounter: serializer.fromJson( + json['mediaReceivedCounter'], + ), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'userId': serializer.toJson(userId), + 'username': serializer.toJson(username), + 'displayName': serializer.toJson(displayName), + 'nickName': serializer.toJson(nickName), + 'avatarSvgCompressed': serializer.toJson( + avatarSvgCompressed, + ), + 'senderProfileCounter': serializer.toJson(senderProfileCounter), + 'accepted': serializer.toJson(accepted), + 'deletedByUser': serializer.toJson(deletedByUser), + 'requested': serializer.toJson(requested), + 'blocked': serializer.toJson(blocked), + 'verified': serializer.toJson(verified), + 'accountDeleted': serializer.toJson(accountDeleted), + 'createdAt': serializer.toJson(createdAt), + 'signalVersion': serializer.toJson(signalVersion), + 'userDiscoveryVersion': serializer.toJson( + userDiscoveryVersion, + ), + 'userDiscoveryExcluded': serializer.toJson(userDiscoveryExcluded), + 'userDiscoveryManualApproved': serializer.toJson( + userDiscoveryManualApproved, + ), + 'recoveryIsTrustedFriend': serializer.toJson( + recoveryIsTrustedFriend, + ), + 'recoveryLastHeartbeat': serializer.toJson( + recoveryLastHeartbeat, + ), + 'recoverySecretShare': serializer.toJson( + recoverySecretShare, + ), + 'recoveryContactsSecretShare': serializer.toJson( + recoveryContactsSecretShare, + ), + 'recoveryContactsLastHeartbeat': serializer.toJson( + recoveryContactsLastHeartbeat, + ), + 'recoveryContactsThreshold': serializer.toJson( + recoveryContactsThreshold, + ), + 'askForFriendPromotions': serializer.toJson( + askForFriendPromotions, + ), + 'mediaSendCounter': serializer.toJson(mediaSendCounter), + 'mediaReceivedCounter': serializer.toJson(mediaReceivedCounter), + }; + } + + ContactsData copyWith({ + int? userId, + String? username, + Value displayName = const Value.absent(), + Value nickName = const Value.absent(), + Value avatarSvgCompressed = const Value.absent(), + int? senderProfileCounter, + bool? accepted, + bool? deletedByUser, + bool? requested, + bool? blocked, + bool? verified, + bool? accountDeleted, + DateTime? createdAt, + String? signalVersion, + Value userDiscoveryVersion = const Value.absent(), + bool? userDiscoveryExcluded, + Value userDiscoveryManualApproved = const Value.absent(), + bool? recoveryIsTrustedFriend, + Value recoveryLastHeartbeat = const Value.absent(), + Value recoverySecretShare = const Value.absent(), + Value recoveryContactsSecretShare = const Value.absent(), + Value recoveryContactsLastHeartbeat = const Value.absent(), + Value recoveryContactsThreshold = const Value.absent(), + Value askForFriendPromotions = const Value.absent(), + int? mediaSendCounter, + int? mediaReceivedCounter, + }) => ContactsData( + userId: userId ?? this.userId, + username: username ?? this.username, + displayName: displayName.present ? displayName.value : this.displayName, + nickName: nickName.present ? nickName.value : this.nickName, + avatarSvgCompressed: avatarSvgCompressed.present + ? avatarSvgCompressed.value + : this.avatarSvgCompressed, + senderProfileCounter: senderProfileCounter ?? this.senderProfileCounter, + accepted: accepted ?? this.accepted, + deletedByUser: deletedByUser ?? this.deletedByUser, + requested: requested ?? this.requested, + blocked: blocked ?? this.blocked, + verified: verified ?? this.verified, + accountDeleted: accountDeleted ?? this.accountDeleted, + createdAt: createdAt ?? this.createdAt, + signalVersion: signalVersion ?? this.signalVersion, + userDiscoveryVersion: userDiscoveryVersion.present + ? userDiscoveryVersion.value + : this.userDiscoveryVersion, + userDiscoveryExcluded: userDiscoveryExcluded ?? this.userDiscoveryExcluded, + userDiscoveryManualApproved: userDiscoveryManualApproved.present + ? userDiscoveryManualApproved.value + : this.userDiscoveryManualApproved, + recoveryIsTrustedFriend: + recoveryIsTrustedFriend ?? this.recoveryIsTrustedFriend, + recoveryLastHeartbeat: recoveryLastHeartbeat.present + ? recoveryLastHeartbeat.value + : this.recoveryLastHeartbeat, + recoverySecretShare: recoverySecretShare.present + ? recoverySecretShare.value + : this.recoverySecretShare, + recoveryContactsSecretShare: recoveryContactsSecretShare.present + ? recoveryContactsSecretShare.value + : this.recoveryContactsSecretShare, + recoveryContactsLastHeartbeat: recoveryContactsLastHeartbeat.present + ? recoveryContactsLastHeartbeat.value + : this.recoveryContactsLastHeartbeat, + recoveryContactsThreshold: recoveryContactsThreshold.present + ? recoveryContactsThreshold.value + : this.recoveryContactsThreshold, + askForFriendPromotions: askForFriendPromotions.present + ? askForFriendPromotions.value + : this.askForFriendPromotions, + mediaSendCounter: mediaSendCounter ?? this.mediaSendCounter, + mediaReceivedCounter: mediaReceivedCounter ?? this.mediaReceivedCounter, + ); + ContactsData copyWithCompanion(ContactsCompanion data) { + return ContactsData( + userId: data.userId.present ? data.userId.value : this.userId, + username: data.username.present ? data.username.value : this.username, + displayName: data.displayName.present + ? data.displayName.value + : this.displayName, + nickName: data.nickName.present ? data.nickName.value : this.nickName, + avatarSvgCompressed: data.avatarSvgCompressed.present + ? data.avatarSvgCompressed.value + : this.avatarSvgCompressed, + senderProfileCounter: data.senderProfileCounter.present + ? data.senderProfileCounter.value + : this.senderProfileCounter, + accepted: data.accepted.present ? data.accepted.value : this.accepted, + deletedByUser: data.deletedByUser.present + ? data.deletedByUser.value + : this.deletedByUser, + requested: data.requested.present ? data.requested.value : this.requested, + blocked: data.blocked.present ? data.blocked.value : this.blocked, + verified: data.verified.present ? data.verified.value : this.verified, + accountDeleted: data.accountDeleted.present + ? data.accountDeleted.value + : this.accountDeleted, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + signalVersion: data.signalVersion.present + ? data.signalVersion.value + : this.signalVersion, + userDiscoveryVersion: data.userDiscoveryVersion.present + ? data.userDiscoveryVersion.value + : this.userDiscoveryVersion, + userDiscoveryExcluded: data.userDiscoveryExcluded.present + ? data.userDiscoveryExcluded.value + : this.userDiscoveryExcluded, + userDiscoveryManualApproved: data.userDiscoveryManualApproved.present + ? data.userDiscoveryManualApproved.value + : this.userDiscoveryManualApproved, + recoveryIsTrustedFriend: data.recoveryIsTrustedFriend.present + ? data.recoveryIsTrustedFriend.value + : this.recoveryIsTrustedFriend, + recoveryLastHeartbeat: data.recoveryLastHeartbeat.present + ? data.recoveryLastHeartbeat.value + : this.recoveryLastHeartbeat, + recoverySecretShare: data.recoverySecretShare.present + ? data.recoverySecretShare.value + : this.recoverySecretShare, + recoveryContactsSecretShare: data.recoveryContactsSecretShare.present + ? data.recoveryContactsSecretShare.value + : this.recoveryContactsSecretShare, + recoveryContactsLastHeartbeat: data.recoveryContactsLastHeartbeat.present + ? data.recoveryContactsLastHeartbeat.value + : this.recoveryContactsLastHeartbeat, + recoveryContactsThreshold: data.recoveryContactsThreshold.present + ? data.recoveryContactsThreshold.value + : this.recoveryContactsThreshold, + askForFriendPromotions: data.askForFriendPromotions.present + ? data.askForFriendPromotions.value + : this.askForFriendPromotions, + mediaSendCounter: data.mediaSendCounter.present + ? data.mediaSendCounter.value + : this.mediaSendCounter, + mediaReceivedCounter: data.mediaReceivedCounter.present + ? data.mediaReceivedCounter.value + : this.mediaReceivedCounter, + ); + } + + @override + String toString() { + return (StringBuffer('ContactsData(') + ..write('userId: $userId, ') + ..write('username: $username, ') + ..write('displayName: $displayName, ') + ..write('nickName: $nickName, ') + ..write('avatarSvgCompressed: $avatarSvgCompressed, ') + ..write('senderProfileCounter: $senderProfileCounter, ') + ..write('accepted: $accepted, ') + ..write('deletedByUser: $deletedByUser, ') + ..write('requested: $requested, ') + ..write('blocked: $blocked, ') + ..write('verified: $verified, ') + ..write('accountDeleted: $accountDeleted, ') + ..write('createdAt: $createdAt, ') + ..write('signalVersion: $signalVersion, ') + ..write('userDiscoveryVersion: $userDiscoveryVersion, ') + ..write('userDiscoveryExcluded: $userDiscoveryExcluded, ') + ..write('userDiscoveryManualApproved: $userDiscoveryManualApproved, ') + ..write('recoveryIsTrustedFriend: $recoveryIsTrustedFriend, ') + ..write('recoveryLastHeartbeat: $recoveryLastHeartbeat, ') + ..write('recoverySecretShare: $recoverySecretShare, ') + ..write('recoveryContactsSecretShare: $recoveryContactsSecretShare, ') + ..write( + 'recoveryContactsLastHeartbeat: $recoveryContactsLastHeartbeat, ', + ) + ..write('recoveryContactsThreshold: $recoveryContactsThreshold, ') + ..write('askForFriendPromotions: $askForFriendPromotions, ') + ..write('mediaSendCounter: $mediaSendCounter, ') + ..write('mediaReceivedCounter: $mediaReceivedCounter') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hashAll([ + userId, + username, + displayName, + nickName, + $driftBlobEquality.hash(avatarSvgCompressed), + senderProfileCounter, + accepted, + deletedByUser, + requested, + blocked, + verified, + accountDeleted, + createdAt, + signalVersion, + $driftBlobEquality.hash(userDiscoveryVersion), + userDiscoveryExcluded, + userDiscoveryManualApproved, + recoveryIsTrustedFriend, + recoveryLastHeartbeat, + $driftBlobEquality.hash(recoverySecretShare), + $driftBlobEquality.hash(recoveryContactsSecretShare), + recoveryContactsLastHeartbeat, + recoveryContactsThreshold, + askForFriendPromotions, + mediaSendCounter, + mediaReceivedCounter, + ]); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ContactsData && + other.userId == this.userId && + other.username == this.username && + other.displayName == this.displayName && + other.nickName == this.nickName && + $driftBlobEquality.equals( + other.avatarSvgCompressed, + this.avatarSvgCompressed, + ) && + other.senderProfileCounter == this.senderProfileCounter && + other.accepted == this.accepted && + other.deletedByUser == this.deletedByUser && + other.requested == this.requested && + other.blocked == this.blocked && + other.verified == this.verified && + other.accountDeleted == this.accountDeleted && + other.createdAt == this.createdAt && + other.signalVersion == this.signalVersion && + $driftBlobEquality.equals( + other.userDiscoveryVersion, + this.userDiscoveryVersion, + ) && + other.userDiscoveryExcluded == this.userDiscoveryExcluded && + other.userDiscoveryManualApproved == + this.userDiscoveryManualApproved && + other.recoveryIsTrustedFriend == this.recoveryIsTrustedFriend && + other.recoveryLastHeartbeat == this.recoveryLastHeartbeat && + $driftBlobEquality.equals( + other.recoverySecretShare, + this.recoverySecretShare, + ) && + $driftBlobEquality.equals( + other.recoveryContactsSecretShare, + this.recoveryContactsSecretShare, + ) && + other.recoveryContactsLastHeartbeat == + this.recoveryContactsLastHeartbeat && + other.recoveryContactsThreshold == this.recoveryContactsThreshold && + other.askForFriendPromotions == this.askForFriendPromotions && + other.mediaSendCounter == this.mediaSendCounter && + other.mediaReceivedCounter == this.mediaReceivedCounter); +} + +class ContactsCompanion extends UpdateCompanion { + final Value userId; + final Value username; + final Value displayName; + final Value nickName; + final Value avatarSvgCompressed; + final Value senderProfileCounter; + final Value accepted; + final Value deletedByUser; + final Value requested; + final Value blocked; + final Value verified; + final Value accountDeleted; + final Value createdAt; + final Value signalVersion; + final Value userDiscoveryVersion; + final Value userDiscoveryExcluded; + final Value userDiscoveryManualApproved; + final Value recoveryIsTrustedFriend; + final Value recoveryLastHeartbeat; + final Value recoverySecretShare; + final Value recoveryContactsSecretShare; + final Value recoveryContactsLastHeartbeat; + final Value recoveryContactsThreshold; + final Value askForFriendPromotions; + final Value mediaSendCounter; + final Value mediaReceivedCounter; + const ContactsCompanion({ + this.userId = const Value.absent(), + this.username = const Value.absent(), + this.displayName = const Value.absent(), + this.nickName = const Value.absent(), + this.avatarSvgCompressed = const Value.absent(), + this.senderProfileCounter = const Value.absent(), + this.accepted = const Value.absent(), + this.deletedByUser = const Value.absent(), + this.requested = const Value.absent(), + this.blocked = const Value.absent(), + this.verified = const Value.absent(), + this.accountDeleted = const Value.absent(), + this.createdAt = const Value.absent(), + this.signalVersion = const Value.absent(), + this.userDiscoveryVersion = const Value.absent(), + this.userDiscoveryExcluded = const Value.absent(), + this.userDiscoveryManualApproved = const Value.absent(), + this.recoveryIsTrustedFriend = const Value.absent(), + this.recoveryLastHeartbeat = const Value.absent(), + this.recoverySecretShare = const Value.absent(), + this.recoveryContactsSecretShare = const Value.absent(), + this.recoveryContactsLastHeartbeat = const Value.absent(), + this.recoveryContactsThreshold = const Value.absent(), + this.askForFriendPromotions = const Value.absent(), + this.mediaSendCounter = const Value.absent(), + this.mediaReceivedCounter = const Value.absent(), + }); + ContactsCompanion.insert({ + this.userId = const Value.absent(), + required String username, + this.displayName = const Value.absent(), + this.nickName = const Value.absent(), + this.avatarSvgCompressed = const Value.absent(), + this.senderProfileCounter = const Value.absent(), + this.accepted = const Value.absent(), + this.deletedByUser = const Value.absent(), + this.requested = const Value.absent(), + this.blocked = const Value.absent(), + this.verified = const Value.absent(), + this.accountDeleted = const Value.absent(), + this.createdAt = const Value.absent(), + this.signalVersion = const Value.absent(), + this.userDiscoveryVersion = const Value.absent(), + this.userDiscoveryExcluded = const Value.absent(), + this.userDiscoveryManualApproved = const Value.absent(), + this.recoveryIsTrustedFriend = const Value.absent(), + this.recoveryLastHeartbeat = const Value.absent(), + this.recoverySecretShare = const Value.absent(), + this.recoveryContactsSecretShare = const Value.absent(), + this.recoveryContactsLastHeartbeat = const Value.absent(), + this.recoveryContactsThreshold = const Value.absent(), + this.askForFriendPromotions = const Value.absent(), + this.mediaSendCounter = const Value.absent(), + this.mediaReceivedCounter = const Value.absent(), + }) : username = Value(username); + static Insertable custom({ + Expression? userId, + Expression? username, + Expression? displayName, + Expression? nickName, + Expression? avatarSvgCompressed, + Expression? senderProfileCounter, + Expression? accepted, + Expression? deletedByUser, + Expression? requested, + Expression? blocked, + Expression? verified, + Expression? accountDeleted, + Expression? createdAt, + Expression? signalVersion, + Expression? userDiscoveryVersion, + Expression? userDiscoveryExcluded, + Expression? userDiscoveryManualApproved, + Expression? recoveryIsTrustedFriend, + Expression? recoveryLastHeartbeat, + Expression? recoverySecretShare, + Expression? recoveryContactsSecretShare, + Expression? recoveryContactsLastHeartbeat, + Expression? recoveryContactsThreshold, + Expression? askForFriendPromotions, + Expression? mediaSendCounter, + Expression? mediaReceivedCounter, + }) { + return RawValuesInsertable({ + if (userId != null) 'user_id': userId, + if (username != null) 'username': username, + if (displayName != null) 'display_name': displayName, + if (nickName != null) 'nick_name': nickName, + if (avatarSvgCompressed != null) + 'avatar_svg_compressed': avatarSvgCompressed, + if (senderProfileCounter != null) + 'sender_profile_counter': senderProfileCounter, + if (accepted != null) 'accepted': accepted, + if (deletedByUser != null) 'deleted_by_user': deletedByUser, + if (requested != null) 'requested': requested, + if (blocked != null) 'blocked': blocked, + if (verified != null) 'verified': verified, + if (accountDeleted != null) 'account_deleted': accountDeleted, + if (createdAt != null) 'created_at': createdAt, + if (signalVersion != null) 'signal_version': signalVersion, + if (userDiscoveryVersion != null) + 'user_discovery_version': userDiscoveryVersion, + if (userDiscoveryExcluded != null) + 'user_discovery_excluded': userDiscoveryExcluded, + if (userDiscoveryManualApproved != null) + 'user_discovery_manual_approved': userDiscoveryManualApproved, + if (recoveryIsTrustedFriend != null) + 'recovery_is_trusted_friend': recoveryIsTrustedFriend, + if (recoveryLastHeartbeat != null) + 'recovery_last_heartbeat': recoveryLastHeartbeat, + if (recoverySecretShare != null) + 'recovery_secret_share': recoverySecretShare, + if (recoveryContactsSecretShare != null) + 'recovery_contacts_secret_share': recoveryContactsSecretShare, + if (recoveryContactsLastHeartbeat != null) + 'recovery_contacts_last_heartbeat': recoveryContactsLastHeartbeat, + if (recoveryContactsThreshold != null) + 'recovery_contacts_threshold': recoveryContactsThreshold, + if (askForFriendPromotions != null) + 'ask_for_friend_promotions': askForFriendPromotions, + if (mediaSendCounter != null) 'media_send_counter': mediaSendCounter, + if (mediaReceivedCounter != null) + 'media_received_counter': mediaReceivedCounter, + }); + } + + ContactsCompanion copyWith({ + Value? userId, + Value? username, + Value? displayName, + Value? nickName, + Value? avatarSvgCompressed, + Value? senderProfileCounter, + Value? accepted, + Value? deletedByUser, + Value? requested, + Value? blocked, + Value? verified, + Value? accountDeleted, + Value? createdAt, + Value? signalVersion, + Value? userDiscoveryVersion, + Value? userDiscoveryExcluded, + Value? userDiscoveryManualApproved, + Value? recoveryIsTrustedFriend, + Value? recoveryLastHeartbeat, + Value? recoverySecretShare, + Value? recoveryContactsSecretShare, + Value? recoveryContactsLastHeartbeat, + Value? recoveryContactsThreshold, + Value? askForFriendPromotions, + Value? mediaSendCounter, + Value? mediaReceivedCounter, + }) { + return ContactsCompanion( + userId: userId ?? this.userId, + username: username ?? this.username, + displayName: displayName ?? this.displayName, + nickName: nickName ?? this.nickName, + avatarSvgCompressed: avatarSvgCompressed ?? this.avatarSvgCompressed, + senderProfileCounter: senderProfileCounter ?? this.senderProfileCounter, + accepted: accepted ?? this.accepted, + deletedByUser: deletedByUser ?? this.deletedByUser, + requested: requested ?? this.requested, + blocked: blocked ?? this.blocked, + verified: verified ?? this.verified, + accountDeleted: accountDeleted ?? this.accountDeleted, + createdAt: createdAt ?? this.createdAt, + signalVersion: signalVersion ?? this.signalVersion, + userDiscoveryVersion: userDiscoveryVersion ?? this.userDiscoveryVersion, + userDiscoveryExcluded: + userDiscoveryExcluded ?? this.userDiscoveryExcluded, + userDiscoveryManualApproved: + userDiscoveryManualApproved ?? this.userDiscoveryManualApproved, + recoveryIsTrustedFriend: + recoveryIsTrustedFriend ?? this.recoveryIsTrustedFriend, + recoveryLastHeartbeat: + recoveryLastHeartbeat ?? this.recoveryLastHeartbeat, + recoverySecretShare: recoverySecretShare ?? this.recoverySecretShare, + recoveryContactsSecretShare: + recoveryContactsSecretShare ?? this.recoveryContactsSecretShare, + recoveryContactsLastHeartbeat: + recoveryContactsLastHeartbeat ?? this.recoveryContactsLastHeartbeat, + recoveryContactsThreshold: + recoveryContactsThreshold ?? this.recoveryContactsThreshold, + askForFriendPromotions: + askForFriendPromotions ?? this.askForFriendPromotions, + mediaSendCounter: mediaSendCounter ?? this.mediaSendCounter, + mediaReceivedCounter: mediaReceivedCounter ?? this.mediaReceivedCounter, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (userId.present) { + map['user_id'] = Variable(userId.value); + } + if (username.present) { + map['username'] = Variable(username.value); + } + if (displayName.present) { + map['display_name'] = Variable(displayName.value); + } + if (nickName.present) { + map['nick_name'] = Variable(nickName.value); + } + if (avatarSvgCompressed.present) { + map['avatar_svg_compressed'] = Variable( + avatarSvgCompressed.value, + ); + } + if (senderProfileCounter.present) { + map['sender_profile_counter'] = Variable(senderProfileCounter.value); + } + if (accepted.present) { + map['accepted'] = Variable(accepted.value); + } + if (deletedByUser.present) { + map['deleted_by_user'] = Variable(deletedByUser.value); + } + if (requested.present) { + map['requested'] = Variable(requested.value); + } + if (blocked.present) { + map['blocked'] = Variable(blocked.value); + } + if (verified.present) { + map['verified'] = Variable(verified.value); + } + if (accountDeleted.present) { + map['account_deleted'] = Variable(accountDeleted.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + if (signalVersion.present) { + map['signal_version'] = Variable(signalVersion.value); + } + if (userDiscoveryVersion.present) { + map['user_discovery_version'] = Variable( + userDiscoveryVersion.value, + ); + } + if (userDiscoveryExcluded.present) { + map['user_discovery_excluded'] = Variable( + userDiscoveryExcluded.value, + ); + } + if (userDiscoveryManualApproved.present) { + map['user_discovery_manual_approved'] = Variable( + userDiscoveryManualApproved.value, + ); + } + if (recoveryIsTrustedFriend.present) { + map['recovery_is_trusted_friend'] = Variable( + recoveryIsTrustedFriend.value, + ); + } + if (recoveryLastHeartbeat.present) { + map['recovery_last_heartbeat'] = Variable( + recoveryLastHeartbeat.value, + ); + } + if (recoverySecretShare.present) { + map['recovery_secret_share'] = Variable( + recoverySecretShare.value, + ); + } + if (recoveryContactsSecretShare.present) { + map['recovery_contacts_secret_share'] = Variable( + recoveryContactsSecretShare.value, + ); + } + if (recoveryContactsLastHeartbeat.present) { + map['recovery_contacts_last_heartbeat'] = Variable( + recoveryContactsLastHeartbeat.value, + ); + } + if (recoveryContactsThreshold.present) { + map['recovery_contacts_threshold'] = Variable( + recoveryContactsThreshold.value, + ); + } + if (askForFriendPromotions.present) { + map['ask_for_friend_promotions'] = Variable( + askForFriendPromotions.value, + ); + } + if (mediaSendCounter.present) { + map['media_send_counter'] = Variable(mediaSendCounter.value); + } + if (mediaReceivedCounter.present) { + map['media_received_counter'] = Variable(mediaReceivedCounter.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ContactsCompanion(') + ..write('userId: $userId, ') + ..write('username: $username, ') + ..write('displayName: $displayName, ') + ..write('nickName: $nickName, ') + ..write('avatarSvgCompressed: $avatarSvgCompressed, ') + ..write('senderProfileCounter: $senderProfileCounter, ') + ..write('accepted: $accepted, ') + ..write('deletedByUser: $deletedByUser, ') + ..write('requested: $requested, ') + ..write('blocked: $blocked, ') + ..write('verified: $verified, ') + ..write('accountDeleted: $accountDeleted, ') + ..write('createdAt: $createdAt, ') + ..write('signalVersion: $signalVersion, ') + ..write('userDiscoveryVersion: $userDiscoveryVersion, ') + ..write('userDiscoveryExcluded: $userDiscoveryExcluded, ') + ..write('userDiscoveryManualApproved: $userDiscoveryManualApproved, ') + ..write('recoveryIsTrustedFriend: $recoveryIsTrustedFriend, ') + ..write('recoveryLastHeartbeat: $recoveryLastHeartbeat, ') + ..write('recoverySecretShare: $recoverySecretShare, ') + ..write('recoveryContactsSecretShare: $recoveryContactsSecretShare, ') + ..write( + 'recoveryContactsLastHeartbeat: $recoveryContactsLastHeartbeat, ', + ) + ..write('recoveryContactsThreshold: $recoveryContactsThreshold, ') + ..write('askForFriendPromotions: $askForFriendPromotions, ') + ..write('mediaSendCounter: $mediaSendCounter, ') + ..write('mediaReceivedCounter: $mediaReceivedCounter') + ..write(')')) + .toString(); + } +} + +class Groups extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Groups(this.attachedDatabase, [this._alias]); + late final GeneratedColumn groupId = GeneratedColumn( + 'group_id', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + late final GeneratedColumn isGroupAdmin = GeneratedColumn( + 'is_group_admin', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("is_group_admin" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + late final GeneratedColumn isDirectChat = GeneratedColumn( + 'is_direct_chat', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("is_direct_chat" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + late final GeneratedColumn pinned = GeneratedColumn( + 'pinned', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("pinned" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + late final GeneratedColumn archived = GeneratedColumn( + 'archived', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("archived" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + late final GeneratedColumn joinedGroup = GeneratedColumn( + 'joined_group', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("joined_group" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + late final GeneratedColumn leftGroup = GeneratedColumn( + 'left_group', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("left_group" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + late final GeneratedColumn deletedContent = GeneratedColumn( + 'deleted_content', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("deleted_content" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + late final GeneratedColumn stateVersionId = GeneratedColumn( + 'state_version_id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultValue: const Constant(0), + ); + late final GeneratedColumn stateEncryptionKey = + GeneratedColumn( + 'state_encryption_key', + aliasedName, + true, + type: DriftSqlType.blob, + requiredDuringInsert: false, + ); + late final GeneratedColumn myGroupPrivateKey = + GeneratedColumn( + 'my_group_private_key', + aliasedName, + true, + type: DriftSqlType.blob, + requiredDuringInsert: false, + ); + late final GeneratedColumn groupName = GeneratedColumn( + 'group_name', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + late final GeneratedColumn draftMessage = GeneratedColumn( + 'draft_message', + aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + ); + late final GeneratedColumn totalMediaCounter = GeneratedColumn( + 'total_media_counter', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultValue: const Constant(0), + ); + late final GeneratedColumn alsoBestFriend = GeneratedColumn( + 'also_best_friend', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("also_best_friend" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + late final GeneratedColumn deleteMessagesAfterMilliseconds = + GeneratedColumn( + 'delete_messages_after_milliseconds', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultValue: const Constant(86400000), + ); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: currentDateAndTime, + ); + late final GeneratedColumn lastMessageSend = + GeneratedColumn( + 'last_message_send', + aliasedName, + true, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + ); + late final GeneratedColumn lastMessageReceived = + GeneratedColumn( + 'last_message_received', + aliasedName, + true, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + ); + late final GeneratedColumn lastFlameCounterChange = + GeneratedColumn( + 'last_flame_counter_change', + aliasedName, + true, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + ); + late final GeneratedColumn lastFlameSync = + GeneratedColumn( + 'last_flame_sync', + aliasedName, + true, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + ); + late final GeneratedColumn flameCounter = GeneratedColumn( + 'flame_counter', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultValue: const Constant(0), + ); + late final GeneratedColumn maxFlameCounter = GeneratedColumn( + 'max_flame_counter', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultValue: const Constant(0), + ); + late final GeneratedColumn maxFlameCounterFrom = + GeneratedColumn( + 'max_flame_counter_from', + aliasedName, + true, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + ); + late final GeneratedColumn lastMessageExchange = + GeneratedColumn( + 'last_message_exchange', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: currentDateAndTime, + ); + @override + List get $columns => [ + groupId, + isGroupAdmin, + isDirectChat, + pinned, + archived, + joinedGroup, + leftGroup, + deletedContent, + stateVersionId, + stateEncryptionKey, + myGroupPrivateKey, + groupName, + draftMessage, + totalMediaCounter, + alsoBestFriend, + deleteMessagesAfterMilliseconds, + createdAt, + lastMessageSend, + lastMessageReceived, + lastFlameCounterChange, + lastFlameSync, + flameCounter, + maxFlameCounter, + maxFlameCounterFrom, + lastMessageExchange, + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'groups'; + @override + Set get $primaryKey => {groupId}; + @override + GroupsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return GroupsData( + groupId: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}group_id'], + )!, + isGroupAdmin: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}is_group_admin'], + )!, + isDirectChat: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}is_direct_chat'], + )!, + pinned: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}pinned'], + )!, + archived: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}archived'], + )!, + joinedGroup: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}joined_group'], + )!, + leftGroup: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}left_group'], + )!, + deletedContent: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}deleted_content'], + )!, + stateVersionId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}state_version_id'], + )!, + stateEncryptionKey: attachedDatabase.typeMapping.read( + DriftSqlType.blob, + data['${effectivePrefix}state_encryption_key'], + ), + myGroupPrivateKey: attachedDatabase.typeMapping.read( + DriftSqlType.blob, + data['${effectivePrefix}my_group_private_key'], + ), + groupName: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}group_name'], + )!, + draftMessage: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}draft_message'], + ), + totalMediaCounter: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}total_media_counter'], + )!, + alsoBestFriend: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}also_best_friend'], + )!, + deleteMessagesAfterMilliseconds: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}delete_messages_after_milliseconds'], + )!, + createdAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}created_at'], + )!, + lastMessageSend: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}last_message_send'], + ), + lastMessageReceived: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}last_message_received'], + ), + lastFlameCounterChange: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}last_flame_counter_change'], + ), + lastFlameSync: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}last_flame_sync'], + ), + flameCounter: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}flame_counter'], + )!, + maxFlameCounter: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}max_flame_counter'], + )!, + maxFlameCounterFrom: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}max_flame_counter_from'], + ), + lastMessageExchange: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}last_message_exchange'], + )!, + ); + } + + @override + Groups createAlias(String alias) { + return Groups(attachedDatabase, alias); + } +} + +class GroupsData extends DataClass implements Insertable { + final String groupId; + final bool isGroupAdmin; + final bool isDirectChat; + final bool pinned; + final bool archived; + final bool joinedGroup; + final bool leftGroup; + final bool deletedContent; + final int stateVersionId; + final i2.Uint8List? stateEncryptionKey; + final i2.Uint8List? myGroupPrivateKey; + final String groupName; + final String? draftMessage; + final int totalMediaCounter; + final bool alsoBestFriend; + final int deleteMessagesAfterMilliseconds; + final DateTime createdAt; + final DateTime? lastMessageSend; + final DateTime? lastMessageReceived; + final DateTime? lastFlameCounterChange; + final DateTime? lastFlameSync; + final int flameCounter; + final int maxFlameCounter; + final DateTime? maxFlameCounterFrom; + final DateTime lastMessageExchange; + const GroupsData({ + required this.groupId, + required this.isGroupAdmin, + required this.isDirectChat, + required this.pinned, + required this.archived, + required this.joinedGroup, + required this.leftGroup, + required this.deletedContent, + required this.stateVersionId, + this.stateEncryptionKey, + this.myGroupPrivateKey, + required this.groupName, + this.draftMessage, + required this.totalMediaCounter, + required this.alsoBestFriend, + required this.deleteMessagesAfterMilliseconds, + required this.createdAt, + this.lastMessageSend, + this.lastMessageReceived, + this.lastFlameCounterChange, + this.lastFlameSync, + required this.flameCounter, + required this.maxFlameCounter, + this.maxFlameCounterFrom, + required this.lastMessageExchange, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['group_id'] = Variable(groupId); + map['is_group_admin'] = Variable(isGroupAdmin); + map['is_direct_chat'] = Variable(isDirectChat); + map['pinned'] = Variable(pinned); + map['archived'] = Variable(archived); + map['joined_group'] = Variable(joinedGroup); + map['left_group'] = Variable(leftGroup); + map['deleted_content'] = Variable(deletedContent); + map['state_version_id'] = Variable(stateVersionId); + if (!nullToAbsent || stateEncryptionKey != null) { + map['state_encryption_key'] = Variable(stateEncryptionKey); + } + if (!nullToAbsent || myGroupPrivateKey != null) { + map['my_group_private_key'] = Variable(myGroupPrivateKey); + } + map['group_name'] = Variable(groupName); + if (!nullToAbsent || draftMessage != null) { + map['draft_message'] = Variable(draftMessage); + } + map['total_media_counter'] = Variable(totalMediaCounter); + map['also_best_friend'] = Variable(alsoBestFriend); + map['delete_messages_after_milliseconds'] = Variable( + deleteMessagesAfterMilliseconds, + ); + map['created_at'] = Variable(createdAt); + if (!nullToAbsent || lastMessageSend != null) { + map['last_message_send'] = Variable(lastMessageSend); + } + if (!nullToAbsent || lastMessageReceived != null) { + map['last_message_received'] = Variable(lastMessageReceived); + } + if (!nullToAbsent || lastFlameCounterChange != null) { + map['last_flame_counter_change'] = Variable( + lastFlameCounterChange, + ); + } + if (!nullToAbsent || lastFlameSync != null) { + map['last_flame_sync'] = Variable(lastFlameSync); + } + map['flame_counter'] = Variable(flameCounter); + map['max_flame_counter'] = Variable(maxFlameCounter); + if (!nullToAbsent || maxFlameCounterFrom != null) { + map['max_flame_counter_from'] = Variable(maxFlameCounterFrom); + } + map['last_message_exchange'] = Variable(lastMessageExchange); + return map; + } + + GroupsCompanion toCompanion(bool nullToAbsent) { + return GroupsCompanion( + groupId: Value(groupId), + isGroupAdmin: Value(isGroupAdmin), + isDirectChat: Value(isDirectChat), + pinned: Value(pinned), + archived: Value(archived), + joinedGroup: Value(joinedGroup), + leftGroup: Value(leftGroup), + deletedContent: Value(deletedContent), + stateVersionId: Value(stateVersionId), + stateEncryptionKey: stateEncryptionKey == null && nullToAbsent + ? const Value.absent() + : Value(stateEncryptionKey), + myGroupPrivateKey: myGroupPrivateKey == null && nullToAbsent + ? const Value.absent() + : Value(myGroupPrivateKey), + groupName: Value(groupName), + draftMessage: draftMessage == null && nullToAbsent + ? const Value.absent() + : Value(draftMessage), + totalMediaCounter: Value(totalMediaCounter), + alsoBestFriend: Value(alsoBestFriend), + deleteMessagesAfterMilliseconds: Value(deleteMessagesAfterMilliseconds), + createdAt: Value(createdAt), + lastMessageSend: lastMessageSend == null && nullToAbsent + ? const Value.absent() + : Value(lastMessageSend), + lastMessageReceived: lastMessageReceived == null && nullToAbsent + ? const Value.absent() + : Value(lastMessageReceived), + lastFlameCounterChange: lastFlameCounterChange == null && nullToAbsent + ? const Value.absent() + : Value(lastFlameCounterChange), + lastFlameSync: lastFlameSync == null && nullToAbsent + ? const Value.absent() + : Value(lastFlameSync), + flameCounter: Value(flameCounter), + maxFlameCounter: Value(maxFlameCounter), + maxFlameCounterFrom: maxFlameCounterFrom == null && nullToAbsent + ? const Value.absent() + : Value(maxFlameCounterFrom), + lastMessageExchange: Value(lastMessageExchange), + ); + } + + factory GroupsData.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return GroupsData( + groupId: serializer.fromJson(json['groupId']), + isGroupAdmin: serializer.fromJson(json['isGroupAdmin']), + isDirectChat: serializer.fromJson(json['isDirectChat']), + pinned: serializer.fromJson(json['pinned']), + archived: serializer.fromJson(json['archived']), + joinedGroup: serializer.fromJson(json['joinedGroup']), + leftGroup: serializer.fromJson(json['leftGroup']), + deletedContent: serializer.fromJson(json['deletedContent']), + stateVersionId: serializer.fromJson(json['stateVersionId']), + stateEncryptionKey: serializer.fromJson( + json['stateEncryptionKey'], + ), + myGroupPrivateKey: serializer.fromJson( + json['myGroupPrivateKey'], + ), + groupName: serializer.fromJson(json['groupName']), + draftMessage: serializer.fromJson(json['draftMessage']), + totalMediaCounter: serializer.fromJson(json['totalMediaCounter']), + alsoBestFriend: serializer.fromJson(json['alsoBestFriend']), + deleteMessagesAfterMilliseconds: serializer.fromJson( + json['deleteMessagesAfterMilliseconds'], + ), + createdAt: serializer.fromJson(json['createdAt']), + lastMessageSend: serializer.fromJson(json['lastMessageSend']), + lastMessageReceived: serializer.fromJson( + json['lastMessageReceived'], + ), + lastFlameCounterChange: serializer.fromJson( + json['lastFlameCounterChange'], + ), + lastFlameSync: serializer.fromJson(json['lastFlameSync']), + flameCounter: serializer.fromJson(json['flameCounter']), + maxFlameCounter: serializer.fromJson(json['maxFlameCounter']), + maxFlameCounterFrom: serializer.fromJson( + json['maxFlameCounterFrom'], + ), + lastMessageExchange: serializer.fromJson( + json['lastMessageExchange'], + ), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'groupId': serializer.toJson(groupId), + 'isGroupAdmin': serializer.toJson(isGroupAdmin), + 'isDirectChat': serializer.toJson(isDirectChat), + 'pinned': serializer.toJson(pinned), + 'archived': serializer.toJson(archived), + 'joinedGroup': serializer.toJson(joinedGroup), + 'leftGroup': serializer.toJson(leftGroup), + 'deletedContent': serializer.toJson(deletedContent), + 'stateVersionId': serializer.toJson(stateVersionId), + 'stateEncryptionKey': serializer.toJson( + stateEncryptionKey, + ), + 'myGroupPrivateKey': serializer.toJson(myGroupPrivateKey), + 'groupName': serializer.toJson(groupName), + 'draftMessage': serializer.toJson(draftMessage), + 'totalMediaCounter': serializer.toJson(totalMediaCounter), + 'alsoBestFriend': serializer.toJson(alsoBestFriend), + 'deleteMessagesAfterMilliseconds': serializer.toJson( + deleteMessagesAfterMilliseconds, + ), + 'createdAt': serializer.toJson(createdAt), + 'lastMessageSend': serializer.toJson(lastMessageSend), + 'lastMessageReceived': serializer.toJson(lastMessageReceived), + 'lastFlameCounterChange': serializer.toJson( + lastFlameCounterChange, + ), + 'lastFlameSync': serializer.toJson(lastFlameSync), + 'flameCounter': serializer.toJson(flameCounter), + 'maxFlameCounter': serializer.toJson(maxFlameCounter), + 'maxFlameCounterFrom': serializer.toJson(maxFlameCounterFrom), + 'lastMessageExchange': serializer.toJson(lastMessageExchange), + }; + } + + GroupsData copyWith({ + String? groupId, + bool? isGroupAdmin, + bool? isDirectChat, + bool? pinned, + bool? archived, + bool? joinedGroup, + bool? leftGroup, + bool? deletedContent, + int? stateVersionId, + Value stateEncryptionKey = const Value.absent(), + Value myGroupPrivateKey = const Value.absent(), + String? groupName, + Value draftMessage = const Value.absent(), + int? totalMediaCounter, + bool? alsoBestFriend, + int? deleteMessagesAfterMilliseconds, + DateTime? createdAt, + Value lastMessageSend = const Value.absent(), + Value lastMessageReceived = const Value.absent(), + Value lastFlameCounterChange = const Value.absent(), + Value lastFlameSync = const Value.absent(), + int? flameCounter, + int? maxFlameCounter, + Value maxFlameCounterFrom = const Value.absent(), + DateTime? lastMessageExchange, + }) => GroupsData( + groupId: groupId ?? this.groupId, + isGroupAdmin: isGroupAdmin ?? this.isGroupAdmin, + isDirectChat: isDirectChat ?? this.isDirectChat, + pinned: pinned ?? this.pinned, + archived: archived ?? this.archived, + joinedGroup: joinedGroup ?? this.joinedGroup, + leftGroup: leftGroup ?? this.leftGroup, + deletedContent: deletedContent ?? this.deletedContent, + stateVersionId: stateVersionId ?? this.stateVersionId, + stateEncryptionKey: stateEncryptionKey.present + ? stateEncryptionKey.value + : this.stateEncryptionKey, + myGroupPrivateKey: myGroupPrivateKey.present + ? myGroupPrivateKey.value + : this.myGroupPrivateKey, + groupName: groupName ?? this.groupName, + draftMessage: draftMessage.present ? draftMessage.value : this.draftMessage, + totalMediaCounter: totalMediaCounter ?? this.totalMediaCounter, + alsoBestFriend: alsoBestFriend ?? this.alsoBestFriend, + deleteMessagesAfterMilliseconds: + deleteMessagesAfterMilliseconds ?? this.deleteMessagesAfterMilliseconds, + createdAt: createdAt ?? this.createdAt, + lastMessageSend: lastMessageSend.present + ? lastMessageSend.value + : this.lastMessageSend, + lastMessageReceived: lastMessageReceived.present + ? lastMessageReceived.value + : this.lastMessageReceived, + lastFlameCounterChange: lastFlameCounterChange.present + ? lastFlameCounterChange.value + : this.lastFlameCounterChange, + lastFlameSync: lastFlameSync.present + ? lastFlameSync.value + : this.lastFlameSync, + flameCounter: flameCounter ?? this.flameCounter, + maxFlameCounter: maxFlameCounter ?? this.maxFlameCounter, + maxFlameCounterFrom: maxFlameCounterFrom.present + ? maxFlameCounterFrom.value + : this.maxFlameCounterFrom, + lastMessageExchange: lastMessageExchange ?? this.lastMessageExchange, + ); + GroupsData copyWithCompanion(GroupsCompanion data) { + return GroupsData( + groupId: data.groupId.present ? data.groupId.value : this.groupId, + isGroupAdmin: data.isGroupAdmin.present + ? data.isGroupAdmin.value + : this.isGroupAdmin, + isDirectChat: data.isDirectChat.present + ? data.isDirectChat.value + : this.isDirectChat, + pinned: data.pinned.present ? data.pinned.value : this.pinned, + archived: data.archived.present ? data.archived.value : this.archived, + joinedGroup: data.joinedGroup.present + ? data.joinedGroup.value + : this.joinedGroup, + leftGroup: data.leftGroup.present ? data.leftGroup.value : this.leftGroup, + deletedContent: data.deletedContent.present + ? data.deletedContent.value + : this.deletedContent, + stateVersionId: data.stateVersionId.present + ? data.stateVersionId.value + : this.stateVersionId, + stateEncryptionKey: data.stateEncryptionKey.present + ? data.stateEncryptionKey.value + : this.stateEncryptionKey, + myGroupPrivateKey: data.myGroupPrivateKey.present + ? data.myGroupPrivateKey.value + : this.myGroupPrivateKey, + groupName: data.groupName.present ? data.groupName.value : this.groupName, + draftMessage: data.draftMessage.present + ? data.draftMessage.value + : this.draftMessage, + totalMediaCounter: data.totalMediaCounter.present + ? data.totalMediaCounter.value + : this.totalMediaCounter, + alsoBestFriend: data.alsoBestFriend.present + ? data.alsoBestFriend.value + : this.alsoBestFriend, + deleteMessagesAfterMilliseconds: + data.deleteMessagesAfterMilliseconds.present + ? data.deleteMessagesAfterMilliseconds.value + : this.deleteMessagesAfterMilliseconds, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + lastMessageSend: data.lastMessageSend.present + ? data.lastMessageSend.value + : this.lastMessageSend, + lastMessageReceived: data.lastMessageReceived.present + ? data.lastMessageReceived.value + : this.lastMessageReceived, + lastFlameCounterChange: data.lastFlameCounterChange.present + ? data.lastFlameCounterChange.value + : this.lastFlameCounterChange, + lastFlameSync: data.lastFlameSync.present + ? data.lastFlameSync.value + : this.lastFlameSync, + flameCounter: data.flameCounter.present + ? data.flameCounter.value + : this.flameCounter, + maxFlameCounter: data.maxFlameCounter.present + ? data.maxFlameCounter.value + : this.maxFlameCounter, + maxFlameCounterFrom: data.maxFlameCounterFrom.present + ? data.maxFlameCounterFrom.value + : this.maxFlameCounterFrom, + lastMessageExchange: data.lastMessageExchange.present + ? data.lastMessageExchange.value + : this.lastMessageExchange, + ); + } + + @override + String toString() { + return (StringBuffer('GroupsData(') + ..write('groupId: $groupId, ') + ..write('isGroupAdmin: $isGroupAdmin, ') + ..write('isDirectChat: $isDirectChat, ') + ..write('pinned: $pinned, ') + ..write('archived: $archived, ') + ..write('joinedGroup: $joinedGroup, ') + ..write('leftGroup: $leftGroup, ') + ..write('deletedContent: $deletedContent, ') + ..write('stateVersionId: $stateVersionId, ') + ..write('stateEncryptionKey: $stateEncryptionKey, ') + ..write('myGroupPrivateKey: $myGroupPrivateKey, ') + ..write('groupName: $groupName, ') + ..write('draftMessage: $draftMessage, ') + ..write('totalMediaCounter: $totalMediaCounter, ') + ..write('alsoBestFriend: $alsoBestFriend, ') + ..write( + 'deleteMessagesAfterMilliseconds: $deleteMessagesAfterMilliseconds, ', + ) + ..write('createdAt: $createdAt, ') + ..write('lastMessageSend: $lastMessageSend, ') + ..write('lastMessageReceived: $lastMessageReceived, ') + ..write('lastFlameCounterChange: $lastFlameCounterChange, ') + ..write('lastFlameSync: $lastFlameSync, ') + ..write('flameCounter: $flameCounter, ') + ..write('maxFlameCounter: $maxFlameCounter, ') + ..write('maxFlameCounterFrom: $maxFlameCounterFrom, ') + ..write('lastMessageExchange: $lastMessageExchange') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hashAll([ + groupId, + isGroupAdmin, + isDirectChat, + pinned, + archived, + joinedGroup, + leftGroup, + deletedContent, + stateVersionId, + $driftBlobEquality.hash(stateEncryptionKey), + $driftBlobEquality.hash(myGroupPrivateKey), + groupName, + draftMessage, + totalMediaCounter, + alsoBestFriend, + deleteMessagesAfterMilliseconds, + createdAt, + lastMessageSend, + lastMessageReceived, + lastFlameCounterChange, + lastFlameSync, + flameCounter, + maxFlameCounter, + maxFlameCounterFrom, + lastMessageExchange, + ]); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is GroupsData && + other.groupId == this.groupId && + other.isGroupAdmin == this.isGroupAdmin && + other.isDirectChat == this.isDirectChat && + other.pinned == this.pinned && + other.archived == this.archived && + other.joinedGroup == this.joinedGroup && + other.leftGroup == this.leftGroup && + other.deletedContent == this.deletedContent && + other.stateVersionId == this.stateVersionId && + $driftBlobEquality.equals( + other.stateEncryptionKey, + this.stateEncryptionKey, + ) && + $driftBlobEquality.equals( + other.myGroupPrivateKey, + this.myGroupPrivateKey, + ) && + other.groupName == this.groupName && + other.draftMessage == this.draftMessage && + other.totalMediaCounter == this.totalMediaCounter && + other.alsoBestFriend == this.alsoBestFriend && + other.deleteMessagesAfterMilliseconds == + this.deleteMessagesAfterMilliseconds && + other.createdAt == this.createdAt && + other.lastMessageSend == this.lastMessageSend && + other.lastMessageReceived == this.lastMessageReceived && + other.lastFlameCounterChange == this.lastFlameCounterChange && + other.lastFlameSync == this.lastFlameSync && + other.flameCounter == this.flameCounter && + other.maxFlameCounter == this.maxFlameCounter && + other.maxFlameCounterFrom == this.maxFlameCounterFrom && + other.lastMessageExchange == this.lastMessageExchange); +} + +class GroupsCompanion extends UpdateCompanion { + final Value groupId; + final Value isGroupAdmin; + final Value isDirectChat; + final Value pinned; + final Value archived; + final Value joinedGroup; + final Value leftGroup; + final Value deletedContent; + final Value stateVersionId; + final Value stateEncryptionKey; + final Value myGroupPrivateKey; + final Value groupName; + final Value draftMessage; + final Value totalMediaCounter; + final Value alsoBestFriend; + final Value deleteMessagesAfterMilliseconds; + final Value createdAt; + final Value lastMessageSend; + final Value lastMessageReceived; + final Value lastFlameCounterChange; + final Value lastFlameSync; + final Value flameCounter; + final Value maxFlameCounter; + final Value maxFlameCounterFrom; + final Value lastMessageExchange; + final Value rowid; + const GroupsCompanion({ + this.groupId = const Value.absent(), + this.isGroupAdmin = const Value.absent(), + this.isDirectChat = const Value.absent(), + this.pinned = const Value.absent(), + this.archived = const Value.absent(), + this.joinedGroup = const Value.absent(), + this.leftGroup = const Value.absent(), + this.deletedContent = const Value.absent(), + this.stateVersionId = const Value.absent(), + this.stateEncryptionKey = const Value.absent(), + this.myGroupPrivateKey = const Value.absent(), + this.groupName = const Value.absent(), + this.draftMessage = const Value.absent(), + this.totalMediaCounter = const Value.absent(), + this.alsoBestFriend = const Value.absent(), + this.deleteMessagesAfterMilliseconds = const Value.absent(), + this.createdAt = const Value.absent(), + this.lastMessageSend = const Value.absent(), + this.lastMessageReceived = const Value.absent(), + this.lastFlameCounterChange = const Value.absent(), + this.lastFlameSync = const Value.absent(), + this.flameCounter = const Value.absent(), + this.maxFlameCounter = const Value.absent(), + this.maxFlameCounterFrom = const Value.absent(), + this.lastMessageExchange = const Value.absent(), + this.rowid = const Value.absent(), + }); + GroupsCompanion.insert({ + required String groupId, + this.isGroupAdmin = const Value.absent(), + this.isDirectChat = const Value.absent(), + this.pinned = const Value.absent(), + this.archived = const Value.absent(), + this.joinedGroup = const Value.absent(), + this.leftGroup = const Value.absent(), + this.deletedContent = const Value.absent(), + this.stateVersionId = const Value.absent(), + this.stateEncryptionKey = const Value.absent(), + this.myGroupPrivateKey = const Value.absent(), + required String groupName, + this.draftMessage = const Value.absent(), + this.totalMediaCounter = const Value.absent(), + this.alsoBestFriend = const Value.absent(), + this.deleteMessagesAfterMilliseconds = const Value.absent(), + this.createdAt = const Value.absent(), + this.lastMessageSend = const Value.absent(), + this.lastMessageReceived = const Value.absent(), + this.lastFlameCounterChange = const Value.absent(), + this.lastFlameSync = const Value.absent(), + this.flameCounter = const Value.absent(), + this.maxFlameCounter = const Value.absent(), + this.maxFlameCounterFrom = const Value.absent(), + this.lastMessageExchange = const Value.absent(), + this.rowid = const Value.absent(), + }) : groupId = Value(groupId), + groupName = Value(groupName); + static Insertable custom({ + Expression? groupId, + Expression? isGroupAdmin, + Expression? isDirectChat, + Expression? pinned, + Expression? archived, + Expression? joinedGroup, + Expression? leftGroup, + Expression? deletedContent, + Expression? stateVersionId, + Expression? stateEncryptionKey, + Expression? myGroupPrivateKey, + Expression? groupName, + Expression? draftMessage, + Expression? totalMediaCounter, + Expression? alsoBestFriend, + Expression? deleteMessagesAfterMilliseconds, + Expression? createdAt, + Expression? lastMessageSend, + Expression? lastMessageReceived, + Expression? lastFlameCounterChange, + Expression? lastFlameSync, + Expression? flameCounter, + Expression? maxFlameCounter, + Expression? maxFlameCounterFrom, + Expression? lastMessageExchange, + Expression? rowid, + }) { + return RawValuesInsertable({ + if (groupId != null) 'group_id': groupId, + if (isGroupAdmin != null) 'is_group_admin': isGroupAdmin, + if (isDirectChat != null) 'is_direct_chat': isDirectChat, + if (pinned != null) 'pinned': pinned, + if (archived != null) 'archived': archived, + if (joinedGroup != null) 'joined_group': joinedGroup, + if (leftGroup != null) 'left_group': leftGroup, + if (deletedContent != null) 'deleted_content': deletedContent, + if (stateVersionId != null) 'state_version_id': stateVersionId, + if (stateEncryptionKey != null) + 'state_encryption_key': stateEncryptionKey, + if (myGroupPrivateKey != null) 'my_group_private_key': myGroupPrivateKey, + if (groupName != null) 'group_name': groupName, + if (draftMessage != null) 'draft_message': draftMessage, + if (totalMediaCounter != null) 'total_media_counter': totalMediaCounter, + if (alsoBestFriend != null) 'also_best_friend': alsoBestFriend, + if (deleteMessagesAfterMilliseconds != null) + 'delete_messages_after_milliseconds': deleteMessagesAfterMilliseconds, + if (createdAt != null) 'created_at': createdAt, + if (lastMessageSend != null) 'last_message_send': lastMessageSend, + if (lastMessageReceived != null) + 'last_message_received': lastMessageReceived, + if (lastFlameCounterChange != null) + 'last_flame_counter_change': lastFlameCounterChange, + if (lastFlameSync != null) 'last_flame_sync': lastFlameSync, + if (flameCounter != null) 'flame_counter': flameCounter, + if (maxFlameCounter != null) 'max_flame_counter': maxFlameCounter, + if (maxFlameCounterFrom != null) + 'max_flame_counter_from': maxFlameCounterFrom, + if (lastMessageExchange != null) + 'last_message_exchange': lastMessageExchange, + if (rowid != null) 'rowid': rowid, + }); + } + + GroupsCompanion copyWith({ + Value? groupId, + Value? isGroupAdmin, + Value? isDirectChat, + Value? pinned, + Value? archived, + Value? joinedGroup, + Value? leftGroup, + Value? deletedContent, + Value? stateVersionId, + Value? stateEncryptionKey, + Value? myGroupPrivateKey, + Value? groupName, + Value? draftMessage, + Value? totalMediaCounter, + Value? alsoBestFriend, + Value? deleteMessagesAfterMilliseconds, + Value? createdAt, + Value? lastMessageSend, + Value? lastMessageReceived, + Value? lastFlameCounterChange, + Value? lastFlameSync, + Value? flameCounter, + Value? maxFlameCounter, + Value? maxFlameCounterFrom, + Value? lastMessageExchange, + Value? rowid, + }) { + return GroupsCompanion( + groupId: groupId ?? this.groupId, + isGroupAdmin: isGroupAdmin ?? this.isGroupAdmin, + isDirectChat: isDirectChat ?? this.isDirectChat, + pinned: pinned ?? this.pinned, + archived: archived ?? this.archived, + joinedGroup: joinedGroup ?? this.joinedGroup, + leftGroup: leftGroup ?? this.leftGroup, + deletedContent: deletedContent ?? this.deletedContent, + stateVersionId: stateVersionId ?? this.stateVersionId, + stateEncryptionKey: stateEncryptionKey ?? this.stateEncryptionKey, + myGroupPrivateKey: myGroupPrivateKey ?? this.myGroupPrivateKey, + groupName: groupName ?? this.groupName, + draftMessage: draftMessage ?? this.draftMessage, + totalMediaCounter: totalMediaCounter ?? this.totalMediaCounter, + alsoBestFriend: alsoBestFriend ?? this.alsoBestFriend, + deleteMessagesAfterMilliseconds: + deleteMessagesAfterMilliseconds ?? + this.deleteMessagesAfterMilliseconds, + createdAt: createdAt ?? this.createdAt, + lastMessageSend: lastMessageSend ?? this.lastMessageSend, + lastMessageReceived: lastMessageReceived ?? this.lastMessageReceived, + lastFlameCounterChange: + lastFlameCounterChange ?? this.lastFlameCounterChange, + lastFlameSync: lastFlameSync ?? this.lastFlameSync, + flameCounter: flameCounter ?? this.flameCounter, + maxFlameCounter: maxFlameCounter ?? this.maxFlameCounter, + maxFlameCounterFrom: maxFlameCounterFrom ?? this.maxFlameCounterFrom, + lastMessageExchange: lastMessageExchange ?? this.lastMessageExchange, + rowid: rowid ?? this.rowid, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (groupId.present) { + map['group_id'] = Variable(groupId.value); + } + if (isGroupAdmin.present) { + map['is_group_admin'] = Variable(isGroupAdmin.value); + } + if (isDirectChat.present) { + map['is_direct_chat'] = Variable(isDirectChat.value); + } + if (pinned.present) { + map['pinned'] = Variable(pinned.value); + } + if (archived.present) { + map['archived'] = Variable(archived.value); + } + if (joinedGroup.present) { + map['joined_group'] = Variable(joinedGroup.value); + } + if (leftGroup.present) { + map['left_group'] = Variable(leftGroup.value); + } + if (deletedContent.present) { + map['deleted_content'] = Variable(deletedContent.value); + } + if (stateVersionId.present) { + map['state_version_id'] = Variable(stateVersionId.value); + } + if (stateEncryptionKey.present) { + map['state_encryption_key'] = Variable( + stateEncryptionKey.value, + ); + } + if (myGroupPrivateKey.present) { + map['my_group_private_key'] = Variable( + myGroupPrivateKey.value, + ); + } + if (groupName.present) { + map['group_name'] = Variable(groupName.value); + } + if (draftMessage.present) { + map['draft_message'] = Variable(draftMessage.value); + } + if (totalMediaCounter.present) { + map['total_media_counter'] = Variable(totalMediaCounter.value); + } + if (alsoBestFriend.present) { + map['also_best_friend'] = Variable(alsoBestFriend.value); + } + if (deleteMessagesAfterMilliseconds.present) { + map['delete_messages_after_milliseconds'] = Variable( + deleteMessagesAfterMilliseconds.value, + ); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + if (lastMessageSend.present) { + map['last_message_send'] = Variable(lastMessageSend.value); + } + if (lastMessageReceived.present) { + map['last_message_received'] = Variable( + lastMessageReceived.value, + ); + } + if (lastFlameCounterChange.present) { + map['last_flame_counter_change'] = Variable( + lastFlameCounterChange.value, + ); + } + if (lastFlameSync.present) { + map['last_flame_sync'] = Variable(lastFlameSync.value); + } + if (flameCounter.present) { + map['flame_counter'] = Variable(flameCounter.value); + } + if (maxFlameCounter.present) { + map['max_flame_counter'] = Variable(maxFlameCounter.value); + } + if (maxFlameCounterFrom.present) { + map['max_flame_counter_from'] = Variable( + maxFlameCounterFrom.value, + ); + } + if (lastMessageExchange.present) { + map['last_message_exchange'] = Variable( + lastMessageExchange.value, + ); + } + if (rowid.present) { + map['rowid'] = Variable(rowid.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('GroupsCompanion(') + ..write('groupId: $groupId, ') + ..write('isGroupAdmin: $isGroupAdmin, ') + ..write('isDirectChat: $isDirectChat, ') + ..write('pinned: $pinned, ') + ..write('archived: $archived, ') + ..write('joinedGroup: $joinedGroup, ') + ..write('leftGroup: $leftGroup, ') + ..write('deletedContent: $deletedContent, ') + ..write('stateVersionId: $stateVersionId, ') + ..write('stateEncryptionKey: $stateEncryptionKey, ') + ..write('myGroupPrivateKey: $myGroupPrivateKey, ') + ..write('groupName: $groupName, ') + ..write('draftMessage: $draftMessage, ') + ..write('totalMediaCounter: $totalMediaCounter, ') + ..write('alsoBestFriend: $alsoBestFriend, ') + ..write( + 'deleteMessagesAfterMilliseconds: $deleteMessagesAfterMilliseconds, ', + ) + ..write('createdAt: $createdAt, ') + ..write('lastMessageSend: $lastMessageSend, ') + ..write('lastMessageReceived: $lastMessageReceived, ') + ..write('lastFlameCounterChange: $lastFlameCounterChange, ') + ..write('lastFlameSync: $lastFlameSync, ') + ..write('flameCounter: $flameCounter, ') + ..write('maxFlameCounter: $maxFlameCounter, ') + ..write('maxFlameCounterFrom: $maxFlameCounterFrom, ') + ..write('lastMessageExchange: $lastMessageExchange, ') + ..write('rowid: $rowid') + ..write(')')) + .toString(); + } +} + +class MediaFiles extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + MediaFiles(this.attachedDatabase, [this._alias]); + late final GeneratedColumn mediaId = GeneratedColumn( + 'media_id', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + late final GeneratedColumn type = GeneratedColumn( + 'type', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + late final GeneratedColumn uploadState = GeneratedColumn( + 'upload_state', + aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + ); + late final GeneratedColumn cloudState = GeneratedColumn( + 'cloud_state', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: const Constant('none'), + ); + late final GeneratedColumn blurhash = GeneratedColumn( + 'blurhash', + aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + ); + late final GeneratedColumn downloadState = GeneratedColumn( + 'download_state', + aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + ); + late final GeneratedColumn requiresAuthentication = + GeneratedColumn( + 'requires_authentication', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("requires_authentication" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + late final GeneratedColumn stored = GeneratedColumn( + 'stored', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("stored" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + late final GeneratedColumn isDraftMedia = GeneratedColumn( + 'is_draft_media', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("is_draft_media" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + late final GeneratedColumn isFavorite = GeneratedColumn( + 'is_favorite', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("is_favorite" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + late final GeneratedColumn hasCropAnalyzed = GeneratedColumn( + 'has_crop_analyzed', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("has_crop_analyzed" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + late final GeneratedColumn preProgressingProcess = GeneratedColumn( + 'pre_progressing_process', + aliasedName, + true, + type: DriftSqlType.int, + requiredDuringInsert: false, + ); + late final GeneratedColumn reuploadRequestedBy = + GeneratedColumn( + 'reupload_requested_by', + aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + ); + late final GeneratedColumn displayLimitInMilliseconds = + GeneratedColumn( + 'display_limit_in_milliseconds', + aliasedName, + true, + type: DriftSqlType.int, + requiredDuringInsert: false, + ); + late final GeneratedColumn removeAudio = GeneratedColumn( + 'remove_audio', + aliasedName, + true, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("remove_audio" IN (0, 1))', + ), + ); + late final GeneratedColumn downloadToken = + GeneratedColumn( + 'download_token', + aliasedName, + true, + type: DriftSqlType.blob, + requiredDuringInsert: false, + ); + late final GeneratedColumn encryptionKey = + GeneratedColumn( + 'encryption_key', + aliasedName, + true, + type: DriftSqlType.blob, + requiredDuringInsert: false, + ); + late final GeneratedColumn encryptionMac = + GeneratedColumn( + 'encryption_mac', + aliasedName, + true, + type: DriftSqlType.blob, + requiredDuringInsert: false, + ); + late final GeneratedColumn encryptionNonce = + GeneratedColumn( + 'encryption_nonce', + aliasedName, + true, + type: DriftSqlType.blob, + requiredDuringInsert: false, + ); + late final GeneratedColumn storedFileHash = + GeneratedColumn( + 'stored_file_hash', + aliasedName, + true, + type: DriftSqlType.blob, + requiredDuringInsert: false, + ); + late final GeneratedColumn hasThumbnail = GeneratedColumn( + 'has_thumbnail', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("has_thumbnail" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + late final GeneratedColumn sizeInBytes = GeneratedColumn( + 'size_in_bytes', + aliasedName, + true, + type: DriftSqlType.int, + requiredDuringInsert: false, + ); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: currentDateAndTime, + ); + late final GeneratedColumn createdAtMonth = GeneratedColumn( + 'created_at_month', + aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + ); + @override + List get $columns => [ + mediaId, + type, + uploadState, + cloudState, + blurhash, + downloadState, + requiresAuthentication, + stored, + isDraftMedia, + isFavorite, + hasCropAnalyzed, + preProgressingProcess, + reuploadRequestedBy, + displayLimitInMilliseconds, + removeAudio, + downloadToken, + encryptionKey, + encryptionMac, + encryptionNonce, + storedFileHash, + hasThumbnail, + sizeInBytes, + createdAt, + createdAtMonth, + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'media_files'; + @override + Set get $primaryKey => {mediaId}; + @override + MediaFilesData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return MediaFilesData( + mediaId: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}media_id'], + )!, + type: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}type'], + )!, + uploadState: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}upload_state'], + ), + cloudState: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}cloud_state'], + )!, + blurhash: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}blurhash'], + ), + downloadState: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}download_state'], + ), + requiresAuthentication: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}requires_authentication'], + )!, + stored: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}stored'], + )!, + isDraftMedia: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}is_draft_media'], + )!, + isFavorite: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}is_favorite'], + )!, + hasCropAnalyzed: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}has_crop_analyzed'], + )!, + preProgressingProcess: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}pre_progressing_process'], + ), + reuploadRequestedBy: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}reupload_requested_by'], + ), + displayLimitInMilliseconds: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}display_limit_in_milliseconds'], + ), + removeAudio: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}remove_audio'], + ), + downloadToken: attachedDatabase.typeMapping.read( + DriftSqlType.blob, + data['${effectivePrefix}download_token'], + ), + encryptionKey: attachedDatabase.typeMapping.read( + DriftSqlType.blob, + data['${effectivePrefix}encryption_key'], + ), + encryptionMac: attachedDatabase.typeMapping.read( + DriftSqlType.blob, + data['${effectivePrefix}encryption_mac'], + ), + encryptionNonce: attachedDatabase.typeMapping.read( + DriftSqlType.blob, + data['${effectivePrefix}encryption_nonce'], + ), + storedFileHash: attachedDatabase.typeMapping.read( + DriftSqlType.blob, + data['${effectivePrefix}stored_file_hash'], + ), + hasThumbnail: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}has_thumbnail'], + )!, + sizeInBytes: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}size_in_bytes'], + ), + createdAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}created_at'], + )!, + createdAtMonth: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}created_at_month'], + ), + ); + } + + @override + MediaFiles createAlias(String alias) { + return MediaFiles(attachedDatabase, alias); + } +} + +class MediaFilesData extends DataClass implements Insertable { + final String mediaId; + final String type; + final String? uploadState; + final String cloudState; + final String? blurhash; + final String? downloadState; + final bool requiresAuthentication; + final bool stored; + final bool isDraftMedia; + final bool isFavorite; + final bool hasCropAnalyzed; + final int? preProgressingProcess; + final String? reuploadRequestedBy; + final int? displayLimitInMilliseconds; + final bool? removeAudio; + final i2.Uint8List? downloadToken; + final i2.Uint8List? encryptionKey; + final i2.Uint8List? encryptionMac; + final i2.Uint8List? encryptionNonce; + final i2.Uint8List? storedFileHash; + final bool hasThumbnail; + final int? sizeInBytes; + final DateTime createdAt; + final String? createdAtMonth; + const MediaFilesData({ + required this.mediaId, + required this.type, + this.uploadState, + required this.cloudState, + this.blurhash, + this.downloadState, + required this.requiresAuthentication, + required this.stored, + required this.isDraftMedia, + required this.isFavorite, + required this.hasCropAnalyzed, + this.preProgressingProcess, + this.reuploadRequestedBy, + this.displayLimitInMilliseconds, + this.removeAudio, + this.downloadToken, + this.encryptionKey, + this.encryptionMac, + this.encryptionNonce, + this.storedFileHash, + required this.hasThumbnail, + this.sizeInBytes, + required this.createdAt, + this.createdAtMonth, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['media_id'] = Variable(mediaId); + map['type'] = Variable(type); + if (!nullToAbsent || uploadState != null) { + map['upload_state'] = Variable(uploadState); + } + map['cloud_state'] = Variable(cloudState); + if (!nullToAbsent || blurhash != null) { + map['blurhash'] = Variable(blurhash); + } + if (!nullToAbsent || downloadState != null) { + map['download_state'] = Variable(downloadState); + } + map['requires_authentication'] = Variable(requiresAuthentication); + map['stored'] = Variable(stored); + map['is_draft_media'] = Variable(isDraftMedia); + map['is_favorite'] = Variable(isFavorite); + map['has_crop_analyzed'] = Variable(hasCropAnalyzed); + if (!nullToAbsent || preProgressingProcess != null) { + map['pre_progressing_process'] = Variable(preProgressingProcess); + } + if (!nullToAbsent || reuploadRequestedBy != null) { + map['reupload_requested_by'] = Variable(reuploadRequestedBy); + } + if (!nullToAbsent || displayLimitInMilliseconds != null) { + map['display_limit_in_milliseconds'] = Variable( + displayLimitInMilliseconds, + ); + } + if (!nullToAbsent || removeAudio != null) { + map['remove_audio'] = Variable(removeAudio); + } + if (!nullToAbsent || downloadToken != null) { + map['download_token'] = Variable(downloadToken); + } + if (!nullToAbsent || encryptionKey != null) { + map['encryption_key'] = Variable(encryptionKey); + } + if (!nullToAbsent || encryptionMac != null) { + map['encryption_mac'] = Variable(encryptionMac); + } + if (!nullToAbsent || encryptionNonce != null) { + map['encryption_nonce'] = Variable(encryptionNonce); + } + if (!nullToAbsent || storedFileHash != null) { + map['stored_file_hash'] = Variable(storedFileHash); + } + map['has_thumbnail'] = Variable(hasThumbnail); + if (!nullToAbsent || sizeInBytes != null) { + map['size_in_bytes'] = Variable(sizeInBytes); + } + map['created_at'] = Variable(createdAt); + if (!nullToAbsent || createdAtMonth != null) { + map['created_at_month'] = Variable(createdAtMonth); + } + return map; + } + + MediaFilesCompanion toCompanion(bool nullToAbsent) { + return MediaFilesCompanion( + mediaId: Value(mediaId), + type: Value(type), + uploadState: uploadState == null && nullToAbsent + ? const Value.absent() + : Value(uploadState), + cloudState: Value(cloudState), + blurhash: blurhash == null && nullToAbsent + ? const Value.absent() + : Value(blurhash), + downloadState: downloadState == null && nullToAbsent + ? const Value.absent() + : Value(downloadState), + requiresAuthentication: Value(requiresAuthentication), + stored: Value(stored), + isDraftMedia: Value(isDraftMedia), + isFavorite: Value(isFavorite), + hasCropAnalyzed: Value(hasCropAnalyzed), + preProgressingProcess: preProgressingProcess == null && nullToAbsent + ? const Value.absent() + : Value(preProgressingProcess), + reuploadRequestedBy: reuploadRequestedBy == null && nullToAbsent + ? const Value.absent() + : Value(reuploadRequestedBy), + displayLimitInMilliseconds: + displayLimitInMilliseconds == null && nullToAbsent + ? const Value.absent() + : Value(displayLimitInMilliseconds), + removeAudio: removeAudio == null && nullToAbsent + ? const Value.absent() + : Value(removeAudio), + downloadToken: downloadToken == null && nullToAbsent + ? const Value.absent() + : Value(downloadToken), + encryptionKey: encryptionKey == null && nullToAbsent + ? const Value.absent() + : Value(encryptionKey), + encryptionMac: encryptionMac == null && nullToAbsent + ? const Value.absent() + : Value(encryptionMac), + encryptionNonce: encryptionNonce == null && nullToAbsent + ? const Value.absent() + : Value(encryptionNonce), + storedFileHash: storedFileHash == null && nullToAbsent + ? const Value.absent() + : Value(storedFileHash), + hasThumbnail: Value(hasThumbnail), + sizeInBytes: sizeInBytes == null && nullToAbsent + ? const Value.absent() + : Value(sizeInBytes), + createdAt: Value(createdAt), + createdAtMonth: createdAtMonth == null && nullToAbsent + ? const Value.absent() + : Value(createdAtMonth), + ); + } + + factory MediaFilesData.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return MediaFilesData( + mediaId: serializer.fromJson(json['mediaId']), + type: serializer.fromJson(json['type']), + uploadState: serializer.fromJson(json['uploadState']), + cloudState: serializer.fromJson(json['cloudState']), + blurhash: serializer.fromJson(json['blurhash']), + downloadState: serializer.fromJson(json['downloadState']), + requiresAuthentication: serializer.fromJson( + json['requiresAuthentication'], + ), + stored: serializer.fromJson(json['stored']), + isDraftMedia: serializer.fromJson(json['isDraftMedia']), + isFavorite: serializer.fromJson(json['isFavorite']), + hasCropAnalyzed: serializer.fromJson(json['hasCropAnalyzed']), + preProgressingProcess: serializer.fromJson( + json['preProgressingProcess'], + ), + reuploadRequestedBy: serializer.fromJson( + json['reuploadRequestedBy'], + ), + displayLimitInMilliseconds: serializer.fromJson( + json['displayLimitInMilliseconds'], + ), + removeAudio: serializer.fromJson(json['removeAudio']), + downloadToken: serializer.fromJson(json['downloadToken']), + encryptionKey: serializer.fromJson(json['encryptionKey']), + encryptionMac: serializer.fromJson(json['encryptionMac']), + encryptionNonce: serializer.fromJson( + json['encryptionNonce'], + ), + storedFileHash: serializer.fromJson( + json['storedFileHash'], + ), + hasThumbnail: serializer.fromJson(json['hasThumbnail']), + sizeInBytes: serializer.fromJson(json['sizeInBytes']), + createdAt: serializer.fromJson(json['createdAt']), + createdAtMonth: serializer.fromJson(json['createdAtMonth']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'mediaId': serializer.toJson(mediaId), + 'type': serializer.toJson(type), + 'uploadState': serializer.toJson(uploadState), + 'cloudState': serializer.toJson(cloudState), + 'blurhash': serializer.toJson(blurhash), + 'downloadState': serializer.toJson(downloadState), + 'requiresAuthentication': serializer.toJson(requiresAuthentication), + 'stored': serializer.toJson(stored), + 'isDraftMedia': serializer.toJson(isDraftMedia), + 'isFavorite': serializer.toJson(isFavorite), + 'hasCropAnalyzed': serializer.toJson(hasCropAnalyzed), + 'preProgressingProcess': serializer.toJson(preProgressingProcess), + 'reuploadRequestedBy': serializer.toJson(reuploadRequestedBy), + 'displayLimitInMilliseconds': serializer.toJson( + displayLimitInMilliseconds, + ), + 'removeAudio': serializer.toJson(removeAudio), + 'downloadToken': serializer.toJson(downloadToken), + 'encryptionKey': serializer.toJson(encryptionKey), + 'encryptionMac': serializer.toJson(encryptionMac), + 'encryptionNonce': serializer.toJson(encryptionNonce), + 'storedFileHash': serializer.toJson(storedFileHash), + 'hasThumbnail': serializer.toJson(hasThumbnail), + 'sizeInBytes': serializer.toJson(sizeInBytes), + 'createdAt': serializer.toJson(createdAt), + 'createdAtMonth': serializer.toJson(createdAtMonth), + }; + } + + MediaFilesData copyWith({ + String? mediaId, + String? type, + Value uploadState = const Value.absent(), + String? cloudState, + Value blurhash = const Value.absent(), + Value downloadState = const Value.absent(), + bool? requiresAuthentication, + bool? stored, + bool? isDraftMedia, + bool? isFavorite, + bool? hasCropAnalyzed, + Value preProgressingProcess = const Value.absent(), + Value reuploadRequestedBy = const Value.absent(), + Value displayLimitInMilliseconds = const Value.absent(), + Value removeAudio = const Value.absent(), + Value downloadToken = const Value.absent(), + Value encryptionKey = const Value.absent(), + Value encryptionMac = const Value.absent(), + Value encryptionNonce = const Value.absent(), + Value storedFileHash = const Value.absent(), + bool? hasThumbnail, + Value sizeInBytes = const Value.absent(), + DateTime? createdAt, + Value createdAtMonth = const Value.absent(), + }) => MediaFilesData( + mediaId: mediaId ?? this.mediaId, + type: type ?? this.type, + uploadState: uploadState.present ? uploadState.value : this.uploadState, + cloudState: cloudState ?? this.cloudState, + blurhash: blurhash.present ? blurhash.value : this.blurhash, + downloadState: downloadState.present + ? downloadState.value + : this.downloadState, + requiresAuthentication: + requiresAuthentication ?? this.requiresAuthentication, + stored: stored ?? this.stored, + isDraftMedia: isDraftMedia ?? this.isDraftMedia, + isFavorite: isFavorite ?? this.isFavorite, + hasCropAnalyzed: hasCropAnalyzed ?? this.hasCropAnalyzed, + preProgressingProcess: preProgressingProcess.present + ? preProgressingProcess.value + : this.preProgressingProcess, + reuploadRequestedBy: reuploadRequestedBy.present + ? reuploadRequestedBy.value + : this.reuploadRequestedBy, + displayLimitInMilliseconds: displayLimitInMilliseconds.present + ? displayLimitInMilliseconds.value + : this.displayLimitInMilliseconds, + removeAudio: removeAudio.present ? removeAudio.value : this.removeAudio, + downloadToken: downloadToken.present + ? downloadToken.value + : this.downloadToken, + encryptionKey: encryptionKey.present + ? encryptionKey.value + : this.encryptionKey, + encryptionMac: encryptionMac.present + ? encryptionMac.value + : this.encryptionMac, + encryptionNonce: encryptionNonce.present + ? encryptionNonce.value + : this.encryptionNonce, + storedFileHash: storedFileHash.present + ? storedFileHash.value + : this.storedFileHash, + hasThumbnail: hasThumbnail ?? this.hasThumbnail, + sizeInBytes: sizeInBytes.present ? sizeInBytes.value : this.sizeInBytes, + createdAt: createdAt ?? this.createdAt, + createdAtMonth: createdAtMonth.present + ? createdAtMonth.value + : this.createdAtMonth, + ); + MediaFilesData copyWithCompanion(MediaFilesCompanion data) { + return MediaFilesData( + mediaId: data.mediaId.present ? data.mediaId.value : this.mediaId, + type: data.type.present ? data.type.value : this.type, + uploadState: data.uploadState.present + ? data.uploadState.value + : this.uploadState, + cloudState: data.cloudState.present + ? data.cloudState.value + : this.cloudState, + blurhash: data.blurhash.present ? data.blurhash.value : this.blurhash, + downloadState: data.downloadState.present + ? data.downloadState.value + : this.downloadState, + requiresAuthentication: data.requiresAuthentication.present + ? data.requiresAuthentication.value + : this.requiresAuthentication, + stored: data.stored.present ? data.stored.value : this.stored, + isDraftMedia: data.isDraftMedia.present + ? data.isDraftMedia.value + : this.isDraftMedia, + isFavorite: data.isFavorite.present + ? data.isFavorite.value + : this.isFavorite, + hasCropAnalyzed: data.hasCropAnalyzed.present + ? data.hasCropAnalyzed.value + : this.hasCropAnalyzed, + preProgressingProcess: data.preProgressingProcess.present + ? data.preProgressingProcess.value + : this.preProgressingProcess, + reuploadRequestedBy: data.reuploadRequestedBy.present + ? data.reuploadRequestedBy.value + : this.reuploadRequestedBy, + displayLimitInMilliseconds: data.displayLimitInMilliseconds.present + ? data.displayLimitInMilliseconds.value + : this.displayLimitInMilliseconds, + removeAudio: data.removeAudio.present + ? data.removeAudio.value + : this.removeAudio, + downloadToken: data.downloadToken.present + ? data.downloadToken.value + : this.downloadToken, + encryptionKey: data.encryptionKey.present + ? data.encryptionKey.value + : this.encryptionKey, + encryptionMac: data.encryptionMac.present + ? data.encryptionMac.value + : this.encryptionMac, + encryptionNonce: data.encryptionNonce.present + ? data.encryptionNonce.value + : this.encryptionNonce, + storedFileHash: data.storedFileHash.present + ? data.storedFileHash.value + : this.storedFileHash, + hasThumbnail: data.hasThumbnail.present + ? data.hasThumbnail.value + : this.hasThumbnail, + sizeInBytes: data.sizeInBytes.present + ? data.sizeInBytes.value + : this.sizeInBytes, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + createdAtMonth: data.createdAtMonth.present + ? data.createdAtMonth.value + : this.createdAtMonth, + ); + } + + @override + String toString() { + return (StringBuffer('MediaFilesData(') + ..write('mediaId: $mediaId, ') + ..write('type: $type, ') + ..write('uploadState: $uploadState, ') + ..write('cloudState: $cloudState, ') + ..write('blurhash: $blurhash, ') + ..write('downloadState: $downloadState, ') + ..write('requiresAuthentication: $requiresAuthentication, ') + ..write('stored: $stored, ') + ..write('isDraftMedia: $isDraftMedia, ') + ..write('isFavorite: $isFavorite, ') + ..write('hasCropAnalyzed: $hasCropAnalyzed, ') + ..write('preProgressingProcess: $preProgressingProcess, ') + ..write('reuploadRequestedBy: $reuploadRequestedBy, ') + ..write('displayLimitInMilliseconds: $displayLimitInMilliseconds, ') + ..write('removeAudio: $removeAudio, ') + ..write('downloadToken: $downloadToken, ') + ..write('encryptionKey: $encryptionKey, ') + ..write('encryptionMac: $encryptionMac, ') + ..write('encryptionNonce: $encryptionNonce, ') + ..write('storedFileHash: $storedFileHash, ') + ..write('hasThumbnail: $hasThumbnail, ') + ..write('sizeInBytes: $sizeInBytes, ') + ..write('createdAt: $createdAt, ') + ..write('createdAtMonth: $createdAtMonth') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hashAll([ + mediaId, + type, + uploadState, + cloudState, + blurhash, + downloadState, + requiresAuthentication, + stored, + isDraftMedia, + isFavorite, + hasCropAnalyzed, + preProgressingProcess, + reuploadRequestedBy, + displayLimitInMilliseconds, + removeAudio, + $driftBlobEquality.hash(downloadToken), + $driftBlobEquality.hash(encryptionKey), + $driftBlobEquality.hash(encryptionMac), + $driftBlobEquality.hash(encryptionNonce), + $driftBlobEquality.hash(storedFileHash), + hasThumbnail, + sizeInBytes, + createdAt, + createdAtMonth, + ]); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is MediaFilesData && + other.mediaId == this.mediaId && + other.type == this.type && + other.uploadState == this.uploadState && + other.cloudState == this.cloudState && + other.blurhash == this.blurhash && + other.downloadState == this.downloadState && + other.requiresAuthentication == this.requiresAuthentication && + other.stored == this.stored && + other.isDraftMedia == this.isDraftMedia && + other.isFavorite == this.isFavorite && + other.hasCropAnalyzed == this.hasCropAnalyzed && + other.preProgressingProcess == this.preProgressingProcess && + other.reuploadRequestedBy == this.reuploadRequestedBy && + other.displayLimitInMilliseconds == this.displayLimitInMilliseconds && + other.removeAudio == this.removeAudio && + $driftBlobEquality.equals(other.downloadToken, this.downloadToken) && + $driftBlobEquality.equals(other.encryptionKey, this.encryptionKey) && + $driftBlobEquality.equals(other.encryptionMac, this.encryptionMac) && + $driftBlobEquality.equals( + other.encryptionNonce, + this.encryptionNonce, + ) && + $driftBlobEquality.equals( + other.storedFileHash, + this.storedFileHash, + ) && + other.hasThumbnail == this.hasThumbnail && + other.sizeInBytes == this.sizeInBytes && + other.createdAt == this.createdAt && + other.createdAtMonth == this.createdAtMonth); +} + +class MediaFilesCompanion extends UpdateCompanion { + final Value mediaId; + final Value type; + final Value uploadState; + final Value cloudState; + final Value blurhash; + final Value downloadState; + final Value requiresAuthentication; + final Value stored; + final Value isDraftMedia; + final Value isFavorite; + final Value hasCropAnalyzed; + final Value preProgressingProcess; + final Value reuploadRequestedBy; + final Value displayLimitInMilliseconds; + final Value removeAudio; + final Value downloadToken; + final Value encryptionKey; + final Value encryptionMac; + final Value encryptionNonce; + final Value storedFileHash; + final Value hasThumbnail; + final Value sizeInBytes; + final Value createdAt; + final Value createdAtMonth; + final Value rowid; + const MediaFilesCompanion({ + this.mediaId = const Value.absent(), + this.type = const Value.absent(), + this.uploadState = const Value.absent(), + this.cloudState = const Value.absent(), + this.blurhash = const Value.absent(), + this.downloadState = const Value.absent(), + this.requiresAuthentication = const Value.absent(), + this.stored = const Value.absent(), + this.isDraftMedia = const Value.absent(), + this.isFavorite = const Value.absent(), + this.hasCropAnalyzed = const Value.absent(), + this.preProgressingProcess = const Value.absent(), + this.reuploadRequestedBy = const Value.absent(), + this.displayLimitInMilliseconds = const Value.absent(), + this.removeAudio = const Value.absent(), + this.downloadToken = const Value.absent(), + this.encryptionKey = const Value.absent(), + this.encryptionMac = const Value.absent(), + this.encryptionNonce = const Value.absent(), + this.storedFileHash = const Value.absent(), + this.hasThumbnail = const Value.absent(), + this.sizeInBytes = const Value.absent(), + this.createdAt = const Value.absent(), + this.createdAtMonth = const Value.absent(), + this.rowid = const Value.absent(), + }); + MediaFilesCompanion.insert({ + required String mediaId, + required String type, + this.uploadState = const Value.absent(), + this.cloudState = const Value.absent(), + this.blurhash = const Value.absent(), + this.downloadState = const Value.absent(), + this.requiresAuthentication = const Value.absent(), + this.stored = const Value.absent(), + this.isDraftMedia = const Value.absent(), + this.isFavorite = const Value.absent(), + this.hasCropAnalyzed = const Value.absent(), + this.preProgressingProcess = const Value.absent(), + this.reuploadRequestedBy = const Value.absent(), + this.displayLimitInMilliseconds = const Value.absent(), + this.removeAudio = const Value.absent(), + this.downloadToken = const Value.absent(), + this.encryptionKey = const Value.absent(), + this.encryptionMac = const Value.absent(), + this.encryptionNonce = const Value.absent(), + this.storedFileHash = const Value.absent(), + this.hasThumbnail = const Value.absent(), + this.sizeInBytes = const Value.absent(), + this.createdAt = const Value.absent(), + this.createdAtMonth = const Value.absent(), + this.rowid = const Value.absent(), + }) : mediaId = Value(mediaId), + type = Value(type); + static Insertable custom({ + Expression? mediaId, + Expression? type, + Expression? uploadState, + Expression? cloudState, + Expression? blurhash, + Expression? downloadState, + Expression? requiresAuthentication, + Expression? stored, + Expression? isDraftMedia, + Expression? isFavorite, + Expression? hasCropAnalyzed, + Expression? preProgressingProcess, + Expression? reuploadRequestedBy, + Expression? displayLimitInMilliseconds, + Expression? removeAudio, + Expression? downloadToken, + Expression? encryptionKey, + Expression? encryptionMac, + Expression? encryptionNonce, + Expression? storedFileHash, + Expression? hasThumbnail, + Expression? sizeInBytes, + Expression? createdAt, + Expression? createdAtMonth, + Expression? rowid, + }) { + return RawValuesInsertable({ + if (mediaId != null) 'media_id': mediaId, + if (type != null) 'type': type, + if (uploadState != null) 'upload_state': uploadState, + if (cloudState != null) 'cloud_state': cloudState, + if (blurhash != null) 'blurhash': blurhash, + if (downloadState != null) 'download_state': downloadState, + if (requiresAuthentication != null) + 'requires_authentication': requiresAuthentication, + if (stored != null) 'stored': stored, + if (isDraftMedia != null) 'is_draft_media': isDraftMedia, + if (isFavorite != null) 'is_favorite': isFavorite, + if (hasCropAnalyzed != null) 'has_crop_analyzed': hasCropAnalyzed, + if (preProgressingProcess != null) + 'pre_progressing_process': preProgressingProcess, + if (reuploadRequestedBy != null) + 'reupload_requested_by': reuploadRequestedBy, + if (displayLimitInMilliseconds != null) + 'display_limit_in_milliseconds': displayLimitInMilliseconds, + if (removeAudio != null) 'remove_audio': removeAudio, + if (downloadToken != null) 'download_token': downloadToken, + if (encryptionKey != null) 'encryption_key': encryptionKey, + if (encryptionMac != null) 'encryption_mac': encryptionMac, + if (encryptionNonce != null) 'encryption_nonce': encryptionNonce, + if (storedFileHash != null) 'stored_file_hash': storedFileHash, + if (hasThumbnail != null) 'has_thumbnail': hasThumbnail, + if (sizeInBytes != null) 'size_in_bytes': sizeInBytes, + if (createdAt != null) 'created_at': createdAt, + if (createdAtMonth != null) 'created_at_month': createdAtMonth, + if (rowid != null) 'rowid': rowid, + }); + } + + MediaFilesCompanion copyWith({ + Value? mediaId, + Value? type, + Value? uploadState, + Value? cloudState, + Value? blurhash, + Value? downloadState, + Value? requiresAuthentication, + Value? stored, + Value? isDraftMedia, + Value? isFavorite, + Value? hasCropAnalyzed, + Value? preProgressingProcess, + Value? reuploadRequestedBy, + Value? displayLimitInMilliseconds, + Value? removeAudio, + Value? downloadToken, + Value? encryptionKey, + Value? encryptionMac, + Value? encryptionNonce, + Value? storedFileHash, + Value? hasThumbnail, + Value? sizeInBytes, + Value? createdAt, + Value? createdAtMonth, + Value? rowid, + }) { + return MediaFilesCompanion( + mediaId: mediaId ?? this.mediaId, + type: type ?? this.type, + uploadState: uploadState ?? this.uploadState, + cloudState: cloudState ?? this.cloudState, + blurhash: blurhash ?? this.blurhash, + downloadState: downloadState ?? this.downloadState, + requiresAuthentication: + requiresAuthentication ?? this.requiresAuthentication, + stored: stored ?? this.stored, + isDraftMedia: isDraftMedia ?? this.isDraftMedia, + isFavorite: isFavorite ?? this.isFavorite, + hasCropAnalyzed: hasCropAnalyzed ?? this.hasCropAnalyzed, + preProgressingProcess: + preProgressingProcess ?? this.preProgressingProcess, + reuploadRequestedBy: reuploadRequestedBy ?? this.reuploadRequestedBy, + displayLimitInMilliseconds: + displayLimitInMilliseconds ?? this.displayLimitInMilliseconds, + removeAudio: removeAudio ?? this.removeAudio, + downloadToken: downloadToken ?? this.downloadToken, + encryptionKey: encryptionKey ?? this.encryptionKey, + encryptionMac: encryptionMac ?? this.encryptionMac, + encryptionNonce: encryptionNonce ?? this.encryptionNonce, + storedFileHash: storedFileHash ?? this.storedFileHash, + hasThumbnail: hasThumbnail ?? this.hasThumbnail, + sizeInBytes: sizeInBytes ?? this.sizeInBytes, + createdAt: createdAt ?? this.createdAt, + createdAtMonth: createdAtMonth ?? this.createdAtMonth, + rowid: rowid ?? this.rowid, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (mediaId.present) { + map['media_id'] = Variable(mediaId.value); + } + if (type.present) { + map['type'] = Variable(type.value); + } + if (uploadState.present) { + map['upload_state'] = Variable(uploadState.value); + } + if (cloudState.present) { + map['cloud_state'] = Variable(cloudState.value); + } + if (blurhash.present) { + map['blurhash'] = Variable(blurhash.value); + } + if (downloadState.present) { + map['download_state'] = Variable(downloadState.value); + } + if (requiresAuthentication.present) { + map['requires_authentication'] = Variable( + requiresAuthentication.value, + ); + } + if (stored.present) { + map['stored'] = Variable(stored.value); + } + if (isDraftMedia.present) { + map['is_draft_media'] = Variable(isDraftMedia.value); + } + if (isFavorite.present) { + map['is_favorite'] = Variable(isFavorite.value); + } + if (hasCropAnalyzed.present) { + map['has_crop_analyzed'] = Variable(hasCropAnalyzed.value); + } + if (preProgressingProcess.present) { + map['pre_progressing_process'] = Variable( + preProgressingProcess.value, + ); + } + if (reuploadRequestedBy.present) { + map['reupload_requested_by'] = Variable( + reuploadRequestedBy.value, + ); + } + if (displayLimitInMilliseconds.present) { + map['display_limit_in_milliseconds'] = Variable( + displayLimitInMilliseconds.value, + ); + } + if (removeAudio.present) { + map['remove_audio'] = Variable(removeAudio.value); + } + if (downloadToken.present) { + map['download_token'] = Variable(downloadToken.value); + } + if (encryptionKey.present) { + map['encryption_key'] = Variable(encryptionKey.value); + } + if (encryptionMac.present) { + map['encryption_mac'] = Variable(encryptionMac.value); + } + if (encryptionNonce.present) { + map['encryption_nonce'] = Variable(encryptionNonce.value); + } + if (storedFileHash.present) { + map['stored_file_hash'] = Variable(storedFileHash.value); + } + if (hasThumbnail.present) { + map['has_thumbnail'] = Variable(hasThumbnail.value); + } + if (sizeInBytes.present) { + map['size_in_bytes'] = Variable(sizeInBytes.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + if (createdAtMonth.present) { + map['created_at_month'] = Variable(createdAtMonth.value); + } + if (rowid.present) { + map['rowid'] = Variable(rowid.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('MediaFilesCompanion(') + ..write('mediaId: $mediaId, ') + ..write('type: $type, ') + ..write('uploadState: $uploadState, ') + ..write('cloudState: $cloudState, ') + ..write('blurhash: $blurhash, ') + ..write('downloadState: $downloadState, ') + ..write('requiresAuthentication: $requiresAuthentication, ') + ..write('stored: $stored, ') + ..write('isDraftMedia: $isDraftMedia, ') + ..write('isFavorite: $isFavorite, ') + ..write('hasCropAnalyzed: $hasCropAnalyzed, ') + ..write('preProgressingProcess: $preProgressingProcess, ') + ..write('reuploadRequestedBy: $reuploadRequestedBy, ') + ..write('displayLimitInMilliseconds: $displayLimitInMilliseconds, ') + ..write('removeAudio: $removeAudio, ') + ..write('downloadToken: $downloadToken, ') + ..write('encryptionKey: $encryptionKey, ') + ..write('encryptionMac: $encryptionMac, ') + ..write('encryptionNonce: $encryptionNonce, ') + ..write('storedFileHash: $storedFileHash, ') + ..write('hasThumbnail: $hasThumbnail, ') + ..write('sizeInBytes: $sizeInBytes, ') + ..write('createdAt: $createdAt, ') + ..write('createdAtMonth: $createdAtMonth, ') + ..write('rowid: $rowid') + ..write(')')) + .toString(); + } +} + +class Messages extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Messages(this.attachedDatabase, [this._alias]); + late final GeneratedColumn groupId = GeneratedColumn( + 'group_id', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES "groups" (group_id) ON DELETE CASCADE', + ), + ); + late final GeneratedColumn messageId = GeneratedColumn( + 'message_id', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + late final GeneratedColumn senderId = GeneratedColumn( + 'sender_id', + aliasedName, + true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES contacts (user_id)', + ), + ); + late final GeneratedColumn type = GeneratedColumn( + 'type', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + late final GeneratedColumn content = GeneratedColumn( + 'content', + aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + ); + late final GeneratedColumn mediaId = GeneratedColumn( + 'media_id', + aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES media_files (media_id) ON DELETE SET NULL', + ), + ); + late final GeneratedColumn additionalMessageData = + GeneratedColumn( + 'additional_message_data', + aliasedName, + true, + type: DriftSqlType.blob, + requiredDuringInsert: false, + ); + late final GeneratedColumn mediaStored = GeneratedColumn( + 'media_stored', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("media_stored" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + late final GeneratedColumn mediaReopened = GeneratedColumn( + 'media_reopened', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("media_reopened" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + late final GeneratedColumn downloadToken = + GeneratedColumn( + 'download_token', + aliasedName, + true, + type: DriftSqlType.blob, + requiredDuringInsert: false, + ); + late final GeneratedColumn quotesMessageId = GeneratedColumn( + 'quotes_message_id', + aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + ); + late final GeneratedColumn isDeletedFromSender = GeneratedColumn( + 'is_deleted_from_sender', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("is_deleted_from_sender" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + late final GeneratedColumn openedAt = GeneratedColumn( + 'opened_at', + aliasedName, + true, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + ); + late final GeneratedColumn openedByAll = GeneratedColumn( + 'opened_by_all', + aliasedName, + true, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + ); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: currentDateAndTime, + ); + late final GeneratedColumn modifiedAt = GeneratedColumn( + 'modified_at', + aliasedName, + true, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + ); + late final GeneratedColumn ackByUser = GeneratedColumn( + 'ack_by_user', + aliasedName, + true, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + ); + late final GeneratedColumn ackByServer = GeneratedColumn( + 'ack_by_server', + aliasedName, + true, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + ); + @override + List get $columns => [ + groupId, + messageId, + senderId, + type, + content, + mediaId, + additionalMessageData, + mediaStored, + mediaReopened, + downloadToken, + quotesMessageId, + isDeletedFromSender, + openedAt, + openedByAll, + createdAt, + modifiedAt, + ackByUser, + ackByServer, + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'messages'; + @override + Set get $primaryKey => {messageId}; + @override + MessagesData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return MessagesData( + groupId: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}group_id'], + )!, + messageId: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}message_id'], + )!, + senderId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}sender_id'], + ), + type: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}type'], + )!, + content: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}content'], + ), + mediaId: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}media_id'], + ), + additionalMessageData: attachedDatabase.typeMapping.read( + DriftSqlType.blob, + data['${effectivePrefix}additional_message_data'], + ), + mediaStored: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}media_stored'], + )!, + mediaReopened: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}media_reopened'], + )!, + downloadToken: attachedDatabase.typeMapping.read( + DriftSqlType.blob, + data['${effectivePrefix}download_token'], + ), + quotesMessageId: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}quotes_message_id'], + ), + isDeletedFromSender: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}is_deleted_from_sender'], + )!, + openedAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}opened_at'], + ), + openedByAll: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}opened_by_all'], + ), + createdAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}created_at'], + )!, + modifiedAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}modified_at'], + ), + ackByUser: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}ack_by_user'], + ), + ackByServer: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}ack_by_server'], + ), + ); + } + + @override + Messages createAlias(String alias) { + return Messages(attachedDatabase, alias); + } +} + +class MessagesData extends DataClass implements Insertable { + final String groupId; + final String messageId; + final int? senderId; + final String type; + final String? content; + final String? mediaId; + final i2.Uint8List? additionalMessageData; + final bool mediaStored; + final bool mediaReopened; + final i2.Uint8List? downloadToken; + final String? quotesMessageId; + final bool isDeletedFromSender; + final DateTime? openedAt; + final DateTime? openedByAll; + final DateTime createdAt; + final DateTime? modifiedAt; + final DateTime? ackByUser; + final DateTime? ackByServer; + const MessagesData({ + required this.groupId, + required this.messageId, + this.senderId, + required this.type, + this.content, + this.mediaId, + this.additionalMessageData, + required this.mediaStored, + required this.mediaReopened, + this.downloadToken, + this.quotesMessageId, + required this.isDeletedFromSender, + this.openedAt, + this.openedByAll, + required this.createdAt, + this.modifiedAt, + this.ackByUser, + this.ackByServer, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['group_id'] = Variable(groupId); + map['message_id'] = Variable(messageId); + if (!nullToAbsent || senderId != null) { + map['sender_id'] = Variable(senderId); + } + map['type'] = Variable(type); + if (!nullToAbsent || content != null) { + map['content'] = Variable(content); + } + if (!nullToAbsent || mediaId != null) { + map['media_id'] = Variable(mediaId); + } + if (!nullToAbsent || additionalMessageData != null) { + map['additional_message_data'] = Variable( + additionalMessageData, + ); + } + map['media_stored'] = Variable(mediaStored); + map['media_reopened'] = Variable(mediaReopened); + if (!nullToAbsent || downloadToken != null) { + map['download_token'] = Variable(downloadToken); + } + if (!nullToAbsent || quotesMessageId != null) { + map['quotes_message_id'] = Variable(quotesMessageId); + } + map['is_deleted_from_sender'] = Variable(isDeletedFromSender); + if (!nullToAbsent || openedAt != null) { + map['opened_at'] = Variable(openedAt); + } + if (!nullToAbsent || openedByAll != null) { + map['opened_by_all'] = Variable(openedByAll); + } + map['created_at'] = Variable(createdAt); + if (!nullToAbsent || modifiedAt != null) { + map['modified_at'] = Variable(modifiedAt); + } + if (!nullToAbsent || ackByUser != null) { + map['ack_by_user'] = Variable(ackByUser); + } + if (!nullToAbsent || ackByServer != null) { + map['ack_by_server'] = Variable(ackByServer); + } + return map; + } + + MessagesCompanion toCompanion(bool nullToAbsent) { + return MessagesCompanion( + groupId: Value(groupId), + messageId: Value(messageId), + senderId: senderId == null && nullToAbsent + ? const Value.absent() + : Value(senderId), + type: Value(type), + content: content == null && nullToAbsent + ? const Value.absent() + : Value(content), + mediaId: mediaId == null && nullToAbsent + ? const Value.absent() + : Value(mediaId), + additionalMessageData: additionalMessageData == null && nullToAbsent + ? const Value.absent() + : Value(additionalMessageData), + mediaStored: Value(mediaStored), + mediaReopened: Value(mediaReopened), + downloadToken: downloadToken == null && nullToAbsent + ? const Value.absent() + : Value(downloadToken), + quotesMessageId: quotesMessageId == null && nullToAbsent + ? const Value.absent() + : Value(quotesMessageId), + isDeletedFromSender: Value(isDeletedFromSender), + openedAt: openedAt == null && nullToAbsent + ? const Value.absent() + : Value(openedAt), + openedByAll: openedByAll == null && nullToAbsent + ? const Value.absent() + : Value(openedByAll), + createdAt: Value(createdAt), + modifiedAt: modifiedAt == null && nullToAbsent + ? const Value.absent() + : Value(modifiedAt), + ackByUser: ackByUser == null && nullToAbsent + ? const Value.absent() + : Value(ackByUser), + ackByServer: ackByServer == null && nullToAbsent + ? const Value.absent() + : Value(ackByServer), + ); + } + + factory MessagesData.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return MessagesData( + groupId: serializer.fromJson(json['groupId']), + messageId: serializer.fromJson(json['messageId']), + senderId: serializer.fromJson(json['senderId']), + type: serializer.fromJson(json['type']), + content: serializer.fromJson(json['content']), + mediaId: serializer.fromJson(json['mediaId']), + additionalMessageData: serializer.fromJson( + json['additionalMessageData'], + ), + mediaStored: serializer.fromJson(json['mediaStored']), + mediaReopened: serializer.fromJson(json['mediaReopened']), + downloadToken: serializer.fromJson(json['downloadToken']), + quotesMessageId: serializer.fromJson(json['quotesMessageId']), + isDeletedFromSender: serializer.fromJson( + json['isDeletedFromSender'], + ), + openedAt: serializer.fromJson(json['openedAt']), + openedByAll: serializer.fromJson(json['openedByAll']), + createdAt: serializer.fromJson(json['createdAt']), + modifiedAt: serializer.fromJson(json['modifiedAt']), + ackByUser: serializer.fromJson(json['ackByUser']), + ackByServer: serializer.fromJson(json['ackByServer']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'groupId': serializer.toJson(groupId), + 'messageId': serializer.toJson(messageId), + 'senderId': serializer.toJson(senderId), + 'type': serializer.toJson(type), + 'content': serializer.toJson(content), + 'mediaId': serializer.toJson(mediaId), + 'additionalMessageData': serializer.toJson( + additionalMessageData, + ), + 'mediaStored': serializer.toJson(mediaStored), + 'mediaReopened': serializer.toJson(mediaReopened), + 'downloadToken': serializer.toJson(downloadToken), + 'quotesMessageId': serializer.toJson(quotesMessageId), + 'isDeletedFromSender': serializer.toJson(isDeletedFromSender), + 'openedAt': serializer.toJson(openedAt), + 'openedByAll': serializer.toJson(openedByAll), + 'createdAt': serializer.toJson(createdAt), + 'modifiedAt': serializer.toJson(modifiedAt), + 'ackByUser': serializer.toJson(ackByUser), + 'ackByServer': serializer.toJson(ackByServer), + }; + } + + MessagesData copyWith({ + String? groupId, + String? messageId, + Value senderId = const Value.absent(), + String? type, + Value content = const Value.absent(), + Value mediaId = const Value.absent(), + Value additionalMessageData = const Value.absent(), + bool? mediaStored, + bool? mediaReopened, + Value downloadToken = const Value.absent(), + Value quotesMessageId = const Value.absent(), + bool? isDeletedFromSender, + Value openedAt = const Value.absent(), + Value openedByAll = const Value.absent(), + DateTime? createdAt, + Value modifiedAt = const Value.absent(), + Value ackByUser = const Value.absent(), + Value ackByServer = const Value.absent(), + }) => MessagesData( + groupId: groupId ?? this.groupId, + messageId: messageId ?? this.messageId, + senderId: senderId.present ? senderId.value : this.senderId, + type: type ?? this.type, + content: content.present ? content.value : this.content, + mediaId: mediaId.present ? mediaId.value : this.mediaId, + additionalMessageData: additionalMessageData.present + ? additionalMessageData.value + : this.additionalMessageData, + mediaStored: mediaStored ?? this.mediaStored, + mediaReopened: mediaReopened ?? this.mediaReopened, + downloadToken: downloadToken.present + ? downloadToken.value + : this.downloadToken, + quotesMessageId: quotesMessageId.present + ? quotesMessageId.value + : this.quotesMessageId, + isDeletedFromSender: isDeletedFromSender ?? this.isDeletedFromSender, + openedAt: openedAt.present ? openedAt.value : this.openedAt, + openedByAll: openedByAll.present ? openedByAll.value : this.openedByAll, + createdAt: createdAt ?? this.createdAt, + modifiedAt: modifiedAt.present ? modifiedAt.value : this.modifiedAt, + ackByUser: ackByUser.present ? ackByUser.value : this.ackByUser, + ackByServer: ackByServer.present ? ackByServer.value : this.ackByServer, + ); + MessagesData copyWithCompanion(MessagesCompanion data) { + return MessagesData( + groupId: data.groupId.present ? data.groupId.value : this.groupId, + messageId: data.messageId.present ? data.messageId.value : this.messageId, + senderId: data.senderId.present ? data.senderId.value : this.senderId, + type: data.type.present ? data.type.value : this.type, + content: data.content.present ? data.content.value : this.content, + mediaId: data.mediaId.present ? data.mediaId.value : this.mediaId, + additionalMessageData: data.additionalMessageData.present + ? data.additionalMessageData.value + : this.additionalMessageData, + mediaStored: data.mediaStored.present + ? data.mediaStored.value + : this.mediaStored, + mediaReopened: data.mediaReopened.present + ? data.mediaReopened.value + : this.mediaReopened, + downloadToken: data.downloadToken.present + ? data.downloadToken.value + : this.downloadToken, + quotesMessageId: data.quotesMessageId.present + ? data.quotesMessageId.value + : this.quotesMessageId, + isDeletedFromSender: data.isDeletedFromSender.present + ? data.isDeletedFromSender.value + : this.isDeletedFromSender, + openedAt: data.openedAt.present ? data.openedAt.value : this.openedAt, + openedByAll: data.openedByAll.present + ? data.openedByAll.value + : this.openedByAll, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + modifiedAt: data.modifiedAt.present + ? data.modifiedAt.value + : this.modifiedAt, + ackByUser: data.ackByUser.present ? data.ackByUser.value : this.ackByUser, + ackByServer: data.ackByServer.present + ? data.ackByServer.value + : this.ackByServer, + ); + } + + @override + String toString() { + return (StringBuffer('MessagesData(') + ..write('groupId: $groupId, ') + ..write('messageId: $messageId, ') + ..write('senderId: $senderId, ') + ..write('type: $type, ') + ..write('content: $content, ') + ..write('mediaId: $mediaId, ') + ..write('additionalMessageData: $additionalMessageData, ') + ..write('mediaStored: $mediaStored, ') + ..write('mediaReopened: $mediaReopened, ') + ..write('downloadToken: $downloadToken, ') + ..write('quotesMessageId: $quotesMessageId, ') + ..write('isDeletedFromSender: $isDeletedFromSender, ') + ..write('openedAt: $openedAt, ') + ..write('openedByAll: $openedByAll, ') + ..write('createdAt: $createdAt, ') + ..write('modifiedAt: $modifiedAt, ') + ..write('ackByUser: $ackByUser, ') + ..write('ackByServer: $ackByServer') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + groupId, + messageId, + senderId, + type, + content, + mediaId, + $driftBlobEquality.hash(additionalMessageData), + mediaStored, + mediaReopened, + $driftBlobEquality.hash(downloadToken), + quotesMessageId, + isDeletedFromSender, + openedAt, + openedByAll, + createdAt, + modifiedAt, + ackByUser, + ackByServer, + ); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is MessagesData && + other.groupId == this.groupId && + other.messageId == this.messageId && + other.senderId == this.senderId && + other.type == this.type && + other.content == this.content && + other.mediaId == this.mediaId && + $driftBlobEquality.equals( + other.additionalMessageData, + this.additionalMessageData, + ) && + other.mediaStored == this.mediaStored && + other.mediaReopened == this.mediaReopened && + $driftBlobEquality.equals(other.downloadToken, this.downloadToken) && + other.quotesMessageId == this.quotesMessageId && + other.isDeletedFromSender == this.isDeletedFromSender && + other.openedAt == this.openedAt && + other.openedByAll == this.openedByAll && + other.createdAt == this.createdAt && + other.modifiedAt == this.modifiedAt && + other.ackByUser == this.ackByUser && + other.ackByServer == this.ackByServer); +} + +class MessagesCompanion extends UpdateCompanion { + final Value groupId; + final Value messageId; + final Value senderId; + final Value type; + final Value content; + final Value mediaId; + final Value additionalMessageData; + final Value mediaStored; + final Value mediaReopened; + final Value downloadToken; + final Value quotesMessageId; + final Value isDeletedFromSender; + final Value openedAt; + final Value openedByAll; + final Value createdAt; + final Value modifiedAt; + final Value ackByUser; + final Value ackByServer; + final Value rowid; + const MessagesCompanion({ + this.groupId = const Value.absent(), + this.messageId = const Value.absent(), + this.senderId = const Value.absent(), + this.type = const Value.absent(), + this.content = const Value.absent(), + this.mediaId = const Value.absent(), + this.additionalMessageData = const Value.absent(), + this.mediaStored = const Value.absent(), + this.mediaReopened = const Value.absent(), + this.downloadToken = const Value.absent(), + this.quotesMessageId = const Value.absent(), + this.isDeletedFromSender = const Value.absent(), + this.openedAt = const Value.absent(), + this.openedByAll = const Value.absent(), + this.createdAt = const Value.absent(), + this.modifiedAt = const Value.absent(), + this.ackByUser = const Value.absent(), + this.ackByServer = const Value.absent(), + this.rowid = const Value.absent(), + }); + MessagesCompanion.insert({ + required String groupId, + required String messageId, + this.senderId = const Value.absent(), + required String type, + this.content = const Value.absent(), + this.mediaId = const Value.absent(), + this.additionalMessageData = const Value.absent(), + this.mediaStored = const Value.absent(), + this.mediaReopened = const Value.absent(), + this.downloadToken = const Value.absent(), + this.quotesMessageId = const Value.absent(), + this.isDeletedFromSender = const Value.absent(), + this.openedAt = const Value.absent(), + this.openedByAll = const Value.absent(), + this.createdAt = const Value.absent(), + this.modifiedAt = const Value.absent(), + this.ackByUser = const Value.absent(), + this.ackByServer = const Value.absent(), + this.rowid = const Value.absent(), + }) : groupId = Value(groupId), + messageId = Value(messageId), + type = Value(type); + static Insertable custom({ + Expression? groupId, + Expression? messageId, + Expression? senderId, + Expression? type, + Expression? content, + Expression? mediaId, + Expression? additionalMessageData, + Expression? mediaStored, + Expression? mediaReopened, + Expression? downloadToken, + Expression? quotesMessageId, + Expression? isDeletedFromSender, + Expression? openedAt, + Expression? openedByAll, + Expression? createdAt, + Expression? modifiedAt, + Expression? ackByUser, + Expression? ackByServer, + Expression? rowid, + }) { + return RawValuesInsertable({ + if (groupId != null) 'group_id': groupId, + if (messageId != null) 'message_id': messageId, + if (senderId != null) 'sender_id': senderId, + if (type != null) 'type': type, + if (content != null) 'content': content, + if (mediaId != null) 'media_id': mediaId, + if (additionalMessageData != null) + 'additional_message_data': additionalMessageData, + if (mediaStored != null) 'media_stored': mediaStored, + if (mediaReopened != null) 'media_reopened': mediaReopened, + if (downloadToken != null) 'download_token': downloadToken, + if (quotesMessageId != null) 'quotes_message_id': quotesMessageId, + if (isDeletedFromSender != null) + 'is_deleted_from_sender': isDeletedFromSender, + if (openedAt != null) 'opened_at': openedAt, + if (openedByAll != null) 'opened_by_all': openedByAll, + if (createdAt != null) 'created_at': createdAt, + if (modifiedAt != null) 'modified_at': modifiedAt, + if (ackByUser != null) 'ack_by_user': ackByUser, + if (ackByServer != null) 'ack_by_server': ackByServer, + if (rowid != null) 'rowid': rowid, + }); + } + + MessagesCompanion copyWith({ + Value? groupId, + Value? messageId, + Value? senderId, + Value? type, + Value? content, + Value? mediaId, + Value? additionalMessageData, + Value? mediaStored, + Value? mediaReopened, + Value? downloadToken, + Value? quotesMessageId, + Value? isDeletedFromSender, + Value? openedAt, + Value? openedByAll, + Value? createdAt, + Value? modifiedAt, + Value? ackByUser, + Value? ackByServer, + Value? rowid, + }) { + return MessagesCompanion( + groupId: groupId ?? this.groupId, + messageId: messageId ?? this.messageId, + senderId: senderId ?? this.senderId, + type: type ?? this.type, + content: content ?? this.content, + mediaId: mediaId ?? this.mediaId, + additionalMessageData: + additionalMessageData ?? this.additionalMessageData, + mediaStored: mediaStored ?? this.mediaStored, + mediaReopened: mediaReopened ?? this.mediaReopened, + downloadToken: downloadToken ?? this.downloadToken, + quotesMessageId: quotesMessageId ?? this.quotesMessageId, + isDeletedFromSender: isDeletedFromSender ?? this.isDeletedFromSender, + openedAt: openedAt ?? this.openedAt, + openedByAll: openedByAll ?? this.openedByAll, + createdAt: createdAt ?? this.createdAt, + modifiedAt: modifiedAt ?? this.modifiedAt, + ackByUser: ackByUser ?? this.ackByUser, + ackByServer: ackByServer ?? this.ackByServer, + rowid: rowid ?? this.rowid, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (groupId.present) { + map['group_id'] = Variable(groupId.value); + } + if (messageId.present) { + map['message_id'] = Variable(messageId.value); + } + if (senderId.present) { + map['sender_id'] = Variable(senderId.value); + } + if (type.present) { + map['type'] = Variable(type.value); + } + if (content.present) { + map['content'] = Variable(content.value); + } + if (mediaId.present) { + map['media_id'] = Variable(mediaId.value); + } + if (additionalMessageData.present) { + map['additional_message_data'] = Variable( + additionalMessageData.value, + ); + } + if (mediaStored.present) { + map['media_stored'] = Variable(mediaStored.value); + } + if (mediaReopened.present) { + map['media_reopened'] = Variable(mediaReopened.value); + } + if (downloadToken.present) { + map['download_token'] = Variable(downloadToken.value); + } + if (quotesMessageId.present) { + map['quotes_message_id'] = Variable(quotesMessageId.value); + } + if (isDeletedFromSender.present) { + map['is_deleted_from_sender'] = Variable(isDeletedFromSender.value); + } + if (openedAt.present) { + map['opened_at'] = Variable(openedAt.value); + } + if (openedByAll.present) { + map['opened_by_all'] = Variable(openedByAll.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + if (modifiedAt.present) { + map['modified_at'] = Variable(modifiedAt.value); + } + if (ackByUser.present) { + map['ack_by_user'] = Variable(ackByUser.value); + } + if (ackByServer.present) { + map['ack_by_server'] = Variable(ackByServer.value); + } + if (rowid.present) { + map['rowid'] = Variable(rowid.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('MessagesCompanion(') + ..write('groupId: $groupId, ') + ..write('messageId: $messageId, ') + ..write('senderId: $senderId, ') + ..write('type: $type, ') + ..write('content: $content, ') + ..write('mediaId: $mediaId, ') + ..write('additionalMessageData: $additionalMessageData, ') + ..write('mediaStored: $mediaStored, ') + ..write('mediaReopened: $mediaReopened, ') + ..write('downloadToken: $downloadToken, ') + ..write('quotesMessageId: $quotesMessageId, ') + ..write('isDeletedFromSender: $isDeletedFromSender, ') + ..write('openedAt: $openedAt, ') + ..write('openedByAll: $openedByAll, ') + ..write('createdAt: $createdAt, ') + ..write('modifiedAt: $modifiedAt, ') + ..write('ackByUser: $ackByUser, ') + ..write('ackByServer: $ackByServer, ') + ..write('rowid: $rowid') + ..write(')')) + .toString(); + } +} + +class MessageHistories extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + MessageHistories(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', + aliasedName, + false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'PRIMARY KEY AUTOINCREMENT', + ), + ); + late final GeneratedColumn messageId = GeneratedColumn( + 'message_id', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES messages (message_id) ON DELETE CASCADE', + ), + ); + late final GeneratedColumn contactId = GeneratedColumn( + 'contact_id', + aliasedName, + true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES contacts (user_id) ON DELETE CASCADE', + ), + ); + late final GeneratedColumn content = GeneratedColumn( + 'content', + aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + ); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: currentDateAndTime, + ); + @override + List get $columns => [ + id, + messageId, + contactId, + content, + createdAt, + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'message_histories'; + @override + Set get $primaryKey => {id}; + @override + MessageHistoriesData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return MessageHistoriesData( + id: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}id'], + )!, + messageId: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}message_id'], + )!, + contactId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}contact_id'], + ), + content: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}content'], + ), + createdAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}created_at'], + )!, + ); + } + + @override + MessageHistories createAlias(String alias) { + return MessageHistories(attachedDatabase, alias); + } +} + +class MessageHistoriesData extends DataClass + implements Insertable { + final int id; + final String messageId; + final int? contactId; + final String? content; + final DateTime createdAt; + const MessageHistoriesData({ + required this.id, + required this.messageId, + this.contactId, + this.content, + required this.createdAt, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['message_id'] = Variable(messageId); + if (!nullToAbsent || contactId != null) { + map['contact_id'] = Variable(contactId); + } + if (!nullToAbsent || content != null) { + map['content'] = Variable(content); + } + map['created_at'] = Variable(createdAt); + return map; + } + + MessageHistoriesCompanion toCompanion(bool nullToAbsent) { + return MessageHistoriesCompanion( + id: Value(id), + messageId: Value(messageId), + contactId: contactId == null && nullToAbsent + ? const Value.absent() + : Value(contactId), + content: content == null && nullToAbsent + ? const Value.absent() + : Value(content), + createdAt: Value(createdAt), + ); + } + + factory MessageHistoriesData.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return MessageHistoriesData( + id: serializer.fromJson(json['id']), + messageId: serializer.fromJson(json['messageId']), + contactId: serializer.fromJson(json['contactId']), + content: serializer.fromJson(json['content']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'messageId': serializer.toJson(messageId), + 'contactId': serializer.toJson(contactId), + 'content': serializer.toJson(content), + 'createdAt': serializer.toJson(createdAt), + }; + } + + MessageHistoriesData copyWith({ + int? id, + String? messageId, + Value contactId = const Value.absent(), + Value content = const Value.absent(), + DateTime? createdAt, + }) => MessageHistoriesData( + id: id ?? this.id, + messageId: messageId ?? this.messageId, + contactId: contactId.present ? contactId.value : this.contactId, + content: content.present ? content.value : this.content, + createdAt: createdAt ?? this.createdAt, + ); + MessageHistoriesData copyWithCompanion(MessageHistoriesCompanion data) { + return MessageHistoriesData( + id: data.id.present ? data.id.value : this.id, + messageId: data.messageId.present ? data.messageId.value : this.messageId, + contactId: data.contactId.present ? data.contactId.value : this.contactId, + content: data.content.present ? data.content.value : this.content, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('MessageHistoriesData(') + ..write('id: $id, ') + ..write('messageId: $messageId, ') + ..write('contactId: $contactId, ') + ..write('content: $content, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, messageId, contactId, content, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is MessageHistoriesData && + other.id == this.id && + other.messageId == this.messageId && + other.contactId == this.contactId && + other.content == this.content && + other.createdAt == this.createdAt); +} + +class MessageHistoriesCompanion extends UpdateCompanion { + final Value id; + final Value messageId; + final Value contactId; + final Value content; + final Value createdAt; + const MessageHistoriesCompanion({ + this.id = const Value.absent(), + this.messageId = const Value.absent(), + this.contactId = const Value.absent(), + this.content = const Value.absent(), + this.createdAt = const Value.absent(), + }); + MessageHistoriesCompanion.insert({ + this.id = const Value.absent(), + required String messageId, + this.contactId = const Value.absent(), + this.content = const Value.absent(), + this.createdAt = const Value.absent(), + }) : messageId = Value(messageId); + static Insertable custom({ + Expression? id, + Expression? messageId, + Expression? contactId, + Expression? content, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (messageId != null) 'message_id': messageId, + if (contactId != null) 'contact_id': contactId, + if (content != null) 'content': content, + if (createdAt != null) 'created_at': createdAt, + }); + } + + MessageHistoriesCompanion copyWith({ + Value? id, + Value? messageId, + Value? contactId, + Value? content, + Value? createdAt, + }) { + return MessageHistoriesCompanion( + id: id ?? this.id, + messageId: messageId ?? this.messageId, + contactId: contactId ?? this.contactId, + content: content ?? this.content, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (messageId.present) { + map['message_id'] = Variable(messageId.value); + } + if (contactId.present) { + map['contact_id'] = Variable(contactId.value); + } + if (content.present) { + map['content'] = Variable(content.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('MessageHistoriesCompanion(') + ..write('id: $id, ') + ..write('messageId: $messageId, ') + ..write('contactId: $contactId, ') + ..write('content: $content, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class Reactions extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Reactions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn messageId = GeneratedColumn( + 'message_id', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES messages (message_id) ON DELETE CASCADE', + ), + ); + late final GeneratedColumn emoji = GeneratedColumn( + 'emoji', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + late final GeneratedColumn senderId = GeneratedColumn( + 'sender_id', + aliasedName, + true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES contacts (user_id) ON DELETE CASCADE', + ), + ); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: currentDateAndTime, + ); + @override + List get $columns => [messageId, emoji, senderId, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'reactions'; + @override + Set get $primaryKey => {messageId, senderId, emoji}; + @override + ReactionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ReactionsData( + messageId: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}message_id'], + )!, + emoji: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}emoji'], + )!, + senderId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}sender_id'], + ), + createdAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}created_at'], + )!, + ); + } + + @override + Reactions createAlias(String alias) { + return Reactions(attachedDatabase, alias); + } +} + +class ReactionsData extends DataClass implements Insertable { + final String messageId; + final String emoji; + final int? senderId; + final DateTime createdAt; + const ReactionsData({ + required this.messageId, + required this.emoji, + this.senderId, + required this.createdAt, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['message_id'] = Variable(messageId); + map['emoji'] = Variable(emoji); + if (!nullToAbsent || senderId != null) { + map['sender_id'] = Variable(senderId); + } + map['created_at'] = Variable(createdAt); + return map; + } + + ReactionsCompanion toCompanion(bool nullToAbsent) { + return ReactionsCompanion( + messageId: Value(messageId), + emoji: Value(emoji), + senderId: senderId == null && nullToAbsent + ? const Value.absent() + : Value(senderId), + createdAt: Value(createdAt), + ); + } + + factory ReactionsData.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ReactionsData( + messageId: serializer.fromJson(json['messageId']), + emoji: serializer.fromJson(json['emoji']), + senderId: serializer.fromJson(json['senderId']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'messageId': serializer.toJson(messageId), + 'emoji': serializer.toJson(emoji), + 'senderId': serializer.toJson(senderId), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ReactionsData copyWith({ + String? messageId, + String? emoji, + Value senderId = const Value.absent(), + DateTime? createdAt, + }) => ReactionsData( + messageId: messageId ?? this.messageId, + emoji: emoji ?? this.emoji, + senderId: senderId.present ? senderId.value : this.senderId, + createdAt: createdAt ?? this.createdAt, + ); + ReactionsData copyWithCompanion(ReactionsCompanion data) { + return ReactionsData( + messageId: data.messageId.present ? data.messageId.value : this.messageId, + emoji: data.emoji.present ? data.emoji.value : this.emoji, + senderId: data.senderId.present ? data.senderId.value : this.senderId, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ReactionsData(') + ..write('messageId: $messageId, ') + ..write('emoji: $emoji, ') + ..write('senderId: $senderId, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(messageId, emoji, senderId, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ReactionsData && + other.messageId == this.messageId && + other.emoji == this.emoji && + other.senderId == this.senderId && + other.createdAt == this.createdAt); +} + +class ReactionsCompanion extends UpdateCompanion { + final Value messageId; + final Value emoji; + final Value senderId; + final Value createdAt; + final Value rowid; + const ReactionsCompanion({ + this.messageId = const Value.absent(), + this.emoji = const Value.absent(), + this.senderId = const Value.absent(), + this.createdAt = const Value.absent(), + this.rowid = const Value.absent(), + }); + ReactionsCompanion.insert({ + required String messageId, + required String emoji, + this.senderId = const Value.absent(), + this.createdAt = const Value.absent(), + this.rowid = const Value.absent(), + }) : messageId = Value(messageId), + emoji = Value(emoji); + static Insertable custom({ + Expression? messageId, + Expression? emoji, + Expression? senderId, + Expression? createdAt, + Expression? rowid, + }) { + return RawValuesInsertable({ + if (messageId != null) 'message_id': messageId, + if (emoji != null) 'emoji': emoji, + if (senderId != null) 'sender_id': senderId, + if (createdAt != null) 'created_at': createdAt, + if (rowid != null) 'rowid': rowid, + }); + } + + ReactionsCompanion copyWith({ + Value? messageId, + Value? emoji, + Value? senderId, + Value? createdAt, + Value? rowid, + }) { + return ReactionsCompanion( + messageId: messageId ?? this.messageId, + emoji: emoji ?? this.emoji, + senderId: senderId ?? this.senderId, + createdAt: createdAt ?? this.createdAt, + rowid: rowid ?? this.rowid, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (messageId.present) { + map['message_id'] = Variable(messageId.value); + } + if (emoji.present) { + map['emoji'] = Variable(emoji.value); + } + if (senderId.present) { + map['sender_id'] = Variable(senderId.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + if (rowid.present) { + map['rowid'] = Variable(rowid.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ReactionsCompanion(') + ..write('messageId: $messageId, ') + ..write('emoji: $emoji, ') + ..write('senderId: $senderId, ') + ..write('createdAt: $createdAt, ') + ..write('rowid: $rowid') + ..write(')')) + .toString(); + } +} + +class GroupMembers extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + GroupMembers(this.attachedDatabase, [this._alias]); + late final GeneratedColumn groupId = GeneratedColumn( + 'group_id', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES "groups" (group_id) ON DELETE CASCADE', + ), + ); + late final GeneratedColumn contactId = GeneratedColumn( + 'contact_id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES contacts (user_id)', + ), + ); + late final GeneratedColumn memberState = GeneratedColumn( + 'member_state', + aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + ); + late final GeneratedColumn groupPublicKey = + GeneratedColumn( + 'group_public_key', + aliasedName, + true, + type: DriftSqlType.blob, + requiredDuringInsert: false, + ); + late final GeneratedColumn lastChatOpened = + GeneratedColumn( + 'last_chat_opened', + aliasedName, + true, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + ); + late final GeneratedColumn lastTypeIndicator = + GeneratedColumn( + 'last_type_indicator', + aliasedName, + true, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + ); + late final GeneratedColumn lastMessage = GeneratedColumn( + 'last_message', + aliasedName, + true, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + ); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: currentDateAndTime, + ); + @override + List get $columns => [ + groupId, + contactId, + memberState, + groupPublicKey, + lastChatOpened, + lastTypeIndicator, + lastMessage, + createdAt, + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'group_members'; + @override + Set get $primaryKey => {groupId, contactId}; + @override + GroupMembersData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return GroupMembersData( + groupId: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}group_id'], + )!, + contactId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}contact_id'], + )!, + memberState: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}member_state'], + ), + groupPublicKey: attachedDatabase.typeMapping.read( + DriftSqlType.blob, + data['${effectivePrefix}group_public_key'], + ), + lastChatOpened: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}last_chat_opened'], + ), + lastTypeIndicator: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}last_type_indicator'], + ), + lastMessage: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}last_message'], + ), + createdAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}created_at'], + )!, + ); + } + + @override + GroupMembers createAlias(String alias) { + return GroupMembers(attachedDatabase, alias); + } +} + +class GroupMembersData extends DataClass + implements Insertable { + final String groupId; + final int contactId; + final String? memberState; + final i2.Uint8List? groupPublicKey; + final DateTime? lastChatOpened; + final DateTime? lastTypeIndicator; + final DateTime? lastMessage; + final DateTime createdAt; + const GroupMembersData({ + required this.groupId, + required this.contactId, + this.memberState, + this.groupPublicKey, + this.lastChatOpened, + this.lastTypeIndicator, + this.lastMessage, + required this.createdAt, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['group_id'] = Variable(groupId); + map['contact_id'] = Variable(contactId); + if (!nullToAbsent || memberState != null) { + map['member_state'] = Variable(memberState); + } + if (!nullToAbsent || groupPublicKey != null) { + map['group_public_key'] = Variable(groupPublicKey); + } + if (!nullToAbsent || lastChatOpened != null) { + map['last_chat_opened'] = Variable(lastChatOpened); + } + if (!nullToAbsent || lastTypeIndicator != null) { + map['last_type_indicator'] = Variable(lastTypeIndicator); + } + if (!nullToAbsent || lastMessage != null) { + map['last_message'] = Variable(lastMessage); + } + map['created_at'] = Variable(createdAt); + return map; + } + + GroupMembersCompanion toCompanion(bool nullToAbsent) { + return GroupMembersCompanion( + groupId: Value(groupId), + contactId: Value(contactId), + memberState: memberState == null && nullToAbsent + ? const Value.absent() + : Value(memberState), + groupPublicKey: groupPublicKey == null && nullToAbsent + ? const Value.absent() + : Value(groupPublicKey), + lastChatOpened: lastChatOpened == null && nullToAbsent + ? const Value.absent() + : Value(lastChatOpened), + lastTypeIndicator: lastTypeIndicator == null && nullToAbsent + ? const Value.absent() + : Value(lastTypeIndicator), + lastMessage: lastMessage == null && nullToAbsent + ? const Value.absent() + : Value(lastMessage), + createdAt: Value(createdAt), + ); + } + + factory GroupMembersData.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return GroupMembersData( + groupId: serializer.fromJson(json['groupId']), + contactId: serializer.fromJson(json['contactId']), + memberState: serializer.fromJson(json['memberState']), + groupPublicKey: serializer.fromJson( + json['groupPublicKey'], + ), + lastChatOpened: serializer.fromJson(json['lastChatOpened']), + lastTypeIndicator: serializer.fromJson( + json['lastTypeIndicator'], + ), + lastMessage: serializer.fromJson(json['lastMessage']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'groupId': serializer.toJson(groupId), + 'contactId': serializer.toJson(contactId), + 'memberState': serializer.toJson(memberState), + 'groupPublicKey': serializer.toJson(groupPublicKey), + 'lastChatOpened': serializer.toJson(lastChatOpened), + 'lastTypeIndicator': serializer.toJson(lastTypeIndicator), + 'lastMessage': serializer.toJson(lastMessage), + 'createdAt': serializer.toJson(createdAt), + }; + } + + GroupMembersData copyWith({ + String? groupId, + int? contactId, + Value memberState = const Value.absent(), + Value groupPublicKey = const Value.absent(), + Value lastChatOpened = const Value.absent(), + Value lastTypeIndicator = const Value.absent(), + Value lastMessage = const Value.absent(), + DateTime? createdAt, + }) => GroupMembersData( + groupId: groupId ?? this.groupId, + contactId: contactId ?? this.contactId, + memberState: memberState.present ? memberState.value : this.memberState, + groupPublicKey: groupPublicKey.present + ? groupPublicKey.value + : this.groupPublicKey, + lastChatOpened: lastChatOpened.present + ? lastChatOpened.value + : this.lastChatOpened, + lastTypeIndicator: lastTypeIndicator.present + ? lastTypeIndicator.value + : this.lastTypeIndicator, + lastMessage: lastMessage.present ? lastMessage.value : this.lastMessage, + createdAt: createdAt ?? this.createdAt, + ); + GroupMembersData copyWithCompanion(GroupMembersCompanion data) { + return GroupMembersData( + groupId: data.groupId.present ? data.groupId.value : this.groupId, + contactId: data.contactId.present ? data.contactId.value : this.contactId, + memberState: data.memberState.present + ? data.memberState.value + : this.memberState, + groupPublicKey: data.groupPublicKey.present + ? data.groupPublicKey.value + : this.groupPublicKey, + lastChatOpened: data.lastChatOpened.present + ? data.lastChatOpened.value + : this.lastChatOpened, + lastTypeIndicator: data.lastTypeIndicator.present + ? data.lastTypeIndicator.value + : this.lastTypeIndicator, + lastMessage: data.lastMessage.present + ? data.lastMessage.value + : this.lastMessage, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('GroupMembersData(') + ..write('groupId: $groupId, ') + ..write('contactId: $contactId, ') + ..write('memberState: $memberState, ') + ..write('groupPublicKey: $groupPublicKey, ') + ..write('lastChatOpened: $lastChatOpened, ') + ..write('lastTypeIndicator: $lastTypeIndicator, ') + ..write('lastMessage: $lastMessage, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + groupId, + contactId, + memberState, + $driftBlobEquality.hash(groupPublicKey), + lastChatOpened, + lastTypeIndicator, + lastMessage, + createdAt, + ); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is GroupMembersData && + other.groupId == this.groupId && + other.contactId == this.contactId && + other.memberState == this.memberState && + $driftBlobEquality.equals( + other.groupPublicKey, + this.groupPublicKey, + ) && + other.lastChatOpened == this.lastChatOpened && + other.lastTypeIndicator == this.lastTypeIndicator && + other.lastMessage == this.lastMessage && + other.createdAt == this.createdAt); +} + +class GroupMembersCompanion extends UpdateCompanion { + final Value groupId; + final Value contactId; + final Value memberState; + final Value groupPublicKey; + final Value lastChatOpened; + final Value lastTypeIndicator; + final Value lastMessage; + final Value createdAt; + final Value rowid; + const GroupMembersCompanion({ + this.groupId = const Value.absent(), + this.contactId = const Value.absent(), + this.memberState = const Value.absent(), + this.groupPublicKey = const Value.absent(), + this.lastChatOpened = const Value.absent(), + this.lastTypeIndicator = const Value.absent(), + this.lastMessage = const Value.absent(), + this.createdAt = const Value.absent(), + this.rowid = const Value.absent(), + }); + GroupMembersCompanion.insert({ + required String groupId, + required int contactId, + this.memberState = const Value.absent(), + this.groupPublicKey = const Value.absent(), + this.lastChatOpened = const Value.absent(), + this.lastTypeIndicator = const Value.absent(), + this.lastMessage = const Value.absent(), + this.createdAt = const Value.absent(), + this.rowid = const Value.absent(), + }) : groupId = Value(groupId), + contactId = Value(contactId); + static Insertable custom({ + Expression? groupId, + Expression? contactId, + Expression? memberState, + Expression? groupPublicKey, + Expression? lastChatOpened, + Expression? lastTypeIndicator, + Expression? lastMessage, + Expression? createdAt, + Expression? rowid, + }) { + return RawValuesInsertable({ + if (groupId != null) 'group_id': groupId, + if (contactId != null) 'contact_id': contactId, + if (memberState != null) 'member_state': memberState, + if (groupPublicKey != null) 'group_public_key': groupPublicKey, + if (lastChatOpened != null) 'last_chat_opened': lastChatOpened, + if (lastTypeIndicator != null) 'last_type_indicator': lastTypeIndicator, + if (lastMessage != null) 'last_message': lastMessage, + if (createdAt != null) 'created_at': createdAt, + if (rowid != null) 'rowid': rowid, + }); + } + + GroupMembersCompanion copyWith({ + Value? groupId, + Value? contactId, + Value? memberState, + Value? groupPublicKey, + Value? lastChatOpened, + Value? lastTypeIndicator, + Value? lastMessage, + Value? createdAt, + Value? rowid, + }) { + return GroupMembersCompanion( + groupId: groupId ?? this.groupId, + contactId: contactId ?? this.contactId, + memberState: memberState ?? this.memberState, + groupPublicKey: groupPublicKey ?? this.groupPublicKey, + lastChatOpened: lastChatOpened ?? this.lastChatOpened, + lastTypeIndicator: lastTypeIndicator ?? this.lastTypeIndicator, + lastMessage: lastMessage ?? this.lastMessage, + createdAt: createdAt ?? this.createdAt, + rowid: rowid ?? this.rowid, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (groupId.present) { + map['group_id'] = Variable(groupId.value); + } + if (contactId.present) { + map['contact_id'] = Variable(contactId.value); + } + if (memberState.present) { + map['member_state'] = Variable(memberState.value); + } + if (groupPublicKey.present) { + map['group_public_key'] = Variable(groupPublicKey.value); + } + if (lastChatOpened.present) { + map['last_chat_opened'] = Variable(lastChatOpened.value); + } + if (lastTypeIndicator.present) { + map['last_type_indicator'] = Variable(lastTypeIndicator.value); + } + if (lastMessage.present) { + map['last_message'] = Variable(lastMessage.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + if (rowid.present) { + map['rowid'] = Variable(rowid.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('GroupMembersCompanion(') + ..write('groupId: $groupId, ') + ..write('contactId: $contactId, ') + ..write('memberState: $memberState, ') + ..write('groupPublicKey: $groupPublicKey, ') + ..write('lastChatOpened: $lastChatOpened, ') + ..write('lastTypeIndicator: $lastTypeIndicator, ') + ..write('lastMessage: $lastMessage, ') + ..write('createdAt: $createdAt, ') + ..write('rowid: $rowid') + ..write(')')) + .toString(); + } +} + +class Receipts extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Receipts(this.attachedDatabase, [this._alias]); + late final GeneratedColumn receiptId = GeneratedColumn( + 'receipt_id', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + late final GeneratedColumn contactId = GeneratedColumn( + 'contact_id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES contacts (user_id) ON DELETE CASCADE', + ), + ); + late final GeneratedColumn messageId = GeneratedColumn( + 'message_id', + aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES messages (message_id) ON DELETE CASCADE', + ), + ); + late final GeneratedColumn message = + GeneratedColumn( + 'message', + aliasedName, + false, + type: DriftSqlType.blob, + requiredDuringInsert: true, + ); + late final GeneratedColumn contactWillSendsReceipt = + GeneratedColumn( + 'contact_will_sends_receipt', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("contact_will_sends_receipt" IN (0, 1))', + ), + defaultValue: const Constant(true), + ); + late final GeneratedColumn willBeRetriedByMediaUpload = + GeneratedColumn( + 'will_be_retried_by_media_upload', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("will_be_retried_by_media_upload" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + late final GeneratedColumn markForRetry = GeneratedColumn( + 'mark_for_retry', + aliasedName, + true, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + ); + late final GeneratedColumn markForRetryAfterAccepted = + GeneratedColumn( + 'mark_for_retry_after_accepted', + aliasedName, + true, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + ); + late final GeneratedColumn ackByServerAt = + GeneratedColumn( + 'ack_by_server_at', + aliasedName, + true, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + ); + late final GeneratedColumn retryCount = GeneratedColumn( + 'retry_count', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultValue: const Constant(0), + ); + late final GeneratedColumn lastRetry = GeneratedColumn( + 'last_retry', + aliasedName, + true, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + ); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: currentDateAndTime, + ); + @override + List get $columns => [ + receiptId, + contactId, + messageId, + message, + contactWillSendsReceipt, + willBeRetriedByMediaUpload, + markForRetry, + markForRetryAfterAccepted, + ackByServerAt, + retryCount, + lastRetry, + createdAt, + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'receipts'; + @override + Set get $primaryKey => {receiptId}; + @override + ReceiptsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ReceiptsData( + receiptId: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}receipt_id'], + )!, + contactId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}contact_id'], + )!, + messageId: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}message_id'], + ), + message: attachedDatabase.typeMapping.read( + DriftSqlType.blob, + data['${effectivePrefix}message'], + )!, + contactWillSendsReceipt: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}contact_will_sends_receipt'], + )!, + willBeRetriedByMediaUpload: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}will_be_retried_by_media_upload'], + )!, + markForRetry: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}mark_for_retry'], + ), + markForRetryAfterAccepted: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}mark_for_retry_after_accepted'], + ), + ackByServerAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}ack_by_server_at'], + ), + retryCount: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}retry_count'], + )!, + lastRetry: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}last_retry'], + ), + createdAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}created_at'], + )!, + ); + } + + @override + Receipts createAlias(String alias) { + return Receipts(attachedDatabase, alias); + } +} + +class ReceiptsData extends DataClass implements Insertable { + final String receiptId; + final int contactId; + final String? messageId; + final i2.Uint8List message; + final bool contactWillSendsReceipt; + final bool willBeRetriedByMediaUpload; + final DateTime? markForRetry; + final DateTime? markForRetryAfterAccepted; + final DateTime? ackByServerAt; + final int retryCount; + final DateTime? lastRetry; + final DateTime createdAt; + const ReceiptsData({ + required this.receiptId, + required this.contactId, + this.messageId, + required this.message, + required this.contactWillSendsReceipt, + required this.willBeRetriedByMediaUpload, + this.markForRetry, + this.markForRetryAfterAccepted, + this.ackByServerAt, + required this.retryCount, + this.lastRetry, + required this.createdAt, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['receipt_id'] = Variable(receiptId); + map['contact_id'] = Variable(contactId); + if (!nullToAbsent || messageId != null) { + map['message_id'] = Variable(messageId); + } + map['message'] = Variable(message); + map['contact_will_sends_receipt'] = Variable(contactWillSendsReceipt); + map['will_be_retried_by_media_upload'] = Variable( + willBeRetriedByMediaUpload, + ); + if (!nullToAbsent || markForRetry != null) { + map['mark_for_retry'] = Variable(markForRetry); + } + if (!nullToAbsent || markForRetryAfterAccepted != null) { + map['mark_for_retry_after_accepted'] = Variable( + markForRetryAfterAccepted, + ); + } + if (!nullToAbsent || ackByServerAt != null) { + map['ack_by_server_at'] = Variable(ackByServerAt); + } + map['retry_count'] = Variable(retryCount); + if (!nullToAbsent || lastRetry != null) { + map['last_retry'] = Variable(lastRetry); + } + map['created_at'] = Variable(createdAt); + return map; + } + + ReceiptsCompanion toCompanion(bool nullToAbsent) { + return ReceiptsCompanion( + receiptId: Value(receiptId), + contactId: Value(contactId), + messageId: messageId == null && nullToAbsent + ? const Value.absent() + : Value(messageId), + message: Value(message), + contactWillSendsReceipt: Value(contactWillSendsReceipt), + willBeRetriedByMediaUpload: Value(willBeRetriedByMediaUpload), + markForRetry: markForRetry == null && nullToAbsent + ? const Value.absent() + : Value(markForRetry), + markForRetryAfterAccepted: + markForRetryAfterAccepted == null && nullToAbsent + ? const Value.absent() + : Value(markForRetryAfterAccepted), + ackByServerAt: ackByServerAt == null && nullToAbsent + ? const Value.absent() + : Value(ackByServerAt), + retryCount: Value(retryCount), + lastRetry: lastRetry == null && nullToAbsent + ? const Value.absent() + : Value(lastRetry), + createdAt: Value(createdAt), + ); + } + + factory ReceiptsData.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ReceiptsData( + receiptId: serializer.fromJson(json['receiptId']), + contactId: serializer.fromJson(json['contactId']), + messageId: serializer.fromJson(json['messageId']), + message: serializer.fromJson(json['message']), + contactWillSendsReceipt: serializer.fromJson( + json['contactWillSendsReceipt'], + ), + willBeRetriedByMediaUpload: serializer.fromJson( + json['willBeRetriedByMediaUpload'], + ), + markForRetry: serializer.fromJson(json['markForRetry']), + markForRetryAfterAccepted: serializer.fromJson( + json['markForRetryAfterAccepted'], + ), + ackByServerAt: serializer.fromJson(json['ackByServerAt']), + retryCount: serializer.fromJson(json['retryCount']), + lastRetry: serializer.fromJson(json['lastRetry']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'receiptId': serializer.toJson(receiptId), + 'contactId': serializer.toJson(contactId), + 'messageId': serializer.toJson(messageId), + 'message': serializer.toJson(message), + 'contactWillSendsReceipt': serializer.toJson( + contactWillSendsReceipt, + ), + 'willBeRetriedByMediaUpload': serializer.toJson( + willBeRetriedByMediaUpload, + ), + 'markForRetry': serializer.toJson(markForRetry), + 'markForRetryAfterAccepted': serializer.toJson( + markForRetryAfterAccepted, + ), + 'ackByServerAt': serializer.toJson(ackByServerAt), + 'retryCount': serializer.toJson(retryCount), + 'lastRetry': serializer.toJson(lastRetry), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ReceiptsData copyWith({ + String? receiptId, + int? contactId, + Value messageId = const Value.absent(), + i2.Uint8List? message, + bool? contactWillSendsReceipt, + bool? willBeRetriedByMediaUpload, + Value markForRetry = const Value.absent(), + Value markForRetryAfterAccepted = const Value.absent(), + Value ackByServerAt = const Value.absent(), + int? retryCount, + Value lastRetry = const Value.absent(), + DateTime? createdAt, + }) => ReceiptsData( + receiptId: receiptId ?? this.receiptId, + contactId: contactId ?? this.contactId, + messageId: messageId.present ? messageId.value : this.messageId, + message: message ?? this.message, + contactWillSendsReceipt: + contactWillSendsReceipt ?? this.contactWillSendsReceipt, + willBeRetriedByMediaUpload: + willBeRetriedByMediaUpload ?? this.willBeRetriedByMediaUpload, + markForRetry: markForRetry.present ? markForRetry.value : this.markForRetry, + markForRetryAfterAccepted: markForRetryAfterAccepted.present + ? markForRetryAfterAccepted.value + : this.markForRetryAfterAccepted, + ackByServerAt: ackByServerAt.present + ? ackByServerAt.value + : this.ackByServerAt, + retryCount: retryCount ?? this.retryCount, + lastRetry: lastRetry.present ? lastRetry.value : this.lastRetry, + createdAt: createdAt ?? this.createdAt, + ); + ReceiptsData copyWithCompanion(ReceiptsCompanion data) { + return ReceiptsData( + receiptId: data.receiptId.present ? data.receiptId.value : this.receiptId, + contactId: data.contactId.present ? data.contactId.value : this.contactId, + messageId: data.messageId.present ? data.messageId.value : this.messageId, + message: data.message.present ? data.message.value : this.message, + contactWillSendsReceipt: data.contactWillSendsReceipt.present + ? data.contactWillSendsReceipt.value + : this.contactWillSendsReceipt, + willBeRetriedByMediaUpload: data.willBeRetriedByMediaUpload.present + ? data.willBeRetriedByMediaUpload.value + : this.willBeRetriedByMediaUpload, + markForRetry: data.markForRetry.present + ? data.markForRetry.value + : this.markForRetry, + markForRetryAfterAccepted: data.markForRetryAfterAccepted.present + ? data.markForRetryAfterAccepted.value + : this.markForRetryAfterAccepted, + ackByServerAt: data.ackByServerAt.present + ? data.ackByServerAt.value + : this.ackByServerAt, + retryCount: data.retryCount.present + ? data.retryCount.value + : this.retryCount, + lastRetry: data.lastRetry.present ? data.lastRetry.value : this.lastRetry, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ReceiptsData(') + ..write('receiptId: $receiptId, ') + ..write('contactId: $contactId, ') + ..write('messageId: $messageId, ') + ..write('message: $message, ') + ..write('contactWillSendsReceipt: $contactWillSendsReceipt, ') + ..write('willBeRetriedByMediaUpload: $willBeRetriedByMediaUpload, ') + ..write('markForRetry: $markForRetry, ') + ..write('markForRetryAfterAccepted: $markForRetryAfterAccepted, ') + ..write('ackByServerAt: $ackByServerAt, ') + ..write('retryCount: $retryCount, ') + ..write('lastRetry: $lastRetry, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + receiptId, + contactId, + messageId, + $driftBlobEquality.hash(message), + contactWillSendsReceipt, + willBeRetriedByMediaUpload, + markForRetry, + markForRetryAfterAccepted, + ackByServerAt, + retryCount, + lastRetry, + createdAt, + ); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ReceiptsData && + other.receiptId == this.receiptId && + other.contactId == this.contactId && + other.messageId == this.messageId && + $driftBlobEquality.equals(other.message, this.message) && + other.contactWillSendsReceipt == this.contactWillSendsReceipt && + other.willBeRetriedByMediaUpload == this.willBeRetriedByMediaUpload && + other.markForRetry == this.markForRetry && + other.markForRetryAfterAccepted == this.markForRetryAfterAccepted && + other.ackByServerAt == this.ackByServerAt && + other.retryCount == this.retryCount && + other.lastRetry == this.lastRetry && + other.createdAt == this.createdAt); +} + +class ReceiptsCompanion extends UpdateCompanion { + final Value receiptId; + final Value contactId; + final Value messageId; + final Value message; + final Value contactWillSendsReceipt; + final Value willBeRetriedByMediaUpload; + final Value markForRetry; + final Value markForRetryAfterAccepted; + final Value ackByServerAt; + final Value retryCount; + final Value lastRetry; + final Value createdAt; + final Value rowid; + const ReceiptsCompanion({ + this.receiptId = const Value.absent(), + this.contactId = const Value.absent(), + this.messageId = const Value.absent(), + this.message = const Value.absent(), + this.contactWillSendsReceipt = const Value.absent(), + this.willBeRetriedByMediaUpload = const Value.absent(), + this.markForRetry = const Value.absent(), + this.markForRetryAfterAccepted = const Value.absent(), + this.ackByServerAt = const Value.absent(), + this.retryCount = const Value.absent(), + this.lastRetry = const Value.absent(), + this.createdAt = const Value.absent(), + this.rowid = const Value.absent(), + }); + ReceiptsCompanion.insert({ + required String receiptId, + required int contactId, + this.messageId = const Value.absent(), + required i2.Uint8List message, + this.contactWillSendsReceipt = const Value.absent(), + this.willBeRetriedByMediaUpload = const Value.absent(), + this.markForRetry = const Value.absent(), + this.markForRetryAfterAccepted = const Value.absent(), + this.ackByServerAt = const Value.absent(), + this.retryCount = const Value.absent(), + this.lastRetry = const Value.absent(), + this.createdAt = const Value.absent(), + this.rowid = const Value.absent(), + }) : receiptId = Value(receiptId), + contactId = Value(contactId), + message = Value(message); + static Insertable custom({ + Expression? receiptId, + Expression? contactId, + Expression? messageId, + Expression? message, + Expression? contactWillSendsReceipt, + Expression? willBeRetriedByMediaUpload, + Expression? markForRetry, + Expression? markForRetryAfterAccepted, + Expression? ackByServerAt, + Expression? retryCount, + Expression? lastRetry, + Expression? createdAt, + Expression? rowid, + }) { + return RawValuesInsertable({ + if (receiptId != null) 'receipt_id': receiptId, + if (contactId != null) 'contact_id': contactId, + if (messageId != null) 'message_id': messageId, + if (message != null) 'message': message, + if (contactWillSendsReceipt != null) + 'contact_will_sends_receipt': contactWillSendsReceipt, + if (willBeRetriedByMediaUpload != null) + 'will_be_retried_by_media_upload': willBeRetriedByMediaUpload, + if (markForRetry != null) 'mark_for_retry': markForRetry, + if (markForRetryAfterAccepted != null) + 'mark_for_retry_after_accepted': markForRetryAfterAccepted, + if (ackByServerAt != null) 'ack_by_server_at': ackByServerAt, + if (retryCount != null) 'retry_count': retryCount, + if (lastRetry != null) 'last_retry': lastRetry, + if (createdAt != null) 'created_at': createdAt, + if (rowid != null) 'rowid': rowid, + }); + } + + ReceiptsCompanion copyWith({ + Value? receiptId, + Value? contactId, + Value? messageId, + Value? message, + Value? contactWillSendsReceipt, + Value? willBeRetriedByMediaUpload, + Value? markForRetry, + Value? markForRetryAfterAccepted, + Value? ackByServerAt, + Value? retryCount, + Value? lastRetry, + Value? createdAt, + Value? rowid, + }) { + return ReceiptsCompanion( + receiptId: receiptId ?? this.receiptId, + contactId: contactId ?? this.contactId, + messageId: messageId ?? this.messageId, + message: message ?? this.message, + contactWillSendsReceipt: + contactWillSendsReceipt ?? this.contactWillSendsReceipt, + willBeRetriedByMediaUpload: + willBeRetriedByMediaUpload ?? this.willBeRetriedByMediaUpload, + markForRetry: markForRetry ?? this.markForRetry, + markForRetryAfterAccepted: + markForRetryAfterAccepted ?? this.markForRetryAfterAccepted, + ackByServerAt: ackByServerAt ?? this.ackByServerAt, + retryCount: retryCount ?? this.retryCount, + lastRetry: lastRetry ?? this.lastRetry, + createdAt: createdAt ?? this.createdAt, + rowid: rowid ?? this.rowid, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (receiptId.present) { + map['receipt_id'] = Variable(receiptId.value); + } + if (contactId.present) { + map['contact_id'] = Variable(contactId.value); + } + if (messageId.present) { + map['message_id'] = Variable(messageId.value); + } + if (message.present) { + map['message'] = Variable(message.value); + } + if (contactWillSendsReceipt.present) { + map['contact_will_sends_receipt'] = Variable( + contactWillSendsReceipt.value, + ); + } + if (willBeRetriedByMediaUpload.present) { + map['will_be_retried_by_media_upload'] = Variable( + willBeRetriedByMediaUpload.value, + ); + } + if (markForRetry.present) { + map['mark_for_retry'] = Variable(markForRetry.value); + } + if (markForRetryAfterAccepted.present) { + map['mark_for_retry_after_accepted'] = Variable( + markForRetryAfterAccepted.value, + ); + } + if (ackByServerAt.present) { + map['ack_by_server_at'] = Variable(ackByServerAt.value); + } + if (retryCount.present) { + map['retry_count'] = Variable(retryCount.value); + } + if (lastRetry.present) { + map['last_retry'] = Variable(lastRetry.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + if (rowid.present) { + map['rowid'] = Variable(rowid.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ReceiptsCompanion(') + ..write('receiptId: $receiptId, ') + ..write('contactId: $contactId, ') + ..write('messageId: $messageId, ') + ..write('message: $message, ') + ..write('contactWillSendsReceipt: $contactWillSendsReceipt, ') + ..write('willBeRetriedByMediaUpload: $willBeRetriedByMediaUpload, ') + ..write('markForRetry: $markForRetry, ') + ..write('markForRetryAfterAccepted: $markForRetryAfterAccepted, ') + ..write('ackByServerAt: $ackByServerAt, ') + ..write('retryCount: $retryCount, ') + ..write('lastRetry: $lastRetry, ') + ..write('createdAt: $createdAt, ') + ..write('rowid: $rowid') + ..write(')')) + .toString(); + } +} + +class ReceivedReceipts extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + ReceivedReceipts(this.attachedDatabase, [this._alias]); + late final GeneratedColumn receiptId = GeneratedColumn( + 'receipt_id', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: currentDateAndTime, + ); + @override + List get $columns => [receiptId, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'received_receipts'; + @override + Set get $primaryKey => {receiptId}; + @override + ReceivedReceiptsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ReceivedReceiptsData( + receiptId: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}receipt_id'], + )!, + createdAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}created_at'], + )!, + ); + } + + @override + ReceivedReceipts createAlias(String alias) { + return ReceivedReceipts(attachedDatabase, alias); + } +} + +class ReceivedReceiptsData extends DataClass + implements Insertable { + final String receiptId; + final DateTime createdAt; + const ReceivedReceiptsData({ + required this.receiptId, + required this.createdAt, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['receipt_id'] = Variable(receiptId); + map['created_at'] = Variable(createdAt); + return map; + } + + ReceivedReceiptsCompanion toCompanion(bool nullToAbsent) { + return ReceivedReceiptsCompanion( + receiptId: Value(receiptId), + createdAt: Value(createdAt), + ); + } + + factory ReceivedReceiptsData.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ReceivedReceiptsData( + receiptId: serializer.fromJson(json['receiptId']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'receiptId': serializer.toJson(receiptId), + 'createdAt': serializer.toJson(createdAt), + }; + } + + ReceivedReceiptsData copyWith({String? receiptId, DateTime? createdAt}) => + ReceivedReceiptsData( + receiptId: receiptId ?? this.receiptId, + createdAt: createdAt ?? this.createdAt, + ); + ReceivedReceiptsData copyWithCompanion(ReceivedReceiptsCompanion data) { + return ReceivedReceiptsData( + receiptId: data.receiptId.present ? data.receiptId.value : this.receiptId, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('ReceivedReceiptsData(') + ..write('receiptId: $receiptId, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(receiptId, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ReceivedReceiptsData && + other.receiptId == this.receiptId && + other.createdAt == this.createdAt); +} + +class ReceivedReceiptsCompanion extends UpdateCompanion { + final Value receiptId; + final Value createdAt; + final Value rowid; + const ReceivedReceiptsCompanion({ + this.receiptId = const Value.absent(), + this.createdAt = const Value.absent(), + this.rowid = const Value.absent(), + }); + ReceivedReceiptsCompanion.insert({ + required String receiptId, + this.createdAt = const Value.absent(), + this.rowid = const Value.absent(), + }) : receiptId = Value(receiptId); + static Insertable custom({ + Expression? receiptId, + Expression? createdAt, + Expression? rowid, + }) { + return RawValuesInsertable({ + if (receiptId != null) 'receipt_id': receiptId, + if (createdAt != null) 'created_at': createdAt, + if (rowid != null) 'rowid': rowid, + }); + } + + ReceivedReceiptsCompanion copyWith({ + Value? receiptId, + Value? createdAt, + Value? rowid, + }) { + return ReceivedReceiptsCompanion( + receiptId: receiptId ?? this.receiptId, + createdAt: createdAt ?? this.createdAt, + rowid: rowid ?? this.rowid, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (receiptId.present) { + map['receipt_id'] = Variable(receiptId.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + if (rowid.present) { + map['rowid'] = Variable(rowid.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ReceivedReceiptsCompanion(') + ..write('receiptId: $receiptId, ') + ..write('createdAt: $createdAt, ') + ..write('rowid: $rowid') + ..write(')')) + .toString(); + } +} + +class SignalIdentityKeyStores extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + SignalIdentityKeyStores(this.attachedDatabase, [this._alias]); + late final GeneratedColumn deviceId = GeneratedColumn( + 'device_id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: true, + ); + late final GeneratedColumn name = GeneratedColumn( + 'name', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + late final GeneratedColumn identityKey = + GeneratedColumn( + 'identity_key', + aliasedName, + false, + type: DriftSqlType.blob, + requiredDuringInsert: true, + ); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: currentDateAndTime, + ); + @override + List get $columns => [ + deviceId, + name, + identityKey, + createdAt, + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'signal_identity_key_stores'; + @override + Set get $primaryKey => {deviceId, name}; + @override + SignalIdentityKeyStoresData map( + Map data, { + String? tablePrefix, + }) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SignalIdentityKeyStoresData( + deviceId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}device_id'], + )!, + name: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}name'], + )!, + identityKey: attachedDatabase.typeMapping.read( + DriftSqlType.blob, + data['${effectivePrefix}identity_key'], + )!, + createdAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}created_at'], + )!, + ); + } + + @override + SignalIdentityKeyStores createAlias(String alias) { + return SignalIdentityKeyStores(attachedDatabase, alias); + } +} + +class SignalIdentityKeyStoresData extends DataClass + implements Insertable { + final int deviceId; + final String name; + final i2.Uint8List identityKey; + final DateTime createdAt; + const SignalIdentityKeyStoresData({ + required this.deviceId, + required this.name, + required this.identityKey, + required this.createdAt, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['device_id'] = Variable(deviceId); + map['name'] = Variable(name); + map['identity_key'] = Variable(identityKey); + map['created_at'] = Variable(createdAt); + return map; + } + + SignalIdentityKeyStoresCompanion toCompanion(bool nullToAbsent) { + return SignalIdentityKeyStoresCompanion( + deviceId: Value(deviceId), + name: Value(name), + identityKey: Value(identityKey), + createdAt: Value(createdAt), + ); + } + + factory SignalIdentityKeyStoresData.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SignalIdentityKeyStoresData( + deviceId: serializer.fromJson(json['deviceId']), + name: serializer.fromJson(json['name']), + identityKey: serializer.fromJson(json['identityKey']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'deviceId': serializer.toJson(deviceId), + 'name': serializer.toJson(name), + 'identityKey': serializer.toJson(identityKey), + 'createdAt': serializer.toJson(createdAt), + }; + } + + SignalIdentityKeyStoresData copyWith({ + int? deviceId, + String? name, + i2.Uint8List? identityKey, + DateTime? createdAt, + }) => SignalIdentityKeyStoresData( + deviceId: deviceId ?? this.deviceId, + name: name ?? this.name, + identityKey: identityKey ?? this.identityKey, + createdAt: createdAt ?? this.createdAt, + ); + SignalIdentityKeyStoresData copyWithCompanion( + SignalIdentityKeyStoresCompanion data, + ) { + return SignalIdentityKeyStoresData( + deviceId: data.deviceId.present ? data.deviceId.value : this.deviceId, + name: data.name.present ? data.name.value : this.name, + identityKey: data.identityKey.present + ? data.identityKey.value + : this.identityKey, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('SignalIdentityKeyStoresData(') + ..write('deviceId: $deviceId, ') + ..write('name: $name, ') + ..write('identityKey: $identityKey, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + deviceId, + name, + $driftBlobEquality.hash(identityKey), + createdAt, + ); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SignalIdentityKeyStoresData && + other.deviceId == this.deviceId && + other.name == this.name && + $driftBlobEquality.equals(other.identityKey, this.identityKey) && + other.createdAt == this.createdAt); +} + +class SignalIdentityKeyStoresCompanion + extends UpdateCompanion { + final Value deviceId; + final Value name; + final Value identityKey; + final Value createdAt; + final Value rowid; + const SignalIdentityKeyStoresCompanion({ + this.deviceId = const Value.absent(), + this.name = const Value.absent(), + this.identityKey = const Value.absent(), + this.createdAt = const Value.absent(), + this.rowid = const Value.absent(), + }); + SignalIdentityKeyStoresCompanion.insert({ + required int deviceId, + required String name, + required i2.Uint8List identityKey, + this.createdAt = const Value.absent(), + this.rowid = const Value.absent(), + }) : deviceId = Value(deviceId), + name = Value(name), + identityKey = Value(identityKey); + static Insertable custom({ + Expression? deviceId, + Expression? name, + Expression? identityKey, + Expression? createdAt, + Expression? rowid, + }) { + return RawValuesInsertable({ + if (deviceId != null) 'device_id': deviceId, + if (name != null) 'name': name, + if (identityKey != null) 'identity_key': identityKey, + if (createdAt != null) 'created_at': createdAt, + if (rowid != null) 'rowid': rowid, + }); + } + + SignalIdentityKeyStoresCompanion copyWith({ + Value? deviceId, + Value? name, + Value? identityKey, + Value? createdAt, + Value? rowid, + }) { + return SignalIdentityKeyStoresCompanion( + deviceId: deviceId ?? this.deviceId, + name: name ?? this.name, + identityKey: identityKey ?? this.identityKey, + createdAt: createdAt ?? this.createdAt, + rowid: rowid ?? this.rowid, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (deviceId.present) { + map['device_id'] = Variable(deviceId.value); + } + if (name.present) { + map['name'] = Variable(name.value); + } + if (identityKey.present) { + map['identity_key'] = Variable(identityKey.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + if (rowid.present) { + map['rowid'] = Variable(rowid.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SignalIdentityKeyStoresCompanion(') + ..write('deviceId: $deviceId, ') + ..write('name: $name, ') + ..write('identityKey: $identityKey, ') + ..write('createdAt: $createdAt, ') + ..write('rowid: $rowid') + ..write(')')) + .toString(); + } +} + +class SignalPreKeyStores extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + SignalPreKeyStores(this.attachedDatabase, [this._alias]); + late final GeneratedColumn preKeyId = GeneratedColumn( + 'pre_key_id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: false, + ); + late final GeneratedColumn preKey = + GeneratedColumn( + 'pre_key', + aliasedName, + false, + type: DriftSqlType.blob, + requiredDuringInsert: true, + ); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: currentDateAndTime, + ); + @override + List get $columns => [preKeyId, preKey, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'signal_pre_key_stores'; + @override + Set get $primaryKey => {preKeyId}; + @override + SignalPreKeyStoresData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SignalPreKeyStoresData( + preKeyId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}pre_key_id'], + )!, + preKey: attachedDatabase.typeMapping.read( + DriftSqlType.blob, + data['${effectivePrefix}pre_key'], + )!, + createdAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}created_at'], + )!, + ); + } + + @override + SignalPreKeyStores createAlias(String alias) { + return SignalPreKeyStores(attachedDatabase, alias); + } +} + +class SignalPreKeyStoresData extends DataClass + implements Insertable { + final int preKeyId; + final i2.Uint8List preKey; + final DateTime createdAt; + const SignalPreKeyStoresData({ + required this.preKeyId, + required this.preKey, + required this.createdAt, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['pre_key_id'] = Variable(preKeyId); + map['pre_key'] = Variable(preKey); + map['created_at'] = Variable(createdAt); + return map; + } + + SignalPreKeyStoresCompanion toCompanion(bool nullToAbsent) { + return SignalPreKeyStoresCompanion( + preKeyId: Value(preKeyId), + preKey: Value(preKey), + createdAt: Value(createdAt), + ); + } + + factory SignalPreKeyStoresData.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SignalPreKeyStoresData( + preKeyId: serializer.fromJson(json['preKeyId']), + preKey: serializer.fromJson(json['preKey']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'preKeyId': serializer.toJson(preKeyId), + 'preKey': serializer.toJson(preKey), + 'createdAt': serializer.toJson(createdAt), + }; + } + + SignalPreKeyStoresData copyWith({ + int? preKeyId, + i2.Uint8List? preKey, + DateTime? createdAt, + }) => SignalPreKeyStoresData( + preKeyId: preKeyId ?? this.preKeyId, + preKey: preKey ?? this.preKey, + createdAt: createdAt ?? this.createdAt, + ); + SignalPreKeyStoresData copyWithCompanion(SignalPreKeyStoresCompanion data) { + return SignalPreKeyStoresData( + preKeyId: data.preKeyId.present ? data.preKeyId.value : this.preKeyId, + preKey: data.preKey.present ? data.preKey.value : this.preKey, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('SignalPreKeyStoresData(') + ..write('preKeyId: $preKeyId, ') + ..write('preKey: $preKey, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(preKeyId, $driftBlobEquality.hash(preKey), createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SignalPreKeyStoresData && + other.preKeyId == this.preKeyId && + $driftBlobEquality.equals(other.preKey, this.preKey) && + other.createdAt == this.createdAt); +} + +class SignalPreKeyStoresCompanion + extends UpdateCompanion { + final Value preKeyId; + final Value preKey; + final Value createdAt; + const SignalPreKeyStoresCompanion({ + this.preKeyId = const Value.absent(), + this.preKey = const Value.absent(), + this.createdAt = const Value.absent(), + }); + SignalPreKeyStoresCompanion.insert({ + this.preKeyId = const Value.absent(), + required i2.Uint8List preKey, + this.createdAt = const Value.absent(), + }) : preKey = Value(preKey); + static Insertable custom({ + Expression? preKeyId, + Expression? preKey, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (preKeyId != null) 'pre_key_id': preKeyId, + if (preKey != null) 'pre_key': preKey, + if (createdAt != null) 'created_at': createdAt, + }); + } + + SignalPreKeyStoresCompanion copyWith({ + Value? preKeyId, + Value? preKey, + Value? createdAt, + }) { + return SignalPreKeyStoresCompanion( + preKeyId: preKeyId ?? this.preKeyId, + preKey: preKey ?? this.preKey, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (preKeyId.present) { + map['pre_key_id'] = Variable(preKeyId.value); + } + if (preKey.present) { + map['pre_key'] = Variable(preKey.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SignalPreKeyStoresCompanion(') + ..write('preKeyId: $preKeyId, ') + ..write('preKey: $preKey, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class SignalSenderKeyStores extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + SignalSenderKeyStores(this.attachedDatabase, [this._alias]); + late final GeneratedColumn senderKeyName = GeneratedColumn( + 'sender_key_name', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + late final GeneratedColumn senderKey = + GeneratedColumn( + 'sender_key', + aliasedName, + false, + type: DriftSqlType.blob, + requiredDuringInsert: true, + ); + @override + List get $columns => [senderKeyName, senderKey]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'signal_sender_key_stores'; + @override + Set get $primaryKey => {senderKeyName}; + @override + SignalSenderKeyStoresData map( + Map data, { + String? tablePrefix, + }) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SignalSenderKeyStoresData( + senderKeyName: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}sender_key_name'], + )!, + senderKey: attachedDatabase.typeMapping.read( + DriftSqlType.blob, + data['${effectivePrefix}sender_key'], + )!, + ); + } + + @override + SignalSenderKeyStores createAlias(String alias) { + return SignalSenderKeyStores(attachedDatabase, alias); + } +} + +class SignalSenderKeyStoresData extends DataClass + implements Insertable { + final String senderKeyName; + final i2.Uint8List senderKey; + const SignalSenderKeyStoresData({ + required this.senderKeyName, + required this.senderKey, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['sender_key_name'] = Variable(senderKeyName); + map['sender_key'] = Variable(senderKey); + return map; + } + + SignalSenderKeyStoresCompanion toCompanion(bool nullToAbsent) { + return SignalSenderKeyStoresCompanion( + senderKeyName: Value(senderKeyName), + senderKey: Value(senderKey), + ); + } + + factory SignalSenderKeyStoresData.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SignalSenderKeyStoresData( + senderKeyName: serializer.fromJson(json['senderKeyName']), + senderKey: serializer.fromJson(json['senderKey']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'senderKeyName': serializer.toJson(senderKeyName), + 'senderKey': serializer.toJson(senderKey), + }; + } + + SignalSenderKeyStoresData copyWith({ + String? senderKeyName, + i2.Uint8List? senderKey, + }) => SignalSenderKeyStoresData( + senderKeyName: senderKeyName ?? this.senderKeyName, + senderKey: senderKey ?? this.senderKey, + ); + SignalSenderKeyStoresData copyWithCompanion( + SignalSenderKeyStoresCompanion data, + ) { + return SignalSenderKeyStoresData( + senderKeyName: data.senderKeyName.present + ? data.senderKeyName.value + : this.senderKeyName, + senderKey: data.senderKey.present ? data.senderKey.value : this.senderKey, + ); + } + + @override + String toString() { + return (StringBuffer('SignalSenderKeyStoresData(') + ..write('senderKeyName: $senderKeyName, ') + ..write('senderKey: $senderKey') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(senderKeyName, $driftBlobEquality.hash(senderKey)); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SignalSenderKeyStoresData && + other.senderKeyName == this.senderKeyName && + $driftBlobEquality.equals(other.senderKey, this.senderKey)); +} + +class SignalSenderKeyStoresCompanion + extends UpdateCompanion { + final Value senderKeyName; + final Value senderKey; + final Value rowid; + const SignalSenderKeyStoresCompanion({ + this.senderKeyName = const Value.absent(), + this.senderKey = const Value.absent(), + this.rowid = const Value.absent(), + }); + SignalSenderKeyStoresCompanion.insert({ + required String senderKeyName, + required i2.Uint8List senderKey, + this.rowid = const Value.absent(), + }) : senderKeyName = Value(senderKeyName), + senderKey = Value(senderKey); + static Insertable custom({ + Expression? senderKeyName, + Expression? senderKey, + Expression? rowid, + }) { + return RawValuesInsertable({ + if (senderKeyName != null) 'sender_key_name': senderKeyName, + if (senderKey != null) 'sender_key': senderKey, + if (rowid != null) 'rowid': rowid, + }); + } + + SignalSenderKeyStoresCompanion copyWith({ + Value? senderKeyName, + Value? senderKey, + Value? rowid, + }) { + return SignalSenderKeyStoresCompanion( + senderKeyName: senderKeyName ?? this.senderKeyName, + senderKey: senderKey ?? this.senderKey, + rowid: rowid ?? this.rowid, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (senderKeyName.present) { + map['sender_key_name'] = Variable(senderKeyName.value); + } + if (senderKey.present) { + map['sender_key'] = Variable(senderKey.value); + } + if (rowid.present) { + map['rowid'] = Variable(rowid.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SignalSenderKeyStoresCompanion(') + ..write('senderKeyName: $senderKeyName, ') + ..write('senderKey: $senderKey, ') + ..write('rowid: $rowid') + ..write(')')) + .toString(); + } +} + +class SignalSessionStores extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + SignalSessionStores(this.attachedDatabase, [this._alias]); + late final GeneratedColumn deviceId = GeneratedColumn( + 'device_id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: true, + ); + late final GeneratedColumn name = GeneratedColumn( + 'name', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + late final GeneratedColumn sessionRecord = + GeneratedColumn( + 'session_record', + aliasedName, + false, + type: DriftSqlType.blob, + requiredDuringInsert: true, + ); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: currentDateAndTime, + ); + @override + List get $columns => [ + deviceId, + name, + sessionRecord, + createdAt, + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'signal_session_stores'; + @override + Set get $primaryKey => {deviceId, name}; + @override + SignalSessionStoresData map( + Map data, { + String? tablePrefix, + }) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SignalSessionStoresData( + deviceId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}device_id'], + )!, + name: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}name'], + )!, + sessionRecord: attachedDatabase.typeMapping.read( + DriftSqlType.blob, + data['${effectivePrefix}session_record'], + )!, + createdAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}created_at'], + )!, + ); + } + + @override + SignalSessionStores createAlias(String alias) { + return SignalSessionStores(attachedDatabase, alias); + } +} + +class SignalSessionStoresData extends DataClass + implements Insertable { + final int deviceId; + final String name; + final i2.Uint8List sessionRecord; + final DateTime createdAt; + const SignalSessionStoresData({ + required this.deviceId, + required this.name, + required this.sessionRecord, + required this.createdAt, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['device_id'] = Variable(deviceId); + map['name'] = Variable(name); + map['session_record'] = Variable(sessionRecord); + map['created_at'] = Variable(createdAt); + return map; + } + + SignalSessionStoresCompanion toCompanion(bool nullToAbsent) { + return SignalSessionStoresCompanion( + deviceId: Value(deviceId), + name: Value(name), + sessionRecord: Value(sessionRecord), + createdAt: Value(createdAt), + ); + } + + factory SignalSessionStoresData.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SignalSessionStoresData( + deviceId: serializer.fromJson(json['deviceId']), + name: serializer.fromJson(json['name']), + sessionRecord: serializer.fromJson(json['sessionRecord']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'deviceId': serializer.toJson(deviceId), + 'name': serializer.toJson(name), + 'sessionRecord': serializer.toJson(sessionRecord), + 'createdAt': serializer.toJson(createdAt), + }; + } + + SignalSessionStoresData copyWith({ + int? deviceId, + String? name, + i2.Uint8List? sessionRecord, + DateTime? createdAt, + }) => SignalSessionStoresData( + deviceId: deviceId ?? this.deviceId, + name: name ?? this.name, + sessionRecord: sessionRecord ?? this.sessionRecord, + createdAt: createdAt ?? this.createdAt, + ); + SignalSessionStoresData copyWithCompanion(SignalSessionStoresCompanion data) { + return SignalSessionStoresData( + deviceId: data.deviceId.present ? data.deviceId.value : this.deviceId, + name: data.name.present ? data.name.value : this.name, + sessionRecord: data.sessionRecord.present + ? data.sessionRecord.value + : this.sessionRecord, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('SignalSessionStoresData(') + ..write('deviceId: $deviceId, ') + ..write('name: $name, ') + ..write('sessionRecord: $sessionRecord, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + deviceId, + name, + $driftBlobEquality.hash(sessionRecord), + createdAt, + ); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SignalSessionStoresData && + other.deviceId == this.deviceId && + other.name == this.name && + $driftBlobEquality.equals(other.sessionRecord, this.sessionRecord) && + other.createdAt == this.createdAt); +} + +class SignalSessionStoresCompanion + extends UpdateCompanion { + final Value deviceId; + final Value name; + final Value sessionRecord; + final Value createdAt; + final Value rowid; + const SignalSessionStoresCompanion({ + this.deviceId = const Value.absent(), + this.name = const Value.absent(), + this.sessionRecord = const Value.absent(), + this.createdAt = const Value.absent(), + this.rowid = const Value.absent(), + }); + SignalSessionStoresCompanion.insert({ + required int deviceId, + required String name, + required i2.Uint8List sessionRecord, + this.createdAt = const Value.absent(), + this.rowid = const Value.absent(), + }) : deviceId = Value(deviceId), + name = Value(name), + sessionRecord = Value(sessionRecord); + static Insertable custom({ + Expression? deviceId, + Expression? name, + Expression? sessionRecord, + Expression? createdAt, + Expression? rowid, + }) { + return RawValuesInsertable({ + if (deviceId != null) 'device_id': deviceId, + if (name != null) 'name': name, + if (sessionRecord != null) 'session_record': sessionRecord, + if (createdAt != null) 'created_at': createdAt, + if (rowid != null) 'rowid': rowid, + }); + } + + SignalSessionStoresCompanion copyWith({ + Value? deviceId, + Value? name, + Value? sessionRecord, + Value? createdAt, + Value? rowid, + }) { + return SignalSessionStoresCompanion( + deviceId: deviceId ?? this.deviceId, + name: name ?? this.name, + sessionRecord: sessionRecord ?? this.sessionRecord, + createdAt: createdAt ?? this.createdAt, + rowid: rowid ?? this.rowid, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (deviceId.present) { + map['device_id'] = Variable(deviceId.value); + } + if (name.present) { + map['name'] = Variable(name.value); + } + if (sessionRecord.present) { + map['session_record'] = Variable(sessionRecord.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + if (rowid.present) { + map['rowid'] = Variable(rowid.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SignalSessionStoresCompanion(') + ..write('deviceId: $deviceId, ') + ..write('name: $name, ') + ..write('sessionRecord: $sessionRecord, ') + ..write('createdAt: $createdAt, ') + ..write('rowid: $rowid') + ..write(')')) + .toString(); + } +} + +class SignalSignedPreKeyStores extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + SignalSignedPreKeyStores(this.attachedDatabase, [this._alias]); + late final GeneratedColumn signedPreKeyId = GeneratedColumn( + 'signed_pre_key_id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: false, + ); + late final GeneratedColumn signedPreKey = + GeneratedColumn( + 'signed_pre_key', + aliasedName, + false, + type: DriftSqlType.blob, + requiredDuringInsert: true, + ); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: currentDateAndTime, + ); + @override + List get $columns => [ + signedPreKeyId, + signedPreKey, + createdAt, + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'signal_signed_pre_key_stores'; + @override + Set get $primaryKey => {signedPreKeyId}; + @override + SignalSignedPreKeyStoresData map( + Map data, { + String? tablePrefix, + }) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SignalSignedPreKeyStoresData( + signedPreKeyId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}signed_pre_key_id'], + )!, + signedPreKey: attachedDatabase.typeMapping.read( + DriftSqlType.blob, + data['${effectivePrefix}signed_pre_key'], + )!, + createdAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}created_at'], + )!, + ); + } + + @override + SignalSignedPreKeyStores createAlias(String alias) { + return SignalSignedPreKeyStores(attachedDatabase, alias); + } +} + +class SignalSignedPreKeyStoresData extends DataClass + implements Insertable { + final int signedPreKeyId; + final i2.Uint8List signedPreKey; + final DateTime createdAt; + const SignalSignedPreKeyStoresData({ + required this.signedPreKeyId, + required this.signedPreKey, + required this.createdAt, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['signed_pre_key_id'] = Variable(signedPreKeyId); + map['signed_pre_key'] = Variable(signedPreKey); + map['created_at'] = Variable(createdAt); + return map; + } + + SignalSignedPreKeyStoresCompanion toCompanion(bool nullToAbsent) { + return SignalSignedPreKeyStoresCompanion( + signedPreKeyId: Value(signedPreKeyId), + signedPreKey: Value(signedPreKey), + createdAt: Value(createdAt), + ); + } + + factory SignalSignedPreKeyStoresData.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SignalSignedPreKeyStoresData( + signedPreKeyId: serializer.fromJson(json['signedPreKeyId']), + signedPreKey: serializer.fromJson(json['signedPreKey']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'signedPreKeyId': serializer.toJson(signedPreKeyId), + 'signedPreKey': serializer.toJson(signedPreKey), + 'createdAt': serializer.toJson(createdAt), + }; + } + + SignalSignedPreKeyStoresData copyWith({ + int? signedPreKeyId, + i2.Uint8List? signedPreKey, + DateTime? createdAt, + }) => SignalSignedPreKeyStoresData( + signedPreKeyId: signedPreKeyId ?? this.signedPreKeyId, + signedPreKey: signedPreKey ?? this.signedPreKey, + createdAt: createdAt ?? this.createdAt, + ); + SignalSignedPreKeyStoresData copyWithCompanion( + SignalSignedPreKeyStoresCompanion data, + ) { + return SignalSignedPreKeyStoresData( + signedPreKeyId: data.signedPreKeyId.present + ? data.signedPreKeyId.value + : this.signedPreKeyId, + signedPreKey: data.signedPreKey.present + ? data.signedPreKey.value + : this.signedPreKey, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('SignalSignedPreKeyStoresData(') + ..write('signedPreKeyId: $signedPreKeyId, ') + ..write('signedPreKey: $signedPreKey, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + signedPreKeyId, + $driftBlobEquality.hash(signedPreKey), + createdAt, + ); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SignalSignedPreKeyStoresData && + other.signedPreKeyId == this.signedPreKeyId && + $driftBlobEquality.equals(other.signedPreKey, this.signedPreKey) && + other.createdAt == this.createdAt); +} + +class SignalSignedPreKeyStoresCompanion + extends UpdateCompanion { + final Value signedPreKeyId; + final Value signedPreKey; + final Value createdAt; + const SignalSignedPreKeyStoresCompanion({ + this.signedPreKeyId = const Value.absent(), + this.signedPreKey = const Value.absent(), + this.createdAt = const Value.absent(), + }); + SignalSignedPreKeyStoresCompanion.insert({ + this.signedPreKeyId = const Value.absent(), + required i2.Uint8List signedPreKey, + this.createdAt = const Value.absent(), + }) : signedPreKey = Value(signedPreKey); + static Insertable custom({ + Expression? signedPreKeyId, + Expression? signedPreKey, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (signedPreKeyId != null) 'signed_pre_key_id': signedPreKeyId, + if (signedPreKey != null) 'signed_pre_key': signedPreKey, + if (createdAt != null) 'created_at': createdAt, + }); + } + + SignalSignedPreKeyStoresCompanion copyWith({ + Value? signedPreKeyId, + Value? signedPreKey, + Value? createdAt, + }) { + return SignalSignedPreKeyStoresCompanion( + signedPreKeyId: signedPreKeyId ?? this.signedPreKeyId, + signedPreKey: signedPreKey ?? this.signedPreKey, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (signedPreKeyId.present) { + map['signed_pre_key_id'] = Variable(signedPreKeyId.value); + } + if (signedPreKey.present) { + map['signed_pre_key'] = Variable(signedPreKey.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SignalSignedPreKeyStoresCompanion(') + ..write('signedPreKeyId: $signedPreKeyId, ') + ..write('signedPreKey: $signedPreKey, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class MessageActions extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + MessageActions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn messageId = GeneratedColumn( + 'message_id', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES messages (message_id) ON DELETE CASCADE', + ), + ); + late final GeneratedColumn contactId = GeneratedColumn( + 'contact_id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES contacts (user_id) ON DELETE CASCADE', + ), + ); + late final GeneratedColumn type = GeneratedColumn( + 'type', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + late final GeneratedColumn actionAt = GeneratedColumn( + 'action_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: currentDateAndTime, + ); + @override + List get $columns => [messageId, contactId, type, actionAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'message_actions'; + @override + Set get $primaryKey => {messageId, contactId, type}; + @override + MessageActionsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return MessageActionsData( + messageId: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}message_id'], + )!, + contactId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}contact_id'], + )!, + type: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}type'], + )!, + actionAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}action_at'], + )!, + ); + } + + @override + MessageActions createAlias(String alias) { + return MessageActions(attachedDatabase, alias); + } +} + +class MessageActionsData extends DataClass + implements Insertable { + final String messageId; + final int contactId; + final String type; + final DateTime actionAt; + const MessageActionsData({ + required this.messageId, + required this.contactId, + required this.type, + required this.actionAt, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['message_id'] = Variable(messageId); + map['contact_id'] = Variable(contactId); + map['type'] = Variable(type); + map['action_at'] = Variable(actionAt); + return map; + } + + MessageActionsCompanion toCompanion(bool nullToAbsent) { + return MessageActionsCompanion( + messageId: Value(messageId), + contactId: Value(contactId), + type: Value(type), + actionAt: Value(actionAt), + ); + } + + factory MessageActionsData.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return MessageActionsData( + messageId: serializer.fromJson(json['messageId']), + contactId: serializer.fromJson(json['contactId']), + type: serializer.fromJson(json['type']), + actionAt: serializer.fromJson(json['actionAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'messageId': serializer.toJson(messageId), + 'contactId': serializer.toJson(contactId), + 'type': serializer.toJson(type), + 'actionAt': serializer.toJson(actionAt), + }; + } + + MessageActionsData copyWith({ + String? messageId, + int? contactId, + String? type, + DateTime? actionAt, + }) => MessageActionsData( + messageId: messageId ?? this.messageId, + contactId: contactId ?? this.contactId, + type: type ?? this.type, + actionAt: actionAt ?? this.actionAt, + ); + MessageActionsData copyWithCompanion(MessageActionsCompanion data) { + return MessageActionsData( + messageId: data.messageId.present ? data.messageId.value : this.messageId, + contactId: data.contactId.present ? data.contactId.value : this.contactId, + type: data.type.present ? data.type.value : this.type, + actionAt: data.actionAt.present ? data.actionAt.value : this.actionAt, + ); + } + + @override + String toString() { + return (StringBuffer('MessageActionsData(') + ..write('messageId: $messageId, ') + ..write('contactId: $contactId, ') + ..write('type: $type, ') + ..write('actionAt: $actionAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(messageId, contactId, type, actionAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is MessageActionsData && + other.messageId == this.messageId && + other.contactId == this.contactId && + other.type == this.type && + other.actionAt == this.actionAt); +} + +class MessageActionsCompanion extends UpdateCompanion { + final Value messageId; + final Value contactId; + final Value type; + final Value actionAt; + final Value rowid; + const MessageActionsCompanion({ + this.messageId = const Value.absent(), + this.contactId = const Value.absent(), + this.type = const Value.absent(), + this.actionAt = const Value.absent(), + this.rowid = const Value.absent(), + }); + MessageActionsCompanion.insert({ + required String messageId, + required int contactId, + required String type, + this.actionAt = const Value.absent(), + this.rowid = const Value.absent(), + }) : messageId = Value(messageId), + contactId = Value(contactId), + type = Value(type); + static Insertable custom({ + Expression? messageId, + Expression? contactId, + Expression? type, + Expression? actionAt, + Expression? rowid, + }) { + return RawValuesInsertable({ + if (messageId != null) 'message_id': messageId, + if (contactId != null) 'contact_id': contactId, + if (type != null) 'type': type, + if (actionAt != null) 'action_at': actionAt, + if (rowid != null) 'rowid': rowid, + }); + } + + MessageActionsCompanion copyWith({ + Value? messageId, + Value? contactId, + Value? type, + Value? actionAt, + Value? rowid, + }) { + return MessageActionsCompanion( + messageId: messageId ?? this.messageId, + contactId: contactId ?? this.contactId, + type: type ?? this.type, + actionAt: actionAt ?? this.actionAt, + rowid: rowid ?? this.rowid, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (messageId.present) { + map['message_id'] = Variable(messageId.value); + } + if (contactId.present) { + map['contact_id'] = Variable(contactId.value); + } + if (type.present) { + map['type'] = Variable(type.value); + } + if (actionAt.present) { + map['action_at'] = Variable(actionAt.value); + } + if (rowid.present) { + map['rowid'] = Variable(rowid.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('MessageActionsCompanion(') + ..write('messageId: $messageId, ') + ..write('contactId: $contactId, ') + ..write('type: $type, ') + ..write('actionAt: $actionAt, ') + ..write('rowid: $rowid') + ..write(')')) + .toString(); + } +} + +class GroupHistories extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + GroupHistories(this.attachedDatabase, [this._alias]); + late final GeneratedColumn groupHistoryId = GeneratedColumn( + 'group_history_id', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + late final GeneratedColumn groupId = GeneratedColumn( + 'group_id', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES "groups" (group_id) ON DELETE CASCADE', + ), + ); + late final GeneratedColumn contactId = GeneratedColumn( + 'contact_id', + aliasedName, + true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES contacts (user_id)', + ), + ); + late final GeneratedColumn affectedContactId = GeneratedColumn( + 'affected_contact_id', + aliasedName, + true, + type: DriftSqlType.int, + requiredDuringInsert: false, + ); + late final GeneratedColumn oldGroupName = GeneratedColumn( + 'old_group_name', + aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + ); + late final GeneratedColumn newGroupName = GeneratedColumn( + 'new_group_name', + aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + ); + late final GeneratedColumn newDeleteMessagesAfterMilliseconds = + GeneratedColumn( + 'new_delete_messages_after_milliseconds', + aliasedName, + true, + type: DriftSqlType.int, + requiredDuringInsert: false, + ); + late final GeneratedColumn type = GeneratedColumn( + 'type', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + late final GeneratedColumn actionAt = GeneratedColumn( + 'action_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: currentDateAndTime, + ); + @override + List get $columns => [ + groupHistoryId, + groupId, + contactId, + affectedContactId, + oldGroupName, + newGroupName, + newDeleteMessagesAfterMilliseconds, + type, + actionAt, + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'group_histories'; + @override + Set get $primaryKey => {groupHistoryId}; + @override + GroupHistoriesData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return GroupHistoriesData( + groupHistoryId: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}group_history_id'], + )!, + groupId: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}group_id'], + )!, + contactId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}contact_id'], + ), + affectedContactId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}affected_contact_id'], + ), + oldGroupName: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}old_group_name'], + ), + newGroupName: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}new_group_name'], + ), + newDeleteMessagesAfterMilliseconds: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}new_delete_messages_after_milliseconds'], + ), + type: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}type'], + )!, + actionAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}action_at'], + )!, + ); + } + + @override + GroupHistories createAlias(String alias) { + return GroupHistories(attachedDatabase, alias); + } +} + +class GroupHistoriesData extends DataClass + implements Insertable { + final String groupHistoryId; + final String groupId; + final int? contactId; + final int? affectedContactId; + final String? oldGroupName; + final String? newGroupName; + final int? newDeleteMessagesAfterMilliseconds; + final String type; + final DateTime actionAt; + const GroupHistoriesData({ + required this.groupHistoryId, + required this.groupId, + this.contactId, + this.affectedContactId, + this.oldGroupName, + this.newGroupName, + this.newDeleteMessagesAfterMilliseconds, + required this.type, + required this.actionAt, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['group_history_id'] = Variable(groupHistoryId); + map['group_id'] = Variable(groupId); + if (!nullToAbsent || contactId != null) { + map['contact_id'] = Variable(contactId); + } + if (!nullToAbsent || affectedContactId != null) { + map['affected_contact_id'] = Variable(affectedContactId); + } + if (!nullToAbsent || oldGroupName != null) { + map['old_group_name'] = Variable(oldGroupName); + } + if (!nullToAbsent || newGroupName != null) { + map['new_group_name'] = Variable(newGroupName); + } + if (!nullToAbsent || newDeleteMessagesAfterMilliseconds != null) { + map['new_delete_messages_after_milliseconds'] = Variable( + newDeleteMessagesAfterMilliseconds, + ); + } + map['type'] = Variable(type); + map['action_at'] = Variable(actionAt); + return map; + } + + GroupHistoriesCompanion toCompanion(bool nullToAbsent) { + return GroupHistoriesCompanion( + groupHistoryId: Value(groupHistoryId), + groupId: Value(groupId), + contactId: contactId == null && nullToAbsent + ? const Value.absent() + : Value(contactId), + affectedContactId: affectedContactId == null && nullToAbsent + ? const Value.absent() + : Value(affectedContactId), + oldGroupName: oldGroupName == null && nullToAbsent + ? const Value.absent() + : Value(oldGroupName), + newGroupName: newGroupName == null && nullToAbsent + ? const Value.absent() + : Value(newGroupName), + newDeleteMessagesAfterMilliseconds: + newDeleteMessagesAfterMilliseconds == null && nullToAbsent + ? const Value.absent() + : Value(newDeleteMessagesAfterMilliseconds), + type: Value(type), + actionAt: Value(actionAt), + ); + } + + factory GroupHistoriesData.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return GroupHistoriesData( + groupHistoryId: serializer.fromJson(json['groupHistoryId']), + groupId: serializer.fromJson(json['groupId']), + contactId: serializer.fromJson(json['contactId']), + affectedContactId: serializer.fromJson(json['affectedContactId']), + oldGroupName: serializer.fromJson(json['oldGroupName']), + newGroupName: serializer.fromJson(json['newGroupName']), + newDeleteMessagesAfterMilliseconds: serializer.fromJson( + json['newDeleteMessagesAfterMilliseconds'], + ), + type: serializer.fromJson(json['type']), + actionAt: serializer.fromJson(json['actionAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'groupHistoryId': serializer.toJson(groupHistoryId), + 'groupId': serializer.toJson(groupId), + 'contactId': serializer.toJson(contactId), + 'affectedContactId': serializer.toJson(affectedContactId), + 'oldGroupName': serializer.toJson(oldGroupName), + 'newGroupName': serializer.toJson(newGroupName), + 'newDeleteMessagesAfterMilliseconds': serializer.toJson( + newDeleteMessagesAfterMilliseconds, + ), + 'type': serializer.toJson(type), + 'actionAt': serializer.toJson(actionAt), + }; + } + + GroupHistoriesData copyWith({ + String? groupHistoryId, + String? groupId, + Value contactId = const Value.absent(), + Value affectedContactId = const Value.absent(), + Value oldGroupName = const Value.absent(), + Value newGroupName = const Value.absent(), + Value newDeleteMessagesAfterMilliseconds = const Value.absent(), + String? type, + DateTime? actionAt, + }) => GroupHistoriesData( + groupHistoryId: groupHistoryId ?? this.groupHistoryId, + groupId: groupId ?? this.groupId, + contactId: contactId.present ? contactId.value : this.contactId, + affectedContactId: affectedContactId.present + ? affectedContactId.value + : this.affectedContactId, + oldGroupName: oldGroupName.present ? oldGroupName.value : this.oldGroupName, + newGroupName: newGroupName.present ? newGroupName.value : this.newGroupName, + newDeleteMessagesAfterMilliseconds: + newDeleteMessagesAfterMilliseconds.present + ? newDeleteMessagesAfterMilliseconds.value + : this.newDeleteMessagesAfterMilliseconds, + type: type ?? this.type, + actionAt: actionAt ?? this.actionAt, + ); + GroupHistoriesData copyWithCompanion(GroupHistoriesCompanion data) { + return GroupHistoriesData( + groupHistoryId: data.groupHistoryId.present + ? data.groupHistoryId.value + : this.groupHistoryId, + groupId: data.groupId.present ? data.groupId.value : this.groupId, + contactId: data.contactId.present ? data.contactId.value : this.contactId, + affectedContactId: data.affectedContactId.present + ? data.affectedContactId.value + : this.affectedContactId, + oldGroupName: data.oldGroupName.present + ? data.oldGroupName.value + : this.oldGroupName, + newGroupName: data.newGroupName.present + ? data.newGroupName.value + : this.newGroupName, + newDeleteMessagesAfterMilliseconds: + data.newDeleteMessagesAfterMilliseconds.present + ? data.newDeleteMessagesAfterMilliseconds.value + : this.newDeleteMessagesAfterMilliseconds, + type: data.type.present ? data.type.value : this.type, + actionAt: data.actionAt.present ? data.actionAt.value : this.actionAt, + ); + } + + @override + String toString() { + return (StringBuffer('GroupHistoriesData(') + ..write('groupHistoryId: $groupHistoryId, ') + ..write('groupId: $groupId, ') + ..write('contactId: $contactId, ') + ..write('affectedContactId: $affectedContactId, ') + ..write('oldGroupName: $oldGroupName, ') + ..write('newGroupName: $newGroupName, ') + ..write( + 'newDeleteMessagesAfterMilliseconds: $newDeleteMessagesAfterMilliseconds, ', + ) + ..write('type: $type, ') + ..write('actionAt: $actionAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + groupHistoryId, + groupId, + contactId, + affectedContactId, + oldGroupName, + newGroupName, + newDeleteMessagesAfterMilliseconds, + type, + actionAt, + ); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is GroupHistoriesData && + other.groupHistoryId == this.groupHistoryId && + other.groupId == this.groupId && + other.contactId == this.contactId && + other.affectedContactId == this.affectedContactId && + other.oldGroupName == this.oldGroupName && + other.newGroupName == this.newGroupName && + other.newDeleteMessagesAfterMilliseconds == + this.newDeleteMessagesAfterMilliseconds && + other.type == this.type && + other.actionAt == this.actionAt); +} + +class GroupHistoriesCompanion extends UpdateCompanion { + final Value groupHistoryId; + final Value groupId; + final Value contactId; + final Value affectedContactId; + final Value oldGroupName; + final Value newGroupName; + final Value newDeleteMessagesAfterMilliseconds; + final Value type; + final Value actionAt; + final Value rowid; + const GroupHistoriesCompanion({ + this.groupHistoryId = const Value.absent(), + this.groupId = const Value.absent(), + this.contactId = const Value.absent(), + this.affectedContactId = const Value.absent(), + this.oldGroupName = const Value.absent(), + this.newGroupName = const Value.absent(), + this.newDeleteMessagesAfterMilliseconds = const Value.absent(), + this.type = const Value.absent(), + this.actionAt = const Value.absent(), + this.rowid = const Value.absent(), + }); + GroupHistoriesCompanion.insert({ + required String groupHistoryId, + required String groupId, + this.contactId = const Value.absent(), + this.affectedContactId = const Value.absent(), + this.oldGroupName = const Value.absent(), + this.newGroupName = const Value.absent(), + this.newDeleteMessagesAfterMilliseconds = const Value.absent(), + required String type, + this.actionAt = const Value.absent(), + this.rowid = const Value.absent(), + }) : groupHistoryId = Value(groupHistoryId), + groupId = Value(groupId), + type = Value(type); + static Insertable custom({ + Expression? groupHistoryId, + Expression? groupId, + Expression? contactId, + Expression? affectedContactId, + Expression? oldGroupName, + Expression? newGroupName, + Expression? newDeleteMessagesAfterMilliseconds, + Expression? type, + Expression? actionAt, + Expression? rowid, + }) { + return RawValuesInsertable({ + if (groupHistoryId != null) 'group_history_id': groupHistoryId, + if (groupId != null) 'group_id': groupId, + if (contactId != null) 'contact_id': contactId, + if (affectedContactId != null) 'affected_contact_id': affectedContactId, + if (oldGroupName != null) 'old_group_name': oldGroupName, + if (newGroupName != null) 'new_group_name': newGroupName, + if (newDeleteMessagesAfterMilliseconds != null) + 'new_delete_messages_after_milliseconds': + newDeleteMessagesAfterMilliseconds, + if (type != null) 'type': type, + if (actionAt != null) 'action_at': actionAt, + if (rowid != null) 'rowid': rowid, + }); + } + + GroupHistoriesCompanion copyWith({ + Value? groupHistoryId, + Value? groupId, + Value? contactId, + Value? affectedContactId, + Value? oldGroupName, + Value? newGroupName, + Value? newDeleteMessagesAfterMilliseconds, + Value? type, + Value? actionAt, + Value? rowid, + }) { + return GroupHistoriesCompanion( + groupHistoryId: groupHistoryId ?? this.groupHistoryId, + groupId: groupId ?? this.groupId, + contactId: contactId ?? this.contactId, + affectedContactId: affectedContactId ?? this.affectedContactId, + oldGroupName: oldGroupName ?? this.oldGroupName, + newGroupName: newGroupName ?? this.newGroupName, + newDeleteMessagesAfterMilliseconds: + newDeleteMessagesAfterMilliseconds ?? + this.newDeleteMessagesAfterMilliseconds, + type: type ?? this.type, + actionAt: actionAt ?? this.actionAt, + rowid: rowid ?? this.rowid, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (groupHistoryId.present) { + map['group_history_id'] = Variable(groupHistoryId.value); + } + if (groupId.present) { + map['group_id'] = Variable(groupId.value); + } + if (contactId.present) { + map['contact_id'] = Variable(contactId.value); + } + if (affectedContactId.present) { + map['affected_contact_id'] = Variable(affectedContactId.value); + } + if (oldGroupName.present) { + map['old_group_name'] = Variable(oldGroupName.value); + } + if (newGroupName.present) { + map['new_group_name'] = Variable(newGroupName.value); + } + if (newDeleteMessagesAfterMilliseconds.present) { + map['new_delete_messages_after_milliseconds'] = Variable( + newDeleteMessagesAfterMilliseconds.value, + ); + } + if (type.present) { + map['type'] = Variable(type.value); + } + if (actionAt.present) { + map['action_at'] = Variable(actionAt.value); + } + if (rowid.present) { + map['rowid'] = Variable(rowid.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('GroupHistoriesCompanion(') + ..write('groupHistoryId: $groupHistoryId, ') + ..write('groupId: $groupId, ') + ..write('contactId: $contactId, ') + ..write('affectedContactId: $affectedContactId, ') + ..write('oldGroupName: $oldGroupName, ') + ..write('newGroupName: $newGroupName, ') + ..write( + 'newDeleteMessagesAfterMilliseconds: $newDeleteMessagesAfterMilliseconds, ', + ) + ..write('type: $type, ') + ..write('actionAt: $actionAt, ') + ..write('rowid: $rowid') + ..write(')')) + .toString(); + } +} + +class KeyVerifications extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + KeyVerifications(this.attachedDatabase, [this._alias]); + late final GeneratedColumn verificationId = GeneratedColumn( + 'verification_id', + aliasedName, + false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'PRIMARY KEY AUTOINCREMENT', + ), + ); + late final GeneratedColumn contactId = GeneratedColumn( + 'contact_id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES contacts (user_id) ON DELETE CASCADE', + ), + ); + late final GeneratedColumn type = GeneratedColumn( + 'type', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + late final GeneratedColumn verifiedBy = GeneratedColumn( + 'verified_by', + aliasedName, + true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES contacts (user_id) ON DELETE CASCADE', + ), + ); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: currentDateAndTime, + ); + @override + List get $columns => [ + verificationId, + contactId, + type, + verifiedBy, + createdAt, + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'key_verifications'; + @override + Set get $primaryKey => {verificationId}; + @override + KeyVerificationsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return KeyVerificationsData( + verificationId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}verification_id'], + )!, + contactId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}contact_id'], + )!, + type: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}type'], + )!, + verifiedBy: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}verified_by'], + ), + createdAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}created_at'], + )!, + ); + } + + @override + KeyVerifications createAlias(String alias) { + return KeyVerifications(attachedDatabase, alias); + } +} + +class KeyVerificationsData extends DataClass + implements Insertable { + final int verificationId; + final int contactId; + final String type; + final int? verifiedBy; + final DateTime createdAt; + const KeyVerificationsData({ + required this.verificationId, + required this.contactId, + required this.type, + this.verifiedBy, + required this.createdAt, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['verification_id'] = Variable(verificationId); + map['contact_id'] = Variable(contactId); + map['type'] = Variable(type); + if (!nullToAbsent || verifiedBy != null) { + map['verified_by'] = Variable(verifiedBy); + } + map['created_at'] = Variable(createdAt); + return map; + } + + KeyVerificationsCompanion toCompanion(bool nullToAbsent) { + return KeyVerificationsCompanion( + verificationId: Value(verificationId), + contactId: Value(contactId), + type: Value(type), + verifiedBy: verifiedBy == null && nullToAbsent + ? const Value.absent() + : Value(verifiedBy), + createdAt: Value(createdAt), + ); + } + + factory KeyVerificationsData.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return KeyVerificationsData( + verificationId: serializer.fromJson(json['verificationId']), + contactId: serializer.fromJson(json['contactId']), + type: serializer.fromJson(json['type']), + verifiedBy: serializer.fromJson(json['verifiedBy']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'verificationId': serializer.toJson(verificationId), + 'contactId': serializer.toJson(contactId), + 'type': serializer.toJson(type), + 'verifiedBy': serializer.toJson(verifiedBy), + 'createdAt': serializer.toJson(createdAt), + }; + } + + KeyVerificationsData copyWith({ + int? verificationId, + int? contactId, + String? type, + Value verifiedBy = const Value.absent(), + DateTime? createdAt, + }) => KeyVerificationsData( + verificationId: verificationId ?? this.verificationId, + contactId: contactId ?? this.contactId, + type: type ?? this.type, + verifiedBy: verifiedBy.present ? verifiedBy.value : this.verifiedBy, + createdAt: createdAt ?? this.createdAt, + ); + KeyVerificationsData copyWithCompanion(KeyVerificationsCompanion data) { + return KeyVerificationsData( + verificationId: data.verificationId.present + ? data.verificationId.value + : this.verificationId, + contactId: data.contactId.present ? data.contactId.value : this.contactId, + type: data.type.present ? data.type.value : this.type, + verifiedBy: data.verifiedBy.present + ? data.verifiedBy.value + : this.verifiedBy, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('KeyVerificationsData(') + ..write('verificationId: $verificationId, ') + ..write('contactId: $contactId, ') + ..write('type: $type, ') + ..write('verifiedBy: $verifiedBy, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(verificationId, contactId, type, verifiedBy, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is KeyVerificationsData && + other.verificationId == this.verificationId && + other.contactId == this.contactId && + other.type == this.type && + other.verifiedBy == this.verifiedBy && + other.createdAt == this.createdAt); +} + +class KeyVerificationsCompanion extends UpdateCompanion { + final Value verificationId; + final Value contactId; + final Value type; + final Value verifiedBy; + final Value createdAt; + const KeyVerificationsCompanion({ + this.verificationId = const Value.absent(), + this.contactId = const Value.absent(), + this.type = const Value.absent(), + this.verifiedBy = const Value.absent(), + this.createdAt = const Value.absent(), + }); + KeyVerificationsCompanion.insert({ + this.verificationId = const Value.absent(), + required int contactId, + required String type, + this.verifiedBy = const Value.absent(), + this.createdAt = const Value.absent(), + }) : contactId = Value(contactId), + type = Value(type); + static Insertable custom({ + Expression? verificationId, + Expression? contactId, + Expression? type, + Expression? verifiedBy, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (verificationId != null) 'verification_id': verificationId, + if (contactId != null) 'contact_id': contactId, + if (type != null) 'type': type, + if (verifiedBy != null) 'verified_by': verifiedBy, + if (createdAt != null) 'created_at': createdAt, + }); + } + + KeyVerificationsCompanion copyWith({ + Value? verificationId, + Value? contactId, + Value? type, + Value? verifiedBy, + Value? createdAt, + }) { + return KeyVerificationsCompanion( + verificationId: verificationId ?? this.verificationId, + contactId: contactId ?? this.contactId, + type: type ?? this.type, + verifiedBy: verifiedBy ?? this.verifiedBy, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (verificationId.present) { + map['verification_id'] = Variable(verificationId.value); + } + if (contactId.present) { + map['contact_id'] = Variable(contactId.value); + } + if (type.present) { + map['type'] = Variable(type.value); + } + if (verifiedBy.present) { + map['verified_by'] = Variable(verifiedBy.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('KeyVerificationsCompanion(') + ..write('verificationId: $verificationId, ') + ..write('contactId: $contactId, ') + ..write('type: $type, ') + ..write('verifiedBy: $verifiedBy, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class VerificationTokens extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + VerificationTokens(this.attachedDatabase, [this._alias]); + late final GeneratedColumn tokenId = GeneratedColumn( + 'token_id', + aliasedName, + false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'PRIMARY KEY AUTOINCREMENT', + ), + ); + late final GeneratedColumn token = + GeneratedColumn( + 'token', + aliasedName, + false, + type: DriftSqlType.blob, + requiredDuringInsert: true, + ); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: currentDateAndTime, + ); + @override + List get $columns => [tokenId, token, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'verification_tokens'; + @override + Set get $primaryKey => {tokenId}; + @override + VerificationTokensData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return VerificationTokensData( + tokenId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}token_id'], + )!, + token: attachedDatabase.typeMapping.read( + DriftSqlType.blob, + data['${effectivePrefix}token'], + )!, + createdAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}created_at'], + )!, + ); + } + + @override + VerificationTokens createAlias(String alias) { + return VerificationTokens(attachedDatabase, alias); + } +} + +class VerificationTokensData extends DataClass + implements Insertable { + final int tokenId; + final i2.Uint8List token; + final DateTime createdAt; + const VerificationTokensData({ + required this.tokenId, + required this.token, + required this.createdAt, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['token_id'] = Variable(tokenId); + map['token'] = Variable(token); + map['created_at'] = Variable(createdAt); + return map; + } + + VerificationTokensCompanion toCompanion(bool nullToAbsent) { + return VerificationTokensCompanion( + tokenId: Value(tokenId), + token: Value(token), + createdAt: Value(createdAt), + ); + } + + factory VerificationTokensData.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return VerificationTokensData( + tokenId: serializer.fromJson(json['tokenId']), + token: serializer.fromJson(json['token']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'tokenId': serializer.toJson(tokenId), + 'token': serializer.toJson(token), + 'createdAt': serializer.toJson(createdAt), + }; + } + + VerificationTokensData copyWith({ + int? tokenId, + i2.Uint8List? token, + DateTime? createdAt, + }) => VerificationTokensData( + tokenId: tokenId ?? this.tokenId, + token: token ?? this.token, + createdAt: createdAt ?? this.createdAt, + ); + VerificationTokensData copyWithCompanion(VerificationTokensCompanion data) { + return VerificationTokensData( + tokenId: data.tokenId.present ? data.tokenId.value : this.tokenId, + token: data.token.present ? data.token.value : this.token, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('VerificationTokensData(') + ..write('tokenId: $tokenId, ') + ..write('token: $token, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(tokenId, $driftBlobEquality.hash(token), createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is VerificationTokensData && + other.tokenId == this.tokenId && + $driftBlobEquality.equals(other.token, this.token) && + other.createdAt == this.createdAt); +} + +class VerificationTokensCompanion + extends UpdateCompanion { + final Value tokenId; + final Value token; + final Value createdAt; + const VerificationTokensCompanion({ + this.tokenId = const Value.absent(), + this.token = const Value.absent(), + this.createdAt = const Value.absent(), + }); + VerificationTokensCompanion.insert({ + this.tokenId = const Value.absent(), + required i2.Uint8List token, + this.createdAt = const Value.absent(), + }) : token = Value(token); + static Insertable custom({ + Expression? tokenId, + Expression? token, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (tokenId != null) 'token_id': tokenId, + if (token != null) 'token': token, + if (createdAt != null) 'created_at': createdAt, + }); + } + + VerificationTokensCompanion copyWith({ + Value? tokenId, + Value? token, + Value? createdAt, + }) { + return VerificationTokensCompanion( + tokenId: tokenId ?? this.tokenId, + token: token ?? this.token, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (tokenId.present) { + map['token_id'] = Variable(tokenId.value); + } + if (token.present) { + map['token'] = Variable(token.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('VerificationTokensCompanion(') + ..write('tokenId: $tokenId, ') + ..write('token: $token, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class UserDiscoveryAnnouncedUsers extends Table + with + TableInfo< + UserDiscoveryAnnouncedUsers, + UserDiscoveryAnnouncedUsersData + > { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + UserDiscoveryAnnouncedUsers(this.attachedDatabase, [this._alias]); + late final GeneratedColumn announcedUserId = GeneratedColumn( + 'announced_user_id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: false, + ); + late final GeneratedColumn announcedPublicKey = + GeneratedColumn( + 'announced_public_key', + aliasedName, + false, + type: DriftSqlType.blob, + requiredDuringInsert: true, + ); + late final GeneratedColumn publicId = GeneratedColumn( + 'public_id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE'), + ); + late final GeneratedColumn username = GeneratedColumn( + 'username', + aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + ); + late final GeneratedColumn wasShownToTheUser = GeneratedColumn( + 'was_shown_to_the_user', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("was_shown_to_the_user" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + late final GeneratedColumn isHidden = GeneratedColumn( + 'is_hidden', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("is_hidden" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + late final GeneratedColumn wasAskedFriends = GeneratedColumn( + 'was_asked_friends', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("was_asked_friends" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + @override + List get $columns => [ + announcedUserId, + announcedPublicKey, + publicId, + username, + wasShownToTheUser, + isHidden, + wasAskedFriends, + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'user_discovery_announced_users'; + @override + Set get $primaryKey => {announcedUserId}; + @override + UserDiscoveryAnnouncedUsersData map( + Map data, { + String? tablePrefix, + }) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return UserDiscoveryAnnouncedUsersData( + announcedUserId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}announced_user_id'], + )!, + announcedPublicKey: attachedDatabase.typeMapping.read( + DriftSqlType.blob, + data['${effectivePrefix}announced_public_key'], + )!, + publicId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}public_id'], + )!, + username: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}username'], + ), + wasShownToTheUser: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}was_shown_to_the_user'], + )!, + isHidden: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}is_hidden'], + )!, + wasAskedFriends: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}was_asked_friends'], + )!, + ); + } + + @override + UserDiscoveryAnnouncedUsers createAlias(String alias) { + return UserDiscoveryAnnouncedUsers(attachedDatabase, alias); + } +} + +class UserDiscoveryAnnouncedUsersData extends DataClass + implements Insertable { + final int announcedUserId; + final i2.Uint8List announcedPublicKey; + final int publicId; + final String? username; + final bool wasShownToTheUser; + final bool isHidden; + final bool wasAskedFriends; + const UserDiscoveryAnnouncedUsersData({ + required this.announcedUserId, + required this.announcedPublicKey, + required this.publicId, + this.username, + required this.wasShownToTheUser, + required this.isHidden, + required this.wasAskedFriends, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['announced_user_id'] = Variable(announcedUserId); + map['announced_public_key'] = Variable(announcedPublicKey); + map['public_id'] = Variable(publicId); + if (!nullToAbsent || username != null) { + map['username'] = Variable(username); + } + map['was_shown_to_the_user'] = Variable(wasShownToTheUser); + map['is_hidden'] = Variable(isHidden); + map['was_asked_friends'] = Variable(wasAskedFriends); + return map; + } + + UserDiscoveryAnnouncedUsersCompanion toCompanion(bool nullToAbsent) { + return UserDiscoveryAnnouncedUsersCompanion( + announcedUserId: Value(announcedUserId), + announcedPublicKey: Value(announcedPublicKey), + publicId: Value(publicId), + username: username == null && nullToAbsent + ? const Value.absent() + : Value(username), + wasShownToTheUser: Value(wasShownToTheUser), + isHidden: Value(isHidden), + wasAskedFriends: Value(wasAskedFriends), + ); + } + + factory UserDiscoveryAnnouncedUsersData.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return UserDiscoveryAnnouncedUsersData( + announcedUserId: serializer.fromJson(json['announcedUserId']), + announcedPublicKey: serializer.fromJson( + json['announcedPublicKey'], + ), + publicId: serializer.fromJson(json['publicId']), + username: serializer.fromJson(json['username']), + wasShownToTheUser: serializer.fromJson(json['wasShownToTheUser']), + isHidden: serializer.fromJson(json['isHidden']), + wasAskedFriends: serializer.fromJson(json['wasAskedFriends']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'announcedUserId': serializer.toJson(announcedUserId), + 'announcedPublicKey': serializer.toJson(announcedPublicKey), + 'publicId': serializer.toJson(publicId), + 'username': serializer.toJson(username), + 'wasShownToTheUser': serializer.toJson(wasShownToTheUser), + 'isHidden': serializer.toJson(isHidden), + 'wasAskedFriends': serializer.toJson(wasAskedFriends), + }; + } + + UserDiscoveryAnnouncedUsersData copyWith({ + int? announcedUserId, + i2.Uint8List? announcedPublicKey, + int? publicId, + Value username = const Value.absent(), + bool? wasShownToTheUser, + bool? isHidden, + bool? wasAskedFriends, + }) => UserDiscoveryAnnouncedUsersData( + announcedUserId: announcedUserId ?? this.announcedUserId, + announcedPublicKey: announcedPublicKey ?? this.announcedPublicKey, + publicId: publicId ?? this.publicId, + username: username.present ? username.value : this.username, + wasShownToTheUser: wasShownToTheUser ?? this.wasShownToTheUser, + isHidden: isHidden ?? this.isHidden, + wasAskedFriends: wasAskedFriends ?? this.wasAskedFriends, + ); + UserDiscoveryAnnouncedUsersData copyWithCompanion( + UserDiscoveryAnnouncedUsersCompanion data, + ) { + return UserDiscoveryAnnouncedUsersData( + announcedUserId: data.announcedUserId.present + ? data.announcedUserId.value + : this.announcedUserId, + announcedPublicKey: data.announcedPublicKey.present + ? data.announcedPublicKey.value + : this.announcedPublicKey, + publicId: data.publicId.present ? data.publicId.value : this.publicId, + username: data.username.present ? data.username.value : this.username, + wasShownToTheUser: data.wasShownToTheUser.present + ? data.wasShownToTheUser.value + : this.wasShownToTheUser, + isHidden: data.isHidden.present ? data.isHidden.value : this.isHidden, + wasAskedFriends: data.wasAskedFriends.present + ? data.wasAskedFriends.value + : this.wasAskedFriends, + ); + } + + @override + String toString() { + return (StringBuffer('UserDiscoveryAnnouncedUsersData(') + ..write('announcedUserId: $announcedUserId, ') + ..write('announcedPublicKey: $announcedPublicKey, ') + ..write('publicId: $publicId, ') + ..write('username: $username, ') + ..write('wasShownToTheUser: $wasShownToTheUser, ') + ..write('isHidden: $isHidden, ') + ..write('wasAskedFriends: $wasAskedFriends') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + announcedUserId, + $driftBlobEquality.hash(announcedPublicKey), + publicId, + username, + wasShownToTheUser, + isHidden, + wasAskedFriends, + ); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is UserDiscoveryAnnouncedUsersData && + other.announcedUserId == this.announcedUserId && + $driftBlobEquality.equals( + other.announcedPublicKey, + this.announcedPublicKey, + ) && + other.publicId == this.publicId && + other.username == this.username && + other.wasShownToTheUser == this.wasShownToTheUser && + other.isHidden == this.isHidden && + other.wasAskedFriends == this.wasAskedFriends); +} + +class UserDiscoveryAnnouncedUsersCompanion + extends UpdateCompanion { + final Value announcedUserId; + final Value announcedPublicKey; + final Value publicId; + final Value username; + final Value wasShownToTheUser; + final Value isHidden; + final Value wasAskedFriends; + const UserDiscoveryAnnouncedUsersCompanion({ + this.announcedUserId = const Value.absent(), + this.announcedPublicKey = const Value.absent(), + this.publicId = const Value.absent(), + this.username = const Value.absent(), + this.wasShownToTheUser = const Value.absent(), + this.isHidden = const Value.absent(), + this.wasAskedFriends = const Value.absent(), + }); + UserDiscoveryAnnouncedUsersCompanion.insert({ + this.announcedUserId = const Value.absent(), + required i2.Uint8List announcedPublicKey, + required int publicId, + this.username = const Value.absent(), + this.wasShownToTheUser = const Value.absent(), + this.isHidden = const Value.absent(), + this.wasAskedFriends = const Value.absent(), + }) : announcedPublicKey = Value(announcedPublicKey), + publicId = Value(publicId); + static Insertable custom({ + Expression? announcedUserId, + Expression? announcedPublicKey, + Expression? publicId, + Expression? username, + Expression? wasShownToTheUser, + Expression? isHidden, + Expression? wasAskedFriends, + }) { + return RawValuesInsertable({ + if (announcedUserId != null) 'announced_user_id': announcedUserId, + if (announcedPublicKey != null) + 'announced_public_key': announcedPublicKey, + if (publicId != null) 'public_id': publicId, + if (username != null) 'username': username, + if (wasShownToTheUser != null) 'was_shown_to_the_user': wasShownToTheUser, + if (isHidden != null) 'is_hidden': isHidden, + if (wasAskedFriends != null) 'was_asked_friends': wasAskedFriends, + }); + } + + UserDiscoveryAnnouncedUsersCompanion copyWith({ + Value? announcedUserId, + Value? announcedPublicKey, + Value? publicId, + Value? username, + Value? wasShownToTheUser, + Value? isHidden, + Value? wasAskedFriends, + }) { + return UserDiscoveryAnnouncedUsersCompanion( + announcedUserId: announcedUserId ?? this.announcedUserId, + announcedPublicKey: announcedPublicKey ?? this.announcedPublicKey, + publicId: publicId ?? this.publicId, + username: username ?? this.username, + wasShownToTheUser: wasShownToTheUser ?? this.wasShownToTheUser, + isHidden: isHidden ?? this.isHidden, + wasAskedFriends: wasAskedFriends ?? this.wasAskedFriends, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (announcedUserId.present) { + map['announced_user_id'] = Variable(announcedUserId.value); + } + if (announcedPublicKey.present) { + map['announced_public_key'] = Variable( + announcedPublicKey.value, + ); + } + if (publicId.present) { + map['public_id'] = Variable(publicId.value); + } + if (username.present) { + map['username'] = Variable(username.value); + } + if (wasShownToTheUser.present) { + map['was_shown_to_the_user'] = Variable(wasShownToTheUser.value); + } + if (isHidden.present) { + map['is_hidden'] = Variable(isHidden.value); + } + if (wasAskedFriends.present) { + map['was_asked_friends'] = Variable(wasAskedFriends.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('UserDiscoveryAnnouncedUsersCompanion(') + ..write('announcedUserId: $announcedUserId, ') + ..write('announcedPublicKey: $announcedPublicKey, ') + ..write('publicId: $publicId, ') + ..write('username: $username, ') + ..write('wasShownToTheUser: $wasShownToTheUser, ') + ..write('isHidden: $isHidden, ') + ..write('wasAskedFriends: $wasAskedFriends') + ..write(')')) + .toString(); + } +} + +class UserDiscoveryUserRelations extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + UserDiscoveryUserRelations(this.attachedDatabase, [this._alias]); + late final GeneratedColumn announcedUserId = GeneratedColumn( + 'announced_user_id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES user_discovery_announced_users (announced_user_id) ON DELETE CASCADE', + ), + ); + late final GeneratedColumn fromContactId = GeneratedColumn( + 'from_contact_id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES contacts (user_id) ON DELETE CASCADE', + ), + ); + late final GeneratedColumn publicKeyVerifiedTimestamp = + GeneratedColumn( + 'public_key_verified_timestamp', + aliasedName, + true, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + ); + @override + List get $columns => [ + announcedUserId, + fromContactId, + publicKeyVerifiedTimestamp, + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'user_discovery_user_relations'; + @override + Set get $primaryKey => {announcedUserId, fromContactId}; + @override + UserDiscoveryUserRelationsData map( + Map data, { + String? tablePrefix, + }) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return UserDiscoveryUserRelationsData( + announcedUserId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}announced_user_id'], + )!, + fromContactId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}from_contact_id'], + )!, + publicKeyVerifiedTimestamp: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}public_key_verified_timestamp'], + ), + ); + } + + @override + UserDiscoveryUserRelations createAlias(String alias) { + return UserDiscoveryUserRelations(attachedDatabase, alias); + } +} + +class UserDiscoveryUserRelationsData extends DataClass + implements Insertable { + final int announcedUserId; + final int fromContactId; + final DateTime? publicKeyVerifiedTimestamp; + const UserDiscoveryUserRelationsData({ + required this.announcedUserId, + required this.fromContactId, + this.publicKeyVerifiedTimestamp, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['announced_user_id'] = Variable(announcedUserId); + map['from_contact_id'] = Variable(fromContactId); + if (!nullToAbsent || publicKeyVerifiedTimestamp != null) { + map['public_key_verified_timestamp'] = Variable( + publicKeyVerifiedTimestamp, + ); + } + return map; + } + + UserDiscoveryUserRelationsCompanion toCompanion(bool nullToAbsent) { + return UserDiscoveryUserRelationsCompanion( + announcedUserId: Value(announcedUserId), + fromContactId: Value(fromContactId), + publicKeyVerifiedTimestamp: + publicKeyVerifiedTimestamp == null && nullToAbsent + ? const Value.absent() + : Value(publicKeyVerifiedTimestamp), + ); + } + + factory UserDiscoveryUserRelationsData.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return UserDiscoveryUserRelationsData( + announcedUserId: serializer.fromJson(json['announcedUserId']), + fromContactId: serializer.fromJson(json['fromContactId']), + publicKeyVerifiedTimestamp: serializer.fromJson( + json['publicKeyVerifiedTimestamp'], + ), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'announcedUserId': serializer.toJson(announcedUserId), + 'fromContactId': serializer.toJson(fromContactId), + 'publicKeyVerifiedTimestamp': serializer.toJson( + publicKeyVerifiedTimestamp, + ), + }; + } + + UserDiscoveryUserRelationsData copyWith({ + int? announcedUserId, + int? fromContactId, + Value publicKeyVerifiedTimestamp = const Value.absent(), + }) => UserDiscoveryUserRelationsData( + announcedUserId: announcedUserId ?? this.announcedUserId, + fromContactId: fromContactId ?? this.fromContactId, + publicKeyVerifiedTimestamp: publicKeyVerifiedTimestamp.present + ? publicKeyVerifiedTimestamp.value + : this.publicKeyVerifiedTimestamp, + ); + UserDiscoveryUserRelationsData copyWithCompanion( + UserDiscoveryUserRelationsCompanion data, + ) { + return UserDiscoveryUserRelationsData( + announcedUserId: data.announcedUserId.present + ? data.announcedUserId.value + : this.announcedUserId, + fromContactId: data.fromContactId.present + ? data.fromContactId.value + : this.fromContactId, + publicKeyVerifiedTimestamp: data.publicKeyVerifiedTimestamp.present + ? data.publicKeyVerifiedTimestamp.value + : this.publicKeyVerifiedTimestamp, + ); + } + + @override + String toString() { + return (StringBuffer('UserDiscoveryUserRelationsData(') + ..write('announcedUserId: $announcedUserId, ') + ..write('fromContactId: $fromContactId, ') + ..write('publicKeyVerifiedTimestamp: $publicKeyVerifiedTimestamp') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(announcedUserId, fromContactId, publicKeyVerifiedTimestamp); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is UserDiscoveryUserRelationsData && + other.announcedUserId == this.announcedUserId && + other.fromContactId == this.fromContactId && + other.publicKeyVerifiedTimestamp == this.publicKeyVerifiedTimestamp); +} + +class UserDiscoveryUserRelationsCompanion + extends UpdateCompanion { + final Value announcedUserId; + final Value fromContactId; + final Value publicKeyVerifiedTimestamp; + final Value rowid; + const UserDiscoveryUserRelationsCompanion({ + this.announcedUserId = const Value.absent(), + this.fromContactId = const Value.absent(), + this.publicKeyVerifiedTimestamp = const Value.absent(), + this.rowid = const Value.absent(), + }); + UserDiscoveryUserRelationsCompanion.insert({ + required int announcedUserId, + required int fromContactId, + this.publicKeyVerifiedTimestamp = const Value.absent(), + this.rowid = const Value.absent(), + }) : announcedUserId = Value(announcedUserId), + fromContactId = Value(fromContactId); + static Insertable custom({ + Expression? announcedUserId, + Expression? fromContactId, + Expression? publicKeyVerifiedTimestamp, + Expression? rowid, + }) { + return RawValuesInsertable({ + if (announcedUserId != null) 'announced_user_id': announcedUserId, + if (fromContactId != null) 'from_contact_id': fromContactId, + if (publicKeyVerifiedTimestamp != null) + 'public_key_verified_timestamp': publicKeyVerifiedTimestamp, + if (rowid != null) 'rowid': rowid, + }); + } + + UserDiscoveryUserRelationsCompanion copyWith({ + Value? announcedUserId, + Value? fromContactId, + Value? publicKeyVerifiedTimestamp, + Value? rowid, + }) { + return UserDiscoveryUserRelationsCompanion( + announcedUserId: announcedUserId ?? this.announcedUserId, + fromContactId: fromContactId ?? this.fromContactId, + publicKeyVerifiedTimestamp: + publicKeyVerifiedTimestamp ?? this.publicKeyVerifiedTimestamp, + rowid: rowid ?? this.rowid, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (announcedUserId.present) { + map['announced_user_id'] = Variable(announcedUserId.value); + } + if (fromContactId.present) { + map['from_contact_id'] = Variable(fromContactId.value); + } + if (publicKeyVerifiedTimestamp.present) { + map['public_key_verified_timestamp'] = Variable( + publicKeyVerifiedTimestamp.value, + ); + } + if (rowid.present) { + map['rowid'] = Variable(rowid.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('UserDiscoveryUserRelationsCompanion(') + ..write('announcedUserId: $announcedUserId, ') + ..write('fromContactId: $fromContactId, ') + ..write('publicKeyVerifiedTimestamp: $publicKeyVerifiedTimestamp, ') + ..write('rowid: $rowid') + ..write(')')) + .toString(); + } +} + +class UserDiscoveryOtherPromotions extends Table + with + TableInfo< + UserDiscoveryOtherPromotions, + UserDiscoveryOtherPromotionsData + > { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + UserDiscoveryOtherPromotions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn fromContactId = GeneratedColumn( + 'from_contact_id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES contacts (user_id) ON DELETE CASCADE', + ), + ); + late final GeneratedColumn promotionId = GeneratedColumn( + 'promotion_id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: true, + ); + late final GeneratedColumn publicId = GeneratedColumn( + 'public_id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: true, + ); + late final GeneratedColumn threshold = GeneratedColumn( + 'threshold', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: true, + ); + late final GeneratedColumn announcementShare = + GeneratedColumn( + 'announcement_share', + aliasedName, + false, + type: DriftSqlType.blob, + requiredDuringInsert: true, + ); + late final GeneratedColumn publicKeyVerifiedTimestamp = + GeneratedColumn( + 'public_key_verified_timestamp', + aliasedName, + true, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + ); + @override + List get $columns => [ + fromContactId, + promotionId, + publicId, + threshold, + announcementShare, + publicKeyVerifiedTimestamp, + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'user_discovery_other_promotions'; + @override + Set get $primaryKey => {fromContactId, publicId}; + @override + UserDiscoveryOtherPromotionsData map( + Map data, { + String? tablePrefix, + }) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return UserDiscoveryOtherPromotionsData( + fromContactId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}from_contact_id'], + )!, + promotionId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}promotion_id'], + )!, + publicId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}public_id'], + )!, + threshold: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}threshold'], + )!, + announcementShare: attachedDatabase.typeMapping.read( + DriftSqlType.blob, + data['${effectivePrefix}announcement_share'], + )!, + publicKeyVerifiedTimestamp: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}public_key_verified_timestamp'], + ), + ); + } + + @override + UserDiscoveryOtherPromotions createAlias(String alias) { + return UserDiscoveryOtherPromotions(attachedDatabase, alias); + } +} + +class UserDiscoveryOtherPromotionsData extends DataClass + implements Insertable { + final int fromContactId; + final int promotionId; + final int publicId; + final int threshold; + final i2.Uint8List announcementShare; + final DateTime? publicKeyVerifiedTimestamp; + const UserDiscoveryOtherPromotionsData({ + required this.fromContactId, + required this.promotionId, + required this.publicId, + required this.threshold, + required this.announcementShare, + this.publicKeyVerifiedTimestamp, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['from_contact_id'] = Variable(fromContactId); + map['promotion_id'] = Variable(promotionId); + map['public_id'] = Variable(publicId); + map['threshold'] = Variable(threshold); + map['announcement_share'] = Variable(announcementShare); + if (!nullToAbsent || publicKeyVerifiedTimestamp != null) { + map['public_key_verified_timestamp'] = Variable( + publicKeyVerifiedTimestamp, + ); + } + return map; + } + + UserDiscoveryOtherPromotionsCompanion toCompanion(bool nullToAbsent) { + return UserDiscoveryOtherPromotionsCompanion( + fromContactId: Value(fromContactId), + promotionId: Value(promotionId), + publicId: Value(publicId), + threshold: Value(threshold), + announcementShare: Value(announcementShare), + publicKeyVerifiedTimestamp: + publicKeyVerifiedTimestamp == null && nullToAbsent + ? const Value.absent() + : Value(publicKeyVerifiedTimestamp), + ); + } + + factory UserDiscoveryOtherPromotionsData.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return UserDiscoveryOtherPromotionsData( + fromContactId: serializer.fromJson(json['fromContactId']), + promotionId: serializer.fromJson(json['promotionId']), + publicId: serializer.fromJson(json['publicId']), + threshold: serializer.fromJson(json['threshold']), + announcementShare: serializer.fromJson( + json['announcementShare'], + ), + publicKeyVerifiedTimestamp: serializer.fromJson( + json['publicKeyVerifiedTimestamp'], + ), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'fromContactId': serializer.toJson(fromContactId), + 'promotionId': serializer.toJson(promotionId), + 'publicId': serializer.toJson(publicId), + 'threshold': serializer.toJson(threshold), + 'announcementShare': serializer.toJson(announcementShare), + 'publicKeyVerifiedTimestamp': serializer.toJson( + publicKeyVerifiedTimestamp, + ), + }; + } + + UserDiscoveryOtherPromotionsData copyWith({ + int? fromContactId, + int? promotionId, + int? publicId, + int? threshold, + i2.Uint8List? announcementShare, + Value publicKeyVerifiedTimestamp = const Value.absent(), + }) => UserDiscoveryOtherPromotionsData( + fromContactId: fromContactId ?? this.fromContactId, + promotionId: promotionId ?? this.promotionId, + publicId: publicId ?? this.publicId, + threshold: threshold ?? this.threshold, + announcementShare: announcementShare ?? this.announcementShare, + publicKeyVerifiedTimestamp: publicKeyVerifiedTimestamp.present + ? publicKeyVerifiedTimestamp.value + : this.publicKeyVerifiedTimestamp, + ); + UserDiscoveryOtherPromotionsData copyWithCompanion( + UserDiscoveryOtherPromotionsCompanion data, + ) { + return UserDiscoveryOtherPromotionsData( + fromContactId: data.fromContactId.present + ? data.fromContactId.value + : this.fromContactId, + promotionId: data.promotionId.present + ? data.promotionId.value + : this.promotionId, + publicId: data.publicId.present ? data.publicId.value : this.publicId, + threshold: data.threshold.present ? data.threshold.value : this.threshold, + announcementShare: data.announcementShare.present + ? data.announcementShare.value + : this.announcementShare, + publicKeyVerifiedTimestamp: data.publicKeyVerifiedTimestamp.present + ? data.publicKeyVerifiedTimestamp.value + : this.publicKeyVerifiedTimestamp, + ); + } + + @override + String toString() { + return (StringBuffer('UserDiscoveryOtherPromotionsData(') + ..write('fromContactId: $fromContactId, ') + ..write('promotionId: $promotionId, ') + ..write('publicId: $publicId, ') + ..write('threshold: $threshold, ') + ..write('announcementShare: $announcementShare, ') + ..write('publicKeyVerifiedTimestamp: $publicKeyVerifiedTimestamp') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + fromContactId, + promotionId, + publicId, + threshold, + $driftBlobEquality.hash(announcementShare), + publicKeyVerifiedTimestamp, + ); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is UserDiscoveryOtherPromotionsData && + other.fromContactId == this.fromContactId && + other.promotionId == this.promotionId && + other.publicId == this.publicId && + other.threshold == this.threshold && + $driftBlobEquality.equals( + other.announcementShare, + this.announcementShare, + ) && + other.publicKeyVerifiedTimestamp == this.publicKeyVerifiedTimestamp); +} + +class UserDiscoveryOtherPromotionsCompanion + extends UpdateCompanion { + final Value fromContactId; + final Value promotionId; + final Value publicId; + final Value threshold; + final Value announcementShare; + final Value publicKeyVerifiedTimestamp; + final Value rowid; + const UserDiscoveryOtherPromotionsCompanion({ + this.fromContactId = const Value.absent(), + this.promotionId = const Value.absent(), + this.publicId = const Value.absent(), + this.threshold = const Value.absent(), + this.announcementShare = const Value.absent(), + this.publicKeyVerifiedTimestamp = const Value.absent(), + this.rowid = const Value.absent(), + }); + UserDiscoveryOtherPromotionsCompanion.insert({ + required int fromContactId, + required int promotionId, + required int publicId, + required int threshold, + required i2.Uint8List announcementShare, + this.publicKeyVerifiedTimestamp = const Value.absent(), + this.rowid = const Value.absent(), + }) : fromContactId = Value(fromContactId), + promotionId = Value(promotionId), + publicId = Value(publicId), + threshold = Value(threshold), + announcementShare = Value(announcementShare); + static Insertable custom({ + Expression? fromContactId, + Expression? promotionId, + Expression? publicId, + Expression? threshold, + Expression? announcementShare, + Expression? publicKeyVerifiedTimestamp, + Expression? rowid, + }) { + return RawValuesInsertable({ + if (fromContactId != null) 'from_contact_id': fromContactId, + if (promotionId != null) 'promotion_id': promotionId, + if (publicId != null) 'public_id': publicId, + if (threshold != null) 'threshold': threshold, + if (announcementShare != null) 'announcement_share': announcementShare, + if (publicKeyVerifiedTimestamp != null) + 'public_key_verified_timestamp': publicKeyVerifiedTimestamp, + if (rowid != null) 'rowid': rowid, + }); + } + + UserDiscoveryOtherPromotionsCompanion copyWith({ + Value? fromContactId, + Value? promotionId, + Value? publicId, + Value? threshold, + Value? announcementShare, + Value? publicKeyVerifiedTimestamp, + Value? rowid, + }) { + return UserDiscoveryOtherPromotionsCompanion( + fromContactId: fromContactId ?? this.fromContactId, + promotionId: promotionId ?? this.promotionId, + publicId: publicId ?? this.publicId, + threshold: threshold ?? this.threshold, + announcementShare: announcementShare ?? this.announcementShare, + publicKeyVerifiedTimestamp: + publicKeyVerifiedTimestamp ?? this.publicKeyVerifiedTimestamp, + rowid: rowid ?? this.rowid, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (fromContactId.present) { + map['from_contact_id'] = Variable(fromContactId.value); + } + if (promotionId.present) { + map['promotion_id'] = Variable(promotionId.value); + } + if (publicId.present) { + map['public_id'] = Variable(publicId.value); + } + if (threshold.present) { + map['threshold'] = Variable(threshold.value); + } + if (announcementShare.present) { + map['announcement_share'] = Variable( + announcementShare.value, + ); + } + if (publicKeyVerifiedTimestamp.present) { + map['public_key_verified_timestamp'] = Variable( + publicKeyVerifiedTimestamp.value, + ); + } + if (rowid.present) { + map['rowid'] = Variable(rowid.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('UserDiscoveryOtherPromotionsCompanion(') + ..write('fromContactId: $fromContactId, ') + ..write('promotionId: $promotionId, ') + ..write('publicId: $publicId, ') + ..write('threshold: $threshold, ') + ..write('announcementShare: $announcementShare, ') + ..write('publicKeyVerifiedTimestamp: $publicKeyVerifiedTimestamp, ') + ..write('rowid: $rowid') + ..write(')')) + .toString(); + } +} + +class UserDiscoveryOwnPromotions extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + UserDiscoveryOwnPromotions(this.attachedDatabase, [this._alias]); + late final GeneratedColumn versionId = GeneratedColumn( + 'version_id', + aliasedName, + false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'PRIMARY KEY AUTOINCREMENT', + ), + ); + late final GeneratedColumn contactId = GeneratedColumn( + 'contact_id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES contacts (user_id) ON DELETE CASCADE', + ), + ); + late final GeneratedColumn promotion = + GeneratedColumn( + 'promotion', + aliasedName, + false, + type: DriftSqlType.blob, + requiredDuringInsert: true, + ); + @override + List get $columns => [versionId, contactId, promotion]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'user_discovery_own_promotions'; + @override + Set get $primaryKey => {versionId}; + @override + UserDiscoveryOwnPromotionsData map( + Map data, { + String? tablePrefix, + }) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return UserDiscoveryOwnPromotionsData( + versionId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}version_id'], + )!, + contactId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}contact_id'], + )!, + promotion: attachedDatabase.typeMapping.read( + DriftSqlType.blob, + data['${effectivePrefix}promotion'], + )!, + ); + } + + @override + UserDiscoveryOwnPromotions createAlias(String alias) { + return UserDiscoveryOwnPromotions(attachedDatabase, alias); + } +} + +class UserDiscoveryOwnPromotionsData extends DataClass + implements Insertable { + final int versionId; + final int contactId; + final i2.Uint8List promotion; + const UserDiscoveryOwnPromotionsData({ + required this.versionId, + required this.contactId, + required this.promotion, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['version_id'] = Variable(versionId); + map['contact_id'] = Variable(contactId); + map['promotion'] = Variable(promotion); + return map; + } + + UserDiscoveryOwnPromotionsCompanion toCompanion(bool nullToAbsent) { + return UserDiscoveryOwnPromotionsCompanion( + versionId: Value(versionId), + contactId: Value(contactId), + promotion: Value(promotion), + ); + } + + factory UserDiscoveryOwnPromotionsData.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return UserDiscoveryOwnPromotionsData( + versionId: serializer.fromJson(json['versionId']), + contactId: serializer.fromJson(json['contactId']), + promotion: serializer.fromJson(json['promotion']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'versionId': serializer.toJson(versionId), + 'contactId': serializer.toJson(contactId), + 'promotion': serializer.toJson(promotion), + }; + } + + UserDiscoveryOwnPromotionsData copyWith({ + int? versionId, + int? contactId, + i2.Uint8List? promotion, + }) => UserDiscoveryOwnPromotionsData( + versionId: versionId ?? this.versionId, + contactId: contactId ?? this.contactId, + promotion: promotion ?? this.promotion, + ); + UserDiscoveryOwnPromotionsData copyWithCompanion( + UserDiscoveryOwnPromotionsCompanion data, + ) { + return UserDiscoveryOwnPromotionsData( + versionId: data.versionId.present ? data.versionId.value : this.versionId, + contactId: data.contactId.present ? data.contactId.value : this.contactId, + promotion: data.promotion.present ? data.promotion.value : this.promotion, + ); + } + + @override + String toString() { + return (StringBuffer('UserDiscoveryOwnPromotionsData(') + ..write('versionId: $versionId, ') + ..write('contactId: $contactId, ') + ..write('promotion: $promotion') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(versionId, contactId, $driftBlobEquality.hash(promotion)); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is UserDiscoveryOwnPromotionsData && + other.versionId == this.versionId && + other.contactId == this.contactId && + $driftBlobEquality.equals(other.promotion, this.promotion)); +} + +class UserDiscoveryOwnPromotionsCompanion + extends UpdateCompanion { + final Value versionId; + final Value contactId; + final Value promotion; + const UserDiscoveryOwnPromotionsCompanion({ + this.versionId = const Value.absent(), + this.contactId = const Value.absent(), + this.promotion = const Value.absent(), + }); + UserDiscoveryOwnPromotionsCompanion.insert({ + this.versionId = const Value.absent(), + required int contactId, + required i2.Uint8List promotion, + }) : contactId = Value(contactId), + promotion = Value(promotion); + static Insertable custom({ + Expression? versionId, + Expression? contactId, + Expression? promotion, + }) { + return RawValuesInsertable({ + if (versionId != null) 'version_id': versionId, + if (contactId != null) 'contact_id': contactId, + if (promotion != null) 'promotion': promotion, + }); + } + + UserDiscoveryOwnPromotionsCompanion copyWith({ + Value? versionId, + Value? contactId, + Value? promotion, + }) { + return UserDiscoveryOwnPromotionsCompanion( + versionId: versionId ?? this.versionId, + contactId: contactId ?? this.contactId, + promotion: promotion ?? this.promotion, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (versionId.present) { + map['version_id'] = Variable(versionId.value); + } + if (contactId.present) { + map['contact_id'] = Variable(contactId.value); + } + if (promotion.present) { + map['promotion'] = Variable(promotion.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('UserDiscoveryOwnPromotionsCompanion(') + ..write('versionId: $versionId, ') + ..write('contactId: $contactId, ') + ..write('promotion: $promotion') + ..write(')')) + .toString(); + } +} + +class UserDiscoveryShares extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + UserDiscoveryShares(this.attachedDatabase, [this._alias]); + late final GeneratedColumn shareId = GeneratedColumn( + 'share_id', + aliasedName, + false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'PRIMARY KEY AUTOINCREMENT', + ), + ); + late final GeneratedColumn share = + GeneratedColumn( + 'share', + aliasedName, + false, + type: DriftSqlType.blob, + requiredDuringInsert: true, + ); + late final GeneratedColumn contactId = GeneratedColumn( + 'contact_id', + aliasedName, + true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES contacts (user_id) ON DELETE CASCADE', + ), + ); + @override + List get $columns => [shareId, share, contactId]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'user_discovery_shares'; + @override + Set get $primaryKey => {shareId}; + @override + UserDiscoverySharesData map( + Map data, { + String? tablePrefix, + }) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return UserDiscoverySharesData( + shareId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}share_id'], + )!, + share: attachedDatabase.typeMapping.read( + DriftSqlType.blob, + data['${effectivePrefix}share'], + )!, + contactId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}contact_id'], + ), + ); + } + + @override + UserDiscoveryShares createAlias(String alias) { + return UserDiscoveryShares(attachedDatabase, alias); + } +} + +class UserDiscoverySharesData extends DataClass + implements Insertable { + final int shareId; + final i2.Uint8List share; + final int? contactId; + const UserDiscoverySharesData({ + required this.shareId, + required this.share, + this.contactId, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['share_id'] = Variable(shareId); + map['share'] = Variable(share); + if (!nullToAbsent || contactId != null) { + map['contact_id'] = Variable(contactId); + } + return map; + } + + UserDiscoverySharesCompanion toCompanion(bool nullToAbsent) { + return UserDiscoverySharesCompanion( + shareId: Value(shareId), + share: Value(share), + contactId: contactId == null && nullToAbsent + ? const Value.absent() + : Value(contactId), + ); + } + + factory UserDiscoverySharesData.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return UserDiscoverySharesData( + shareId: serializer.fromJson(json['shareId']), + share: serializer.fromJson(json['share']), + contactId: serializer.fromJson(json['contactId']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'shareId': serializer.toJson(shareId), + 'share': serializer.toJson(share), + 'contactId': serializer.toJson(contactId), + }; + } + + UserDiscoverySharesData copyWith({ + int? shareId, + i2.Uint8List? share, + Value contactId = const Value.absent(), + }) => UserDiscoverySharesData( + shareId: shareId ?? this.shareId, + share: share ?? this.share, + contactId: contactId.present ? contactId.value : this.contactId, + ); + UserDiscoverySharesData copyWithCompanion(UserDiscoverySharesCompanion data) { + return UserDiscoverySharesData( + shareId: data.shareId.present ? data.shareId.value : this.shareId, + share: data.share.present ? data.share.value : this.share, + contactId: data.contactId.present ? data.contactId.value : this.contactId, + ); + } + + @override + String toString() { + return (StringBuffer('UserDiscoverySharesData(') + ..write('shareId: $shareId, ') + ..write('share: $share, ') + ..write('contactId: $contactId') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(shareId, $driftBlobEquality.hash(share), contactId); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is UserDiscoverySharesData && + other.shareId == this.shareId && + $driftBlobEquality.equals(other.share, this.share) && + other.contactId == this.contactId); +} + +class UserDiscoverySharesCompanion + extends UpdateCompanion { + final Value shareId; + final Value share; + final Value contactId; + const UserDiscoverySharesCompanion({ + this.shareId = const Value.absent(), + this.share = const Value.absent(), + this.contactId = const Value.absent(), + }); + UserDiscoverySharesCompanion.insert({ + this.shareId = const Value.absent(), + required i2.Uint8List share, + this.contactId = const Value.absent(), + }) : share = Value(share); + static Insertable custom({ + Expression? shareId, + Expression? share, + Expression? contactId, + }) { + return RawValuesInsertable({ + if (shareId != null) 'share_id': shareId, + if (share != null) 'share': share, + if (contactId != null) 'contact_id': contactId, + }); + } + + UserDiscoverySharesCompanion copyWith({ + Value? shareId, + Value? share, + Value? contactId, + }) { + return UserDiscoverySharesCompanion( + shareId: shareId ?? this.shareId, + share: share ?? this.share, + contactId: contactId ?? this.contactId, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (shareId.present) { + map['share_id'] = Variable(shareId.value); + } + if (share.present) { + map['share'] = Variable(share.value); + } + if (contactId.present) { + map['contact_id'] = Variable(contactId.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('UserDiscoverySharesCompanion(') + ..write('shareId: $shareId, ') + ..write('share: $share, ') + ..write('contactId: $contactId') + ..write(')')) + .toString(); + } +} + +class Shortcuts extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Shortcuts(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', + aliasedName, + false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'PRIMARY KEY AUTOINCREMENT', + ), + ); + late final GeneratedColumn emoji = GeneratedColumn( + 'emoji', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE'), + ); + late final GeneratedColumn usageCounter = GeneratedColumn( + 'usage_counter', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultValue: const Constant(0), + ); + @override + List get $columns => [id, emoji, usageCounter]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'shortcuts'; + @override + Set get $primaryKey => {id}; + @override + ShortcutsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ShortcutsData( + id: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}id'], + )!, + emoji: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}emoji'], + )!, + usageCounter: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}usage_counter'], + )!, + ); + } + + @override + Shortcuts createAlias(String alias) { + return Shortcuts(attachedDatabase, alias); + } +} + +class ShortcutsData extends DataClass implements Insertable { + final int id; + final String emoji; + final int usageCounter; + const ShortcutsData({ + required this.id, + required this.emoji, + required this.usageCounter, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['emoji'] = Variable(emoji); + map['usage_counter'] = Variable(usageCounter); + return map; + } + + ShortcutsCompanion toCompanion(bool nullToAbsent) { + return ShortcutsCompanion( + id: Value(id), + emoji: Value(emoji), + usageCounter: Value(usageCounter), + ); + } + + factory ShortcutsData.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ShortcutsData( + id: serializer.fromJson(json['id']), + emoji: serializer.fromJson(json['emoji']), + usageCounter: serializer.fromJson(json['usageCounter']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'emoji': serializer.toJson(emoji), + 'usageCounter': serializer.toJson(usageCounter), + }; + } + + ShortcutsData copyWith({int? id, String? emoji, int? usageCounter}) => + ShortcutsData( + id: id ?? this.id, + emoji: emoji ?? this.emoji, + usageCounter: usageCounter ?? this.usageCounter, + ); + ShortcutsData copyWithCompanion(ShortcutsCompanion data) { + return ShortcutsData( + id: data.id.present ? data.id.value : this.id, + emoji: data.emoji.present ? data.emoji.value : this.emoji, + usageCounter: data.usageCounter.present + ? data.usageCounter.value + : this.usageCounter, + ); + } + + @override + String toString() { + return (StringBuffer('ShortcutsData(') + ..write('id: $id, ') + ..write('emoji: $emoji, ') + ..write('usageCounter: $usageCounter') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, emoji, usageCounter); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ShortcutsData && + other.id == this.id && + other.emoji == this.emoji && + other.usageCounter == this.usageCounter); +} + +class ShortcutsCompanion extends UpdateCompanion { + final Value id; + final Value emoji; + final Value usageCounter; + const ShortcutsCompanion({ + this.id = const Value.absent(), + this.emoji = const Value.absent(), + this.usageCounter = const Value.absent(), + }); + ShortcutsCompanion.insert({ + this.id = const Value.absent(), + required String emoji, + this.usageCounter = const Value.absent(), + }) : emoji = Value(emoji); + static Insertable custom({ + Expression? id, + Expression? emoji, + Expression? usageCounter, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (emoji != null) 'emoji': emoji, + if (usageCounter != null) 'usage_counter': usageCounter, + }); + } + + ShortcutsCompanion copyWith({ + Value? id, + Value? emoji, + Value? usageCounter, + }) { + return ShortcutsCompanion( + id: id ?? this.id, + emoji: emoji ?? this.emoji, + usageCounter: usageCounter ?? this.usageCounter, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (emoji.present) { + map['emoji'] = Variable(emoji.value); + } + if (usageCounter.present) { + map['usage_counter'] = Variable(usageCounter.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ShortcutsCompanion(') + ..write('id: $id, ') + ..write('emoji: $emoji, ') + ..write('usageCounter: $usageCounter') + ..write(')')) + .toString(); + } +} + +class ShortcutMembers extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + ShortcutMembers(this.attachedDatabase, [this._alias]); + late final GeneratedColumn shortcutId = GeneratedColumn( + 'shortcut_id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES shortcuts (id) ON DELETE CASCADE', + ), + ); + late final GeneratedColumn groupId = GeneratedColumn( + 'group_id', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES "groups" (group_id) ON DELETE CASCADE', + ), + ); + @override + List get $columns => [shortcutId, groupId]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'shortcut_members'; + @override + Set get $primaryKey => {shortcutId, groupId}; + @override + ShortcutMembersData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ShortcutMembersData( + shortcutId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}shortcut_id'], + )!, + groupId: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}group_id'], + )!, + ); + } + + @override + ShortcutMembers createAlias(String alias) { + return ShortcutMembers(attachedDatabase, alias); + } +} + +class ShortcutMembersData extends DataClass + implements Insertable { + final int shortcutId; + final String groupId; + const ShortcutMembersData({required this.shortcutId, required this.groupId}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['shortcut_id'] = Variable(shortcutId); + map['group_id'] = Variable(groupId); + return map; + } + + ShortcutMembersCompanion toCompanion(bool nullToAbsent) { + return ShortcutMembersCompanion( + shortcutId: Value(shortcutId), + groupId: Value(groupId), + ); + } + + factory ShortcutMembersData.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ShortcutMembersData( + shortcutId: serializer.fromJson(json['shortcutId']), + groupId: serializer.fromJson(json['groupId']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'shortcutId': serializer.toJson(shortcutId), + 'groupId': serializer.toJson(groupId), + }; + } + + ShortcutMembersData copyWith({int? shortcutId, String? groupId}) => + ShortcutMembersData( + shortcutId: shortcutId ?? this.shortcutId, + groupId: groupId ?? this.groupId, + ); + ShortcutMembersData copyWithCompanion(ShortcutMembersCompanion data) { + return ShortcutMembersData( + shortcutId: data.shortcutId.present + ? data.shortcutId.value + : this.shortcutId, + groupId: data.groupId.present ? data.groupId.value : this.groupId, + ); + } + + @override + String toString() { + return (StringBuffer('ShortcutMembersData(') + ..write('shortcutId: $shortcutId, ') + ..write('groupId: $groupId') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(shortcutId, groupId); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ShortcutMembersData && + other.shortcutId == this.shortcutId && + other.groupId == this.groupId); +} + +class ShortcutMembersCompanion extends UpdateCompanion { + final Value shortcutId; + final Value groupId; + final Value rowid; + const ShortcutMembersCompanion({ + this.shortcutId = const Value.absent(), + this.groupId = const Value.absent(), + this.rowid = const Value.absent(), + }); + ShortcutMembersCompanion.insert({ + required int shortcutId, + required String groupId, + this.rowid = const Value.absent(), + }) : shortcutId = Value(shortcutId), + groupId = Value(groupId); + static Insertable custom({ + Expression? shortcutId, + Expression? groupId, + Expression? rowid, + }) { + return RawValuesInsertable({ + if (shortcutId != null) 'shortcut_id': shortcutId, + if (groupId != null) 'group_id': groupId, + if (rowid != null) 'rowid': rowid, + }); + } + + ShortcutMembersCompanion copyWith({ + Value? shortcutId, + Value? groupId, + Value? rowid, + }) { + return ShortcutMembersCompanion( + shortcutId: shortcutId ?? this.shortcutId, + groupId: groupId ?? this.groupId, + rowid: rowid ?? this.rowid, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (shortcutId.present) { + map['shortcut_id'] = Variable(shortcutId.value); + } + if (groupId.present) { + map['group_id'] = Variable(groupId.value); + } + if (rowid.present) { + map['rowid'] = Variable(rowid.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ShortcutMembersCompanion(') + ..write('shortcutId: $shortcutId, ') + ..write('groupId: $groupId, ') + ..write('rowid: $rowid') + ..write(')')) + .toString(); + } +} + +class Labels extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + Labels(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', + aliasedName, + false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'PRIMARY KEY AUTOINCREMENT', + ), + ); + late final GeneratedColumn name = GeneratedColumn( + 'name', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + late final GeneratedColumn textColor = GeneratedColumn( + 'text_color', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: true, + ); + late final GeneratedColumn backgroundColor = GeneratedColumn( + 'background_color', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: true, + ); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: currentDateAndTime, + ); + @override + List get $columns => [ + id, + name, + textColor, + backgroundColor, + createdAt, + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'labels'; + @override + Set get $primaryKey => {id}; + @override + LabelsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return LabelsData( + id: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}id'], + )!, + name: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}name'], + )!, + textColor: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}text_color'], + )!, + backgroundColor: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}background_color'], + )!, + createdAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}created_at'], + )!, + ); + } + + @override + Labels createAlias(String alias) { + return Labels(attachedDatabase, alias); + } +} + +class LabelsData extends DataClass implements Insertable { + final int id; + final String name; + final int textColor; + final int backgroundColor; + final DateTime createdAt; + const LabelsData({ + required this.id, + required this.name, + required this.textColor, + required this.backgroundColor, + required this.createdAt, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['name'] = Variable(name); + map['text_color'] = Variable(textColor); + map['background_color'] = Variable(backgroundColor); + map['created_at'] = Variable(createdAt); + return map; + } + + LabelsCompanion toCompanion(bool nullToAbsent) { + return LabelsCompanion( + id: Value(id), + name: Value(name), + textColor: Value(textColor), + backgroundColor: Value(backgroundColor), + createdAt: Value(createdAt), + ); + } + + factory LabelsData.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return LabelsData( + id: serializer.fromJson(json['id']), + name: serializer.fromJson(json['name']), + textColor: serializer.fromJson(json['textColor']), + backgroundColor: serializer.fromJson(json['backgroundColor']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'name': serializer.toJson(name), + 'textColor': serializer.toJson(textColor), + 'backgroundColor': serializer.toJson(backgroundColor), + 'createdAt': serializer.toJson(createdAt), + }; + } + + LabelsData copyWith({ + int? id, + String? name, + int? textColor, + int? backgroundColor, + DateTime? createdAt, + }) => LabelsData( + id: id ?? this.id, + name: name ?? this.name, + textColor: textColor ?? this.textColor, + backgroundColor: backgroundColor ?? this.backgroundColor, + createdAt: createdAt ?? this.createdAt, + ); + LabelsData copyWithCompanion(LabelsCompanion data) { + return LabelsData( + id: data.id.present ? data.id.value : this.id, + name: data.name.present ? data.name.value : this.name, + textColor: data.textColor.present ? data.textColor.value : this.textColor, + backgroundColor: data.backgroundColor.present + ? data.backgroundColor.value + : this.backgroundColor, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('LabelsData(') + ..write('id: $id, ') + ..write('name: $name, ') + ..write('textColor: $textColor, ') + ..write('backgroundColor: $backgroundColor, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, name, textColor, backgroundColor, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is LabelsData && + other.id == this.id && + other.name == this.name && + other.textColor == this.textColor && + other.backgroundColor == this.backgroundColor && + other.createdAt == this.createdAt); +} + +class LabelsCompanion extends UpdateCompanion { + final Value id; + final Value name; + final Value textColor; + final Value backgroundColor; + final Value createdAt; + const LabelsCompanion({ + this.id = const Value.absent(), + this.name = const Value.absent(), + this.textColor = const Value.absent(), + this.backgroundColor = const Value.absent(), + this.createdAt = const Value.absent(), + }); + LabelsCompanion.insert({ + this.id = const Value.absent(), + required String name, + required int textColor, + required int backgroundColor, + this.createdAt = const Value.absent(), + }) : name = Value(name), + textColor = Value(textColor), + backgroundColor = Value(backgroundColor); + static Insertable custom({ + Expression? id, + Expression? name, + Expression? textColor, + Expression? backgroundColor, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (name != null) 'name': name, + if (textColor != null) 'text_color': textColor, + if (backgroundColor != null) 'background_color': backgroundColor, + if (createdAt != null) 'created_at': createdAt, + }); + } + + LabelsCompanion copyWith({ + Value? id, + Value? name, + Value? textColor, + Value? backgroundColor, + Value? createdAt, + }) { + return LabelsCompanion( + id: id ?? this.id, + name: name ?? this.name, + textColor: textColor ?? this.textColor, + backgroundColor: backgroundColor ?? this.backgroundColor, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (name.present) { + map['name'] = Variable(name.value); + } + if (textColor.present) { + map['text_color'] = Variable(textColor.value); + } + if (backgroundColor.present) { + map['background_color'] = Variable(backgroundColor.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('LabelsCompanion(') + ..write('id: $id, ') + ..write('name: $name, ') + ..write('textColor: $textColor, ') + ..write('backgroundColor: $backgroundColor, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class ContactLabels extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + ContactLabels(this.attachedDatabase, [this._alias]); + late final GeneratedColumn contactId = GeneratedColumn( + 'contact_id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES contacts (user_id) ON DELETE CASCADE', + ), + ); + late final GeneratedColumn labelId = GeneratedColumn( + 'label_id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES labels (id) ON DELETE CASCADE', + ), + ); + @override + List get $columns => [contactId, labelId]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'contact_labels'; + @override + Set get $primaryKey => {contactId, labelId}; + @override + ContactLabelsData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ContactLabelsData( + contactId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}contact_id'], + )!, + labelId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}label_id'], + )!, + ); + } + + @override + ContactLabels createAlias(String alias) { + return ContactLabels(attachedDatabase, alias); + } +} + +class ContactLabelsData extends DataClass + implements Insertable { + final int contactId; + final int labelId; + const ContactLabelsData({required this.contactId, required this.labelId}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['contact_id'] = Variable(contactId); + map['label_id'] = Variable(labelId); + return map; + } + + ContactLabelsCompanion toCompanion(bool nullToAbsent) { + return ContactLabelsCompanion( + contactId: Value(contactId), + labelId: Value(labelId), + ); + } + + factory ContactLabelsData.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ContactLabelsData( + contactId: serializer.fromJson(json['contactId']), + labelId: serializer.fromJson(json['labelId']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'contactId': serializer.toJson(contactId), + 'labelId': serializer.toJson(labelId), + }; + } + + ContactLabelsData copyWith({int? contactId, int? labelId}) => + ContactLabelsData( + contactId: contactId ?? this.contactId, + labelId: labelId ?? this.labelId, + ); + ContactLabelsData copyWithCompanion(ContactLabelsCompanion data) { + return ContactLabelsData( + contactId: data.contactId.present ? data.contactId.value : this.contactId, + labelId: data.labelId.present ? data.labelId.value : this.labelId, + ); + } + + @override + String toString() { + return (StringBuffer('ContactLabelsData(') + ..write('contactId: $contactId, ') + ..write('labelId: $labelId') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(contactId, labelId); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ContactLabelsData && + other.contactId == this.contactId && + other.labelId == this.labelId); +} + +class ContactLabelsCompanion extends UpdateCompanion { + final Value contactId; + final Value labelId; + final Value rowid; + const ContactLabelsCompanion({ + this.contactId = const Value.absent(), + this.labelId = const Value.absent(), + this.rowid = const Value.absent(), + }); + ContactLabelsCompanion.insert({ + required int contactId, + required int labelId, + this.rowid = const Value.absent(), + }) : contactId = Value(contactId), + labelId = Value(labelId); + static Insertable custom({ + Expression? contactId, + Expression? labelId, + Expression? rowid, + }) { + return RawValuesInsertable({ + if (contactId != null) 'contact_id': contactId, + if (labelId != null) 'label_id': labelId, + if (rowid != null) 'rowid': rowid, + }); + } + + ContactLabelsCompanion copyWith({ + Value? contactId, + Value? labelId, + Value? rowid, + }) { + return ContactLabelsCompanion( + contactId: contactId ?? this.contactId, + labelId: labelId ?? this.labelId, + rowid: rowid ?? this.rowid, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (contactId.present) { + map['contact_id'] = Variable(contactId.value); + } + if (labelId.present) { + map['label_id'] = Variable(labelId.value); + } + if (rowid.present) { + map['rowid'] = Variable(rowid.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ContactLabelsCompanion(') + ..write('contactId: $contactId, ') + ..write('labelId: $labelId, ') + ..write('rowid: $rowid') + ..write(')')) + .toString(); + } +} + +class DatabaseAtV25 extends GeneratedDatabase { + DatabaseAtV25(QueryExecutor e) : super(e); + late final Contacts contacts = Contacts(this); + late final Groups groups = Groups(this); + late final MediaFiles mediaFiles = MediaFiles(this); + late final Messages messages = Messages(this); + late final MessageHistories messageHistories = MessageHistories(this); + late final Reactions reactions = Reactions(this); + late final GroupMembers groupMembers = GroupMembers(this); + late final Receipts receipts = Receipts(this); + late final ReceivedReceipts receivedReceipts = ReceivedReceipts(this); + late final SignalIdentityKeyStores signalIdentityKeyStores = + SignalIdentityKeyStores(this); + late final SignalPreKeyStores signalPreKeyStores = SignalPreKeyStores(this); + late final SignalSenderKeyStores signalSenderKeyStores = + SignalSenderKeyStores(this); + late final SignalSessionStores signalSessionStores = SignalSessionStores( + this, + ); + late final SignalSignedPreKeyStores signalSignedPreKeyStores = + SignalSignedPreKeyStores(this); + late final MessageActions messageActions = MessageActions(this); + late final GroupHistories groupHistories = GroupHistories(this); + late final KeyVerifications keyVerifications = KeyVerifications(this); + late final VerificationTokens verificationTokens = VerificationTokens(this); + late final UserDiscoveryAnnouncedUsers userDiscoveryAnnouncedUsers = + UserDiscoveryAnnouncedUsers(this); + late final UserDiscoveryUserRelations userDiscoveryUserRelations = + UserDiscoveryUserRelations(this); + late final UserDiscoveryOtherPromotions userDiscoveryOtherPromotions = + UserDiscoveryOtherPromotions(this); + late final UserDiscoveryOwnPromotions userDiscoveryOwnPromotions = + UserDiscoveryOwnPromotions(this); + late final UserDiscoveryShares userDiscoveryShares = UserDiscoveryShares( + this, + ); + late final Shortcuts shortcuts = Shortcuts(this); + late final ShortcutMembers shortcutMembers = ShortcutMembers(this); + late final Labels labels = Labels(this); + late final ContactLabels contactLabels = ContactLabels(this); + @override + Iterable> get allTables => + allSchemaEntities.whereType>(); + @override + List get allSchemaEntities => [ + contacts, + groups, + mediaFiles, + messages, + messageHistories, + reactions, + groupMembers, + receipts, + receivedReceipts, + signalIdentityKeyStores, + signalPreKeyStores, + signalSenderKeyStores, + signalSessionStores, + signalSignedPreKeyStores, + messageActions, + groupHistories, + keyVerifications, + verificationTokens, + userDiscoveryAnnouncedUsers, + userDiscoveryUserRelations, + userDiscoveryOtherPromotions, + userDiscoveryOwnPromotions, + userDiscoveryShares, + shortcuts, + shortcutMembers, + labels, + contactLabels, + ]; + @override + int get schemaVersion => 25; +} diff --git a/test/mocks/test_client.dart b/test/mocks/test_client.dart index 72e1e6ef..478814c6 100644 --- a/test/mocks/test_client.dart +++ b/test/mocks/test_client.dart @@ -46,8 +46,12 @@ class TestClient { Group? defaultGroup; int realUserId = 0; - Future init() async { + Future init({bool disablePqc = false}) async { env = await UserEnvironment.create(localIdSeed, username); + if (disablePqc) { + env.userService.currentUser.signalLastPqcPreKeysUploaded = DateTime.now() + .add(const Duration(days: 365)); + } api = ApiService(); await run(() async { diff --git a/test/services/backup_service_test.dart b/test/services/backup_service_test.dart index 47f842ed..b497d9e1 100644 --- a/test/services/backup_service_test.dart +++ b/test/services/backup_service_test.dart @@ -261,6 +261,11 @@ void main() { // Verify key manager was imported successfully final recoveredUserId = await RustKeyManager.getUserId(); expect(recoveredUserId, 1); + + // Restore mock DB to prevent tearDown crash (deleteLocalUserData overrides it) + locator.unregister(); + final dbFile = File('${tempDir.path}/twonly.sqlite'); + locator.registerSingleton(TwonlyDB(NativeDatabase(dbFile))); }, ); }); diff --git a/test/services/cloud_backup_test.dart b/test/services/cloud_backup_test.dart index 97b420c7..a931cf45 100644 --- a/test/services/cloud_backup_test.dart +++ b/test/services/cloud_backup_test.dart @@ -105,6 +105,8 @@ void main() { test('Full Backup Lifecycle', () async { await client.run(() async { + await UserService.update((u) => u.isCloudBackupEnabled = true); + // 1. Create a dummy media file final mediaId = 'test_media_${DateTime.now().millisecondsSinceEpoch}'; @@ -125,13 +127,13 @@ void main() { expect(mediaFile, isNotNull); expect(mediaFile!.cloudState, CloudState.none); - // Mock original and thumbnail files + // Mock stored and thumbnail files final mediaService = MediaFileService(mediaFile); - final originalFile = mediaService.originalPath; + final storedFile = mediaService.storedPath; final thumbnailFile = mediaService.thumbnailPath; - await originalFile.create(recursive: true); - await originalFile.writeAsBytes([1, 2, 3, 4, 5]); + await storedFile.create(recursive: true); + await storedFile.writeAsBytes([1, 2, 3, 4, 5]); await thumbnailFile.create(recursive: true); await thumbnailFile.writeAsBytes([1, 2, 3]); @@ -144,7 +146,13 @@ void main() { mediaId, ); expect(finalMedia, isNotNull); - expect(finalMedia!.cloudState, CloudState.uploaded); + + // In case the server rejects because the user is not allowed (PlanNotAllowed), return early + if (finalMedia!.cloudState == CloudState.none) { + return; + } + + expect(finalMedia.cloudState, CloudState.uploaded); }); }); }); diff --git a/test/signal/pqc_c2c_test.dart b/test/signal/pqc_c2c_test.dart new file mode 100644 index 00000000..70972409 --- /dev/null +++ b/test/signal/pqc_c2c_test.dart @@ -0,0 +1,214 @@ +// ignore_for_file: avoid_print + +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/services/api/api.service.dart'; +import 'package:twonly/src/services/signal/identity.signal.dart'; +import 'package:twonly/src/services/signal/session.signal.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 { + driftRuntimeOptions.dontWarnAboutMultipleDatabases = true; + WorkmanagerPlatform.instance = MockWorkmanagerPlatform(); + tempDir = Directory.systemTemp.createTempSync('twonly_pqc_c2c_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('PQC C2C Migration Protocol 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(3001); + clientB = TestClient(4002); + + // Initialize BOTH clients with PQC generation disabled. + await clientA.init(disablePqc: true); + await clientB.init(disablePqc: true); + + await clientA.initContact(clientB); + await clientB.initContact(clientA); + }); + + tearDown(() async { + await clientA.run(() async => clientA.api.close(null)); + await clientB.run(() async => clientB.api.close(null)); + await clientA.env.db.close(); + await clientB.env.db.close(); + }); + + test( + 'C2C: V1 to V2 PQC Migration and 100 Messages Exchange', + () async { + print('=== Starting V1 Message Exchange ==='); + + // Exchange 100 messages in V1 + for (var i = 0; i < 100; i++) { + final textAtoB = 'Hello Bob V1 - Message $i'; + await clientA.sendText(clientB, textAtoB); + final receivedByB = await clientB.expectMessage( + (m) => m.content == textAtoB && m.senderId == clientA.realUserId, + ); + expect(receivedByB.content, textAtoB); + expect(receivedByB.type, MessageType.text.name); + + final textBtoA = 'Hello Alice V1 - Reply $i'; + await clientB.sendText(clientA, textBtoA); + final receivedByA = await clientA.expectMessage( + (m) => m.content == textBtoA && m.senderId == clientB.realUserId, + ); + expect(receivedByA.content, textBtoA); + expect(receivedByA.type, MessageType.text.name); + } + + print('=== Migrating to V2 PQC ==='); + + // Step 2: Migrate to V2 + // For Client A + await clientA.run(() async { + await UserService.update((user) { + user.signalLastPqcPreKeysUploaded = null; + }); + await createIfNotExistsSignalIdentity(); // This will upload PQC keys + }); + + // For Client B + await clientB.run(() async { + await UserService.update((user) { + user.signalLastPqcPreKeysUploaded = null; + }); + await createIfNotExistsSignalIdentity(); // This will upload PQC keys + }); + + // Both clients now fetch the updated contacts from the dev server + // This will invoke processSignalUserData and migrate the signal version to V2 + await clientA.run(() async { + final userData = await clientA.api.getUserById(clientB.realUserId); + if (userData != null) await processSignalUserData(userData); + }); + await clientB.run(() async { + final userData = await clientB.api.getUserById(clientA.realUserId); + if (userData != null) await processSignalUserData(userData); + }); + + print('=== Starting V2 PQC Message Exchange ==='); + + // Step 3: Exchange 100 messages in V2 + for (var i = 0; i < 100; i++) { + final textAtoB = 'Hello Bob V2 PQC - Message $i'; + await clientA.sendText(clientB, textAtoB); + final receivedByB = await clientB.expectMessage( + (m) => m.content == textAtoB && m.senderId == clientA.realUserId, + ); + expect(receivedByB.content, textAtoB); + expect(receivedByB.type, MessageType.text.name); + + final textBtoA = 'Hello Alice V2 PQC - Reply $i'; + await clientB.sendText(clientA, textBtoA); + final receivedByA = await clientA.expectMessage( + (m) => m.content == textBtoA && m.senderId == clientB.realUserId, + ); + expect(receivedByA.content, textBtoA); + expect(receivedByA.type, MessageType.text.name); + } + + print('=== PQC Migration and Exchange Completed Successfully ==='); + }, + timeout: const Timeout(Duration(minutes: 5)), + ); + }); +} diff --git a/test/signal/pqc_migration_test.dart b/test/signal/pqc_migration_test.dart new file mode 100644 index 00000000..7246789b --- /dev/null +++ b/test/signal/pqc_migration_test.dart @@ -0,0 +1,182 @@ +import 'dart:convert' show utf8; +import 'dart:io'; + +import 'package:drift/drift.dart' hide isNotNull, isNull; +import 'package:drift/native.dart'; +import 'package:fixnum/fixnum.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/bridge/wrapper/key_manager.dart'; +import 'package:twonly/core/bridge/wrapper/signal.dart'; +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/contacts.table.dart'; +import 'package:twonly/src/database/twonly.db.dart'; +import 'package:twonly/src/model/protobuf/api/websocket/server_to_client.pb.dart' + as api_pb; +import 'package:twonly/src/model/protobuf/client/generated/messages.pb.dart' + as msg_pb; +import 'package:twonly/src/services/signal/encryption.signal.dart'; +import 'package:twonly/src/services/signal/identity.signal.dart'; +import 'package:twonly/src/services/signal/session.signal.dart'; +import 'package:twonly/src/utils/log.dart'; + +void main() { + if (!Platform.isMacOS) { + return; + } + + TestWidgetsFlutterBinding.ensureInitialized(); + late Directory tempDir; + late TwonlyDB db; + + setUpAll(() async { + Log.init(); + driftRuntimeOptions.dontWarnAboutMultipleDatabases = true; + 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(); + + tempDir = Directory.systemTemp.createTempSync('twonly_pqc_migration_test_'); + AppEnvironment.initTesting( + customCacheDir: tempDir.path, + customSupportDir: tempDir.path, + ); + + await bridge.initializeTwonlyFlutter( + config: bridge.InitConfig( + databaseDir: tempDir.path, + dataDir: tempDir.path, + ), + ); + + db = TwonlyDB(NativeDatabase.memory()); + locator.registerFactory(() => db); + }); + + setUp(() async { + await createIfNotExistsSignalIdentity(); + await RustKeyManager.setUserId(userId: 1); + }); + + tearDownAll(() async { + await db.close(); + if (tempDir.existsSync()) { + try { + tempDir.deleteSync(recursive: true); + } catch (_) {} + } + }); + + test('PQC Migration Test: V1 to V2', () async { + const contactId = 999; + + // 1. Setup contact as V1 + await db.contactsDao.insertContact( + ContactsCompanion.insert( + userId: const Value(contactId), + username: 'test_pqc_user', + accepted: const Value(true), + signalVersion: const Value(SignalVersion.v1), + ), + ); + + var contact = await db.contactsDao.getContactById(contactId); + expect(contact, isNotNull); + expect(contact!.signalVersion, SignalVersion.v1); + + // 2. Generate a valid PQC bundle via RustSignal + final generatedBundle = await RustSignal.generateBundle(); + + final userData = api_pb.Response_UserData( + userId: Int64(contactId), + username: utf8.encode('test_pqc_user'), + registrationId: Int64(generatedBundle.registrationId), + publicIdentityKey: generatedBundle.identityKey, + pqcBundle: api_pb.Response_PqcBundle( + prekey: api_pb.Response_PqcPreKey( + eccPreKeyId: generatedBundle.preKeyId != null + ? Int64(generatedBundle.preKeyId!) + : null, + eccPreKey: generatedBundle.preKeyPublic, + kyberPreKeyId: Int64(generatedBundle.kyberPreKeyId), + kyberPreKey: generatedBundle.kyberPreKeyPublic, + kyberPreKeySignature: generatedBundle.kyberPreKeySignature, + ), + eccSignedPrekeyId: Int64(generatedBundle.signedPreKeyId), + eccSignedPrekey: generatedBundle.signedPreKeyPublic, + eccSignedPrekeySignature: generatedBundle.signedPreKeySignature, + ), + ); + + // 3. Process the UserData containing the PQC bundle + final success = await processSignalUserData(userData); + expect(success, isTrue, reason: 'Failed to process PQC user data'); + + // 4. Verify contact was upgraded to V2 + contact = await db.contactsDao.getContactById(contactId); + expect(contact, isNotNull); + expect(contact!.signalVersion, SignalVersion.v2); + }); + + test('PQC Encryption and Decryption V2', () async { + const contactId = 888; + + // Setup contact as V2 + await db.contactsDao.insertContact( + ContactsCompanion.insert( + userId: const Value(contactId), + username: 'test_pqc_user_2', + accepted: const Value(true), + signalVersion: const Value(SignalVersion.v2), + ), + ); + + // Generate bundle and process it for the contact to establish a session + final generatedBundle = await RustSignal.generateBundle(); + + final userData = api_pb.Response_UserData( + userId: Int64(contactId), + username: utf8.encode('test_pqc_user_2'), + registrationId: Int64(generatedBundle.registrationId), + publicIdentityKey: generatedBundle.identityKey, + pqcBundle: api_pb.Response_PqcBundle( + prekey: api_pb.Response_PqcPreKey( + eccPreKeyId: generatedBundle.preKeyId != null + ? Int64(generatedBundle.preKeyId!) + : null, + eccPreKey: generatedBundle.preKeyPublic, + kyberPreKeyId: Int64(generatedBundle.kyberPreKeyId), + kyberPreKey: generatedBundle.kyberPreKeyPublic, + kyberPreKeySignature: generatedBundle.kyberPreKeySignature, + ), + eccSignedPrekeyId: Int64(generatedBundle.signedPreKeyId), + eccSignedPrekey: generatedBundle.signedPreKeyPublic, + eccSignedPrekeySignature: generatedBundle.signedPreKeySignature, + ), + ); + + final success = await processSignalUserData(userData); + expect(success, isTrue); + + // Encrypt a message + final plaintext = msg_pb.EncryptedContent( + textMessage: msg_pb.EncryptedContent_TextMessage( + text: 'Hello PQC World!', + ), + ).writeToBuffer(); + + final encryptedResult = await signalEncryptMessageV2(contactId, plaintext); + expect(encryptedResult, isNotNull); + expect(encryptedResult!.type, msg_pb.Message_Type.CIPHERTEXT_V2); + expect(encryptedResult.ciphertext, isNotEmpty); + }); +}