diff --git a/CHANGELOG.md b/CHANGELOG.md index 40292fb2..553d8ec8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,12 @@ # Changelog -## 0.2.30 - -- Fix: Changed minimum threshold for the user discovery to 3 - -## 0.2.28 +## 0.3.0 - Improved: Design of some UI components - Improved: Memories viewer shows state for batch operations and has improved performance +- Fix: Issue with background notifications on Android +- Fix: Changed minimum threshold for the user discovery to 3 +- Fix: Multiple UI issues - Fix: Auto-detect if FCM token does not work and trigger a reset ## 0.2.26 diff --git a/fastlane/Fastfile b/fastlane/Fastfile index e8ca079f..eaa30a1c 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -33,7 +33,7 @@ platform :android do # Load release notes from CHANGELOG.md changelog_path = File.expand_path("../CHANGELOG.md", __dir__) - release_notes = "Automated local release via Fastlane" + release_notes = "Small bug fixes." if File.exist?(changelog_path) changelog_content = File.read(changelog_path) escaped_version = Regexp.escape(version) @@ -122,6 +122,11 @@ platform :android do UI.message("Starting F-Droid deployment...") FileUtils.mkdir_p(fdroid_repo_dir) + # Delete all APK files in the directory + sh("rm -f #{fdroid_repo_dir}/*.apk") + + UI.message("All APK files deleted.") + apks.each do |apk_path| basename = File.basename(apk_path) new_name = "eu.twonly_v#{version}-#{basename}" diff --git a/lib/main.dart b/lib/main.dart index a4ed4ed5..619cb22e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -76,7 +76,7 @@ void main() async { unawaited(StartupGuard.markAppStartup()); var storageError = await twonlyMinimumInitialization(); - await initFCMService(); + await FcmNotificationService.initStartup(); var userExists = false; @@ -109,6 +109,8 @@ void main() async { unawaited(initFileDownloader()); if (userExists) { + unawaited(FcmNotificationService.initAfterUserLoaded()); + if (userService.currentUser.allowErrorTrackingViaSentry) { AppState.allowErrorTrackingViaSentry = true; await SentryFlutter.init( diff --git a/lib/src/localization/generated/app_localizations.dart b/lib/src/localization/generated/app_localizations.dart index 04b40571..e30d9e52 100644 --- a/lib/src/localization/generated/app_localizations.dart +++ b/lib/src/localization/generated/app_localizations.dart @@ -140,18 +140,6 @@ abstract class AppLocalizations { /// **'Say goodbye to addictive features! twonly was created for sharing moments, free from useless distractions or ads.'** String get onboardingFocusBody; - /// No description provided for @onboardingSendTwonliesTitle. - /// - /// In en, this message translates to: - /// **'Send twonlies'** - String get onboardingSendTwonliesTitle; - - /// No description provided for @onboardingSendTwonliesBody. - /// - /// In en, this message translates to: - /// **'Share moments securely with your partner. twonly ensures that only your partner can open it, keeping your moments with your partner a two(o)nly thing!'** - String get onboardingSendTwonliesBody; - /// No description provided for @onboardingNotProductTitle. /// /// In en, this message translates to: @@ -164,12 +152,6 @@ abstract class AppLocalizations { /// **'twonly is financed by donations and an optional subscription. Your data will never be sold.'** String get onboardingNotProductBody; - /// No description provided for @onboardingGetStartedTitle. - /// - /// In en, this message translates to: - /// **'Let\'s go!'** - String get onboardingGetStartedTitle; - /// No description provided for @registerUsernameSlogan. /// /// In en, this message translates to: @@ -320,24 +302,12 @@ abstract class AppLocalizations { /// **'Username not found'** String get searchUsernameNotFound; - /// No description provided for @searchUsernameNotFoundBody. - /// - /// In en, this message translates to: - /// **'There is no user with the username \"{username}\" registered'** - String searchUsernameNotFoundBody(Object username); - /// No description provided for @searchUsernameNewFollowerTitle. /// /// In en, this message translates to: /// **'Open requests'** String get searchUsernameNewFollowerTitle; - /// No description provided for @chatListViewSearchUserNameBtn. - /// - /// In en, this message translates to: - /// **'Add your first twonly contact!'** - String get chatListViewSearchUserNameBtn; - /// No description provided for @chatListDetailInput. /// /// In en, this message translates to: @@ -512,12 +482,6 @@ abstract class AppLocalizations { /// **'Store in Gallery'** String get settingsStorageDataStoreInGTitle; - /// No description provided for @settingsStorageDataStoreInGSubtitle. - /// - /// In en, this message translates to: - /// **'Store saved images additional in the systems gallery.'** - String get settingsStorageDataStoreInGSubtitle; - /// No description provided for @settingsStorageDataMediaAutoDownload. /// /// In en, this message translates to: @@ -611,13 +575,13 @@ abstract class AppLocalizations { /// No description provided for @settingsPrivacyBlockUsers. /// /// In en, this message translates to: - /// **'Block users'** + /// **'Block contacts'** String get settingsPrivacyBlockUsers; /// No description provided for @settingsPrivacyBlockUsersDesc. /// /// In en, this message translates to: - /// **'Blocked users will not be able to communicate with you. You can unblock a blocked user at any time.'** + /// **'Blocked contacts will not be able to communicate with you. You can unblock a blocked contact at any time.'** String get settingsPrivacyBlockUsersDesc; /// No description provided for @settingsPrivacyBlockUsersCount. @@ -632,12 +596,6 @@ abstract class AppLocalizations { /// **'Security Profile'** String get settingsPrivacyProfileSelectionTitle; - /// No description provided for @settingsPrivacyProfileSelectionDesc. - /// - /// In en, this message translates to: - /// **'Choose your setup path and security configuration'** - String get settingsPrivacyProfileSelectionDesc; - /// No description provided for @securityProfileTitle. /// /// In en, this message translates to: @@ -935,13 +893,19 @@ abstract class AppLocalizations { /// No description provided for @contactVerifyNumberTitle. /// /// In en, this message translates to: - /// **'Verify contact'** + /// **'Verify contacts'** String get contactVerifyNumberTitle; + /// No description provided for @contactVerifyNumberSubtitle. + /// + /// In en, this message translates to: + /// **'Verify the identity of your contacts to make sure you are texting the right person.'** + String get contactVerifyNumberSubtitle; + /// No description provided for @userVerifiedTitle. /// /// In en, this message translates to: - /// **'User verified'** + /// **'Contact verified'** String get userVerifiedTitle; /// No description provided for @contactVerifiedBy. @@ -1013,13 +977,13 @@ abstract class AppLocalizations { /// No description provided for @contactBlockBody. /// /// In en, this message translates to: - /// **'A blocked user will no longer be able to send you messages and their profile will be hidden from view. To unblock a user, simply navigate to Settings > Privacy > Blocked Users.'** + /// **'A blocked contact will no longer be able to send you messages and their profile will be hidden from view. To unblock a contact, simply navigate to Settings > Privacy > Blocked Contacts.'** String get contactBlockBody; /// No description provided for @contactRemove. /// /// In en, this message translates to: - /// **'Remove user'** + /// **'Remove contact'** String get contactRemove; /// No description provided for @contactRemoveTitle. @@ -1031,7 +995,7 @@ abstract class AppLocalizations { /// No description provided for @contactRemoveBody. /// /// In en, this message translates to: - /// **'Permanently remove the user. If the user tries to send you a new message, you will have to accept the user again first.'** + /// **'Permanently remove the contact. If the contact tries to send you a new message, you will have to accept the contact again first.'** String get contactRemoveBody; /// No description provided for @undo. @@ -1721,7 +1685,7 @@ abstract class AppLocalizations { /// No description provided for @reportUser. /// /// In en, this message translates to: - /// **'Report user'** + /// **'Report contact'** String get reportUser; /// No description provided for @newDeviceRegistered. @@ -2360,18 +2324,6 @@ abstract class AppLocalizations { /// **'Draft'** String get draftMessage; - /// No description provided for @exportMemories. - /// - /// In en, this message translates to: - /// **'Export memories (Beta)'** - String get exportMemories; - - /// No description provided for @importMemories. - /// - /// In en, this message translates to: - /// **'Import memories (Beta)'** - String get importMemories; - /// No description provided for @voiceMessageSlideToCancel. /// /// In en, this message translates to: @@ -2771,7 +2723,7 @@ abstract class AppLocalizations { /// No description provided for @verificationBadgeGreenDesc. /// /// In en, this message translates to: - /// **'A contact you have *personally* verified.'** + /// **'A contact you have *personally verified* using the QR code.'** String get verificationBadgeGreenDesc; /// No description provided for @verificationBadgeYellowDesc. @@ -2786,6 +2738,18 @@ abstract class AppLocalizations { /// **'A contact whose identity has *not* yet been verified.'** String get verificationBadgeRedDesc; + /// No description provided for @scanNow. + /// + /// In en, this message translates to: + /// **'Scan now'** + String get scanNow; + + /// No description provided for @openQrCode. + /// + /// In en, this message translates to: + /// **'Open QR code'** + String get openQrCode; + /// No description provided for @deleteVerificationTitle. /// /// In en, this message translates to: @@ -2810,12 +2774,6 @@ abstract class AppLocalizations { /// **'{count, plural, =1{1 mutual group} other{{count} mutual groups}}'** String mutualGroupsTitle(num count); - /// No description provided for @mutualGroupsSentMessages. - /// - /// In en, this message translates to: - /// **'{count, plural, =1{1 message sent} other{{count} messages sent}}'** - String mutualGroupsSentMessages(num count); - /// No description provided for @chatEntryFlameRestored. /// /// In en, this message translates to: @@ -2888,12 +2846,6 @@ abstract class AppLocalizations { /// **'When the typing indicator is turned off, you can\'t see when others are typing a message.'** String get settingsTypingIndicationSubtitle; - /// No description provided for @scanQrOrShow. - /// - /// In en, this message translates to: - /// **'Scan / Show QR'** - String get scanQrOrShow; - /// No description provided for @contactActionBlock. /// /// In en, this message translates to: @@ -2948,12 +2900,6 @@ abstract class AppLocalizations { /// **'Mutual Friends'** String get userDiscoverySettingsTitle; - /// No description provided for @userDiscoveryWhyThisIsUsed. - /// - /// In en, this message translates to: - /// **'Why this is used'** - String get userDiscoveryWhyThisIsUsed; - /// No description provided for @userDiscoveryFeatureOffers. /// /// In en, this message translates to: @@ -3236,12 +3182,6 @@ abstract class AppLocalizations { /// **'Back'** String get back; - /// No description provided for @onboardingExampleLabel. - /// - /// In en, this message translates to: - /// **'Example'** - String get onboardingExampleLabel; - /// No description provided for @makerChangedUsername. /// /// In en, this message translates to: @@ -3410,12 +3350,6 @@ abstract class AppLocalizations { /// **'Drag to Zoom'** String get dragToZoom; - /// No description provided for @showUsername. - /// - /// In en, this message translates to: - /// **'Show username'** - String get showUsername; - /// No description provided for @onboardingProfileSelectionTitle. /// /// In en, this message translates to: @@ -3642,30 +3576,6 @@ abstract class AppLocalizations { /// **'There are no images on your device.'** String get importGalleryNoImagesFoundDesc; - /// No description provided for @importGalleryShowAllImages. - /// - /// In en, this message translates to: - /// **'Show all images'** - String get importGalleryShowAllImages; - - /// No description provided for @importGalleryShowTwonlyAlbum. - /// - /// In en, this message translates to: - /// **'Show twonly album'** - String get importGalleryShowTwonlyAlbum; - - /// No description provided for @importGalleryToggleDescAll. - /// - /// In en, this message translates to: - /// **'Viewing all images on your device.'** - String get importGalleryToggleDescAll; - - /// No description provided for @importGalleryToggleDescTwonly. - /// - /// In en, this message translates to: - /// **'Viewing the \"twonly\" album.'** - String get importGalleryToggleDescTwonly; - /// No description provided for @importGalleryFilterTwonly. /// /// In en, this message translates to: diff --git a/lib/src/localization/generated/app_localizations_de.dart b/lib/src/localization/generated/app_localizations_de.dart index e6eaac68..8c863954 100644 --- a/lib/src/localization/generated/app_localizations_de.dart +++ b/lib/src/localization/generated/app_localizations_de.dart @@ -33,13 +33,6 @@ class AppLocalizationsDe extends AppLocalizations { String get onboardingFocusBody => 'Verabschiede dich von süchtig machenden Funktionen! twonly wurde für das Teilen von Momenten ohne nutzlose Ablenkungen oder Werbung entwickelt.'; - @override - String get onboardingSendTwonliesTitle => 'twonlies senden'; - - @override - String get onboardingSendTwonliesBody => - 'Teile Momente sicher mit deinem Partner. twonly stellt sicher, dass nur dein Partner sie öffnen kann, sodass deine Momente mit deinem Partner eine two(o)nly Sache bleiben!'; - @override String get onboardingNotProductTitle => 'Du bist nicht das Produkt!'; @@ -47,9 +40,6 @@ class AppLocalizationsDe extends AppLocalizations { String get onboardingNotProductBody => 'twonly wird durch Spenden und ein optionales Abonnement finanziert. Deine Daten werden niemals verkauft.'; - @override - String get onboardingGetStartedTitle => 'Auf geht\'s'; - @override String get registerUsernameSlogan => 'Konto erstellen'; @@ -126,18 +116,9 @@ class AppLocalizationsDe extends AppLocalizations { @override String get searchUsernameNotFound => 'Benutzername nicht gefunden'; - @override - String searchUsernameNotFoundBody(Object username) { - return 'Es wurde kein Benutzer mit dem Benutzernamen \"$username\" gefunden.'; - } - @override String get searchUsernameNewFollowerTitle => 'Offene Anfragen'; - @override - String get chatListViewSearchUserNameBtn => - 'Füge deinen ersten twonly-Kontakt hinzu!'; - @override String get chatListDetailInput => 'Nachricht eingeben'; @@ -229,10 +210,6 @@ class AppLocalizationsDe extends AppLocalizations { @override String get settingsStorageDataStoreInGTitle => 'In der Galerie speichern'; - @override - String get settingsStorageDataStoreInGSubtitle => - 'Speichere Bilder zusätzlich in der Systemgalerie.'; - @override String get settingsStorageDataMediaAutoDownload => 'Automatischer Mediendownload'; @@ -280,11 +257,11 @@ class AppLocalizationsDe extends AppLocalizations { String get settingsPrivacy => 'Datenschutz & Sicherheit'; @override - String get settingsPrivacyBlockUsers => 'Benutzer blockieren'; + String get settingsPrivacyBlockUsers => 'Kontakte blockieren'; @override String get settingsPrivacyBlockUsersDesc => - 'Blockierte Benutzer können nicht mit dir kommunizieren. Du kannst einen blockierten Benutzer jederzeit wieder entsperren.'; + 'Blockierte Kontakte können nicht mit dir kommunizieren. Du kannst einen blockierten Kontakt jederzeit wieder entsperren.'; @override String settingsPrivacyBlockUsersCount(Object len) { @@ -294,10 +271,6 @@ class AppLocalizationsDe extends AppLocalizations { @override String get settingsPrivacyProfileSelectionTitle => 'Sicherheitsprofil'; - @override - String get settingsPrivacyProfileSelectionDesc => - 'Wähle deinen Setup-Pfad und deine Sicherheitskonfiguration'; - @override String get securityProfileTitle => 'Sicherheitsprofil'; @@ -460,10 +433,14 @@ class AppLocalizationsDe extends AppLocalizations { 'Dein Konto wird gelöscht. Es gibt keine Möglichkeit, es wiederherzustellen.'; @override - String get contactVerifyNumberTitle => 'Benutzer verifizieren'; + String get contactVerifyNumberTitle => 'Kontakte verifizieren'; @override - String get userVerifiedTitle => 'Benutzer verifiziert'; + String get contactVerifyNumberSubtitle => + 'Überprüfe die Identität deiner Kontakte, um sicherzugehen, dass du mit der richtigen Person schreibst.'; + + @override + String get userVerifiedTitle => 'Kontakt verifiziert'; @override String contactVerifiedBy(Object username) { @@ -508,10 +485,10 @@ class AppLocalizationsDe extends AppLocalizations { @override String get contactBlockBody => - 'Ein blockierter Benutzer kann dir keine Nachrichten mehr senden, und deren Profil ist nicht mehr sichtbar. Um die Blockierung eines Benutzers aufzuheben, navigiere einfach zu Einstellungen > Datenschutz > Blockierte Benutzer.'; + 'Ein blockierter Kontakt kann dir keine Nachrichten mehr senden, und deren Profil ist nicht mehr sichtbar. Um die Blockierung eines Kontakts aufzuheben, navigiere einfach zu Einstellungen > Datenschutz > Blockierte Kontakte.'; @override - String get contactRemove => 'Benutzer löschen'; + String get contactRemove => 'Kontakt löschen'; @override String contactRemoveTitle(Object username) { @@ -520,7 +497,7 @@ class AppLocalizationsDe extends AppLocalizations { @override String get contactRemoveBody => - 'Den Benutzer dauerhaft entfernen. Wenn der Benutzer versucht, dir eine neue Nachricht zu senden, musst du den Benutzer erst wieder akzeptieren.'; + 'Den Kontakt dauerhaft entfernen. Wenn der Kontakt versucht, dir eine neue Nachricht zu senden, musst du den Kontakt erst wieder akzeptieren.'; @override String get undo => 'Rückgängig'; @@ -910,7 +887,7 @@ class AppLocalizationsDe extends AppLocalizations { String get reportUserReason => 'Meldegrund'; @override - String get reportUser => 'Benutzer melden'; + String get reportUser => 'Kontakt melden'; @override String get newDeviceRegistered => @@ -1307,12 +1284,6 @@ class AppLocalizationsDe extends AppLocalizations { @override String get draftMessage => 'Entwurf'; - @override - String get exportMemories => 'Memories exportieren (Beta)'; - - @override - String get importMemories => 'Memories importieren (Beta)'; - @override String get voiceMessageSlideToCancel => 'Zum Abbrechen ziehen'; @@ -1561,7 +1532,7 @@ class AppLocalizationsDe extends AppLocalizations { @override String get verificationBadgeGreenDesc => - 'Ein Kontakt, den du *persönlich verifiziert* hast.'; + 'Ein Kontakt, den du über den QR-code *persönlich verifiziert* hast.'; @override String get verificationBadgeYellowDesc => @@ -1571,6 +1542,12 @@ class AppLocalizationsDe extends AppLocalizations { String get verificationBadgeRedDesc => 'Ein Kontakt, dessen Identität noch *nicht überprüft* wurde.'; + @override + String get scanNow => 'Jetzt scannen'; + + @override + String get openQrCode => 'QR-Code öffnen'; + @override String get deleteVerificationTitle => 'Verifizierung löschen?'; @@ -1594,17 +1571,6 @@ class AppLocalizationsDe extends AppLocalizations { return '$_temp0'; } - @override - String mutualGroupsSentMessages(num count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: '$count Nachrichten gesendet', - one: '1 Nachricht gesendet', - ); - return '$_temp0'; - } - @override String chatEntryFlameRestored(Object count) { return '$count Flammen wiederhergestellt'; @@ -1650,9 +1616,6 @@ class AppLocalizationsDe extends AppLocalizations { String get settingsTypingIndicationSubtitle => 'Bei deaktivierten Tipp-Indikatoren kannst du nicht sehen, wenn andere gerade eine Nachricht tippen.'; - @override - String get scanQrOrShow => 'QR scannen / anzeigen'; - @override String get contactActionBlock => 'Blockieren'; @@ -1684,9 +1647,6 @@ class AppLocalizationsDe extends AppLocalizations { @override String get userDiscoverySettingsTitle => 'Gemeinsame Freunde'; - @override - String get userDiscoveryWhyThisIsUsed => 'Warum dies verwendet wird'; - @override String get userDiscoveryFeatureOffers => 'Dein Nutzen auf einen Blick'; @@ -1854,9 +1814,6 @@ class AppLocalizationsDe extends AppLocalizations { @override String get back => 'Zurück'; - @override - String get onboardingExampleLabel => 'Beispiel'; - @override String makerChangedUsername(Object maker, Object oldName, Object newName) { return '$maker hat den Benutzernamen von $oldName zu $newName geändert.'; @@ -1957,9 +1914,6 @@ class AppLocalizationsDe extends AppLocalizations { @override String get dragToZoom => 'Zum Zoomen ziehen'; - @override - String get showUsername => 'Benutzernamen anzeigen'; - @override String get onboardingProfileSelectionTitle => 'Wähle deinen Setup-Weg'; @@ -2094,20 +2048,6 @@ class AppLocalizationsDe extends AppLocalizations { String get importGalleryNoImagesFoundDesc => 'Es befinden sich keine Bilder auf deinem Gerät.'; - @override - String get importGalleryShowAllImages => 'Alle Bilder anzeigen'; - - @override - String get importGalleryShowTwonlyAlbum => 'twonly-Album anzeigen'; - - @override - String get importGalleryToggleDescAll => - 'Es werden alle Bilder auf deinem Gerät angezeigt.'; - - @override - String get importGalleryToggleDescTwonly => - 'Es wird das \"twonly\"-Album angezeigt.'; - @override String get importGalleryFilterTwonly => 'Nur das twonly-Album anzeigen'; diff --git a/lib/src/localization/generated/app_localizations_en.dart b/lib/src/localization/generated/app_localizations_en.dart index 7fa61242..6594af21 100644 --- a/lib/src/localization/generated/app_localizations_en.dart +++ b/lib/src/localization/generated/app_localizations_en.dart @@ -32,13 +32,6 @@ class AppLocalizationsEn extends AppLocalizations { String get onboardingFocusBody => 'Say goodbye to addictive features! twonly was created for sharing moments, free from useless distractions or ads.'; - @override - String get onboardingSendTwonliesTitle => 'Send twonlies'; - - @override - String get onboardingSendTwonliesBody => - 'Share moments securely with your partner. twonly ensures that only your partner can open it, keeping your moments with your partner a two(o)nly thing!'; - @override String get onboardingNotProductTitle => 'You are not the product!'; @@ -46,9 +39,6 @@ class AppLocalizationsEn extends AppLocalizations { String get onboardingNotProductBody => 'twonly is financed by donations and an optional subscription. Your data will never be sold.'; - @override - String get onboardingGetStartedTitle => 'Let\'s go!'; - @override String get registerUsernameSlogan => 'Create your account'; @@ -125,17 +115,9 @@ class AppLocalizationsEn extends AppLocalizations { @override String get searchUsernameNotFound => 'Username not found'; - @override - String searchUsernameNotFoundBody(Object username) { - return 'There is no user with the username \"$username\" registered'; - } - @override String get searchUsernameNewFollowerTitle => 'Open requests'; - @override - String get chatListViewSearchUserNameBtn => 'Add your first twonly contact!'; - @override String get chatListDetailInput => 'Type a message'; @@ -226,10 +208,6 @@ class AppLocalizationsEn extends AppLocalizations { @override String get settingsStorageDataStoreInGTitle => 'Store in Gallery'; - @override - String get settingsStorageDataStoreInGSubtitle => - 'Store saved images additional in the systems gallery.'; - @override String get settingsStorageDataMediaAutoDownload => 'Media auto-download'; @@ -276,11 +254,11 @@ class AppLocalizationsEn extends AppLocalizations { String get settingsPrivacy => 'Privacy & Security'; @override - String get settingsPrivacyBlockUsers => 'Block users'; + String get settingsPrivacyBlockUsers => 'Block contacts'; @override String get settingsPrivacyBlockUsersDesc => - 'Blocked users will not be able to communicate with you. You can unblock a blocked user at any time.'; + 'Blocked contacts will not be able to communicate with you. You can unblock a blocked contact at any time.'; @override String settingsPrivacyBlockUsersCount(Object len) { @@ -290,10 +268,6 @@ class AppLocalizationsEn extends AppLocalizations { @override String get settingsPrivacyProfileSelectionTitle => 'Security Profile'; - @override - String get settingsPrivacyProfileSelectionDesc => - 'Choose your setup path and security configuration'; - @override String get securityProfileTitle => 'Security Profile'; @@ -455,10 +429,14 @@ class AppLocalizationsEn extends AppLocalizations { 'Your account will be deleted. There is no change to restore it.'; @override - String get contactVerifyNumberTitle => 'Verify contact'; + String get contactVerifyNumberTitle => 'Verify contacts'; @override - String get userVerifiedTitle => 'User verified'; + String get contactVerifyNumberSubtitle => + 'Verify the identity of your contacts to make sure you are texting the right person.'; + + @override + String get userVerifiedTitle => 'Contact verified'; @override String contactVerifiedBy(Object username) { @@ -503,10 +481,10 @@ class AppLocalizationsEn extends AppLocalizations { @override String get contactBlockBody => - 'A blocked user will no longer be able to send you messages and their profile will be hidden from view. To unblock a user, simply navigate to Settings > Privacy > Blocked Users.'; + 'A blocked contact will no longer be able to send you messages and their profile will be hidden from view. To unblock a contact, simply navigate to Settings > Privacy > Blocked Contacts.'; @override - String get contactRemove => 'Remove user'; + String get contactRemove => 'Remove contact'; @override String contactRemoveTitle(Object username) { @@ -515,7 +493,7 @@ class AppLocalizationsEn extends AppLocalizations { @override String get contactRemoveBody => - 'Permanently remove the user. If the user tries to send you a new message, you will have to accept the user again first.'; + 'Permanently remove the contact. If the contact tries to send you a new message, you will have to accept the contact again first.'; @override String get undo => 'Undo'; @@ -904,7 +882,7 @@ class AppLocalizationsEn extends AppLocalizations { String get reportUserReason => 'Reporting reason'; @override - String get reportUser => 'Report user'; + String get reportUser => 'Report contact'; @override String get newDeviceRegistered => @@ -1298,12 +1276,6 @@ class AppLocalizationsEn extends AppLocalizations { @override String get draftMessage => 'Draft'; - @override - String get exportMemories => 'Export memories (Beta)'; - - @override - String get importMemories => 'Import memories (Beta)'; - @override String get voiceMessageSlideToCancel => 'Slide to cancel'; @@ -1547,7 +1519,7 @@ class AppLocalizationsEn extends AppLocalizations { @override String get verificationBadgeGreenDesc => - 'A contact you have *personally* verified.'; + 'A contact you have *personally verified* using the QR code.'; @override String get verificationBadgeYellowDesc => @@ -1557,6 +1529,12 @@ class AppLocalizationsEn extends AppLocalizations { String get verificationBadgeRedDesc => 'A contact whose identity has *not* yet been verified.'; + @override + String get scanNow => 'Scan now'; + + @override + String get openQrCode => 'Open QR code'; + @override String get deleteVerificationTitle => 'Delete verification?'; @@ -1580,17 +1558,6 @@ class AppLocalizationsEn extends AppLocalizations { return '$_temp0'; } - @override - String mutualGroupsSentMessages(num count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: '$count messages sent', - one: '1 message sent', - ); - return '$_temp0'; - } - @override String chatEntryFlameRestored(Object count) { return '$count flames restored'; @@ -1636,9 +1603,6 @@ class AppLocalizationsEn extends AppLocalizations { String get settingsTypingIndicationSubtitle => 'When the typing indicator is turned off, you can\'t see when others are typing a message.'; - @override - String get scanQrOrShow => 'Scan / Show QR'; - @override String get contactActionBlock => 'Block'; @@ -1670,9 +1634,6 @@ class AppLocalizationsEn extends AppLocalizations { @override String get userDiscoverySettingsTitle => 'Mutual Friends'; - @override - String get userDiscoveryWhyThisIsUsed => 'Why this is used'; - @override String get userDiscoveryFeatureOffers => 'Your benefits at a glance'; @@ -1840,9 +1801,6 @@ class AppLocalizationsEn extends AppLocalizations { @override String get back => 'Back'; - @override - String get onboardingExampleLabel => 'Example'; - @override String makerChangedUsername(Object maker, Object oldName, Object newName) { return '$maker changed their username from $oldName to $newName.'; @@ -1942,9 +1900,6 @@ class AppLocalizationsEn extends AppLocalizations { @override String get dragToZoom => 'Drag to Zoom'; - @override - String get showUsername => 'Show username'; - @override String get onboardingProfileSelectionTitle => 'Choose your setup path'; @@ -2079,18 +2034,6 @@ class AppLocalizationsEn extends AppLocalizations { String get importGalleryNoImagesFoundDesc => 'There are no images on your device.'; - @override - String get importGalleryShowAllImages => 'Show all images'; - - @override - String get importGalleryShowTwonlyAlbum => 'Show twonly album'; - - @override - String get importGalleryToggleDescAll => 'Viewing all images on your device.'; - - @override - String get importGalleryToggleDescTwonly => 'Viewing the \"twonly\" album.'; - @override String get importGalleryFilterTwonly => 'Only show the twonly-Album'; diff --git a/lib/src/localization/translations b/lib/src/localization/translations index c95e98ca..673f6d8c 160000 --- a/lib/src/localization/translations +++ b/lib/src/localization/translations @@ -1 +1 @@ -Subproject commit c95e98ca929d630ead028d84e13934b30dbeba3b +Subproject commit 673f6d8c3036d64060b1114912bd5bf5515d5420 diff --git a/lib/src/services/api.service.dart b/lib/src/services/api.service.dart index 65cc226b..2e2bbc61 100644 --- a/lib/src/services/api.service.dart +++ b/lib/src/services/api.service.dart @@ -21,7 +21,8 @@ import 'package:twonly/locator.dart'; import 'package:twonly/src/database/twonly.db.dart'; 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' as server; +import 'package:twonly/src/model/protobuf/api/websocket/server_to_client.pb.dart' + as server; import 'package:twonly/src/model/protobuf/api/websocket/server_to_client.pbserver.dart'; import 'package:twonly/src/services/api/client2client/user_discovery.c2c.dart'; import 'package:twonly/src/services/api/mediafiles/download.api.dart'; @@ -65,13 +66,15 @@ class ApiService { Stream get onPlanUpdated => _planUpdateController.stream; final _connectionStateController = StreamController.broadcast(); - Stream get onConnectionStateUpdated => _connectionStateController.stream; + Stream get onConnectionStateUpdated => + _connectionStateController.stream; final _appOutdatedController = StreamController.broadcast(); Stream get onAppOutdated => _appOutdatedController.stream; final _newDeviceRegisteredController = StreamController.broadcast(); - Stream get onNewDeviceRegistered => _newDeviceRegisteredController.stream; + Stream get onNewDeviceRegistered => + _newDeviceRegisteredController.stream; bool appIsOutdated = false; bool isAuthenticated = false; @@ -80,7 +83,8 @@ class ApiService { Timer? reconnectionTimer; int _reconnectionDelay = 5; - final HashMap> _pendingRequests = HashMap(); + final HashMap> _pendingRequests = + HashMap(); IOWebSocketChannel? _channel; // ignore: cancel_subscriptions StreamSubscription>? _connectivitySubscription; @@ -112,7 +116,7 @@ class ApiService { // Function is called after the user is authenticated at the server Future onAuthenticated() async { - await initFCMAfterAuthenticated(); + await FcmNotificationService.initFCMAfterAuthenticated(); _connectionStateController.add(true); if (AppState.isInBackgroundTask) { @@ -418,7 +422,9 @@ class ApiService { } if (res.error == ErrorCode.UserIdNotFound && contactId != null) { Log.warn('Contact deleted their account $contactId.'); - final contact = await twonlyDB.contactsDao.getContactByUserId(contactId).getSingleOrNull(); + final contact = await twonlyDB.contactsDao + .getContactByUserId(contactId) + .getSingleOrNull(); if (contact != null) { await twonlyDB.contactsDao.updateContact( contactId, @@ -483,7 +489,8 @@ class ApiService { return true; } if (result.isError) { - if (result.error != ErrorCode.AuthTokenNotValid && result.error != ErrorCode.ForegroundSessionConnected) { + if (result.error != ErrorCode.AuthTokenNotValid && + result.error != ErrorCode.ForegroundSessionConnected) { Log.error( 'got error while authenticating to the server: ${result.error}', ); @@ -521,7 +528,8 @@ class ApiService { return true; } if (result.isError) { - if (result.error != ErrorCode.AuthTokenNotValid && result.error != ErrorCode.ForegroundSessionConnected) { + if (result.error != ErrorCode.AuthTokenNotValid && + result.error != ErrorCode.ForegroundSessionConnected) { Log.error( 'got error while authenticating to the server: ${result.error}', ); @@ -553,7 +561,8 @@ class ApiService { return; } - final handshake = Handshake()..getAuthChallenge = Handshake_GetAuthChallenge(); + final handshake = Handshake() + ..getAuthChallenge = Handshake_GetAuthChallenge(); final req = createClientToServerFromHandshake(handshake); final result = await sendRequestSync(req, authenticated: false); @@ -618,7 +627,9 @@ class ApiService { final register = Handshake_Register() ..username = username - ..publicIdentityKey = (await signalStore.getIdentityKeyPair()).getPublicKey().serialize() + ..publicIdentityKey = (await signalStore.getIdentityKeyPair()) + .getPublicKey() + .serialize() ..registrationId = Int64(signalIdentity.registrationId) ..signedPrekey = signedPreKey.getKeyPair().publicKey.serialize() ..signedPrekeySignature = signedPreKey.signature diff --git a/lib/src/services/api/server_messages.api.dart b/lib/src/services/api/server_messages.api.dart index b1833390..a9fc8f1a 100644 --- a/lib/src/services/api/server_messages.api.dart +++ b/lib/src/services/api/server_messages.api.dart @@ -5,6 +5,7 @@ import 'package:clock/clock.dart'; import 'package:drift/drift.dart'; import 'package:hashlib/random.dart'; import 'package:mutex/mutex.dart'; + import 'package:twonly/globals.dart'; import 'package:twonly/locator.dart'; import 'package:twonly/src/database/daos/contacts.dao.dart'; @@ -281,7 +282,7 @@ Future<(EncryptedContent?, PlaintextContent?)> handleEncryptedMessageRaw( Log.info('[$receiptId] Finished handleEncryptedMessage'); if (a == null && b == null) { - unawaited(updateLastServerMessageTimestamp()); + unawaited(FcmNotificationService.updateLastServerMessageTimestamp()); if (Platform.isAndroid) { // Message was handled without any error. Show push notification to the user for Android. await showPushNotificationFromServerMessages( diff --git a/lib/src/services/notifications/fcm.background.dart b/lib/src/services/notifications/fcm.background.dart new file mode 100644 index 00000000..ac058ff8 --- /dev/null +++ b/lib/src/services/notifications/fcm.background.dart @@ -0,0 +1,29 @@ +import 'dart:async'; +import 'dart:io' show Platform; + +import 'package:firebase_messaging/firebase_messaging.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; +import 'package:twonly/globals.dart'; +import 'package:twonly/src/services/background/callback_dispatcher.background.dart'; +import 'package:twonly/src/services/notifications/fcm.notifications.dart'; +import 'package:twonly/src/services/notifications/setup.notifications.dart'; +import 'package:twonly/src/utils/log.dart'; + +@pragma('vm:entry-point') +Future firebaseMessagingBackgroundHandler(RemoteMessage message) async { + SentryWidgetsFlutterBinding.ensureInitialized(); + await AppEnvironment.init(); + final isInitialized = await initBackgroundExecution(); + await setupPushNotification(); + Log.info('Handling a background message: ${message.messageId}'); + await FcmNotificationService.handleRemoteMessage(message); + + if (Platform.isAndroid) { + if (isInitialized) { + await handlePeriodicTask(lastExecutionInSecondsLimit: 10); + } + } else { + // make sure every thing run... + await Future.delayed(const Duration(milliseconds: 2000)); + } +} diff --git a/lib/src/services/notifications/fcm.notifications.dart b/lib/src/services/notifications/fcm.notifications.dart index fce869b5..b0fca4c8 100644 --- a/lib/src/services/notifications/fcm.notifications.dart +++ b/lib/src/services/notifications/fcm.notifications.dart @@ -1,5 +1,3 @@ -// ignore_for_file: unreachable_from_main - import 'dart:async'; import 'dart:io' show Platform; @@ -7,13 +5,11 @@ import 'package:firebase_app_installations/firebase_app_installations.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter_secure_storage/flutter_secure_storage.dart'; -import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:twonly/globals.dart'; import 'package:twonly/locator.dart'; import 'package:twonly/src/constants/secure_storage.keys.dart'; -import 'package:twonly/src/services/background/callback_dispatcher.background.dart'; import 'package:twonly/src/services/notifications/background.notifications.dart'; -import 'package:twonly/src/services/notifications/setup.notifications.dart'; +import 'package:twonly/src/services/notifications/fcm.background.dart'; import 'package:twonly/src/services/user.service.dart'; import 'package:twonly/src/utils/log.dart'; @@ -21,240 +17,253 @@ import '../../../firebase_options.dart'; // see more here: https://firebase.google.com/docs/cloud-messaging/flutter/receive?hl=de -Future checkForTokenUpdates() async { - try { - if (!userService.isUserCreated) return; - if (Platform.isIOS) { - var apnsToken = await FirebaseMessaging.instance.getAPNSToken(); - for (var i = 0; i < 20; i++) { - if (apnsToken != null) break; - await Future.delayed(const Duration(seconds: 1)); - apnsToken = await FirebaseMessaging.instance.getAPNSToken(); - } - if (apnsToken == null) { - Log.error('Could not get APNS token even after 20s...'); +class FcmNotificationService { + static Future initStartup() async { + await Firebase.initializeApp( + options: DefaultFirebaseOptions.currentPlatform, + ); + + FirebaseMessaging.onBackgroundMessage(firebaseMessagingBackgroundHandler); + + FirebaseMessaging.onMessage.listen(handleRemoteMessage); + } + + static Future initAfterUserLoaded() async { + unawaited(_checkForTokenUpdates()); + unawaited(_checkFcmHealthAndResetIfNeeded()); + } + + static Future initFCMAfterAuthenticated({bool force = false}) async { + final fcmToken = userService.currentUser.fcmToken; + if (userService.currentUser.updateFCMToken || force) { + if (fcmToken == null) { + Log.error('FCM token could not be updated as it is empty'); + await _checkForTokenUpdates(); return; } - } - - final fcmToken = await FirebaseMessaging.instance.getToken(); - if (fcmToken == null) { - Log.error('Could not get fcm token'); - return; - } - - Log.info('Loaded FCM token.'); - - if (userService.currentUser.fcmToken == null || - fcmToken != userService.currentUser.fcmToken) { - Log.info('Got new FCM token.'); - await UserService.update((u) { - u - ..updateFCMToken = true - ..fcmToken = fcmToken; - }); - } - - FirebaseMessaging.instance.onTokenRefresh - .listen((fcmToken) async { - await UserService.update((u) { - u - ..updateFCMToken = true - ..fcmToken = fcmToken; - }); - }) - .onError((err) { - Log.error('could not listen on token refresh'); + final res = await apiService.updateFCMToken( + fcmToken, + ); + if (res.isSuccess) { + Log.info('Uploaded new FCM token!'); + await UserService.update((u) { + u.updateFCMToken = false; }); - } catch (e) { - Log.error('could not load fcm token: $e'); + } else { + Log.error('Could not update FCM token!'); + } + } } -} -Future initFCMAfterAuthenticated({bool force = false}) async { - final fcmToken = userService.currentUser.fcmToken; - if (userService.currentUser.updateFCMToken || force) { - if (fcmToken == null) { - Log.error('FCM token could not be updated as it is empty'); - await checkForTokenUpdates(); + static Future resetFCMTokens() async { + await FirebaseInstallations.instance.delete(); + Log.info('Firebase Installation successfully deleted.'); + await FirebaseMessaging.instance.deleteToken(); + Log.info('Old FCM deleted.'); + await UserService.update((u) => u.fcmToken = null); + await _checkForTokenUpdates(); + await initFCMAfterAuthenticated(force: true); + } + + static Future _checkForTokenUpdates() async { + try { + if (!userService.isUserCreated) { + Log.info( + 'Checking for FCM token updates skipped: user is not yet created.', + ); + return; + } + if (Platform.isIOS) { + var apnsToken = await FirebaseMessaging.instance.getAPNSToken(); + for (var i = 0; i < 20; i++) { + if (apnsToken != null) break; + await Future.delayed(const Duration(seconds: 1)); + apnsToken = await FirebaseMessaging.instance.getAPNSToken(); + } + if (apnsToken == null) { + Log.error('Could not get APNS token even after 20s...'); + return; + } + } + + final fcmToken = await FirebaseMessaging.instance.getToken(); + if (fcmToken == null) { + Log.error('Could not get fcm token'); + return; + } + + Log.info('Loaded FCM token.'); + + if (userService.currentUser.fcmToken == null || + fcmToken != userService.currentUser.fcmToken) { + Log.info('Got new FCM token.'); + await UserService.update((u) { + u + ..updateFCMToken = true + ..fcmToken = fcmToken; + }); + if (apiService.isAuthenticated) { + final res = await apiService.updateFCMToken(fcmToken); + if (res.isSuccess) { + Log.info('Uploaded new FCM token!'); + await UserService.update((u) { + u.updateFCMToken = false; + }); + } else { + Log.error('Could not update FCM token!'); + } + } + } + + FirebaseMessaging.instance.onTokenRefresh + // ignore: avoid_types_on_closure_parameters + .listen((String fcmToken) async { + await UserService.update((u) { + u + ..updateFCMToken = true + ..fcmToken = fcmToken; + }); + if (apiService.isAuthenticated) { + final res = await apiService.updateFCMToken(fcmToken); + if (res.isSuccess) { + Log.info('Uploaded new FCM token!'); + await UserService.update((u) { + u.updateFCMToken = false; + }); + } else { + Log.error('Could not update FCM token!'); + } + } + }) + .onError((err) { + Log.error('could not listen on token refresh'); + }); + } catch (e) { + Log.error('could not load fcm token: $e'); + } + } + + static Future handleRemoteMessage(RemoteMessage message) async { + await _updateLastFcmMessageTimestamp(); + if (!Platform.isAndroid) { + Log.error('Got message in Dart while on iOS'); + } + if (message.notification != null && AppState.isAppInBackground) { + Log.error( + 'Got notification but app is in background, so the SDK already have shown the message.', + ); return; } - final res = await apiService.updateFCMToken( - fcmToken, - ); - if (res.isSuccess) { - Log.info('Uploaded new FCM token!'); - await UserService.update((u) { - u.updateFCMToken = false; - }); - } else { - Log.error('Could not update FCM token!'); + + if (message.notification != null || message.data['title'] != null) { + final title = + message.notification?.title ?? message.data['title'] as String? ?? ''; + final body = + message.notification?.body ?? message.data['body'] as String? ?? ''; + await customLocalPushNotification(title, body); } } -} -Future resetFCMTokens() async { - await FirebaseInstallations.instance.delete(); - Log.info('Firebase Installation successfully deleted.'); - await FirebaseMessaging.instance.deleteToken(); - Log.info('Old FCM deleted.'); - await UserService.update((u) => u.fcmToken = null); - await checkForTokenUpdates(); - await initFCMAfterAuthenticated(force: true); -} - -Future initFCMService() async { - await Firebase.initializeApp( - options: DefaultFirebaseOptions.currentPlatform, - ); - - unawaited(checkForTokenUpdates()); - unawaited(checkFcmHealthAndResetIfNeeded()); - - FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler); - - FirebaseMessaging.onMessage.listen(handleRemoteMessage); -} - -@pragma('vm:entry-point') -Future _firebaseMessagingBackgroundHandler(RemoteMessage message) async { - SentryWidgetsFlutterBinding.ensureInitialized(); - await AppEnvironment.init(); - final isInitialized = await initBackgroundExecution(); - await setupPushNotification(); - Log.info('Handling a background message: ${message.messageId}'); - await handleRemoteMessage(message); - - if (Platform.isAndroid) { - if (isInitialized) { - await handlePeriodicTask(lastExecutionInSecondsLimit: 10); + static Future _updateLastFcmMessageTimestamp() async { + const storage = FlutterSecureStorage(); + final nowMs = DateTime.now().millisecondsSinceEpoch.toString(); + try { + await storage.write( + key: SecureStorageKeys.lastFcmMessageTimestamp, + value: nowMs, + iOptions: const IOSOptions( + groupId: 'CN332ZUGRP.eu.twonly.shared', + accessibility: KeychainAccessibility.first_unlock, + ), + ); + Log.info('Updated last FCM message timestamp to $nowMs'); + } catch (e) { + Log.error('Could not write last FCM message timestamp: $e'); } - } else { - // make sure every thing run... - await Future.delayed(const Duration(milliseconds: 2000)); - } -} - -Future handleRemoteMessage(RemoteMessage message) async { - await updateLastFcmMessageTimestamp(); - if (!Platform.isAndroid) { - Log.error('Got message in Dart while on iOS'); - } - if (message.notification != null && AppState.isAppInBackground) { - Log.error( - 'Got notification but app is in background, so the SDK already have shown the message.', - ); - return; } - if (message.notification != null || message.data['title'] != null) { - final title = - message.notification?.title ?? message.data['title'] as String? ?? ''; - final body = - message.notification?.body ?? message.data['body'] as String? ?? ''; - await customLocalPushNotification(title, body); + static Future updateLastServerMessageTimestamp() async { + const storage = FlutterSecureStorage(); + final nowMs = DateTime.now().millisecondsSinceEpoch.toString(); + try { + await storage.write( + key: SecureStorageKeys.lastServerMessageTimestamp, + value: nowMs, + iOptions: const IOSOptions( + groupId: 'CN332ZUGRP.eu.twonly.shared', + accessibility: KeychainAccessibility.first_unlock, + ), + ); + Log.info('Updated last server message timestamp to $nowMs'); + } catch (e) { + Log.error('Could not write last server message timestamp: $e'); + } } - // On Android the push notification is now shown in the server_message.dart. This ensures - // that the messages was successfully decrypted before showing the push notification - // else if (message.data['push_data'] != null) { - // await handlePushData(message.data['push_data'] as String); - // } -} + static Future _checkFcmHealthAndResetIfNeeded() async { + if (!userService.isUserCreated) { + Log.info('FCM health check skipped: user is not yet created.'); + return; + } + const storage = FlutterSecureStorage(); + try { + final lastFcmStr = await storage.read( + key: SecureStorageKeys.lastFcmMessageTimestamp, + iOptions: const IOSOptions( + groupId: 'CN332ZUGRP.eu.twonly.shared', + accessibility: KeychainAccessibility.first_unlock, + ), + ); + final lastServerStr = await storage.read( + key: SecureStorageKeys.lastServerMessageTimestamp, + iOptions: const IOSOptions( + groupId: 'CN332ZUGRP.eu.twonly.shared', + accessibility: KeychainAccessibility.first_unlock, + ), + ); -Future updateLastFcmMessageTimestamp() async { - const storage = FlutterSecureStorage(); - final nowMs = DateTime.now().millisecondsSinceEpoch.toString(); - try { - await storage.write( - key: SecureStorageKeys.lastFcmMessageTimestamp, - value: nowMs, - iOptions: const IOSOptions( - groupId: 'CN332ZUGRP.eu.twonly.shared', - accessibility: KeychainAccessibility.first_unlock, - ), - ); - Log.info('Updated last FCM message timestamp to $nowMs'); - } catch (e) { - Log.error('Could not write last FCM message timestamp: $e'); - } -} + final now = DateTime.now(); + final threeDaysAgo = now.subtract(const Duration(days: 3)); -Future updateLastServerMessageTimestamp() async { - const storage = FlutterSecureStorage(); - final nowMs = DateTime.now().millisecondsSinceEpoch.toString(); - try { - await storage.write( - key: SecureStorageKeys.lastServerMessageTimestamp, - value: nowMs, - iOptions: const IOSOptions( - groupId: 'CN332ZUGRP.eu.twonly.shared', - accessibility: KeychainAccessibility.first_unlock, - ), - ); - Log.info('Updated last server message timestamp to $nowMs'); - } catch (e) { - Log.error('Could not write last server message timestamp: $e'); - } -} - -Future checkFcmHealthAndResetIfNeeded() async { - if (!userService.isUserCreated) return; - const storage = FlutterSecureStorage(); - try { - final lastFcmStr = await storage.read( - key: SecureStorageKeys.lastFcmMessageTimestamp, - iOptions: const IOSOptions( - groupId: 'CN332ZUGRP.eu.twonly.shared', - accessibility: KeychainAccessibility.first_unlock, - ), - ); - final lastServerStr = await storage.read( - key: SecureStorageKeys.lastServerMessageTimestamp, - iOptions: const IOSOptions( - groupId: 'CN332ZUGRP.eu.twonly.shared', - accessibility: KeychainAccessibility.first_unlock, - ), - ); - - final now = DateTime.now(); - final threeDaysAgo = now.subtract(const Duration(days: 3)); - - DateTime? lastFcmTime; - if (lastFcmStr != null) { - final ms = int.tryParse(lastFcmStr); - if (ms != null) { - lastFcmTime = DateTime.fromMillisecondsSinceEpoch(ms); + DateTime? lastFcmTime; + if (lastFcmStr != null) { + final ms = int.tryParse(lastFcmStr); + if (ms != null) { + lastFcmTime = DateTime.fromMillisecondsSinceEpoch(ms); + } } - } - if (lastFcmTime != null) { - Log.info('Last message received via FCM messaging system: $lastFcmTime'); - } else { - Log.info('No record of a message received via FCM messaging system.'); - } - - DateTime? lastServerTime; - if (lastServerStr != null) { - final ms = int.tryParse(lastServerStr); - if (ms != null) { - lastServerTime = DateTime.fromMillisecondsSinceEpoch(ms); + if (lastFcmTime != null) { + Log.info( + 'Last message received via FCM messaging system: $lastFcmTime', + ); + } else { + Log.info('No record of a message received via FCM messaging system.'); } - } - // Check conditions: - // 1. No messages received via FCM in the last 3 days (either null or older than 3 days) - final fcmInactive = lastFcmTime == null || lastFcmTime.isBefore(threeDaysAgo); - // 2. Server message received within the last 3 days - final serverActive = lastServerTime != null && lastServerTime.isAfter(threeDaysAgo); + DateTime? lastServerTime; + if (lastServerStr != null) { + final ms = int.tryParse(lastServerStr); + if (ms != null) { + lastServerTime = DateTime.fromMillisecondsSinceEpoch(ms); + } + } - if (fcmInactive && serverActive) { - Log.warn('FCM has been inactive for >3 days, but server messages have been active. Resetting FCM tokens...'); - await resetFCMTokens(); - } else { - Log.info('FCM check passed. No reset needed.'); + final fcmInactive = + lastFcmTime == null || lastFcmTime.isBefore(threeDaysAgo); + final serverActive = + lastServerTime != null && lastServerTime.isAfter(threeDaysAgo); + + if (fcmInactive && serverActive) { + Log.warn( + 'FCM has been inactive for >3 days, but server messages have been active. Resetting FCM tokens...', + ); + await resetFCMTokens(); + } else { + Log.info('FCM check passed. No reset needed.'); + } + } catch (e) { + Log.error('Error during FCM health check: $e'); } - } catch (e) { - Log.error('Error during FCM health check: $e'); } } diff --git a/lib/src/visual/components/verification_badge_info.comp.dart b/lib/src/visual/components/verification_badge_info.comp.dart index 60bfaa07..28b40b85 100644 --- a/lib/src/visual/components/verification_badge_info.comp.dart +++ b/lib/src/visual/components/verification_badge_info.comp.dart @@ -1,14 +1,23 @@ import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart' + show FaIcon, FontAwesomeIcons; +import 'package:go_router/go_router.dart'; import 'package:twonly/locator.dart'; +import 'package:twonly/src/constants/routes.keys.dart'; import 'package:twonly/src/services/profile.service.dart'; import 'package:twonly/src/utils/misc.dart'; +import 'package:twonly/src/visual/elements/my_button.element.dart'; import 'package:twonly/src/visual/elements/svg_icon.element.dart'; import 'package:twonly/src/visual/themes/light.dart'; const colorVerificationBadgeYellow = Color.fromARGB(255, 0, 182, 238); class VerificationBadgeInfo extends StatelessWidget { - const VerificationBadgeInfo({super.key}); + const VerificationBadgeInfo({ + this.displayButtons = false, + super.key, + }); + final bool displayButtons; @override Widget build(BuildContext context) { @@ -24,7 +33,44 @@ class VerificationBadgeInfo extends StatelessWidget { icon: const SvgIcon(assetPath: SvgIcons.verifiedGreen, size: 40), description: context.lang.verificationBadgeGreenDesc, boldTextColor: primaryColor, + onTap: () => context.push(Routes.cameraQRScanner), ), + if (displayButtons) + Padding( + padding: const EdgeInsets.only(bottom: 20), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + IntrinsicWidth( + child: MyButton( + variant: MyButtonVariant.primaryDense, + onPressed: () => context.push(Routes.cameraQRScanner), + child: Row( + children: [ + const FaIcon(FontAwesomeIcons.camera), + const SizedBox(width: 6), + Text(context.lang.scanNow), + ], + ), + ), + ), + const SizedBox(width: 8), + IntrinsicWidth( + child: MyButton( + variant: MyButtonVariant.primaryDense, + onPressed: () => context.push(Routes.settingsPublicProfile), + child: Row( + children: [ + const FaIcon(FontAwesomeIcons.qrcode), + const SizedBox(width: 6), + Text(context.lang.openQrCode), + ], + ), + ), + ), + ], + ), + ), if (userService.currentUser.securityProfile != SecurityProfile.strict || userService.currentUser.isUserDiscoveryEnabled) _buildItem( @@ -52,8 +98,9 @@ class VerificationBadgeInfo extends StatelessWidget { required Widget icon, required String description, required Color boldTextColor, + VoidCallback? onTap, }) { - return Padding( + final item = Padding( padding: const EdgeInsets.symmetric(vertical: 25), child: Row( children: [ @@ -74,5 +121,14 @@ class VerificationBadgeInfo extends StatelessWidget { ], ), ); + + if (onTap != null) { + return GestureDetector( + behavior: HitTestBehavior.translucent, + onTap: onTap, + child: item, + ); + } + return item; } } diff --git a/lib/src/visual/views/camera/share_image_editor_components/layers/text.layer.dart b/lib/src/visual/views/camera/share_image_editor_components/layers/text.layer.dart index 8b93bc99..6c2ea0ff 100755 --- a/lib/src/visual/views/camera/share_image_editor_components/layers/text.layer.dart +++ b/lib/src/visual/views/camera/share_image_editor_components/layers/text.layer.dart @@ -118,6 +118,7 @@ class _TextViewState extends State { child: TextField( controller: textController, autofocus: true, + textCapitalization: TextCapitalization.sentences, maxLines: null, minLines: 1, onEditingComplete: onEditionComplete, diff --git a/lib/src/visual/views/chats/chat_messages_components/message_context_menu.dart b/lib/src/visual/views/chats/chat_messages_components/message_context_menu.dart index 3f9afecf..829d405c 100644 --- a/lib/src/visual/views/chats/chat_messages_components/message_context_menu.dart +++ b/lib/src/visual/views/chats/chat_messages_components/message_context_menu.dart @@ -248,6 +248,7 @@ Future editTextMessage(BuildContext context, Message message) async { child: TextField( controller: controller, autofocus: true, + textCapitalization: TextCapitalization.sentences, keyboardType: TextInputType.multiline, maxLines: 4, minLines: 1, diff --git a/lib/src/visual/views/chats/chat_messages_components/message_input.dart b/lib/src/visual/views/chats/chat_messages_components/message_input.dart index 6c543f0f..01c879e3 100644 --- a/lib/src/visual/views/chats/chat_messages_components/message_input.dart +++ b/lib/src/visual/views/chats/chat_messages_components/message_input.dart @@ -293,6 +293,7 @@ class _MessageInputState extends State { TextField( controller: _textFieldController, focusNode: widget.textFieldFocus, + textCapitalization: TextCapitalization.sentences, keyboardType: TextInputType.multiline, showCursor: _recordingState != RecordingState.recording, diff --git a/lib/src/visual/views/chats/chat_messages_components/response_container.dart b/lib/src/visual/views/chats/chat_messages_components/response_container.dart index 771cb931..6d4d08ad 100644 --- a/lib/src/visual/views/chats/chat_messages_components/response_container.dart +++ b/lib/src/visual/views/chats/chat_messages_components/response_container.dart @@ -69,11 +69,10 @@ class ResponseContainer extends StatelessWidget { messageId: msg.quotesMessageId, showBorder: false, showLeftBorder: false, - colorUsername: false, ), ), ), - if (child != null) child!, + ?child, ], ), ), @@ -263,7 +262,7 @@ class _ResponsePreviewState extends State { ], ), ), - if (imageWidget != null) imageWidget, + ?imageWidget, ], ), ); diff --git a/lib/src/visual/views/chats/media_viewer.view.dart b/lib/src/visual/views/chats/media_viewer.view.dart index e1c16156..02c10e4e 100644 --- a/lib/src/visual/views/chats/media_viewer.view.dart +++ b/lib/src/visual/views/chats/media_viewer.view.dart @@ -833,6 +833,7 @@ class _MediaViewerViewState extends State { child: TextField( autofocus: true, controller: textMessageController, + textCapitalization: TextCapitalization.sentences, onChanged: (value) async { await twonlyDB.groupsDao.updateGroup( widget.group.groupId, diff --git a/lib/src/visual/views/contact/contact.view.dart b/lib/src/visual/views/contact/contact.view.dart index aa0343c2..cc37b15d 100644 --- a/lib/src/visual/views/contact/contact.view.dart +++ b/lib/src/visual/views/contact/contact.view.dart @@ -278,6 +278,7 @@ Future showNicknameChangeDialog( content: TextField( controller: controller, autofocus: true, + textCapitalization: TextCapitalization.words, decoration: InputDecoration( hintText: context.lang.contactNicknameNew, ), @@ -319,6 +320,7 @@ Future showReportDialog( content: TextField( controller: controller, autofocus: true, + textCapitalization: TextCapitalization.sentences, decoration: InputDecoration(hintText: context.lang.reportUserReason), ), actions: [ diff --git a/lib/src/visual/views/groups/group.view.dart b/lib/src/visual/views/groups/group.view.dart index 8aef9679..f12f6aaf 100644 --- a/lib/src/visual/views/groups/group.view.dart +++ b/lib/src/visual/views/groups/group.view.dart @@ -322,6 +322,7 @@ Future showGroupNameChangeDialog( content: TextField( controller: controller, autofocus: true, + textCapitalization: TextCapitalization.words, decoration: InputDecoration(hintText: context.lang.groupNameInput), ), actions: [ diff --git a/lib/src/visual/views/home.view.dart b/lib/src/visual/views/home.view.dart index 791106e2..058a58c5 100644 --- a/lib/src/visual/views/home.view.dart +++ b/lib/src/visual/views/home.view.dart @@ -32,7 +32,7 @@ class HomeView extends StatefulWidget { State createState() => HomeViewState(); } -class HomeViewState extends State { +class HomeViewState extends State with WidgetsBindingObserver { int _activePageIdx = 1; double _offsetRatio = 0; double _offsetFromOne = 0; @@ -53,6 +53,7 @@ class HomeViewState extends State { @override void initState() { super.initState(); + WidgetsBinding.instance.addObserver(this); var initialPage = widget.initialPage; if (initialPage == 1 && !userService.currentUser.startWithCameraOpen) { initialPage = 0; @@ -78,7 +79,9 @@ class HomeViewState extends State { _selectNotificationSub = selectNotificationStream.stream.listen(( response, ) async { - if (response.payload != null && response.payload!.startsWith(Routes.chats) && response.payload! != Routes.chats) { + if (response.payload != null && + response.payload!.startsWith(Routes.chats) && + response.payload! != Routes.chats) { await routerProvider.push(response.payload!); } streamHomeViewPageIndex.add(0); @@ -92,7 +95,11 @@ class HomeViewState extends State { }); if (initialPage == 1) { - unawaited(_mainCameraController.selectCamera(0, true)); + WidgetsBinding.instance.addPostFrameCallback((_) { + if (_isViewActive()) { + unawaited(_mainCameraController.selectCamera(0, true)); + } + }); } unawaited(_initAsync()); @@ -114,31 +121,40 @@ class HomeViewState extends State { ); WidgetsBinding.instance.addPostFrameCallback((_) { - if (widget.initialPage == 1 && !userService.currentUser.startWithCameraOpen || widget.initialPage == 0) { + if (widget.initialPage == 1 && + !userService.currentUser.startWithCameraOpen || + widget.initialPage == 0) { streamHomeViewPageIndex.add(0); } }); } Future _initAsync() async { - final notificationAppLaunchDetails = await flutterLocalNotificationsPlugin.getNotificationAppLaunchDetails(); + final notificationAppLaunchDetails = await flutterLocalNotificationsPlugin + .getNotificationAppLaunchDetails(); RemoteMessage? initialRemoteMessage; try { - initialRemoteMessage = await FirebaseMessaging.instance.getInitialMessage(); + initialRemoteMessage = await FirebaseMessaging.instance + .getInitialMessage(); } catch (e) { Log.error('Could not get initial Firebase message: $e'); } if (widget.initialPage == 0 || initialRemoteMessage != null || - (notificationAppLaunchDetails != null && notificationAppLaunchDetails.didNotificationLaunchApp)) { + (notificationAppLaunchDetails != null && + notificationAppLaunchDetails.didNotificationLaunchApp)) { if (initialRemoteMessage != null) { Log.info('App launched from iOS/Remote push notification tap.'); streamHomeViewPageIndex.add(0); - } else if (notificationAppLaunchDetails?.didNotificationLaunchApp ?? false) { - final payload = notificationAppLaunchDetails?.notificationResponse?.payload; - if (payload != null && payload.startsWith(Routes.chats) && payload != Routes.chats) { + } else if (notificationAppLaunchDetails?.didNotificationLaunchApp ?? + false) { + final payload = + notificationAppLaunchDetails?.notificationResponse?.payload; + if (payload != null && + payload.startsWith(Routes.chats) && + payload != Routes.chats) { await routerProvider.push(payload); streamHomeViewPageIndex.add(0); } @@ -165,6 +181,7 @@ class HomeViewState extends State { @override void dispose() { + WidgetsBinding.instance.removeObserver(this); _onMessageOpenedAppSub?.cancel(); _homeViewPageIndexSub?.cancel(); _selectNotificationSub?.cancel(); @@ -176,11 +193,38 @@ class HomeViewState extends State { super.dispose(); } + bool _isViewActive() { + if (!mounted) return false; + return ModalRoute.of(context)?.isCurrent ?? false; + } + + @override + void didChangeAppLifecycleState(AppLifecycleState state) { + super.didChangeAppLifecycleState(state); + if (state == AppLifecycleState.resumed) { + if (_offsetRatio < 1 && + !_mainCameraController.isSharePreviewIsShown && + _isViewActive()) { + unawaited( + _mainCameraController.selectCamera( + _mainCameraController.selectedCameraDetails.cameraId, + false, + ), + ); + } + } else if (state == AppLifecycleState.inactive || + state == AppLifecycleState.paused) { + unawaited(_mainCameraController.closeCamera()); + } + } + bool _onPageView(ScrollNotification notification) { _disableCameraTimer?.cancel(); if (notification.depth > 0 && notification.metrics.axis == Axis.vertical) { - final canScroll = notification.metrics.maxScrollExtent > notification.metrics.minScrollExtent; + final canScroll = + notification.metrics.maxScrollExtent > + notification.metrics.minScrollExtent; if (!canScroll) { if (!_isBottomNavVisible) { setState(() { @@ -188,13 +232,17 @@ class HomeViewState extends State { }); } } else { - if (_activePageIdx == 2 && notification.metrics.pixels < 100 && !_isBottomNavVisible) { + if (_activePageIdx == 2 && + notification.metrics.pixels < 100 && + !_isBottomNavVisible) { setState(() { _isBottomNavVisible = true; }); } else if (notification is ScrollUpdateNotification) { final delta = notification.scrollDelta ?? 0; - if (delta > 5 && _isBottomNavVisible && (_activePageIdx != 2 || notification.metrics.pixels >= 100)) { + if (delta > 5 && + _isBottomNavVisible && + (_activePageIdx != 2 || notification.metrics.pixels >= 100)) { setState(() { _isBottomNavVisible = false; }); @@ -216,7 +264,8 @@ class HomeViewState extends State { if (_mainCameraController.cameraController == null && !_mainCameraController.initCameraStarted && - _offsetRatio < 1) { + _offsetRatio < 1 && + _isViewActive()) { unawaited( _mainCameraController.selectCamera( _mainCameraController.selectedCameraDetails.cameraId, @@ -281,12 +330,15 @@ class HomeViewState extends State { left: 0, top: 0, right: 0, - bottom: (_offsetRatio > 0.25) ? MediaQuery.sizeOf(context).height * 2 : 0, + bottom: (_offsetRatio > 0.25) + ? MediaQuery.sizeOf(context).height * 2 + : 0, child: Opacity( opacity: 1 - (_offsetRatio * 4) % 1, child: CameraPreviewControllerView( mainController: _mainCameraController, - isVisible: ((1 - (_offsetRatio * 4) % 1) == 1) && _activePageIdx == 1, + isVisible: + ((1 - (_offsetRatio * 4) % 1) == 1) && _activePageIdx == 1, ), ), ), diff --git a/lib/src/visual/views/onboarding/register.view.dart b/lib/src/visual/views/onboarding/register.view.dart index fde5a191..e3a4dd59 100644 --- a/lib/src/visual/views/onboarding/register.view.dart +++ b/lib/src/visual/views/onboarding/register.view.dart @@ -10,6 +10,7 @@ import 'package:twonly/locator.dart'; import 'package:twonly/src/constants/routes.keys.dart'; import 'package:twonly/src/model/json/userdata.model.dart'; import 'package:twonly/src/model/protobuf/api/websocket/error.pb.dart'; +import 'package:twonly/src/services/notifications/fcm.notifications.dart'; import 'package:twonly/src/services/signal/identity.signal.dart'; import 'package:twonly/src/services/user.service.dart'; import 'package:twonly/src/utils/log.dart'; @@ -163,6 +164,8 @@ class _RegisterViewState extends State { await UserService.save(userData); + unawaited(FcmNotificationService.initAfterUserLoaded()); + await apiService.authenticate(); widget.callbackOnSuccess(); } catch (e, stack) { diff --git a/lib/src/visual/views/onboarding/setup.view.dart b/lib/src/visual/views/onboarding/setup.view.dart index 1021eec7..57f4704e 100644 --- a/lib/src/visual/views/onboarding/setup.view.dart +++ b/lib/src/visual/views/onboarding/setup.view.dart @@ -18,9 +18,9 @@ import 'package:twonly/src/visual/views/settings/privacy/user_discovery/componen enum SetupPages { profile, backup, + verificationBadge, profileSelection, securityProfile, - verificationBadge, shareYourFriends, letYourFriendsFindYou, } @@ -40,22 +40,23 @@ extension SetupPagesExtension on SetupPages { return [ SetupPages.profile, SetupPages.backup, + SetupPages.verificationBadge, SetupPages.profileSelection, ]; case SetupProfile.maximum: return [ SetupPages.profile, SetupPages.backup, - SetupPages.profileSelection, SetupPages.verificationBadge, + SetupPages.profileSelection, ]; case SetupProfile.customized: return [ SetupPages.profile, SetupPages.backup, + SetupPages.verificationBadge, SetupPages.profileSelection, SetupPages.securityProfile, - SetupPages.verificationBadge, SetupPages.shareYourFriends, SetupPages.letYourFriendsFindYou, ]; diff --git a/lib/src/visual/views/settings/help/contact_us.view.dart b/lib/src/visual/views/settings/help/contact_us.view.dart index 1727c4da..31e7a6a2 100644 --- a/lib/src/visual/views/settings/help/contact_us.view.dart +++ b/lib/src/visual/views/settings/help/contact_us.view.dart @@ -193,6 +193,7 @@ $debugLogToken const SizedBox(height: 5), TextField( controller: _controller, + textCapitalization: TextCapitalization.sentences, decoration: InputDecoration( hintText: context.lang.contactUsYourMessage, border: const OutlineInputBorder(), diff --git a/lib/src/visual/views/settings/help/contact_us/submit_message.view.dart b/lib/src/visual/views/settings/help/contact_us/submit_message.view.dart index 3846c486..5df1440d 100644 --- a/lib/src/visual/views/settings/help/contact_us/submit_message.view.dart +++ b/lib/src/visual/views/settings/help/contact_us/submit_message.view.dart @@ -86,6 +86,7 @@ class _ContactUsState extends State { const SizedBox(height: 10), TextField( controller: _controller, + textCapitalization: TextCapitalization.sentences, decoration: InputDecoration( hintText: context.lang.contactUsYourMessage, border: const OutlineInputBorder(), diff --git a/lib/src/visual/views/settings/help/faq/verification_badge_faq.view.dart b/lib/src/visual/views/settings/help/faq/verification_badge_faq.view.dart index 809e1310..c5010cc3 100644 --- a/lib/src/visual/views/settings/help/faq/verification_badge_faq.view.dart +++ b/lib/src/visual/views/settings/help/faq/verification_badge_faq.view.dart @@ -1,10 +1,6 @@ import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:go_router/go_router.dart'; -import 'package:twonly/src/constants/routes.keys.dart'; import 'package:twonly/src/utils/misc.dart'; import 'package:twonly/src/visual/components/verification_badge_info.comp.dart'; -import 'package:twonly/src/visual/elements/better_list_title.element.dart'; class VerificationBadeFaqView extends StatefulWidget { const VerificationBadeFaqView({super.key}); @@ -23,18 +19,9 @@ class _VerificationBadeFaqViewState extends State { ), body: ListView( padding: const EdgeInsets.all(40), - children: [ - const VerificationBadgeInfo(), - const SizedBox(height: 20), - BetterListTile( - leading: const FaIcon(FontAwesomeIcons.camera), - text: context.lang.scanOtherProfile, - onTap: () => context.push(Routes.cameraQRScanner), - ), - BetterListTile( - leading: const FaIcon(FontAwesomeIcons.qrcode), - text: context.lang.openYourOwnQRcode, - onTap: () => context.push(Routes.settingsPublicProfile), + children: const [ + VerificationBadgeInfo( + displayButtons: true, ), ], ), diff --git a/lib/src/visual/views/settings/notification.view.dart b/lib/src/visual/views/settings/notification.view.dart index c8e3696e..cb81a962 100644 --- a/lib/src/visual/views/settings/notification.view.dart +++ b/lib/src/visual/views/settings/notification.view.dart @@ -45,7 +45,7 @@ class _NotificationViewState extends State { _isLoadingTroubleshooting = true; }); - await initFCMAfterAuthenticated(force: true); + await FcmNotificationService.initFCMAfterAuthenticated(force: true); await setupNotificationWithUsers(force: true); @@ -90,7 +90,7 @@ class _NotificationViewState extends State { setState(() { _isLoadingReset = true; }); - await resetFCMTokens(); + await FcmNotificationService.resetFCMTokens(); if (!mounted) return; await showAlertDialog( context, diff --git a/lib/src/visual/views/settings/privacy.view.dart b/lib/src/visual/views/settings/privacy.view.dart index 5040d160..5bca8461 100644 --- a/lib/src/visual/views/settings/privacy.view.dart +++ b/lib/src/visual/views/settings/privacy.view.dart @@ -67,8 +67,9 @@ class _PrivacyViewState extends State { ), ListTile( title: Text(context.lang.contactVerifyNumberTitle), + subtitle: Text(context.lang.contactVerifyNumberSubtitle), onTap: () async { - await context.push(Routes.settingsPublicProfile); + await context.push(Routes.settingsHelpFaqVerifyBadge); setState(() {}); }, ), diff --git a/lib/src/visual/views/settings/profile/profile.view.dart b/lib/src/visual/views/settings/profile/profile.view.dart index 1a422491..34f80400 100644 --- a/lib/src/visual/views/settings/profile/profile.view.dart +++ b/lib/src/visual/views/settings/profile/profile.view.dart @@ -176,6 +176,7 @@ class _ProfileViewState extends State { context.lang.settingsProfileEditDisplayName, context.lang.settingsProfileEditDisplayNameNew, maxLength: 30, + textCapitalization: TextCapitalization.words, ); if (context.mounted && displayName != null && @@ -210,6 +211,7 @@ Future showDisplayNameChangeDialog( String hintText, { List? inputFormatters, int? maxLength, + TextCapitalization textCapitalization = TextCapitalization.none, }) { final controller = TextEditingController(text: currentName); @@ -223,6 +225,7 @@ Future showDisplayNameChangeDialog( autofocus: true, inputFormatters: inputFormatters, maxLength: maxLength, + textCapitalization: textCapitalization, decoration: InputDecoration( hintText: hintText, ), diff --git a/lib/src/visual/views/user_study/user_study_questionnaire.view.dart b/lib/src/visual/views/user_study/user_study_questionnaire.view.dart index 997c328a..53dae0ee 100644 --- a/lib/src/visual/views/user_study/user_study_questionnaire.view.dart +++ b/lib/src/visual/views/user_study/user_study_questionnaire.view.dart @@ -256,6 +256,7 @@ class _UserStudyQuestionnaireViewState Widget _buildTextField(String hint, void Function(String) onChanged) { return TextField( + textCapitalization: TextCapitalization.sentences, decoration: InputDecoration( hintText: hint, border: const OutlineInputBorder(), diff --git a/pubspec.yaml b/pubspec.yaml index 12dbfffc..ee76bcac 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: "twonly, a privacy-friendly way to connect with friends through sec publish_to: 'none' -version: 0.2.29+138 +version: 0.3.0+139 environment: sdk: ^3.11.0 diff --git a/rust/Cargo.lock b/rust/Cargo.lock index bbf942dc..a5fe4cdf 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -391,12 +391,6 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" -[[package]] -name = "const-oid" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c" - [[package]] name = "core-foundation" version = "0.10.1" @@ -562,7 +556,7 @@ version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" dependencies = [ - "const-oid 0.9.6", + "const-oid", "pem-rfc7468", "zeroize", ] @@ -594,7 +588,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.4", - "const-oid 0.9.6", + "const-oid", "crypto-common 0.1.7", "subtle", ] @@ -606,7 +600,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4850db49bf08e663084f7fb5c87d202ef91a3907271aff24a94eb97ff039153c" dependencies = [ "block-buffer 0.12.0", - "const-oid 0.10.2", "crypto-common 0.2.1", "ctutils", ] @@ -1857,25 +1850,6 @@ dependencies = [ "prost", ] -[[package]] -name = "protocols" -version = "0.1.0" -dependencies = [ - "base64", - "blahaj", - "hmac 0.13.0", - "prost", - "prost-build", - "rand 0.10.1", - "serde", - "serde_json", - "sha2 0.11.0", - "sqlx", - "thiserror 2.0.18", - "tokio", - "tracing", -] - [[package]] name = "quote" version = "1.0.45" @@ -1991,7 +1965,7 @@ version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8573f03f5883dcaebdfcf4725caa1ecb9c15b2ef50c43a07b816e06799bb12d" dependencies = [ - "const-oid 0.9.6", + "const-oid", "digest 0.10.7", "num-bigint-dig", "num-integer", @@ -2012,20 +1986,24 @@ dependencies = [ "aes-gcm", "android-native-keyring-store", "apple-native-keyring-store", + "base64", + "blahaj", "chrono", "flutter_rust_bridge", "hex", "hkdf", + "hmac 0.13.0", "keyring-core", "libsqlite3-sys", "paste", "postcard", "pretty_env_logger", + "prost", "prost-build", - "protocols", "rand 0.10.1", "scrypt", "serde", + "serde_json", "sha2 0.10.9", "sqlx", "tempfile", diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 26ca7546..129bc1af 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -36,7 +36,11 @@ libsqlite3-sys = { version = "0.35.0", features = [ tokio = { version = "1.44", features = ["full"] } tracing = "0.1.44" rand = "0.10.1" -protocols = { path = "../rust_dependencies/protocols" } +prost = "0.14.1" +blahaj = "0.6.0" +serde_json = "1.0" +base64 = "0.22.1" +hmac = "0.13.0" hkdf = "0.12.4" sha2 = "0.10.8" aes-gcm = "0.10.3" diff --git a/rust/build.rs b/rust/build.rs new file mode 100644 index 00000000..135361e9 --- /dev/null +++ b/rust/build.rs @@ -0,0 +1,5 @@ +use std::io::Result; +fn main() -> Result<()> { + prost_build::compile_protos(&["src/user_discovery/types.proto"], &["src/"])?; + Ok(()) +} diff --git a/rust/src/backup/backup_archive.rs b/rust/src/backup/backup_archive.rs index d1dac2e7..86d748e4 100644 --- a/rust/src/backup/backup_archive.rs +++ b/rust/src/backup/backup_archive.rs @@ -13,6 +13,7 @@ use zip::{CompressionMethod, ZipArchive, ZipWriter}; pub(crate) struct BackupArchive {} impl BackupArchive { + #[allow(clippy::type_complexity)] fn get_backup_files( ctx: &Context, keys: &KeyManager, diff --git a/rust/src/backup/backup_identity.rs b/rust/src/backup/backup_identity.rs index 1fa49bd7..a81c1e4f 100644 --- a/rust/src/backup/backup_identity.rs +++ b/rust/src/backup/backup_identity.rs @@ -52,7 +52,7 @@ impl BackupIdentity { let key_manager: KeyManager = postcard::from_bytes(&decrypted_bytes)?; - key_manager.store_to_keychain(&secure_storage)?; + key_manager.store_to_keychain(secure_storage)?; Ok(()) } diff --git a/rust/src/bridge/callbacks.rs b/rust/src/bridge/callbacks.rs index 1b94d68f..988d9623 100644 --- a/rust/src/bridge/callbacks.rs +++ b/rust/src/bridge/callbacks.rs @@ -2,8 +2,8 @@ pub(crate) mod log; mod macros; pub(crate) mod user_discovery; +use crate::user_discovery::traits::{AnnouncedUser, OtherPromotion}; use flutter_rust_bridge::DartFnFuture; -use protocols::user_discovery::traits::{AnnouncedUser, OtherPromotion}; use crate::error::{Result, TwonlyError}; use crate::{callback_generator, frb_generated::StreamSink}; @@ -50,7 +50,9 @@ pub(crate) fn get_callbacks() -> Result { let caller_opt = CURRENT_CALLBACK_ID.try_with(|&c| c).ok(); let lock = FLUTTER_CALLBACKS.read().unwrap(); - let map = lock.as_ref().ok_or(TwonlyError::MissingCallbackInitialization)?; + let map = lock + .as_ref() + .ok_or(TwonlyError::MissingCallbackInitialization)?; if let Some(id) = caller_opt { if let Some(cb) = map.get(&id) { diff --git a/rust/src/bridge/callbacks/macros.rs b/rust/src/bridge/callbacks/macros.rs index 02b1d8d8..af53a4ee 100644 --- a/rust/src/bridge/callbacks/macros.rs +++ b/rust/src/bridge/callbacks/macros.rs @@ -31,6 +31,7 @@ macro_rules! callback_generator { // 3. Generate the Automated Init Function paste::paste! { + #[allow(clippy::too_many_arguments)] pub fn init_flutter_callbacks( callback_id: u32, $( diff --git a/rust/src/bridge/callbacks/user_discovery.rs b/rust/src/bridge/callbacks/user_discovery.rs index c9b390b7..2f4c4136 100644 --- a/rust/src/bridge/callbacks/user_discovery.rs +++ b/rust/src/bridge/callbacks/user_discovery.rs @@ -1,9 +1,10 @@ use crate::bridge::callbacks::get_callbacks; use crate::bridge::get_twonly_flutter; use crate::error::TwonlyError; -use protocols::user_discovery::error::{Result, UserDiscoveryError}; -use protocols::user_discovery::traits::UserDiscoveryUtils; -use protocols::user_discovery::traits::{AnnouncedUser, OtherPromotion, UserDiscoveryStore}; +use crate::user_discovery::error::{Result, UserDiscoveryError}; +use crate::user_discovery::traits::UserDiscoveryUtils; +use crate::user_discovery::traits::{AnnouncedUser, OtherPromotion, UserDiscoveryStore}; +#[cfg(test)] use std::collections::HashMap; use std::path::PathBuf; @@ -148,6 +149,7 @@ impl UserDiscoveryStore for UserDiscoveryStoreFlutter { .ok_or(TwonlyError::DartError.into()) } + #[cfg(test)] async fn get_all_announced_users( &self, ) -> Result)>>> { diff --git a/rust/src/bridge/mod.rs b/rust/src/bridge/mod.rs index f675cbb7..31a00057 100644 --- a/rust/src/bridge/mod.rs +++ b/rust/src/bridge/mod.rs @@ -13,12 +13,12 @@ use crate::error::Result; use crate::error::TwonlyError; use crate::keys::KeyManager; use crate::secure_storage::SecureStorage; +use crate::user_discovery::UserDiscovery; use crate::utils::Shared; use flutter_rust_bridge::frb; -use protocols::user_discovery::UserDiscovery; -pub use protocols::user_discovery::traits::AnnouncedUser; -pub use protocols::user_discovery::traits::OtherPromotion; +pub use crate::user_discovery::traits::AnnouncedUser; +pub use crate::user_discovery::traits::OtherPromotion; use tokio::sync::Mutex; pub struct InitConfig { @@ -57,9 +57,9 @@ pub(crate) struct TwonlyFlutter { pub(super) fn get_twonly_flutter() -> Result<&'static TwonlyFlutter> { let ctx = Context::get_static()?; if let Context::Flutter(twonly) = ctx { - return Ok(twonly); + Ok(twonly) } else { - return Err(TwonlyError::Initialization); + Err(TwonlyError::Initialization) } } diff --git a/rust/src/bridge/wrapper/backup.rs b/rust/src/bridge/wrapper/backup.rs index 26f92441..d5f81309 100644 --- a/rust/src/bridge/wrapper/backup.rs +++ b/rust/src/bridge/wrapper/backup.rs @@ -53,7 +53,7 @@ impl RustBackupIdentity { pub async fn get_identity_backup_bytes() -> Result> { let key_manager = get_twonly_flutter()?.key_manager.lock().await; - return BackupIdentity::encrypt_key_manager(&key_manager); + BackupIdentity::encrypt_key_manager(&key_manager) } pub async fn restore_identity_backup( @@ -70,7 +70,7 @@ impl RustBackupIdentity { impl RustBackupArchive { pub async fn create_backup_archive() -> Result<(String, String)> { let ctx = Context::get_static()?; - let path = BackupArchive::create_backup(&ctx).await?; + let path = BackupArchive::create_backup(ctx).await?; let key_manager = get_twonly_flutter()?.key_manager.lock().await; let token = hex::encode(key_manager.main_key.get_backup_download_token()); Ok((token, path.canonicalize()?.to_string_lossy().to_string())) diff --git a/rust/src/context.rs b/rust/src/context.rs index d409b523..b0e92bb3 100644 --- a/rust/src/context.rs +++ b/rust/src/context.rs @@ -1,3 +1,4 @@ +use crate::user_discovery::UserDiscovery; use crate::{ bridge::{ callbacks::user_discovery::{UserDiscoveryStoreFlutter, UserDiscoveryUtilsFlutter}, @@ -9,7 +10,6 @@ use crate::{ log::init_tracing, utils::Shared, }; -use protocols::user_discovery::UserDiscovery; use std::{path::PathBuf, sync::Arc}; use tokio::sync::{Mutex, OnceCell}; use zeroize::Zeroize; diff --git a/rust/src/database/tables/mod.rs b/rust/src/database/tables/mod.rs index 7d27b9ea..d3058b96 100644 --- a/rust/src/database/tables/mod.rs +++ b/rust/src/database/tables/mod.rs @@ -6,7 +6,7 @@ macro_rules! generate_insert { pub async fn $fn_name( pool: &sqlx::SqlitePool, $($field: $ty),+ - ) -> crate::error::Result { + ) -> $crate::error::Result { let sql = format!( "INSERT INTO {} ({}) VALUES ({}) RETURNING id", $table, @@ -27,7 +27,7 @@ macro_rules! generate_insert { #[macro_export] macro_rules! generate_select { ($table:literal, $fn_name:ident) => { - pub async fn $fn_name(pool: &sqlx::SqlitePool) -> crate::error::Result> { + pub async fn $fn_name(pool: &sqlx::SqlitePool) -> $crate::error::Result> { let sql = format!("SELECT * FROM {}", $table); let results = sqlx::query_as::<_, Self>(sqlx::AssertSqlSafe(sql)) .fetch_all(pool) @@ -36,7 +36,7 @@ macro_rules! generate_select { } }; ($table:literal, $fn_name:ident, $($field:ident : $ty:ty),+) => { - pub async fn $fn_name(pool: &sqlx::SqlitePool, $($field: $ty),+) -> crate::error::Result> { + pub async fn $fn_name(pool: &sqlx::SqlitePool, $($field: $ty),+) -> $crate::error::Result> { let mut sql = format!("SELECT * FROM {} WHERE ", $table); let mut filters = Vec::new(); $( @@ -63,7 +63,7 @@ macro_rules! generate_table_tests { #[cfg(test)] mod tests { use super::*; - use crate::database::Database; + use $crate::database::Database; use tempfile::tempdir; #[tokio::test] @@ -88,11 +88,10 @@ macro_rules! generate_test_select { #[cfg(test)] #[tokio::test] async fn []() { - use crate::database::Database; use tempfile::tempdir; let dir = tempdir().unwrap(); let db_path = dir.path().join("test.sqlite").display().to_string(); - let db = Database::new(&db_path, None, false).await.unwrap(); + let db = $crate::database::Database::new(&db_path, None, false).await.unwrap(); db.run_migrations().await.unwrap(); $struct::$insert_fn(&db.pool, $($arg),+).await.unwrap(); diff --git a/rust/src/error.rs b/rust/src/error.rs index 7a688384..18ac9bc4 100644 --- a/rust/src/error.rs +++ b/rust/src/error.rs @@ -1,5 +1,5 @@ +use crate::user_discovery::error::UserDiscoveryError; use hex::FromHexError; -use protocols::user_discovery::error::UserDiscoveryError; use scrypt::errors::{InvalidOutputLen, InvalidParams}; use thiserror::Error; use zip::result::ZipError; diff --git a/rust/src/keys/main_key.rs b/rust/src/keys/main_key.rs index 0612a127..0a3960ce 100644 --- a/rust/src/keys/main_key.rs +++ b/rust/src/keys/main_key.rs @@ -61,12 +61,12 @@ impl MainKey { self.decrypt_with_info(b"backup_key", encrypted_backup) } - /// Encrypts a newly generated media key using the derived Media Main Key. + // Encrypts a newly generated media key using the derived Media Main Key. // pub fn encrypt_media_key(&self, media_key: &[u8; 32]) -> Vec { // self.encrypt_with_info(b"media_main_key", media_key) // } - /// Decrypts a wrapped media key using the derived Media Main Key. + // Decrypts a wrapped media key using the derived Media Main Key. // pub fn decrypt_media_key(&self, wrapped_media_key: &[u8]) -> Result<[u8; 32]> { // let decrypted = self.decrypt_with_info(b"media_main_key", wrapped_media_key)?; diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 255e19a3..4792ba90 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -6,6 +6,8 @@ mod error; mod frb_generated; mod keys; mod log; +mod passwordless_recovery; mod secure_storage; mod standalone; +mod user_discovery; mod utils; diff --git a/rust_dependencies/protocols/src/passwordless_recovery/mod.rs b/rust/src/passwordless_recovery/mod.rs similarity index 100% rename from rust_dependencies/protocols/src/passwordless_recovery/mod.rs rename to rust/src/passwordless_recovery/mod.rs diff --git a/rust_dependencies/protocols/src/passwordless_recovery/traits.rs b/rust/src/passwordless_recovery/traits.rs similarity index 100% rename from rust_dependencies/protocols/src/passwordless_recovery/traits.rs rename to rust/src/passwordless_recovery/traits.rs diff --git a/rust_dependencies/protocols/src/passwordless_recovery/types.proto b/rust/src/passwordless_recovery/types.proto similarity index 100% rename from rust_dependencies/protocols/src/passwordless_recovery/types.proto rename to rust/src/passwordless_recovery/types.proto diff --git a/rust_dependencies/protocols/src/user_discovery/README.md b/rust/src/user_discovery/README.md similarity index 100% rename from rust_dependencies/protocols/src/user_discovery/README.md rename to rust/src/user_discovery/README.md diff --git a/rust_dependencies/protocols/src/user_discovery/error.rs b/rust/src/user_discovery/error.rs similarity index 100% rename from rust_dependencies/protocols/src/user_discovery/error.rs rename to rust/src/user_discovery/error.rs diff --git a/rust_dependencies/protocols/src/user_discovery/mod.rs b/rust/src/user_discovery/mod.rs similarity index 97% rename from rust_dependencies/protocols/src/user_discovery/mod.rs rename to rust/src/user_discovery/mod.rs index cfe0d2ac..c683f882 100644 --- a/rust_dependencies/protocols/src/user_discovery/mod.rs +++ b/rust/src/user_discovery/mod.rs @@ -4,9 +4,10 @@ pub mod stores; pub mod tests; pub mod traits; -use std::collections::{HashMap, HashSet}; +#[cfg(test)] +use std::collections::HashMap; +use std::collections::{HashSet}; use std::sync::Arc; -use std::u8; use blahaj::{Share, Sharks}; use prost::Message; use serde::{Deserialize, Serialize}; @@ -184,6 +185,7 @@ impl UserDiscovery)>>)` - All connections the user has discovered /// * `Err(UserDiscoveryError)` - If there where erros in the store. /// + #[cfg(test)] pub async fn get_all_announced_users( &self, ) -> Result)>>> { @@ -384,7 +386,8 @@ impl UserDiscovery UserDiscovery> = dealer @@ -476,12 +479,10 @@ impl UserDiscovery UserDiscovery UserDiscovery UserDiscovery UserDiscovery UserDiscovery Result>> { let storage = self.storage(); let elements = storage.own_promotions[(version as usize)..] - .into_iter() + .iter() .map(|(_, promotion)| promotion.to_owned()) .collect(); Ok(elements) @@ -107,7 +107,7 @@ impl UserDiscoveryStore for InMemoryStore { if let Some(element) = element { return Ok(Some(element.1.to_owned())); } - return Ok(None); + Ok(None) } async fn store_other_promotion(&self, promotion: OtherPromotion) -> Result<()> { @@ -158,7 +158,7 @@ impl UserDiscoveryStore for InMemoryStore { let entry = storage .announced_users .entry(announced_user.clone()) - .or_insert(vec![]); + .or_default(); if announced_user.user_id != from_contact_id { if let Some(found) = entry.iter_mut().find(|x| x.0 == from_contact_id) { found.1 = public_key_verified_timestamp; diff --git a/rust/src/user_discovery/stores/mod.rs b/rust/src/user_discovery/stores/mod.rs new file mode 100644 index 00000000..8548743a --- /dev/null +++ b/rust/src/user_discovery/stores/mod.rs @@ -0,0 +1,4 @@ +#[cfg(test)] +mod in_memory_store; +#[cfg(test)] +pub(super) use in_memory_store::InMemoryStore; diff --git a/rust_dependencies/protocols/src/user_discovery/tests.rs b/rust/src/user_discovery/tests.rs similarity index 100% rename from rust_dependencies/protocols/src/user_discovery/tests.rs rename to rust/src/user_discovery/tests.rs diff --git a/rust_dependencies/protocols/src/user_discovery/traits.rs b/rust/src/user_discovery/traits.rs similarity index 93% rename from rust_dependencies/protocols/src/user_discovery/traits.rs rename to rust/src/user_discovery/traits.rs index c9dcb507..a7b65a98 100644 --- a/rust_dependencies/protocols/src/user_discovery/traits.rs +++ b/rust/src/user_discovery/traits.rs @@ -1,9 +1,14 @@ +#[cfg(test)] use std::collections::HashMap; use crate::user_discovery::error::Result; use crate::user_discovery::UserID; use std::future::Future; +/// Type alias used in `UserDiscoveryStore::get_all_announced_users`. +#[cfg(test)] +pub type AnnouncedUserMap = HashMap)>>; + #[derive(Clone, sqlx::FromRow)] pub struct OtherPromotion { pub promotion_id: u32, @@ -65,9 +70,8 @@ pub trait UserDiscoveryStore { public_key_verified_timestamp: Option, ) -> impl Future> + Send; - fn get_all_announced_users( - &self, - ) -> impl Future)>>>> + Send; + #[cfg(test)] + fn get_all_announced_users(&self) -> impl Future> + Send; fn get_contact_promotion( &self, diff --git a/rust_dependencies/protocols/src/user_discovery/types.proto b/rust/src/user_discovery/types.proto similarity index 100% rename from rust_dependencies/protocols/src/user_discovery/types.proto rename to rust/src/user_discovery/types.proto diff --git a/rust_dependencies/.gitignore b/rust_dependencies/.gitignore deleted file mode 100644 index e69de29b..00000000 diff --git a/rust_dependencies/Cargo.lock b/rust_dependencies/Cargo.lock deleted file mode 100644 index 2a1c057b..00000000 --- a/rust_dependencies/Cargo.lock +++ /dev/null @@ -1,1639 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 4 - -[[package]] -name = "aho-corasick" -version = "1.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" -dependencies = [ - "memchr", -] - -[[package]] -name = "allocator-api2" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" - -[[package]] -name = "anyhow" -version = "1.0.102" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" - -[[package]] -name = "base64" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" - -[[package]] -name = "bitflags" -version = "2.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3" - -[[package]] -name = "blahaj" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5106bf2680d585dc5f29711b8aa5dde353180b8e14af89b7f0424f760c84e7ce" -dependencies = [ - "hashbrown 0.15.5", - "rand 0.8.6", - "zeroize", -] - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "block-buffer" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdd35008169921d80bc60d3d0ab416eecb028c4cd653352907921d95084790be" -dependencies = [ - "hybrid-array", -] - -[[package]] -name = "bytes" -version = "1.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" - -[[package]] -name = "cfg-if" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" - -[[package]] -name = "chacha20" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f8d983286843e49675a4b7a2d174efe136dc93a18d69130dd18198a6c167601" -dependencies = [ - "cfg-if", - "cpufeatures 0.3.0", - "rand_core 0.10.1", -] - -[[package]] -name = "cmov" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f88a43d011fc4a6876cb7344703e297c71dda42494fee094d5f7c76bf13f746" - -[[package]] -name = "concurrent-queue" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "const-oid" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c" - -[[package]] -name = "cpufeatures" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" -dependencies = [ - "libc", -] - -[[package]] -name = "cpufeatures" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" -dependencies = [ - "libc", -] - -[[package]] -name = "crc" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eb8a2a1cd12ab0d987a5d5e825195d372001a4094a0376319d5a0ad71c1ba0d" -dependencies = [ - "crc-catalog", -] - -[[package]] -name = "crc-catalog" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" - -[[package]] -name = "crossbeam-queue" -version = "0.3.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" - -[[package]] -name = "crypto-common" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "crypto-common" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77727bb15fa921304124b128af125e7e3b968275d1b108b379190264f4423710" -dependencies = [ - "hybrid-array", -] - -[[package]] -name = "ctutils" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d5515a3834141de9eafb9717ad39eea8247b5674e6066c404e8c4b365d2a29e" -dependencies = [ - "cmov", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer 0.10.4", - "crypto-common 0.1.7", -] - -[[package]] -name = "digest" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4850db49bf08e663084f7fb5c87d202ef91a3907271aff24a94eb97ff039153c" -dependencies = [ - "block-buffer 0.12.0", - "const-oid", - "crypto-common 0.2.1", - "ctutils", -] - -[[package]] -name = "displaydoc" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "dotenvy" -version = "0.15.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" - -[[package]] -name = "either" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" -dependencies = [ - "serde", -] - -[[package]] -name = "env_logger" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" -dependencies = [ - "humantime", - "is-terminal", - "log", - "regex", - "termcolor", -] - -[[package]] -name = "equivalent" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" - -[[package]] -name = "errno" -version = "0.3.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" -dependencies = [ - "libc", - "windows-sys", -] - -[[package]] -name = "event-listener" -version = "5.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13b66accf52311f30a0db42147dadea9850cb48cd070028831ae5f5d4b856ab" -dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite", -] - -[[package]] -name = "fastrand" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" - -[[package]] -name = "fixedbitset" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" - -[[package]] -name = "foldhash" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" - -[[package]] -name = "foldhash" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" - -[[package]] -name = "form_urlencoded" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "futures-core" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" - -[[package]] -name = "futures-intrusive" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" -dependencies = [ - "futures-core", - "lock_api", - "parking_lot", -] - -[[package]] -name = "futures-io" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" - -[[package]] -name = "futures-sink" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" - -[[package]] -name = "futures-task" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" - -[[package]] -name = "futures-util" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" -dependencies = [ - "futures-core", - "futures-io", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "slab", -] - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "getrandom" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" -dependencies = [ - "cfg-if", - "libc", - "r-efi", - "rand_core 0.10.1", - "wasip2", - "wasip3", -] - -[[package]] -name = "hashbrown" -version = "0.15.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" -dependencies = [ - "allocator-api2", - "equivalent", - "foldhash 0.1.5", -] - -[[package]] -name = "hashbrown" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" -dependencies = [ - "allocator-api2", - "equivalent", - "foldhash 0.2.0", -] - -[[package]] -name = "hashbrown" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51" - -[[package]] -name = "hashlink" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" -dependencies = [ - "hashbrown 0.15.5", -] - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "hermit-abi" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "hmac" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6303bc9732ae41b04cb554b844a762b4115a61bfaa81e3e83050991eeb56863f" -dependencies = [ - "digest 0.11.2", -] - -[[package]] -name = "humantime" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "135b12329e5e3ce057a9f972339ea52bc954fe1e9358ef27f95e89716fbc5424" - -[[package]] -name = "hybrid-array" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3944cf8cf766b40e2a1a333ee5e9b563f854d5fa49d6a8ca2764e97c6eddb214" -dependencies = [ - "typenum", -] - -[[package]] -name = "icu_collections" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" -dependencies = [ - "displaydoc", - "potential_utf", - "utf8_iter", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locale_core" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" -dependencies = [ - "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_normalizer" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" -dependencies = [ - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec", - "zerovec", -] - -[[package]] -name = "icu_normalizer_data" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" - -[[package]] -name = "icu_properties" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" -dependencies = [ - "icu_collections", - "icu_locale_core", - "icu_properties_data", - "icu_provider", - "zerotrie", - "zerovec", -] - -[[package]] -name = "icu_properties_data" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" - -[[package]] -name = "icu_provider" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" -dependencies = [ - "displaydoc", - "icu_locale_core", - "writeable", - "yoke", - "zerofrom", - "zerotrie", - "zerovec", -] - -[[package]] -name = "id-arena" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" - -[[package]] -name = "idna" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" -dependencies = [ - "idna_adapter", - "smallvec", - "utf8_iter", -] - -[[package]] -name = "idna_adapter" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" -dependencies = [ - "icu_normalizer", - "icu_properties", -] - -[[package]] -name = "indexmap" -version = "2.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" -dependencies = [ - "equivalent", - "hashbrown 0.17.0", - "serde", - "serde_core", -] - -[[package]] -name = "is-terminal" -version = "0.4.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46" -dependencies = [ - "hermit-abi", - "libc", - "windows-sys", -] - -[[package]] -name = "itertools" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" - -[[package]] -name = "leb128fmt" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" - -[[package]] -name = "libc" -version = "0.2.185" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ff2c0fe9bc6cb6b14a0592c2ff4fa9ceb83eea9db979b0487cd054946a2b8f" - -[[package]] -name = "linux-raw-sys" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" - -[[package]] -name = "litemap" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" - -[[package]] -name = "lock_api" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" -dependencies = [ - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" - -[[package]] -name = "memchr" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" - -[[package]] -name = "mio" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1" -dependencies = [ - "libc", - "wasi", - "windows-sys", -] - -[[package]] -name = "multimap" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d87ecb2933e8aeadb3e3a02b828fed80a7528047e68b4f424523a0981a3a084" - -[[package]] -name = "once_cell" -version = "1.21.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" - -[[package]] -name = "parking" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" - -[[package]] -name = "parking_lot" -version = "0.12.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-link", -] - -[[package]] -name = "percent-encoding" -version = "2.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" - -[[package]] -name = "petgraph" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" -dependencies = [ - "fixedbitset", - "hashbrown 0.15.5", - "indexmap", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" - -[[package]] -name = "potential_utf" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564" -dependencies = [ - "zerovec", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" -dependencies = [ - "zerocopy", -] - -[[package]] -name = "pretty_env_logger" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "865724d4dbe39d9f3dd3b52b88d859d66bcb2d6a0acfd5ea68a65fb66d4bdc1c" -dependencies = [ - "env_logger", - "log", -] - -[[package]] -name = "prettyplease" -version = "0.2.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" -dependencies = [ - "proc-macro2", - "syn", -] - -[[package]] -name = "proc-macro2" -version = "1.0.106" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "prost" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ea70524a2f82d518bce41317d0fae74151505651af45faf1ffbd6fd33f0568" -dependencies = [ - "bytes", - "prost-derive", -] - -[[package]] -name = "prost-build" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "343d3bd7056eda839b03204e68deff7d1b13aba7af2b2fd16890697274262ee7" -dependencies = [ - "heck", - "itertools", - "log", - "multimap", - "petgraph", - "prettyplease", - "prost", - "prost-types", - "regex", - "syn", - "tempfile", -] - -[[package]] -name = "prost-derive" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27c6023962132f4b30eb4c172c91ce92d933da334c59c23cddee82358ddafb0b" -dependencies = [ - "anyhow", - "itertools", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "prost-types" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8991c4cbdb8bc5b11f0b074ffe286c30e523de90fee5ba8132f1399f23cb3dd7" -dependencies = [ - "prost", -] - -[[package]] -name = "protocols" -version = "0.1.0" -dependencies = [ - "base64", - "blahaj", - "hmac", - "pretty_env_logger", - "prost", - "prost-build", - "rand 0.10.1", - "serde", - "serde_json", - "sha2 0.11.0", - "sqlx", - "thiserror", - "tokio", - "tracing", -] - -[[package]] -name = "quote" -version = "1.0.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "r-efi" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" - -[[package]] -name = "rand" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca0ecfa931c29007047d1bc58e623ab12e5590e8c7cc53200d5202b69266d8a" -dependencies = [ - "libc", - "rand_chacha", - "rand_core 0.6.4", -] - -[[package]] -name = "rand" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2e8e8bcc7961af1fdac401278c6a831614941f6164ee3bf4ce61b7edb162207" -dependencies = [ - "chacha20", - "getrandom 0.4.2", - "rand_core 0.10.1", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom 0.2.17", -] - -[[package]] -name = "rand_core" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" - -[[package]] -name = "redox_syscall" -version = "0.5.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" -dependencies = [ - "bitflags", -] - -[[package]] -name = "regex" -version = "1.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" - -[[package]] -name = "rustix" -version = "1.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" -dependencies = [ - "bitflags", - "errno", - "libc", - "linux-raw-sys", - "windows-sys", -] - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "semver" -version = "1.0.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" - -[[package]] -name = "serde" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" -dependencies = [ - "serde_core", - "serde_derive", -] - -[[package]] -name = "serde_core" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.149" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" -dependencies = [ - "itoa", - "memchr", - "serde", - "serde_core", - "zmij", -] - -[[package]] -name = "sha2" -version = "0.10.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - -[[package]] -name = "sha2" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "446ba717509524cb3f22f17ecc096f10f4822d76ab5c0b9822c5f9c284e825f4" -dependencies = [ - "cfg-if", - "cpufeatures 0.3.0", - "digest 0.11.2", -] - -[[package]] -name = "signal-hook-registry" -version = "1.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" -dependencies = [ - "errno", - "libc", -] - -[[package]] -name = "slab" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" - -[[package]] -name = "smallvec" -version = "1.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" - -[[package]] -name = "socket2" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" -dependencies = [ - "libc", - "windows-sys", -] - -[[package]] -name = "sqlx" -version = "0.9.0-alpha.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "decccfa5f2f3eac95eb68085cfe69a0172fa9711666c3a634cfc806d4fb74a47" -dependencies = [ - "sqlx-core", - "sqlx-macros", -] - -[[package]] -name = "sqlx-core" -version = "0.9.0-alpha.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86854e8c6aba0dafcf1c04b4836b0b7fa3a20c560e3554567afefe1258fa4e60" -dependencies = [ - "base64", - "bytes", - "cfg-if", - "crc", - "crossbeam-queue", - "either", - "event-listener", - "futures-core", - "futures-intrusive", - "futures-io", - "futures-util", - "hashbrown 0.16.1", - "hashlink", - "indexmap", - "log", - "memchr", - "percent-encoding", - "serde", - "sha2 0.10.9", - "smallvec", - "thiserror", - "tracing", - "url", -] - -[[package]] -name = "sqlx-macros" -version = "0.9.0-alpha.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7aab9442ed1568e3aed6c368737226ee4e0e8d1deb0e0887fa6bf15282ace44" -dependencies = [ - "proc-macro2", - "quote", - "sqlx-core", - "sqlx-macros-core", - "syn", -] - -[[package]] -name = "sqlx-macros-core" -version = "0.9.0-alpha.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34eb4976b8f02ac57ee98d4ce40cd1aad7ab31d9792977bc3171f787ba6ba2fb" -dependencies = [ - "cfg-if", - "dotenvy", - "either", - "heck", - "hex", - "proc-macro2", - "quote", - "serde", - "serde_json", - "sha2 0.10.9", - "sqlx-core", - "syn", - "url", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" - -[[package]] -name = "syn" -version = "2.0.117" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "synstructure" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tempfile" -version = "3.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" -dependencies = [ - "fastrand", - "getrandom 0.4.2", - "once_cell", - "rustix", - "windows-sys", -] - -[[package]] -name = "termcolor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "thiserror" -version = "2.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "2.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tinystr" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" -dependencies = [ - "displaydoc", - "zerovec", -] - -[[package]] -name = "tokio" -version = "1.52.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67dee974fe86fd92cc45b7a95fdd2f99a36a6d7b0d431a231178d3d670bbcc6" -dependencies = [ - "bytes", - "libc", - "mio", - "parking_lot", - "pin-project-lite", - "signal-hook-registry", - "socket2", - "tokio-macros", - "windows-sys", -] - -[[package]] -name = "tokio-macros" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tracing" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" -dependencies = [ - "log", - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tracing-core" -version = "0.1.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" -dependencies = [ - "once_cell", -] - -[[package]] -name = "typenum" -version = "1.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ce102ab67701b8526c123c1bab5cbe42d7040ccfd0f64af1a385808d2f43de" - -[[package]] -name = "unicode-ident" -version = "1.0.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" - -[[package]] -name = "unicode-xid" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" - -[[package]] -name = "url" -version = "2.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", - "serde", -] - -[[package]] -name = "utf8_iter" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" - -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] -name = "wasi" -version = "0.11.1+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" - -[[package]] -name = "wasip2" -version = "1.0.3+wasi-0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6" -dependencies = [ - "wit-bindgen 0.57.1", -] - -[[package]] -name = "wasip3" -version = "0.4.0+wasi-0.3.0-rc-2026-01-06" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" -dependencies = [ - "wit-bindgen 0.51.0", -] - -[[package]] -name = "wasm-encoder" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" -dependencies = [ - "leb128fmt", - "wasmparser", -] - -[[package]] -name = "wasm-metadata" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" -dependencies = [ - "anyhow", - "indexmap", - "wasm-encoder", - "wasmparser", -] - -[[package]] -name = "wasmparser" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" -dependencies = [ - "bitflags", - "hashbrown 0.15.5", - "indexmap", - "semver", -] - -[[package]] -name = "winapi-util" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" -dependencies = [ - "windows-sys", -] - -[[package]] -name = "windows-link" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" - -[[package]] -name = "windows-sys" -version = "0.61.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" -dependencies = [ - "windows-link", -] - -[[package]] -name = "wit-bindgen" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" -dependencies = [ - "wit-bindgen-rust-macro", -] - -[[package]] -name = "wit-bindgen" -version = "0.57.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" - -[[package]] -name = "wit-bindgen-core" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" -dependencies = [ - "anyhow", - "heck", - "wit-parser", -] - -[[package]] -name = "wit-bindgen-rust" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" -dependencies = [ - "anyhow", - "heck", - "indexmap", - "prettyplease", - "syn", - "wasm-metadata", - "wit-bindgen-core", - "wit-component", -] - -[[package]] -name = "wit-bindgen-rust-macro" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" -dependencies = [ - "anyhow", - "prettyplease", - "proc-macro2", - "quote", - "syn", - "wit-bindgen-core", - "wit-bindgen-rust", -] - -[[package]] -name = "wit-component" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" -dependencies = [ - "anyhow", - "bitflags", - "indexmap", - "log", - "serde", - "serde_derive", - "serde_json", - "wasm-encoder", - "wasm-metadata", - "wasmparser", - "wit-parser", -] - -[[package]] -name = "wit-parser" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" -dependencies = [ - "anyhow", - "id-arena", - "indexmap", - "log", - "semver", - "serde", - "serde_derive", - "serde_json", - "unicode-xid", - "wasmparser", -] - -[[package]] -name = "writeable" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" - -[[package]] -name = "yoke" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abe8c5fda708d9ca3df187cae8bfb9ceda00dd96231bed36e445a1a48e66f9ca" -dependencies = [ - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - -[[package]] -name = "zerocopy" -version = "0.8.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.8.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "zerofrom" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69faa1f2a1ea75661980b013019ed6687ed0e83d069bc1114e2cc74c6c04c4df" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - -[[package]] -name = "zeroize" -version = "1.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85a5b4158499876c763cb03bc4e49185d3cccbabb15b33c627f7884f43db852e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "zerotrie" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf" -dependencies = [ - "displaydoc", - "yoke", - "zerofrom", -] - -[[package]] -name = "zerovec" -version = "0.11.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" -dependencies = [ - "yoke", - "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "zmij" -version = "1.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" diff --git a/rust_dependencies/Cargo.toml b/rust_dependencies/Cargo.toml deleted file mode 100644 index 1f2f14b9..00000000 --- a/rust_dependencies/Cargo.toml +++ /dev/null @@ -1,3 +0,0 @@ -[workspace] -members = ["protocols"] -resolver = "3" diff --git a/rust_dependencies/protocols/Cargo.toml b/rust_dependencies/protocols/Cargo.toml deleted file mode 100644 index 7196dd26..00000000 --- a/rust_dependencies/protocols/Cargo.toml +++ /dev/null @@ -1,29 +0,0 @@ -[package] -name = "protocols" -version = "0.1.0" -edition = "2021" - -[lib] -crate-type = ["rlib", "cdylib", "staticlib"] - -[dependencies] -thiserror = "2.0.18" -tracing = "0.1.44" -serde = "1.0.228" -prost = "0.14.1" -rand = "0.10.1" -blahaj = "0.6.0" -serde_json = "1.0" -base64 = "0.22.1" -hmac = "0.13.0" -sha2 = "0.11.0" -tokio = { version = "1.44", features = ["full"] } -sqlx = { version = "0.9.0-alpha.1", default-features = false, features = [ - "derive", -] } - -[dev-dependencies] -pretty_env_logger = "0.5.0" - -[build-dependencies] -prost-build = "0.14.1" diff --git a/rust_dependencies/protocols/build.rs b/rust_dependencies/protocols/build.rs deleted file mode 100644 index 12e4744b..00000000 --- a/rust_dependencies/protocols/build.rs +++ /dev/null @@ -1,11 +0,0 @@ -use std::io::Result; -fn main() -> Result<()> { - prost_build::compile_protos( - &[ - "src/user_discovery/types.proto", - "src/key_verification/types.proto", - ], - &["src/"], - )?; - Ok(()) -} diff --git a/rust_dependencies/protocols/src/key_verification/error.rs b/rust_dependencies/protocols/src/key_verification/error.rs deleted file mode 100644 index a23b1d1c..00000000 --- a/rust_dependencies/protocols/src/key_verification/error.rs +++ /dev/null @@ -1,30 +0,0 @@ -use prost::DecodeError; -use thiserror::Error; - -pub type Result = core::result::Result; - -#[derive(Error, Debug)] -pub enum KeyVerificationError { - #[error("The prefix deeplink url must start with https:// and end with a #")] - InvalidDeeplinkPrefix, - - #[error("Invalid qr text")] - InvalidQrText, - - #[error( - "Contact user_id is known and the stored public_key does not match the received user id" - )] - InvalidPublicKeyAndUserIdCombination, - - #[error("Store error: `{0}`")] - Store(String), - - #[error("`{0}`")] - Base64(#[from] base64::DecodeError), - - #[error("`{0}`")] - Prost(#[from] DecodeError), - - #[error("`{0}`")] - Hmac(#[from] hmac::digest::InvalidLength), -} diff --git a/rust_dependencies/protocols/src/key_verification/mod.rs b/rust_dependencies/protocols/src/key_verification/mod.rs deleted file mode 100644 index f3493473..00000000 --- a/rust_dependencies/protocols/src/key_verification/mod.rs +++ /dev/null @@ -1,194 +0,0 @@ -use crate::key_verification::{error::KeyVerificationError, traits::KeyVerificationStore}; -use crate::user_discovery::UserID; -use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine as _}; -use error::Result; -use hmac::{Hmac, KeyInit, Mac}; -use prost::Message; -use sha2::Sha256; - -pub(crate) mod error; -pub mod stores; -pub mod traits; - -include!(concat!(env!("OUT_DIR"), "/key_verification.rs")); - -pub struct KeyVerificationConfig { - /// The link prefix for the qr code which should be registered as a deeplink on Android and a universal link on iOS - /// The link MUST start with a https:// and end with a # - /// The link should contain the username of the user so the application can show the scanned user without internet - /// Example: https://me.twonly.eu/tobi# - deeplink_prefix: String, - /// The user ID used to calculate the verification proof - user_id: UserID, - /// The public_key of the user to calculate the verification proof - public_key: Vec, -} - -pub struct ScannedUser { - pub user_id: UserID, - pub public_key: Vec, - pub verification_proof: Vec, -} - -pub struct KeyVerification { - store: Store, - config: KeyVerificationConfig, -} - -impl KeyVerification { - pub fn new(store: Store, config: KeyVerificationConfig) -> Result> { - if !config.deeplink_prefix.starts_with("https://") || !config.deeplink_prefix.ends_with("#") - { - return Err(KeyVerificationError::InvalidDeeplinkPrefix); - } - Ok(Self { store, config }) - } - - /// Generates the a string which should be displayed in the UI so others can scan it. - pub fn generate_qr_text(&self) -> Result { - // 10 Bytes should be enough. Tokens are only valid for one day and then deleted. - let secret_verification_token: Vec = rand::random_iter().take(16).collect(); - - self.store - .push_new_secret_verification_token(&secret_verification_token)?; - - let verification_data = VerificationData { - user_id: self.config.user_id, - public_key: self.config.public_key.clone(), - secret_verification_token, - }; - - let verification_data_bytes = verification_data.encode_to_vec(); - let encoded = URL_SAFE_NO_PAD.encode(verification_data_bytes); - - Ok(format!("{}{}", self.config.deeplink_prefix, encoded)) - } - - /// Handles the scanned qr code text and creates a response message - /// which can be send to the other person - pub fn get_user_from_scanned_qr_text(&self, received_text: &str) -> Result { - let splitted: Vec<_> = received_text.split('#').collect(); - if splitted.len() != 2 { - tracing::info!("Scanned qr text does not contain a #"); - return Err(KeyVerificationError::InvalidQrText); - } - let verification_data_bytes = URL_SAFE_NO_PAD.decode(splitted[1])?; - let verification_data = VerificationData::decode(verification_data_bytes.as_slice())?; - - let mut mac = Hmac::::new_from_slice(&verification_data.secret_verification_token)?; - mac.update(&self.config.user_id.to_le_bytes()); - mac.update(&self.config.public_key); - mac.update(&verification_data.user_id.to_le_bytes()); - mac.update(&verification_data.public_key); - - let verification_proof = mac.finalize().into_bytes().to_vec(); - - Ok(ScannedUser { - user_id: verification_data.user_id, - public_key: verification_data.public_key, - verification_proof, - }) - } - - /// Checks whether the received verification proof is valid - pub fn is_received_verification_proof_valid( - &self, - from_user_id: UserID, - public_key: Vec, - verification_proof: Vec, - ) -> Result { - let verification_tokens = self.store.get_all_valid_verification_tokens()?; - - for verification_token in &verification_tokens { - let calculated_verification_proof = { - let mut mac = Hmac::::new_from_slice(verification_token)?; - mac.update(&from_user_id.to_le_bytes()); - mac.update(&public_key); - mac.update(&self.config.user_id.to_le_bytes()); - mac.update(&self.config.public_key); - mac.finalize().into_bytes().to_vec() - }; - - if calculated_verification_proof == verification_proof { - return Ok(true); - } - } - - Ok(false) - } -} - -#[cfg(test)] -mod tests { - use crate::key_verification::{stores::InMemoryStore, KeyVerification, KeyVerificationConfig}; - - #[test] - fn test_key_verification() { - let _ = pretty_env_logger::try_init(); - - const ALICE_ID: i64 = 10; - const BOB_ID: i64 = 11; - - let alice_kv = KeyVerification::new( - InMemoryStore::default(), - KeyVerificationConfig { - user_id: ALICE_ID, - public_key: vec![ALICE_ID as u8; 32], - deeplink_prefix: "https://me.twonly.eu/alice#".into(), - }, - ) - .unwrap(); - - let bob_kv = KeyVerification::new( - InMemoryStore::default(), - KeyVerificationConfig { - user_id: BOB_ID, - public_key: vec![BOB_ID as u8; 32], - deeplink_prefix: "https://me.twonly.eu/bob#".into(), - }, - ) - .unwrap(); - - let qr_code_text = alice_kv.generate_qr_text().unwrap(); - assert_eq!(qr_code_text.len(), 99); - - tracing::debug!("Generated QR-Code-Link: {qr_code_text}"); - - let scanned_user = bob_kv.get_user_from_scanned_qr_text(&qr_code_text).unwrap(); - - // THIS must be done by the application - assert_eq!(scanned_user.user_id, ALICE_ID); - assert_eq!(scanned_user.public_key, vec![ALICE_ID as u8; 32]); - - // SEND scanned_user.verification_proof over the establish e2ee protected session if public_key verification was valid. - - let valid_verification_proof = alice_kv - .is_received_verification_proof_valid( - BOB_ID, - vec![BOB_ID as u8; 32], - scanned_user.verification_proof.clone(), - ) - .unwrap(); - - assert_eq!(valid_verification_proof, true); - - let valid_verification_proof = alice_kv - .is_received_verification_proof_valid( - BOB_ID, - vec![(BOB_ID + 1) as u8; 32], - scanned_user.verification_proof.clone(), - ) - .unwrap(); - - assert_eq!(valid_verification_proof, false); - - let mut modified_proof = scanned_user.verification_proof; - modified_proof[0] = modified_proof[0] + 1; - - let valid_verification_proof = alice_kv - .is_received_verification_proof_valid(BOB_ID, vec![BOB_ID as u8; 32], modified_proof) - .unwrap(); - - assert_eq!(valid_verification_proof, false); - } -} diff --git a/rust_dependencies/protocols/src/key_verification/stores/in_memory_store.rs b/rust_dependencies/protocols/src/key_verification/stores/in_memory_store.rs deleted file mode 100644 index 160fbfb8..00000000 --- a/rust_dependencies/protocols/src/key_verification/stores/in_memory_store.rs +++ /dev/null @@ -1,22 +0,0 @@ -use std::sync::{Arc, Mutex}; - -use crate::key_verification::{error::Result, traits::KeyVerificationStore}; - -#[derive(Default)] -pub struct InMemoryStore { - verification_tokens: Arc>>>, -} - -impl KeyVerificationStore for InMemoryStore { - fn push_new_secret_verification_token(&self, token: &[u8]) -> Result<()> { - self.verification_tokens - .lock() - .unwrap() - .push(token.to_vec()); - Ok(()) - } - - fn get_all_valid_verification_tokens(&self) -> Result>> { - Ok(self.verification_tokens.lock().unwrap().clone()) - } -} diff --git a/rust_dependencies/protocols/src/key_verification/stores/mod.rs b/rust_dependencies/protocols/src/key_verification/stores/mod.rs deleted file mode 100644 index 30b1f14d..00000000 --- a/rust_dependencies/protocols/src/key_verification/stores/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -mod in_memory_store; - -pub use in_memory_store::InMemoryStore; diff --git a/rust_dependencies/protocols/src/key_verification/traits.rs b/rust_dependencies/protocols/src/key_verification/traits.rs deleted file mode 100644 index 1689e3a8..00000000 --- a/rust_dependencies/protocols/src/key_verification/traits.rs +++ /dev/null @@ -1,7 +0,0 @@ -use super::error::Result; -pub trait KeyVerificationStore { - fn push_new_secret_verification_token(&self, token: &[u8]) -> Result<()>; - /// This function should return all tokens from the last 24h - /// All other tokens can be removed from the database - fn get_all_valid_verification_tokens(&self) -> Result>>; -} diff --git a/rust_dependencies/protocols/src/key_verification/types.proto b/rust_dependencies/protocols/src/key_verification/types.proto deleted file mode 100644 index bd515eb0..00000000 --- a/rust_dependencies/protocols/src/key_verification/types.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; -package key_verification; - -message VerificationData { - int64 user_id = 1; - bytes public_key = 2; - bytes secret_verification_token = 3; -} - -message VerificationMessage { - bytes calculated_mac = 1; -} \ No newline at end of file diff --git a/rust_dependencies/protocols/src/lib.rs b/rust_dependencies/protocols/src/lib.rs deleted file mode 100644 index 85641306..00000000 --- a/rust_dependencies/protocols/src/lib.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub mod key_verification; -pub mod passwordless_recovery; -pub mod user_discovery; diff --git a/rust_dependencies/protocols/src/user_discovery/stores/mod.rs b/rust_dependencies/protocols/src/user_discovery/stores/mod.rs deleted file mode 100644 index c22f0a9e..00000000 --- a/rust_dependencies/protocols/src/user_discovery/stores/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -mod in_memory_store; -pub use in_memory_store::InMemoryStore; diff --git a/scripts/generate_proto.sh b/scripts/generate_proto.sh index e6c8ca1a..9e4fd5e9 100755 --- a/scripts/generate_proto.sh +++ b/scripts/generate_proto.sh @@ -18,7 +18,7 @@ protoc --proto_path="$CLIENT_DIR" --dart_out="$GENERATED_DIR" "qr.proto" protoc --proto_path="$CLIENT_DIR" --dart_out="$GENERATED_DIR" "data.proto" mkdir "$GENERATED_DIR/user_discovery/" &>/dev/null -protoc --proto_path="./rust_dependencies/protocols/src/user_discovery/" --dart_out="$GENERATED_DIR/user_discovery/" "types.proto" +protoc --proto_path="./rust/src/user_discovery/" --dart_out="$GENERATED_DIR/user_discovery/" "types.proto" protoc --proto_path="$CLIENT_DIR" --dart_out="$GENERATED_DIR" "push_notification.proto" protoc --proto_path="$CLIENT_DIR" --swift_out="./ios/NotificationService/" "push_notification.proto"