diff --git a/documentation/settings.md b/documentation/settings.md index 406663c2..628fd35c 100644 --- a/documentation/settings.md +++ b/documentation/settings.md @@ -212,9 +212,9 @@ The settings card links to **Backup & Restore** and **Export** subpages. ### Backup & Restore -Choose which information to include or restore: node name, identity, radio settings and regions; location, contact and privacy settings; app preferences; contacts and their filters and settings, groups, direct-message and route history; discovered contacts; and channels, filters, communities, settings and history. A radio connection is required to back up or restore radio settings and contact or channel lists. Contact and channel lists are restored to the connected radio; message history and groups are restored in the app. +Choose individual items to include in a backup or restore. Location settings include the saved coordinates, GPS enable state and interval, contact discovery options, and privacy/adverts settings. When importing, only items found in the selected file can be selected. Backups from the official MeshCore app are supported; those files do not include app preferences, groups, filters, or message history, so those choices are unavailable. A radio connection is required to restore radio settings and contact or channel lists. Contact and channel lists are restored to the connected radio; message history and groups are restored in the app. -Node Settings includes the radio's identity and private key. Some radio firmware does not allow identity backup or restore; the app will let you know if this feature is unavailable. Restoring Node Settings replaces the connected radio's identity after confirmation. +The private-key option is off by default because it changes the radio's identity. Select it only when you intend to restore that identity; the app asks for confirmation before proceeding. Some radios do not allow identity backup or restore, and the app will let you know if this feature is unavailable. A password protects the backup file. Leave the password blank to create an unprotected file. Backups may contain your radio's private key, channel keys, messages and saved passwords, so store them carefully. Downloaded models, received image files and cached map tiles are not included. diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index f69db281..b345cc1f 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -198,13 +198,33 @@ "backupRestore_selectImportFile": "Import File", "backupRestore_password": "Password (optional)", "backupRestore_passwordHelp": "A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.", + "backupRestore_importUnavailable": "Check the password or choose a supported backup file.", "backupRestore_items": "Backup and restore items", "backupRestore_nodeSettings": "Node Settings", "backupRestore_nodeSettingsDescription": "Device name, private and public keys, radio settings, and regions", + "backupRestore_deviceName": "Device Name", + "backupRestore_privateKey": "Private Key (sensitive)", + "backupRestore_publicKey": "Public Key", + "backupRestore_radioSettings": "Radio Settings", + "backupRestore_regions": "Regions", + "backupRestore_location": "Location", + "backupRestore_contactSettings": "Contact Settings", + "backupRestore_privacySettings": "Privacy Settings", + "backupRestore_contactsData": "Contacts", + "backupRestore_perContactSettings": "Contact Settings and Filters", + "backupRestore_contactGroups": "Contact Groups", + "backupRestore_contactHistory": "Contact History", + "backupRestore_channelsData": "Channels", + "backupRestore_channelFilters": "Message Filter Settings", + "backupRestore_channelSettings": "Channel Settings", + "backupRestore_communities": "Communities", + "backupRestore_channelHistory": "Channel History", "backupRestore_locationSettings": "Location Settings", "backupRestore_locationSettingsDescription": "Location, contact settings, and privacy settings", "backupRestore_appSettings": "App Settings", "backupRestore_appSettingsDescription": "App preferences and appearance settings", + "backupRestore_ipfsKey": "IPFS API Key (sensitive)", + "backupRestore_stadiaMapKey": "Stadia Maps API Key (sensitive)", "backupRestore_contacts": "Contacts", "backupRestore_contactsDescription": "Contacts, per-contact filters and settings, groups, and message history", "backupRestore_discoveredContacts": "Discovered Contacts", diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index 4b7b8e08..6c42cc51 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -862,6 +862,12 @@ abstract class AppLocalizations { /// **'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'** String get backupRestore_passwordHelp; + /// No description provided for @backupRestore_importUnavailable. + /// + /// In en, this message translates to: + /// **'Check the password or choose a supported backup file.'** + String get backupRestore_importUnavailable; + /// No description provided for @backupRestore_items. /// /// In en, this message translates to: @@ -880,6 +886,108 @@ abstract class AppLocalizations { /// **'Device name, private and public keys, radio settings, and regions'** String get backupRestore_nodeSettingsDescription; + /// No description provided for @backupRestore_deviceName. + /// + /// In en, this message translates to: + /// **'Device Name'** + String get backupRestore_deviceName; + + /// No description provided for @backupRestore_privateKey. + /// + /// In en, this message translates to: + /// **'Private Key (sensitive)'** + String get backupRestore_privateKey; + + /// No description provided for @backupRestore_publicKey. + /// + /// In en, this message translates to: + /// **'Public Key'** + String get backupRestore_publicKey; + + /// No description provided for @backupRestore_radioSettings. + /// + /// In en, this message translates to: + /// **'Radio Settings'** + String get backupRestore_radioSettings; + + /// No description provided for @backupRestore_regions. + /// + /// In en, this message translates to: + /// **'Regions'** + String get backupRestore_regions; + + /// No description provided for @backupRestore_location. + /// + /// In en, this message translates to: + /// **'Location'** + String get backupRestore_location; + + /// No description provided for @backupRestore_contactSettings. + /// + /// In en, this message translates to: + /// **'Contact Settings'** + String get backupRestore_contactSettings; + + /// No description provided for @backupRestore_privacySettings. + /// + /// In en, this message translates to: + /// **'Privacy Settings'** + String get backupRestore_privacySettings; + + /// No description provided for @backupRestore_contactsData. + /// + /// In en, this message translates to: + /// **'Contacts'** + String get backupRestore_contactsData; + + /// No description provided for @backupRestore_perContactSettings. + /// + /// In en, this message translates to: + /// **'Contact Settings and Filters'** + String get backupRestore_perContactSettings; + + /// No description provided for @backupRestore_contactGroups. + /// + /// In en, this message translates to: + /// **'Contact Groups'** + String get backupRestore_contactGroups; + + /// No description provided for @backupRestore_contactHistory. + /// + /// In en, this message translates to: + /// **'Contact History'** + String get backupRestore_contactHistory; + + /// No description provided for @backupRestore_channelsData. + /// + /// In en, this message translates to: + /// **'Channels'** + String get backupRestore_channelsData; + + /// No description provided for @backupRestore_channelFilters. + /// + /// In en, this message translates to: + /// **'Message Filter Settings'** + String get backupRestore_channelFilters; + + /// No description provided for @backupRestore_channelSettings. + /// + /// In en, this message translates to: + /// **'Channel Settings'** + String get backupRestore_channelSettings; + + /// No description provided for @backupRestore_communities. + /// + /// In en, this message translates to: + /// **'Communities'** + String get backupRestore_communities; + + /// No description provided for @backupRestore_channelHistory. + /// + /// In en, this message translates to: + /// **'Channel History'** + String get backupRestore_channelHistory; + /// No description provided for @backupRestore_locationSettings. /// /// In en, this message translates to: @@ -904,6 +1012,18 @@ abstract class AppLocalizations { /// **'App preferences and appearance settings'** String get backupRestore_appSettingsDescription; + /// No description provided for @backupRestore_ipfsKey. + /// + /// In en, this message translates to: + /// **'IPFS API Key (sensitive)'** + String get backupRestore_ipfsKey; + + /// No description provided for @backupRestore_stadiaMapKey. + /// + /// In en, this message translates to: + /// **'Stadia Maps API Key (sensitive)'** + String get backupRestore_stadiaMapKey; + /// No description provided for @backupRestore_contacts. /// /// In en, this message translates to: diff --git a/lib/l10n/app_localizations_bg.dart b/lib/l10n/app_localizations_bg.dart index 1c6f29f0..1525fd45 100644 --- a/lib/l10n/app_localizations_bg.dart +++ b/lib/l10n/app_localizations_bg.dart @@ -425,6 +425,10 @@ class AppLocalizationsBg extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -435,6 +439,57 @@ class AppLocalizationsBg extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -449,6 +504,12 @@ class AppLocalizationsBg extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart index 93d4740c..7a98cc9a 100644 --- a/lib/l10n/app_localizations_de.dart +++ b/lib/l10n/app_localizations_de.dart @@ -428,6 +428,10 @@ class AppLocalizationsDe extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -438,6 +442,57 @@ class AppLocalizationsDe extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -452,6 +507,12 @@ class AppLocalizationsDe extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 398c66dc..741c6a86 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -421,6 +421,10 @@ class AppLocalizationsEn extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -431,6 +435,57 @@ class AppLocalizationsEn extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -445,6 +500,12 @@ class AppLocalizationsEn extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart index a6762562..8249dd75 100644 --- a/lib/l10n/app_localizations_es.dart +++ b/lib/l10n/app_localizations_es.dart @@ -426,6 +426,10 @@ class AppLocalizationsEs extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -436,6 +440,57 @@ class AppLocalizationsEs extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -450,6 +505,12 @@ class AppLocalizationsEs extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart index 06b802f3..efae49c7 100644 --- a/lib/l10n/app_localizations_fr.dart +++ b/lib/l10n/app_localizations_fr.dart @@ -428,6 +428,10 @@ class AppLocalizationsFr extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -438,6 +442,57 @@ class AppLocalizationsFr extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -452,6 +507,12 @@ class AppLocalizationsFr extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_hu.dart b/lib/l10n/app_localizations_hu.dart index c05ff030..64420984 100644 --- a/lib/l10n/app_localizations_hu.dart +++ b/lib/l10n/app_localizations_hu.dart @@ -424,6 +424,10 @@ class AppLocalizationsHu extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -434,6 +438,57 @@ class AppLocalizationsHu extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -448,6 +503,12 @@ class AppLocalizationsHu extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart index 5c712f66..998e97c0 100644 --- a/lib/l10n/app_localizations_it.dart +++ b/lib/l10n/app_localizations_it.dart @@ -428,6 +428,10 @@ class AppLocalizationsIt extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -438,6 +442,57 @@ class AppLocalizationsIt extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -452,6 +507,12 @@ class AppLocalizationsIt extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart index 676b9c1b..50eeb3d6 100644 --- a/lib/l10n/app_localizations_ja.dart +++ b/lib/l10n/app_localizations_ja.dart @@ -409,6 +409,10 @@ class AppLocalizationsJa extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -419,6 +423,57 @@ class AppLocalizationsJa extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -433,6 +488,12 @@ class AppLocalizationsJa extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_ko.dart b/lib/l10n/app_localizations_ko.dart index a1f61083..11acc5bc 100644 --- a/lib/l10n/app_localizations_ko.dart +++ b/lib/l10n/app_localizations_ko.dart @@ -409,6 +409,10 @@ class AppLocalizationsKo extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -419,6 +423,57 @@ class AppLocalizationsKo extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -433,6 +488,12 @@ class AppLocalizationsKo extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_nl.dart b/lib/l10n/app_localizations_nl.dart index 2eb8d6d2..0da21c09 100644 --- a/lib/l10n/app_localizations_nl.dart +++ b/lib/l10n/app_localizations_nl.dart @@ -424,6 +424,10 @@ class AppLocalizationsNl extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -434,6 +438,57 @@ class AppLocalizationsNl extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -448,6 +503,12 @@ class AppLocalizationsNl extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_pl.dart b/lib/l10n/app_localizations_pl.dart index 43790915..ab7bd293 100644 --- a/lib/l10n/app_localizations_pl.dart +++ b/lib/l10n/app_localizations_pl.dart @@ -431,6 +431,10 @@ class AppLocalizationsPl extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -441,6 +445,57 @@ class AppLocalizationsPl extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -455,6 +510,12 @@ class AppLocalizationsPl extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart index 2a70fb29..9f8f4943 100644 --- a/lib/l10n/app_localizations_pt.dart +++ b/lib/l10n/app_localizations_pt.dart @@ -427,6 +427,10 @@ class AppLocalizationsPt extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -437,6 +441,57 @@ class AppLocalizationsPt extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -451,6 +506,12 @@ class AppLocalizationsPt extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart index 224d80a0..c0534b20 100644 --- a/lib/l10n/app_localizations_ru.dart +++ b/lib/l10n/app_localizations_ru.dart @@ -427,6 +427,10 @@ class AppLocalizationsRu extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -437,6 +441,57 @@ class AppLocalizationsRu extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -451,6 +506,12 @@ class AppLocalizationsRu extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_sk.dart b/lib/l10n/app_localizations_sk.dart index f52aab24..35263c5b 100644 --- a/lib/l10n/app_localizations_sk.dart +++ b/lib/l10n/app_localizations_sk.dart @@ -427,6 +427,10 @@ class AppLocalizationsSk extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -437,6 +441,57 @@ class AppLocalizationsSk extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -451,6 +506,12 @@ class AppLocalizationsSk extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_sl.dart b/lib/l10n/app_localizations_sl.dart index 5fdc42f9..95e03d47 100644 --- a/lib/l10n/app_localizations_sl.dart +++ b/lib/l10n/app_localizations_sl.dart @@ -426,6 +426,10 @@ class AppLocalizationsSl extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -436,6 +440,57 @@ class AppLocalizationsSl extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -450,6 +505,12 @@ class AppLocalizationsSl extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_sv.dart b/lib/l10n/app_localizations_sv.dart index 4723c8f2..9be4b142 100644 --- a/lib/l10n/app_localizations_sv.dart +++ b/lib/l10n/app_localizations_sv.dart @@ -422,6 +422,10 @@ class AppLocalizationsSv extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -432,6 +436,57 @@ class AppLocalizationsSv extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -446,6 +501,12 @@ class AppLocalizationsSv extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_uk.dart b/lib/l10n/app_localizations_uk.dart index 8c15697e..a87c8d27 100644 --- a/lib/l10n/app_localizations_uk.dart +++ b/lib/l10n/app_localizations_uk.dart @@ -426,6 +426,10 @@ class AppLocalizationsUk extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -436,6 +440,57 @@ class AppLocalizationsUk extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -450,6 +505,12 @@ class AppLocalizationsUk extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart index 6e95a003..5c09fbb1 100644 --- a/lib/l10n/app_localizations_zh.dart +++ b/lib/l10n/app_localizations_zh.dart @@ -403,6 +403,10 @@ class AppLocalizationsZh extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -413,6 +417,57 @@ class AppLocalizationsZh extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -427,6 +482,12 @@ class AppLocalizationsZh extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/screens/backup_restore_screen.dart b/lib/screens/backup_restore_screen.dart new file mode 100644 index 00000000..f6d50833 --- /dev/null +++ b/lib/screens/backup_restore_screen.dart @@ -0,0 +1,497 @@ +import 'dart:async'; +import 'dart:convert'; +import 'dart:typed_data'; + +import 'package:file_selector/file_selector.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:share_plus/share_plus.dart'; + +import '../connector/meshcore_connector.dart'; +import '../helpers/snack_bar_builder.dart'; +import '../l10n/l10n.dart'; +import '../services/app_settings_service.dart'; +import '../services/backup_service.dart'; +import '../services/message_filter/message_filter_service.dart'; +import '../utils/platform_info.dart'; +import '../utils/share_origin.dart'; +import '../widgets/app_bar.dart'; +import '../widgets/mesh_ui.dart'; +import '../widgets/sync_progress_overlay.dart'; + +class BackupRestoreScreen extends StatefulWidget { + const BackupRestoreScreen({super.key}); + + @override + State createState() => _BackupRestoreScreenState(); +} + +class _BackupRestoreScreenState extends State { + static const int _maxImportBytes = 100 * 1024 * 1024; + static const _backupService = BackupService(); + static const _fileType = XTypeGroup( + label: 'MeshCore backup', + extensions: ['json'], + mimeTypes: ['application/json'], + ); + static const Set _defaultUncheckedItems = { + BackupItem.privateKey, + BackupItem.ipfsKey, + BackupItem.stadiaMapKey, + }; + static const Set _deviceStoredItems = { + BackupItem.deviceName, + BackupItem.publicKey, + BackupItem.radioSettings, + BackupItem.location, + BackupItem.contactSettings, + BackupItem.privacySettings, + }; + static const Set _defaultUncheckedOnRestore = { + ..._defaultUncheckedItems, + ..._deviceStoredItems, + }; + final _passwordController = TextEditingController(); + final Set _selectedItems = BackupItem.values + .where((item) => !_defaultUncheckedItems.contains(item)) + .toSet(); + Set? _availableItems; + String? _importContents; + String? _importFileName; + Timer? _inspectionTimer; + int _inspectionGeneration = 0; + bool _hasInitializedImportSelection = false; + bool _busy = false; + + @override + void dispose() { + _inspectionTimer?.cancel(); + _passwordController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + return Scaffold( + appBar: AppBar( + title: AppBarTitle( + l10n.backupRestore_title, + indicators: false, + subtitle: false, + ), + centerTitle: true, + bottom: const SyncProgressAppBarBottom(), + ), + body: SafeArea( + top: false, + child: ListView( + padding: const EdgeInsets.fromLTRB(0, 8, 0, 24), + children: [ + SectionHeader(l10n.backupRestore_import), + MeshCard( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + OutlinedButton.icon( + onPressed: _busy ? null : _selectImportFile, + icon: const Icon(Icons.upload_file_outlined), + label: Text( + _importFileName ?? l10n.backupRestore_selectImportFile, + ), + ), + const SizedBox(height: 12), + TextField( + controller: _passwordController, + obscureText: true, + autocorrect: false, + enableSuggestions: false, + onChanged: (_) => _scheduleImportInspection(), + decoration: InputDecoration( + labelText: l10n.backupRestore_password, + helperText: + _importContents != null && + _availableItems?.isEmpty == true + ? l10n.backupRestore_importUnavailable + : l10n.backupRestore_passwordHelp, + border: const OutlineInputBorder(), + ), + ), + ], + ), + ), + SectionHeader(l10n.backupRestore_items), + MeshCard( + padding: EdgeInsets.zero, + child: Column( + children: [ + _groupTile( + title: l10n.backupRestore_nodeSettings, + icon: Icons.router_outlined, + items: [ + (BackupItem.deviceName, l10n.backupRestore_deviceName), + (BackupItem.privateKey, l10n.backupRestore_privateKey), + (BackupItem.publicKey, l10n.backupRestore_publicKey), + ( + BackupItem.radioSettings, + l10n.backupRestore_radioSettings, + ), + (BackupItem.regions, l10n.backupRestore_regions), + ], + ), + const Divider(height: 1, indent: 16), + _groupTile( + title: l10n.backupRestore_locationSettings, + icon: Icons.location_on_outlined, + items: [ + (BackupItem.location, l10n.backupRestore_location), + ( + BackupItem.contactSettings, + l10n.backupRestore_contactSettings, + ), + ( + BackupItem.privacySettings, + l10n.backupRestore_privacySettings, + ), + ], + ), + const Divider(height: 1, indent: 16), + _groupTile( + title: l10n.backupRestore_appSettings, + icon: Icons.settings_outlined, + items: [ + (BackupItem.appSettings, l10n.backupRestore_appSettings), + (BackupItem.ipfsKey, l10n.backupRestore_ipfsKey), + ( + BackupItem.stadiaMapKey, + l10n.backupRestore_stadiaMapKey, + ), + ], + ), + const Divider(height: 1, indent: 16), + _groupTile( + title: l10n.backupRestore_contacts, + icon: Icons.contacts_outlined, + items: [ + (BackupItem.contacts, l10n.backupRestore_contactsData), + ( + BackupItem.perContactSettings, + l10n.backupRestore_perContactSettings, + ), + ( + BackupItem.contactGroups, + l10n.backupRestore_contactGroups, + ), + ( + BackupItem.contactHistory, + l10n.backupRestore_contactHistory, + ), + ], + ), + const Divider(height: 1, indent: 16), + _itemTile( + BackupItem.discoveredContacts, + l10n.backupRestore_discoveredContacts, + Icons.person_search_outlined, + ), + const Divider(height: 1, indent: 16), + _groupTile( + title: l10n.backupRestore_channels, + icon: Icons.forum_outlined, + items: [ + (BackupItem.channels, l10n.backupRestore_channelsData), + ( + BackupItem.channelFilters, + l10n.backupRestore_channelFilters, + ), + ( + BackupItem.channelSettings, + l10n.backupRestore_channelSettings, + ), + (BackupItem.communities, l10n.backupRestore_communities), + ( + BackupItem.channelHistory, + l10n.backupRestore_channelHistory, + ), + ], + ), + ], + ), + ), + Padding( + padding: const EdgeInsets.fromLTRB(16, 16, 16, 0), + child: FilledButton.icon( + onPressed: + _busy || + _selectedItems.isEmpty || + (_importContents != null && _availableItems == null) + ? null + : _runAction, + icon: _busy + ? const SizedBox.square( + dimension: 18, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : Icon( + _importContents == null + ? Icons.backup_outlined + : Icons.restore_outlined, + ), + label: Text( + _importContents == null + ? l10n.backupRestore_backup + : l10n.backupRestore_restore, + ), + ), + ), + ], + ), + ), + ); + } + + Widget _groupTile({ + required String title, + required IconData icon, + required List<(BackupItem, String)> items, + }) { + return ExpansionTile( + leading: Icon(icon), + title: Text(title), + tilePadding: const EdgeInsets.symmetric(horizontal: 16), + childrenPadding: EdgeInsets.zero, + initiallyExpanded: true, + visualDensity: VisualDensity.compact, + children: [for (final item in items) _itemTile(item.$1, item.$2)], + ); + } + + Widget _itemTile(BackupItem item, String title, [IconData? icon]) { + final available = + _availableItems == null || _availableItems!.contains(item); + return CheckboxListTile( + value: _selectedItems.contains(item), + dense: true, + visualDensity: VisualDensity.compact, + onChanged: _busy || !available + ? null + : (selected) => setState(() { + if (selected == true) { + _selectedItems.add(item); + } else { + _selectedItems.remove(item); + } + }), + secondary: icon == null ? null : Icon(icon), + title: Text(title), + controlAffinity: ListTileControlAffinity.trailing, + contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 2), + ); + } + + Future _selectImportFile() async { + final l10n = context.l10n; + try { + final file = await openFile(acceptedTypeGroups: const [_fileType]); + if (file == null) return; + if (await file.length() > _maxImportBytes) { + _showMessage(l10n.backupRestore_fileTooLarge); + return; + } + final contents = utf8.decode(await file.readAsBytes()); + if (!mounted) return; + setState(() { + _importContents = contents; + _importFileName = file.name; + _availableItems = null; + _selectedItems.clear(); + _hasInitializedImportSelection = false; + }); + await _inspectImport(); + } catch (error) { + if (mounted) { + _showMessage(l10n.backupRestore_failed(error.toString())); + } + } + } + + void _scheduleImportInspection() { + _inspectionTimer?.cancel(); + _inspectionTimer = Timer(const Duration(milliseconds: 350), _inspectImport); + } + + Future _inspectImport() async { + final contents = _importContents; + if (contents == null) return; + final generation = ++_inspectionGeneration; + try { + final info = await _backupService.inspectImport( + contents: contents, + password: _passwordController.text, + ); + if (!mounted || generation != _inspectionGeneration) return; + setState(() { + _availableItems = info.availableItems; + if (!_hasInitializedImportSelection) { + _selectedItems + ..clear() + ..addAll( + info.availableItems.where( + (item) => !_defaultUncheckedOnRestore.contains(item), + ), + ); + _hasInitializedImportSelection = true; + } else { + _selectedItems.retainAll(info.availableItems); + } + }); + } catch (_) { + if (!mounted || generation != _inspectionGeneration) return; + setState(() { + _availableItems = {}; + _selectedItems.clear(); + }); + } + } + + Future _runAction() async { + if (_selectedItems.isEmpty) { + _showMessage(context.l10n.backupRestore_selectAtLeastOne); + return; + } + if (_importContents != null) { + await _restore(); + } else { + await _createBackup(); + } + } + + Future _createBackup() async { + final l10n = context.l10n; + final connector = context.read(); + final shareOrigin = shareOriginOf(context); + setState(() => _busy = true); + try { + final contents = await _backupService.createBackup( + items: Set.of(_selectedItems), + connector: connector, + settings: context.read().settings, + password: _passwordController.text, + ); + if (!mounted) return; + final filename = + 'meshcore-open_backup_${DateTime.now().millisecondsSinceEpoch}.json'; + final file = XFile.fromData( + Uint8List.fromList(utf8.encode(contents)), + name: filename, + mimeType: 'application/json', + ); + if (PlatformInfo.isWeb) { + await file.saveTo(filename); + } else if (PlatformInfo.isDesktop) { + final location = await getSaveLocation( + suggestedName: filename, + acceptedTypeGroups: const [_fileType], + ); + if (location == null) return; + await file.saveTo(location.path); + } else { + final result = await SharePlus.instance.share( + ShareParams( + files: [file], + fileNameOverrides: [filename], + sharePositionOrigin: shareOrigin, + ), + ); + if (result.status == ShareResultStatus.dismissed) return; + } + if (mounted) _showMessage(l10n.backupRestore_backupComplete); + } catch (error) { + if (mounted) { + _showMessage(l10n.backupRestore_failed(error.toString())); + } + } finally { + if (mounted) setState(() => _busy = false); + } + } + + Future _restore() async { + final l10n = context.l10n; + final connector = context.read(); + final appSettingsService = context.read(); + final messageFilterService = context.read(); + final needsKeyConfirmation = _selectedItems.contains(BackupItem.privateKey); + if (needsKeyConfirmation && !await _confirmIdentityReplacement()) return; + setState(() => _busy = true); + try { + await _backupService.restoreBackup( + contents: _importContents!, + password: _passwordController.text, + items: Set.of(_selectedItems), + connector: connector, + appSettingsService: appSettingsService, + ); + if (_selectedItems.any( + (item) => + item == BackupItem.appSettings || + item == BackupItem.ipfsKey || + item == BackupItem.stadiaMapKey, + )) { + await appSettingsService.loadSettings(); + } + if (_selectedItems.contains(BackupItem.channelFilters)) { + await messageFilterService.load(); + } + if (mounted) { + _showMessage(l10n.backupRestore_restoreComplete); + setState(() { + _importContents = null; + _importFileName = null; + _availableItems = null; + _selectedItems + ..clear() + ..addAll( + BackupItem.values.where( + (item) => !_defaultUncheckedItems.contains(item), + ), + ); + _hasInitializedImportSelection = false; + }); + } + } catch (error) { + if (mounted) { + _showMessage(l10n.backupRestore_failed(error.toString())); + } + } finally { + if (mounted) setState(() => _busy = false); + } + } + + Future _confirmIdentityReplacement() async { + final l10n = context.l10n; + return await showDialog( + context: context, + builder: (dialogContext) => AlertDialog( + title: Text(l10n.backupRestore_replaceIdentityTitle), + content: Text(l10n.backupRestore_replaceIdentityMessage), + actions: [ + TextButton( + onPressed: () => Navigator.pop(dialogContext, false), + child: Text(l10n.common_cancel), + ), + FilledButton( + onPressed: () => Navigator.pop(dialogContext, true), + child: Text(l10n.backupRestore_restore), + ), + ], + ), + ) ?? + false; + } + + void _showMessage(String message) { + if (!mounted) return; + showDismissibleSnackBar(context, content: Text(message)); + } +} diff --git a/lib/screens/export_screen.dart b/lib/screens/export_screen.dart new file mode 100644 index 00000000..45066a61 --- /dev/null +++ b/lib/screens/export_screen.dart @@ -0,0 +1,123 @@ +import 'package:flutter/material.dart'; +import 'package:meshcore_open/utils/gpx_export.dart'; +import 'package:provider/provider.dart'; + +import '../connector/meshcore_connector.dart'; +import '../helpers/snack_bar_builder.dart'; +import '../l10n/l10n.dart'; +import '../utils/share_origin.dart'; +import '../widgets/app_bar.dart'; +import '../widgets/mesh_ui.dart'; +import '../widgets/mesh_nav_tile.dart'; +import '../widgets/sync_progress_overlay.dart'; + +class ExportScreen extends StatelessWidget { + const ExportScreen({super.key}); + + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + final connector = context.read(); + return Scaffold( + appBar: AppBar( + title: AppBarTitle( + l10n.settings_export, + indicators: false, + subtitle: false, + ), + centerTitle: true, + bottom: const SyncProgressAppBarBottom(), + ), + body: SafeArea( + top: false, + child: ListView( + padding: const EdgeInsets.fromLTRB(0, 8, 0, 24), + children: [ + SectionHeader(l10n.settings_export), + MeshCard( + padding: EdgeInsets.zero, + child: Column( + children: [ + MeshNavTile( + icon: Icons.download_outlined, + title: l10n.settings_gpxExportRepeaters, + subtitle: l10n.settings_gpxExportRepeatersSubtitle, + onTap: () { + final exporter = GpxExport(connector)..addRepeaters(); + _gpxExport( + context, + exporter, + l10n.map_repeater, + l10n.settings_gpxExportRepeatersRoom, + 'meshcore_repeaters_', + ); + }, + ), + const Divider(height: 1, indent: 16), + MeshNavTile( + icon: Icons.download_outlined, + title: l10n.settings_gpxExportContacts, + subtitle: l10n.settings_gpxExportContactsSubtitle, + onTap: () { + final exporter = GpxExport(connector)..addContacts(); + _gpxExport( + context, + exporter, + l10n.map_repeater, + l10n.settings_gpxExportChat, + 'meshcore_contacts_', + ); + }, + ), + const Divider(height: 1, indent: 16), + MeshNavTile( + icon: Icons.download_outlined, + title: l10n.settings_gpxExportAll, + subtitle: l10n.settings_gpxExportAllSubtitle, + onTap: () { + final exporter = GpxExport(connector)..addAll(); + _gpxExport( + context, + exporter, + l10n.map_repeater, + l10n.settings_gpxExportAllContacts, + 'meshcore_all_', + ); + }, + ), + ], + ), + ), + ], + ), + ), + ); + } + + Future _gpxExport( + BuildContext context, + GpxExport exporter, + String name, + String description, + String filename, + ) async { + final l10n = context.l10n; + final result = await exporter.exportGPX( + name, + description, + filename, + l10n.settings_gpxExportShareText, + l10n.settings_gpxExportShareSubject, + sharePositionOrigin: shareOriginOf(context), + ); + if (!context.mounted) return; + final message = switch (result) { + gpxExportSuccess => l10n.settings_gpxExportSuccess, + gpxExportNoContacts => l10n.settings_gpxExportNoContacts, + gpxExportNotAvailable => l10n.settings_gpxExportNotAvailable, + gpxExportFailed => l10n.settings_gpxExportError, + _ => l10n.settings_gpxExportError, + }; + showDismissibleSnackBar(context, content: Text(message)); + } +} diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart index 733038eb..6b2e2294 100644 --- a/lib/screens/settings_screen.dart +++ b/lib/screens/settings_screen.dart @@ -597,33 +597,10 @@ class _SettingsScreenState extends State { ? () => pushSelfTelemetryScreen(context) : null, ), - const Divider(height: 1, indent: 16), - MeshNavTile( - icon: Icons.route_outlined, - title: l10n.repeater_pathHashMode, - subtitle: !connected - ? offline - : !connector.supportsPathHashMode - ? l10n.settings_requiresFirmware('v1.14') - : _pathHashModeSubtitle(context, connector.pathHashByteWidth), - onTap: connector.isConnected && connector.supportsPathHashMode - ? () => _editPathHashMode(context, connector) - : null, - ), ], ); } - String _pathHashModeSubtitle(BuildContext context, int pathHashByteWidth) { - final l10n = context.l10n; - return switch (pathHashByteWidth.clamp(1, 4).toInt()) { - 1 => l10n.repeater_pathHashModeOption0, - 2 => l10n.repeater_pathHashModeOption1, - 3 => l10n.repeater_pathHashModeOption2, - _ => l10n.repeater_pathHashModeOption3, - }; - } - Widget _buildLocationCardContent( BuildContext context, MeshCoreConnector connector, @@ -773,95 +750,6 @@ class _SettingsScreenState extends State { ); } - void _editPathHashMode(BuildContext context, MeshCoreConnector connector) { - final l10n = context.l10n; - var selectedMode = (connector.pathHashByteWidth - 1).clamp(0, 2).toInt(); - - showDialog( - context: context, - builder: (dialogContext) => StatefulBuilder( - builder: (builderContext, setDialogState) => AlertDialog( - scrollable: true, - title: Text(l10n.repeater_pathHashMode), - content: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - DropdownButtonFormField( - isExpanded: true, - initialValue: selectedMode, - decoration: InputDecoration( - labelText: l10n.repeater_pathHashMode, - border: const OutlineInputBorder(), - ), - items: [ - DropdownMenuItem( - value: 0, - child: Text( - l10n.repeater_pathHashModeOption0, - overflow: TextOverflow.ellipsis, - ), - ), - DropdownMenuItem( - value: 1, - child: Text( - l10n.repeater_pathHashModeOption1, - overflow: TextOverflow.ellipsis, - ), - ), - DropdownMenuItem( - value: 2, - child: Text( - l10n.repeater_pathHashModeOption2, - overflow: TextOverflow.ellipsis, - ), - ), - ], - onChanged: (value) { - if (value == null) return; - setDialogState(() => selectedMode = value); - }, - ), - const SizedBox(height: 12), - Text( - l10n.settings_pathHashModeHelper, - style: Theme.of(builderContext).textTheme.bodyMedium, - ), - ], - ), - actions: [ - TextButton( - onPressed: () => Navigator.pop(dialogContext), - child: Text(l10n.common_cancel), - ), - FilledButton( - onPressed: () async { - Navigator.pop(dialogContext); - if (!_ensureConnected(context, connector)) return; - try { - await connector.setPathHashMode(selectedMode); - await connector.refreshDeviceInfo(); - if (!context.mounted) return; - showDismissibleSnackBar( - context, - content: Text(l10n.repeater_settingsSaved), - ); - } catch (e) { - if (!context.mounted) return; - showDismissibleSnackBar( - context, - content: Text(l10n.settings_error(e.toString())), - ); - } - }, - child: Text(l10n.common_save), - ), - ], - ), - ), - ); - } - Future _editLocation( BuildContext context, MeshCoreConnector connector, diff --git a/lib/services/backup_service.dart b/lib/services/backup_service.dart new file mode 100644 index 00000000..4eb205a2 --- /dev/null +++ b/lib/services/backup_service.dart @@ -0,0 +1,1334 @@ +import 'dart:convert'; +import 'dart:math'; +import 'dart:typed_data'; + +import 'package:cryptography/cryptography.dart'; + +import '../connector/meshcore_connector.dart'; +import '../connector/meshcore_protocol.dart'; +import '../models/app_settings.dart'; +import '../models/contact.dart'; +import 'app_settings_service.dart'; +import '../storage/channel_store.dart'; +import '../storage/contact_store.dart'; +import '../storage/prefs_manager.dart'; + +const int _backupVersion = 1; +const int _pbkdf2Iterations = 310000; +const String _backupFormat = 'meshcore-open-backup'; +const String _encryptedBackupFormat = 'meshcore-open-encrypted-backup'; + +const List _contactPreferencePrefixes = [ + 'contacts', + 'contact_groups', + 'contact_smaz_', + 'contact_cyr2lat_', + 'contact_url_images_', + 'contact_unread_count', + 'messages_', + 'path_history_', +]; + +const List _channelPreferencePrefixes = [ + 'channels', + 'channel_slot_ids_', + 'channel_messages_', + 'channel_order_', + 'channel_smaz_', + 'channel_cyr2lat_', + 'channel_url_images_', + 'channel_region_', + 'default_region_', + 'communities_v1', + 'message_filter_', +]; + +const List _scopedPreferencePrefixes = [ + ..._contactPreferencePrefixes, + ..._channelPreferencePrefixes, + 'discovered_contacts', +]; + +enum BackupSection { + nodeSettings, + locationSettings, + appSettings, + contacts, + discoveredContacts, + channels, +} + +enum BackupItem { + deviceName, + privateKey, + publicKey, + radioSettings, + regions, + location, + contactSettings, + privacySettings, + appSettings, + contacts, + perContactSettings, + contactGroups, + contactHistory, + discoveredContacts, + channels, + channelFilters, + ipfsKey, + stadiaMapKey, + channelSettings, + communities, + channelHistory, +} + +class BackupImportInfo { + const BackupImportInfo({ + required this.availableItems, + required this.isOfficial, + }); + + final Set availableItems; + final bool isOfficial; +} + +class BackupService { + const BackupService(); + + Future inspectImport({ + required String contents, + required String password, + }) async { + final decoded = _decodeJson(contents); + final bool isOfficial = _isOfficialBackup(decoded); + final payload = await _decodeImport(contents, password: password); + return BackupImportInfo( + availableItems: _availableItems(payload), + isOfficial: isOfficial, + ); + } + + Future> _decodeImport( + String contents, { + required String password, + }) async { + final decoded = _decodeJson(contents); + if (decoded is Map && + decoded['format'] == _encryptedBackupFormat) { + return decodeBackup(contents, password: password); + } + if (decoded is Map && decoded['format'] == _backupFormat) { + return _validatePayload(decoded); + } + if (_isOfficialBackup(decoded)) { + return _normalizeOfficialBackup(decoded as Map); + } + throw const FormatException('Invalid or unsupported backup file'); + } + + Future createBackup({ + required Set items, + required MeshCoreConnector connector, + required AppSettings settings, + required String password, + }) async { + if (items.isEmpty) throw StateError('Select at least one backup item'); + final includedItems = Set.of(items); + final customVars = connector.currentCustomVars ?? const {}; + if (includedItems.isEmpty) { + throw StateError('No selected settings are available on this radio'); + } + final publicKey = connector.selfPublicKeyHex; + final devicePrefix = _devicePrefix(publicKey); + if (includedItems.any(_requiresRadioConnection)) { + _requireConnected(connector); + if (devicePrefix.isEmpty) { + throw StateError('Wait for radio identity to finish loading'); + } + } + final sections = {}; + final nodeItems = includedItems + .where((item) => _sectionForItem(item) == BackupSection.nodeSettings) + .toSet(); + if (nodeItems.isNotEmpty) { + final node = {}; + if (includedItems.contains(BackupItem.deviceName)) { + node['name'] = connector.selfName; + } + if (includedItems.contains(BackupItem.publicKey)) { + node['publicKey'] = publicKey; + } + if (includedItems.contains(BackupItem.privateKey)) { + node['privateKey'] = base64Encode(await connector.exportPrivateKey()); + } + if (includedItems.contains(BackupItem.radioSettings)) { + node['radio'] = { + 'frequencyHz': connector.currentFreqHz, + 'bandwidthHz': connector.currentBwHz, + 'spreadingFactor': connector.currentSf, + 'codingRate': connector.currentCr, + 'clientRepeat': connector.clientRepeat, + 'txPowerDbm': connector.currentTxPower, + 'pathHashByteWidth': connector.pathHashByteWidth, + 'defaultFloodScope': connector.defaultFloodScopeName, + }; + } + if (includedItems.contains(BackupItem.regions)) { + node['preferences'] = _snapshotPreferences((key) => key == 'regions'); + } + sections[BackupSection.nodeSettings.name] = node; + } + + final location = {}; + if (includedItems.contains(BackupItem.location)) { + location['location'] = { + 'latitude': connector.selfLatitude, + 'longitude': connector.selfLongitude, + }; + if (customVars.containsKey('gps')) { + location['gpsEnabled'] = customVars['gps'] == '1'; + final deviceInterval = int.tryParse(customVars['gps_interval'] ?? ''); + location['gpsIntervalSeconds'] = + deviceInterval != null && deviceInterval >= 0 + ? deviceInterval + : settings.gpsIntervalSeconds; + } + } + if (includedItems.contains(BackupItem.contactSettings)) { + location['contactSettings'] = { + 'autoAddChat': connector.autoAddUsers, + 'autoAddRepeater': connector.autoAddRepeaters, + 'autoAddRoomServer': connector.autoAddRoomServers, + 'autoAddSensor': connector.autoAddSensors, + 'overwriteOldest': connector.autoAddOverwriteOldest, + 'maxHops': connector.autoAddMaxHops, + 'evictDiscoveredContactsEnabled': + settings.evictDiscoveredContactsEnabled, + }; + } + if (includedItems.contains(BackupItem.privacySettings)) { + final privacySettings = { + 'telemetryBase': connector.telemetryModeBase, + 'telemetryLocation': connector.telemetryModeLoc, + 'telemetryEnvironment': connector.telemetryModeEnv, + 'advertLocation': connector.advertLocationPolicy, + 'multiAcks': connector.multiAcks, + 'autoSendZeroHopAdvertOnGpsUpdate': + settings.autoSendZeroHopAdvertOnGpsUpdate, + }; + final appSettingsJson = settings.toJson(); + if (appSettingsJson.containsKey('auto_send_self_advert_as_flood')) { + privacySettings['autoSendSelfAdvertAsFlood'] = + appSettingsJson['auto_send_self_advert_as_flood']; + } + location['privacySettings'] = privacySettings; + } + if (location.isNotEmpty) { + sections[BackupSection.locationSettings.name] = location; + } + + for (final section in BackupSection.values) { + final sectionItems = includedItems + .where((item) => _sectionForItem(item) == section) + .toSet(); + if (sectionItems.isEmpty || + section == BackupSection.nodeSettings || + section == BackupSection.locationSettings) { + continue; + } + sections[section.name] = { + 'preferences': section == BackupSection.appSettings + ? _snapshotAppSettingsPreferences(sectionItems) + : _snapshotPreferences( + (key) => + _preferenceBelongsToItems(key, sectionItems, devicePrefix), + ), + }; + } + + final payload = { + 'format': _backupFormat, + 'version': _backupVersion, + 'createdAt': DateTime.now().toUtc().toIso8601String(), + 'sourcePublicKey': publicKey, + 'items': includedItems.map((item) => item.name).toList(), + 'sections': sections, + }; + return encodeBackup(payload, password: password); + } + + Future restoreBackup({ + required String contents, + required String password, + required Set items, + required MeshCoreConnector connector, + required AppSettingsService appSettingsService, + }) async { + if (items.isEmpty) throw StateError('Select at least one item to restore'); + final payload = await _decodeImport(contents, password: password); + final sectionData = payload['sections']; + if (sectionData is! Map) throw const FormatException('Missing backup data'); + final sourcePublicKey = _normalizePublicKey( + payload['sourcePublicKey'] as String? ?? '', + ); + final availableItems = _availableItems(payload); + final selectedItems = items.intersection(availableItems); + if (selectedItems.isEmpty) { + throw const FormatException('The backup has none of the selected items'); + } + for (final section in BackupSection.values) { + final sectionItems = selectedItems + .where((item) => _sectionForItem(item) == section) + .toSet(); + if (sectionItems.isEmpty) continue; + final data = _sectionData(sectionData, section); + if (data != null) { + _validatePreferenceSnapshot( + data['preferences'], + section, + _devicePrefix(sourcePublicKey), + ); + } + } + final node = _sectionData(sectionData, BackupSection.nodeSettings); + final location = _sectionData(sectionData, BackupSection.locationSettings); + final importingIdentity = selectedItems.contains(BackupItem.privateKey); + final destinationPublicKey = importingIdentity + ? sourcePublicKey + : _normalizePublicKey(connector.selfPublicKeyHex); + final restoreContacts = selectedItems.any( + (item) => _sectionForItem(item) == BackupSection.contacts, + ); + final restoreChannels = selectedItems.any( + (item) => _sectionForItem(item) == BackupSection.channels, + ); + if (importingIdentity && + (sourcePublicKey.isEmpty || + _normalizePublicKey(node?['publicKey'] as String? ?? '') != + sourcePublicKey)) { + throw const FormatException('Backup radio identity is invalid'); + } + if (selectedItems.any(_requiresRadioConnection)) { + _requireConnected(connector); + if ((restoreContacts || restoreChannels) && + destinationPublicKey.length < 10) { + throw StateError('Wait for radio identity to finish loading'); + } + } + if (node != null) { + final name = node['name']; + if (selectedItems.contains(BackupItem.deviceName) && name is String) { + await connector.setNodeName(name); + } + final radio = _asMap(node['radio']); + if (selectedItems.contains(BackupItem.radioSettings) && radio != null) { + final frequencyHz = radio['frequencyHz']; + final bandwidthHz = radio['bandwidthHz']; + final spreadingFactor = radio['spreadingFactor']; + final codingRate = radio['codingRate']; + if (frequencyHz is int && + bandwidthHz is int && + spreadingFactor is int && + codingRate is int) { + final accepted = await connector.setRadioParams( + frequencyHz, + bandwidthHz, + spreadingFactor, + codingRate, + clientRepeat: + connector.supportsAllowedRepeatFreq && + radio['clientRepeat'] is bool + ? radio['clientRepeat'] as bool + : null, + ); + if (!accepted) throw StateError('The radio rejected its settings'); + } + final txPowerDbm = radio['txPowerDbm']; + if (txPowerDbm is int) { + await connector.sendFrame( + buildSetRadioTxPowerFrame(txPowerDbm), + waitForGenericAck: true, + ); + } + final pathHashByteWidth = radio['pathHashByteWidth']; + if (pathHashByteWidth is int && connector.supportsPathHashMode) { + await connector.setPathHashMode(pathHashByteWidth - 1); + } + final defaultFloodScope = radio['defaultFloodScope']; + if (defaultFloodScope is String && + connector.supportsDefaultFloodScope) { + await connector.setDefaultFloodScope(defaultFloodScope); + } + } + if (selectedItems.contains(BackupItem.privateKey)) { + await connector.importPrivateKey(_decodePrivateKey(node['privateKey'])); + } + if (selectedItems.contains(BackupItem.regions)) { + await _restorePreferences( + node['preferences'], + section: BackupSection.nodeSettings, + items: selectedItems, + sourcePublicKey: sourcePublicKey, + destinationPublicKey: destinationPublicKey, + ); + } + } + + if (location != null) { + final locationData = _asMap(location['location']); + final latitude = locationData?['latitude']; + final longitude = locationData?['longitude']; + if (selectedItems.contains(BackupItem.location)) { + if (latitude is num && longitude is num) { + await connector.setNodeLocation( + lat: latitude.toDouble(), + lon: longitude.toDouble(), + ); + } + final gpsEnabled = location['gpsEnabled']; + if (gpsEnabled is bool) { + await connector.setCustomVar(gpsEnabled ? 'gps:1' : 'gps:0'); + } + final gpsInterval = location['gpsIntervalSeconds']; + if (gpsInterval is int) { + if (gpsInterval < 0 || gpsInterval >= 86400) { + throw const FormatException('Invalid GPS interval in backup'); + } + await appSettingsService.setGpsIntervalSeconds( + gpsInterval, + writeToDevice: (value) => + connector.setCustomVar('gps_interval:$value'), + ); + } + } + final contactSettings = _asMap(location['contactSettings']); + if (selectedItems.contains(BackupItem.contactSettings) && + contactSettings != null) { + if (connector.supportsAutoAddConfig) { + await connector.sendFrame( + buildSetAutoAddConfigFrame( + autoAddChat: contactSettings['autoAddChat'] == true, + autoAddRepeater: contactSettings['autoAddRepeater'] == true, + autoAddRoomServer: contactSettings['autoAddRoomServer'] == true, + autoAddSensor: contactSettings['autoAddSensor'] == true, + overwriteOldest: contactSettings['overwriteOldest'] == true, + maxHops: contactSettings['maxHops'] is int + ? contactSettings['maxHops'] as int + : null, + ), + waitForGenericAck: true, + ); + } + final evict = contactSettings['evictDiscoveredContactsEnabled']; + if (evict is bool) { + await appSettingsService.setEvictDiscoveredContactsEnabled(evict); + } + } + final privacy = _asMap(location['privacySettings']); + if (selectedItems.contains(BackupItem.privacySettings) && + privacy != null) { + await connector.setTelemetryModeBase( + _intOr(privacy['telemetryBase'], connector.telemetryModeBase), + _intOr(privacy['telemetryLocation'], connector.telemetryModeLoc), + _intOr(privacy['telemetryEnvironment'], connector.telemetryModeEnv), + _intOr(privacy['advertLocation'], connector.advertLocationPolicy), + _intOr(privacy['multiAcks'], connector.multiAcks), + ); + final autoZeroHop = privacy['autoSendZeroHopAdvertOnGpsUpdate']; + if (autoZeroHop is bool) { + await appSettingsService.setAutoSendZeroHopAdvertOnGpsUpdate( + autoZeroHop, + ); + } + final autoFlood = privacy['autoSendSelfAdvertAsFlood']; + final appSettingsJson = appSettingsService.settings.toJson(); + if (autoFlood is bool && + appSettingsJson.containsKey('auto_send_self_advert_as_flood')) { + await appSettingsService.updateSettings( + AppSettings.fromJson({ + ...appSettingsJson, + 'auto_send_self_advert_as_flood': autoFlood, + }), + ); + } + } + } + + for (final section in BackupSection.values) { + final sectionItems = selectedItems + .where((item) => _sectionForItem(item) == section) + .toSet(); + if (sectionItems.isEmpty || + section == BackupSection.nodeSettings || + section == BackupSection.locationSettings) { + continue; + } + final data = _sectionData(sectionData, section); + if (data != null) { + await _restorePreferences( + data['preferences'], + section: section, + items: sectionItems, + sourcePublicKey: sourcePublicKey, + destinationPublicKey: destinationPublicKey, + ); + } + } + if (selectedItems.contains(BackupItem.contacts)) { + await _restoreRadioContacts(connector, destinationPublicKey); + } + if (selectedItems.contains(BackupItem.channels)) { + await _restoreRadioChannels(connector, destinationPublicKey); + } + } + + Future _restoreRadioContacts( + MeshCoreConnector connector, + String publicKey, + ) async { + final store = ContactStore()..setPublicKeyHex = publicKey; + final contacts = await store.loadContacts(); + for (final contact in contacts) { + if (contact.publicKeyHex.toUpperCase() == publicKey.toUpperCase()) { + continue; + } + Contact? existing; + for (final candidate in connector.contacts) { + if (candidate.publicKeyHex == contact.publicKeyHex) { + existing = candidate; + break; + } + } + final pathLengthValue = existing?.pathLength ?? contact.pathLength; + final pathHashWidth = existing?.pathHashWidth ?? contact.pathHashWidth; + final pathLength = pathLengthValue < 0 + ? 0xff + : (pathLengthValue & 0x3f) | (((pathHashWidth - 1) & 0x03) << 6); + await connector.sendFrame( + buildUpdateContactPathFrame( + contact.publicKey, + existing?.path ?? contact.path, + pathLength, + type: contact.type, + flags: contact.flags, + name: contact.name, + lat: contact.latitude, + lon: contact.longitude, + lastAdvert: contact.lastSeen, + lastModified: contact.lastModified, + ), + waitForGenericAck: true, + ); + } + } + + Future _restoreRadioChannels( + MeshCoreConnector connector, + String publicKey, + ) async { + final store = ChannelStore()..setPublicKeyHex = publicKey; + final channels = await store.loadChannels(); + for (final channel in channels) { + await connector.sendFrame( + buildSetChannelFrame(channel.index, channel.name, channel.psk), + waitForGenericAck: true, + ); + } + } + + static String _encodePrettyBackup(Object payload) { + final pretty = const JsonEncoder.withIndent(' ').convert(payload); + return pretty.replaceAllMapped( + RegExp(r'("path_bytes"\s*:\s*)\[\s*([0-9,\s]*?)\s*\]'), + (match) { + final values = match[2]! + .split(',') + .map((value) => value.trim()) + .where((value) => value.isNotEmpty); + return '${match[1]}[${values.join(', ')}]'; + }, + ); + } + + static Future encodeBackup( + Map payload, { + required String password, + }) async { + final plainText = jsonEncode(payload); + if (password.isEmpty) { + return _encodePrettyBackup(payload); + } + + final salt = _secureBytes(16); + final nonce = _secureBytes(12); + final key = await _deriveKey(password, salt, _pbkdf2Iterations); + final box = await AesGcm.with256bits().encrypt( + utf8.encode(plainText), + secretKey: key, + nonce: nonce, + ); + return const JsonEncoder.withIndent(' ').convert({ + 'format': _encryptedBackupFormat, + 'version': _backupVersion, + 'kdf': 'PBKDF2-HMAC-SHA256', + 'iterations': _pbkdf2Iterations, + 'cipher': 'AES-256-GCM', + 'salt': base64Encode(salt), + 'nonce': base64Encode(nonce), + 'ciphertext': base64Encode(box.cipherText), + 'tag': base64Encode(box.mac.bytes), + }); + } + + static Future> decodeBackup( + String contents, { + required String password, + }) async { + final decoded = jsonDecode(contents); + if (decoded is! Map) { + throw const FormatException('Invalid backup file'); + } + if (decoded['format'] == _encryptedBackupFormat) { + if (password.isEmpty) throw const FormatException('Password required'); + if (decoded['version'] != _backupVersion || + decoded['kdf'] != 'PBKDF2-HMAC-SHA256' || + decoded['cipher'] != 'AES-256-GCM') { + throw const FormatException('Unsupported encrypted backup format'); + } + final iterations = decoded['iterations']; + if (iterations is! int || iterations < 100000 || iterations > 1000000) { + throw const FormatException('Invalid password derivation settings'); + } + try { + final salt = base64Decode(decoded['salt'] as String); + final nonce = base64Decode(decoded['nonce'] as String); + final ciphertext = base64Decode(decoded['ciphertext'] as String); + final tag = base64Decode(decoded['tag'] as String); + if (salt.length != 16 || nonce.length != 12 || tag.length != 16) { + throw const FormatException('Invalid encrypted backup'); + } + final key = await _deriveKey(password, salt, iterations); + final plaintext = await AesGcm.with256bits().decrypt( + SecretBox(ciphertext, nonce: nonce, mac: Mac(tag)), + secretKey: key, + ); + return _validatePayload(jsonDecode(utf8.decode(plaintext))); + } on FormatException { + rethrow; + } catch (_) { + throw const FormatException('Wrong password or damaged backup'); + } + } + return _validatePayload(decoded); + } + + static Object? _decodeJson(String contents) { + try { + return jsonDecode(contents); + } on FormatException { + final repaired = contents.replaceFirstMapped( + RegExp(r'("name"\s*:\s*"(?:\\.|[^"\\])*"\s*)(?=\s*"public_key"\s*:)'), + (match) => '${match[1]},', + ); + if (repaired == contents) rethrow; + return jsonDecode(repaired); + } + } + + static bool _isOfficialBackup(Object? value) => + value is Map && + value.containsKey('public_key') && + (value.containsKey('private_key') || + value.containsKey('radio_settings') || + value.containsKey('channels') || + value.containsKey('contacts')); + + static Set _availableItems(Map payload) { + final rawItems = payload['items']; + if (rawItems is! List) return {}; + final available = {}; + for (final name in rawItems.whereType()) { + for (final item in BackupItem.values) { + if (item.name == name) available.add(item); + } + } + return available; + } + + static Map _normalizeOfficialBackup( + Map source, + ) { + final publicKey = _normalizePublicKey( + source['public_key'] as String? ?? '', + ); + if (publicKey.isEmpty) throw const FormatException('Invalid public key'); + final devicePrefix = _devicePrefix(publicKey); + final sections = {}; + final items = {}; + + final node = {}; + if (source['name'] is String) { + node['name'] = source['name']; + items.add(BackupItem.deviceName); + } + node['publicKey'] = publicKey; + items.add(BackupItem.publicKey); + final privateKey = _decodeHex(source['private_key'], length: 64); + if (privateKey != null) { + node['privateKey'] = base64Encode(privateKey); + items.add(BackupItem.privateKey); + } + final sourceRadio = _asMap(source['radio_settings']); + if (sourceRadio != null) { + final radio = {}; + final frequency = _asNumber(sourceRadio['frequency']); + final bandwidth = _asNumber(sourceRadio['bandwidth']); + final spreadingFactor = _asNumber(sourceRadio['spreading_factor']); + final codingRate = _asNumber(sourceRadio['coding_rate']); + final txPower = _asNumber(sourceRadio['tx_power']); + if (frequency != null) { + radio['frequencyHz'] = frequency < 10000000 + ? frequency * 1000 + : frequency; + } + if (bandwidth != null) radio['bandwidthHz'] = bandwidth; + if (spreadingFactor != null) radio['spreadingFactor'] = spreadingFactor; + if (codingRate != null) radio['codingRate'] = codingRate; + if (txPower != null) radio['txPowerDbm'] = txPower; + if (radio.isNotEmpty) { + node['radio'] = radio; + items.add(BackupItem.radioSettings); + } + } + if (node.isNotEmpty) sections[BackupSection.nodeSettings.name] = node; + + final position = _asMap(source['position_settings']); + if (position != null) { + final latitude = _asDouble(position['latitude']); + final longitude = _asDouble(position['longitude']); + if (latitude != null && longitude != null) { + sections[BackupSection.locationSettings.name] = { + 'location': { + 'latitude': latitude, + 'longitude': longitude, + }, + }; + items.add(BackupItem.location); + } + } + final autoAdd = _asMap(source['auto_add_settings']); + if (autoAdd != null && autoAdd.isNotEmpty) { + final location = + _asMap(sections[BackupSection.locationSettings.name]) ?? {}; + location['contactSettings'] = { + 'autoAddChat': autoAdd['auto_add_chat'], + 'autoAddRepeater': autoAdd['auto_add_repeater'], + 'autoAddRoomServer': autoAdd['auto_add_room_server'], + 'autoAddSensor': autoAdd['auto_add_sensor'], + 'overwriteOldest': autoAdd['overwrite_oldest'], + 'maxHops': _asNumber(autoAdd['auto_add_max_hops']), + }; + sections[BackupSection.locationSettings.name] = location; + items.add(BackupItem.contactSettings); + } + final other = _asMap(source['other_settings']); + if (other?.containsKey('advert_location_policy') ?? false) { + final location = + _asMap(sections[BackupSection.locationSettings.name]) ?? {}; + location['privacySettings'] = { + 'advertLocation': _asNumber(other!['advert_location_policy']), + }; + sections[BackupSection.locationSettings.name] = location; + items.add(BackupItem.privacySettings); + } + + final channels = source['channels']; + if (channels is List) { + final stored = >[]; + for (var i = 0; i < channels.length; i++) { + final entry = _asMap(channels[i]); + if (entry == null || entry['name'] is! String) continue; + final psk = _decodeHex(entry['secret'], length: 16); + if (psk == null) continue; + stored.add({ + 'index': i, + 'name': entry['name'], + 'psk': base64Encode(psk), + 'unreadCount': 0, + }); + } + sections[BackupSection.channels.name] = { + 'preferences': {'channels$devicePrefix': jsonEncode(stored)}, + }; + items.add(BackupItem.channels); + } + + final contacts = source['contacts']; + if (contacts is List) { + final stored = >[]; + for (final entry in contacts) { + final contact = _asMap(entry); + if (contact == null) continue; + final key = _decodeHex(contact['public_key'], length: 32); + if (key == null) continue; + final path = _parseOfficialPath(contact['out_path_list']); + final advertSeconds = _asNumber(contact['last_advert']) ?? 0; + final modifiedSeconds = _asNumber(contact['last_modified']); + final latitude = _asDouble(contact['latitude']); + final longitude = _asDouble(contact['longitude']); + final name = + contact['custom_name'] is String && + (contact['custom_name'] as String).isNotEmpty + ? contact['custom_name'] as String + : contact['name'] as String? ?? ''; + stored.add({ + 'publicKey': base64Encode(key), + 'name': name, + 'type': _asNumber(contact['type']) ?? 0, + 'flags': _asNumber(contact['flags']) ?? 0, + 'pathLength': path.$2, + 'path': base64Encode(path.$1), + 'pathHashWidth': path.$1.isEmpty ? 1 : 2, + 'pathOverride': null, + 'pathOverrideBytes': null, + 'latitude': latitude, + 'longitude': longitude, + 'lastSeen': advertSeconds * 1000, + 'lastModified': modifiedSeconds == null + ? null + : modifiedSeconds * 1000, + 'lastMessageAt': advertSeconds * 1000, + 'isActive': true, + 'rawPacket': null, + 'telemetryFixAt': null, + }); + } + sections[BackupSection.contacts.name] = { + 'preferences': {'contacts$devicePrefix': jsonEncode(stored)}, + }; + items.add(BackupItem.contacts); + } + + return { + 'format': _backupFormat, + 'version': _backupVersion, + 'sourcePublicKey': publicKey, + 'items': items.map((item) => item.name).toList(), + 'sections': sections, + }; + } + + static Uint8List? _decodeHex(Object? value, {required int length}) { + if (value is! String || + value.length != length * 2 || + !RegExp(r'^[0-9a-fA-F]+$').hasMatch(value)) { + return null; + } + return Uint8List.fromList([ + for (var i = 0; i < value.length; i += 2) + int.parse(value.substring(i, i + 2), radix: 16), + ]); + } + + static (Uint8List, int) _parseOfficialPath(Object? value) { + if (value == null) return (Uint8List(0), -1); + if (value is! String || value.isEmpty) return (Uint8List(0), 0); + final bytes = []; + for (final part in value.split(',')) { + final hash = _decodeHex(part, length: 2); + if (hash == null) return (Uint8List(0), -1); + bytes.addAll(hash); + } + return (Uint8List.fromList(bytes), bytes.length ~/ 2); + } + + static int? _asNumber(Object? value) { + if (value is int) return value; + if (value is num) return value.toInt(); + if (value is String) return num.tryParse(value)?.toInt(); + return null; + } + + static double? _asDouble(Object? value) { + if (value is num) return value.toDouble(); + if (value is String) return double.tryParse(value); + return null; + } + + static Map _validatePayload(Object? value) { + if (value is! Map || + value['format'] != _backupFormat || + value['version'] != _backupVersion || + value['sections'] is! Map || + value['items'] is! List || + !(value['items'] as List).every((item) => item is String)) { + throw const FormatException('Invalid or unsupported backup file'); + } + return value; + } + + static void _requireConnected(MeshCoreConnector connector) { + if (!connector.isConnected) { + throw StateError( + 'Connect to the radio to back up or restore its settings', + ); + } + } + + static Uint8List _decodePrivateKey(Object? value) { + if (value is! String) { + throw const FormatException('Backup has no private key'); + } + final bytes = Uint8List.fromList(base64Decode(value)); + if (bytes.length != 64) throw const FormatException('Invalid private key'); + return bytes; + } + + static Map? _sectionData( + Map sectionData, + BackupSection section, + ) => _asMap(sectionData[section.name]); + + static Map? _asMap(Object? value) => + value is Map ? value : null; + + static Map? _asJsonMapPreference(Object? value) { + final map = _asMap(value); + if (map != null || value is! String) return map; + try { + return _asMap(jsonDecode(value)); + } on FormatException { + return null; + } + } + + static int _intOr(Object? value, int fallback) => + value is int ? value : fallback; + + static Map _snapshotPreferences( + bool Function(String) include, + ) { + final prefs = PrefsManager.instance; + final values = {}; + for (final key in prefs.getKeys()) { + if (!include(key)) continue; + final value = prefs.get(key); + if (value is String) { + values[key] = _expandJsonPreference(value); + } else if (value is bool || value is int || value is double) { + values[key] = value; + } else if (value is List) { + values[key] = value; + } + } + return values; + } + + static Object _expandJsonPreference(String value) { + try { + final decoded = jsonDecode(value); + if (decoded is Map || + (decoded is List && + decoded.isNotEmpty && + decoded.any((item) => item is! String))) { + return _formatBackupJsonValue(decoded)!; + } + } on FormatException { + return value; + } + return value; + } + + static Object? _formatBackupJsonValue(Object? value) { + if (value is Map) { + return { + for (final entry in value.entries) + entry.key.toString(): _formatBackupJsonValue(entry.value), + }; + } + if (value is List) { + return value.map(_formatBackupJsonValue).toList(); + } + return value; + } + + static Map _snapshotAppSettingsPreferences( + Set items, + ) { + final values = _snapshotPreferences( + (key) => _preferenceBelongsToItems(key, items, ''), + ); + final appSettings = _asMap(values['app_settings']); + if (values.containsKey('app_settings') && appSettings == null) { + throw StateError('Cannot safely filter sensitive app settings'); + } + if (appSettings == null) return values; + + final includesAllSettings = items.contains(BackupItem.appSettings); + appSettings.removeWhere((key, _) { + if (key == 'upload_ipfs_api_key') { + return !items.contains(BackupItem.ipfsKey); + } + if (key == 'map_tile_api_key') { + return !items.contains(BackupItem.stadiaMapKey); + } + return !includesAllSettings; + }); + values['app_settings'] = appSettings; + return values; + } + + static BackupSection _sectionForItem(BackupItem item) => switch (item) { + BackupItem.deviceName || + BackupItem.privateKey || + BackupItem.publicKey || + BackupItem.radioSettings || + BackupItem.regions => BackupSection.nodeSettings, + BackupItem.location || + BackupItem.contactSettings || + BackupItem.privacySettings => BackupSection.locationSettings, + BackupItem.appSettings || + BackupItem.ipfsKey || + BackupItem.stadiaMapKey => BackupSection.appSettings, + BackupItem.contacts || + BackupItem.perContactSettings || + BackupItem.contactGroups || + BackupItem.contactHistory => BackupSection.contacts, + BackupItem.discoveredContacts => BackupSection.discoveredContacts, + BackupItem.channels || + BackupItem.channelFilters || + BackupItem.channelSettings || + BackupItem.communities || + BackupItem.channelHistory => BackupSection.channels, + }; + + static bool _requiresRadioConnection(BackupItem item) => + _sectionForItem(item) != BackupSection.appSettings && + item != BackupItem.channelFilters; + + static bool _preferenceBelongsToItems( + String key, + Set items, + String devicePrefix, + ) { + if (items.contains(BackupItem.regions) && key == 'regions') return true; + if (key == 'app_settings' && + (items.contains(BackupItem.appSettings) || + items.contains(BackupItem.ipfsKey) || + items.contains(BackupItem.stadiaMapKey))) { + return true; + } + if (items.contains(BackupItem.appSettings) && + key != 'app_settings' && + _preferenceBelongsToSection(key, BackupSection.appSettings)) { + return true; + } + if (items.contains(BackupItem.contacts) && + key.startsWith('contacts$devicePrefix')) { + return true; + } + if (items.contains(BackupItem.perContactSettings) && + (key.startsWith('contact_smaz_$devicePrefix') || + key.startsWith('contact_cyr2lat_$devicePrefix') || + key.startsWith('contact_url_images_$devicePrefix'))) { + return true; + } + if (items.contains(BackupItem.contactGroups) && + key.startsWith('contact_groups$devicePrefix')) { + return true; + } + if (items.contains(BackupItem.contactHistory) && + (key.startsWith('messages_$devicePrefix') || + key.startsWith('path_history_$devicePrefix') || + key.startsWith('contact_unread_count$devicePrefix'))) { + return true; + } + if (items.contains(BackupItem.discoveredContacts) && + key.startsWith('discovered_contacts$devicePrefix')) { + return true; + } + if (items.contains(BackupItem.channels) && + (key.startsWith('channels$devicePrefix') || + key.startsWith('channel_slot_ids_$devicePrefix'))) { + return true; + } + if (items.contains(BackupItem.channelFilters) && + key.startsWith('message_filter_')) { + return true; + } + if (items.contains(BackupItem.channelSettings) && + (key.startsWith('channel_smaz_$devicePrefix') || + key.startsWith('channel_cyr2lat_$devicePrefix') || + key.startsWith('channel_url_images_$devicePrefix') || + key.startsWith('channel_region_$devicePrefix') || + key.startsWith('default_region_$devicePrefix') || + key.startsWith('channel_order_$devicePrefix'))) { + return true; + } + if (items.contains(BackupItem.communities) && + key.startsWith('communities_v1$devicePrefix')) { + return true; + } + if (items.contains(BackupItem.channelHistory) && + key.startsWith('channel_messages_$devicePrefix')) { + return true; + } + return false; + } + + static bool _preferenceBelongsToSection( + String key, + BackupSection section, { + String devicePrefix = '', + }) { + switch (section) { + case BackupSection.nodeSettings: + return key == 'regions'; + case BackupSection.locationSettings: + return false; + case BackupSection.contacts: + return _startsWithScopedPrefix( + key, + _contactPreferencePrefixes, + devicePrefix, + ); + case BackupSection.discoveredContacts: + return _startsWithScopedPrefix(key, const [ + 'discovered_contacts', + ], devicePrefix); + case BackupSection.channels: + return key.startsWith('message_filter_') || + _startsWithScopedPrefix( + key, + _channelPreferencePrefixes, + devicePrefix, + ); + case BackupSection.appSettings: + return !key.startsWith('flutter.') && + key != 'regions' && + !_startsWithAny(key, _scopedPreferencePrefixes); + } + } + + static bool _startsWithScopedPrefix( + String key, + List prefixes, + String devicePrefix, + ) => + devicePrefix.isNotEmpty && + prefixes.any((prefix) => key.startsWith('$prefix$devicePrefix')); + + static bool _startsWithAny(String value, List prefixes) => + prefixes.any(value.startsWith); + + static bool _isSupportedPreferenceValue(Object? value) => + value is String || + value is bool || + value is int || + value is double || + value is Map || + value is List; + + static void _validatePreferenceSnapshot( + Object? rawValues, + BackupSection section, + String devicePrefix, + ) { + if (rawValues == null) return; + final values = _asMap(rawValues); + if (values == null) { + throw const FormatException('Invalid backup preferences'); + } + for (final entry in values.entries) { + if (!_preferenceBelongsToSection( + entry.key, + section, + devicePrefix: devicePrefix, + )) { + throw FormatException('Backup preference is outside ${section.name}'); + } + if (!_isSupportedPreferenceValue(entry.value)) { + throw FormatException('Invalid preference value for ${entry.key}'); + } + } + } + + static Future _restorePreferences( + Object? rawValues, { + required BackupSection section, + required Set items, + required String sourcePublicKey, + required String destinationPublicKey, + }) async { + _validatePreferenceSnapshot( + rawValues, + section, + _devicePrefix(sourcePublicKey), + ); + final values = _asMap(rawValues); + if (values == null) return; + final prefs = PrefsManager.instance; + final sourcePrefix = _devicePrefix(sourcePublicKey); + final destinationPrefix = _devicePrefix(destinationPublicKey); + final existingAppSettings = _asJsonMapPreference( + prefs.getString('app_settings'), + ); + final matching = prefs.getKeys().where((key) { + if (section == BackupSection.appSettings && + key == 'app_settings' && + !items.contains(BackupItem.appSettings)) { + return false; + } + if (!_preferenceBelongsToSection( + key, + section, + devicePrefix: destinationPrefix, + ) || + !_preferenceBelongsToItems(key, items, destinationPrefix)) { + return false; + } + if (section == BackupSection.appSettings || + section == BackupSection.nodeSettings) { + return true; + } + return _hasDevicePrefix(key, section, destinationPrefix) || + (section == BackupSection.channels && + key.startsWith('message_filter_')); + }).toList(); + for (final key in matching) { + await prefs.remove(key); + } + for (final entry in values.entries) { + if (!_preferenceBelongsToItems(entry.key, items, sourcePrefix)) { + continue; + } + final key = _remapKey( + entry.key, + section, + sourcePrefix, + destinationPrefix, + ); + final value = entry.value; + if (section == BackupSection.appSettings && key == 'app_settings') { + final storedIncoming = _asJsonMapPreference(value); + if (storedIncoming == null) { + throw const FormatException('Invalid app settings in backup'); + } + final incoming = Map.from(storedIncoming); + final merged = _mergeSensitiveAppSettings( + existing: existingAppSettings, + incoming: incoming, + items: items, + ); + await prefs.setString(key, jsonEncode(merged)); + } else if (value is String) { + await prefs.setString(key, value); + } else if (value is bool) { + await prefs.setBool(key, value); + } else if (value is int) { + await prefs.setInt(key, value); + } else if (value is double) { + await prefs.setDouble(key, value); + } else if (value is Map || + (value is List && value.any((item) => item is! String))) { + await prefs.setString(key, jsonEncode(value)); + } else if (value is List && value.every((item) => item is String)) { + await prefs.setStringList(key, value.cast()); + } else { + throw FormatException('Invalid preference value for $key'); + } + } + } + + static Map _mergeSensitiveAppSettings({ + required Map? existing, + required Map incoming, + required Set items, + }) { + final includesAll = items.contains(BackupItem.appSettings); + final result = Map.from( + includesAll ? incoming : (existing ?? const {}), + ); + const sensitiveKeys = { + BackupItem.ipfsKey: 'upload_ipfs_api_key', + BackupItem.stadiaMapKey: 'map_tile_api_key', + }; + for (final entry in sensitiveKeys.entries) { + if (items.contains(entry.key)) { + if (incoming.containsKey(entry.value)) { + result[entry.value] = incoming[entry.value]; + } + } else if (includesAll && existing?.containsKey(entry.value) == true) { + result[entry.value] = existing![entry.value]; + } + } + return result; + } + + static String _remapKey( + String key, + BackupSection section, + String sourcePrefix, + String destinationPrefix, + ) { + if (sourcePrefix.isEmpty || destinationPrefix.isEmpty) return key; + final prefixes = switch (section) { + BackupSection.contacts => _contactPreferencePrefixes, + BackupSection.discoveredContacts => const ['discovered_contacts'], + BackupSection.channels => _channelPreferencePrefixes, + _ => const [], + }; + for (final prefix in prefixes) { + final scopedPrefix = '$prefix$sourcePrefix'; + if (key.startsWith(scopedPrefix)) { + return '$prefix$destinationPrefix${key.substring(scopedPrefix.length)}'; + } + } + return key; + } + + static bool _hasDevicePrefix( + String key, + BackupSection section, + String devicePrefix, + ) { + if (section == BackupSection.channels && + key.startsWith('message_filter_')) { + return true; + } + if (devicePrefix.isEmpty) return false; + final prefixes = switch (section) { + BackupSection.contacts => _contactPreferencePrefixes, + BackupSection.discoveredContacts => const ['discovered_contacts'], + BackupSection.channels => _channelPreferencePrefixes, + _ => const [], + }; + return prefixes.any((prefix) => key.startsWith('$prefix$devicePrefix')); + } + + static String _normalizePublicKey(String publicKey) => + RegExp(r'^[0-9a-fA-F]{64}$').hasMatch(publicKey) + ? publicKey.toLowerCase() + : ''; + + static String _devicePrefix(String publicKey) { + final normalized = _normalizePublicKey(publicKey); + return normalized.isEmpty ? '' : normalized.substring(0, 10); + } + + static Uint8List _secureBytes(int length) { + final random = Random.secure(); + return Uint8List.fromList( + List.generate(length, (_) => random.nextInt(256)), + ); + } + + static Future _deriveKey( + String password, + List salt, + int iterations, + ) => Pbkdf2.hmacSha256( + iterations: iterations, + bits: 256, + ).deriveKey(secretKey: SecretKey(utf8.encode(password)), nonce: salt); +} diff --git a/test/services/backup_service_test.dart b/test/services/backup_service_test.dart new file mode 100644 index 00000000..9cf07dd4 --- /dev/null +++ b/test/services/backup_service_test.dart @@ -0,0 +1,305 @@ +import 'dart:convert'; + +import 'package:flutter_test/flutter_test.dart'; +import 'package:meshcore_open/connector/meshcore_connector.dart'; +import 'package:meshcore_open/models/app_settings.dart'; +import 'package:meshcore_open/services/app_settings_service.dart'; +import 'package:meshcore_open/services/backup_service.dart'; +import 'package:meshcore_open/storage/prefs_manager.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +void main() { + const payload = { + 'format': 'meshcore-open-backup', + 'version': 1, + 'sourcePublicKey': '0011223344', + 'items': ['privateKey'], + 'sections': { + 'nodeSettings': {'privateKey': 'private-key-data'}, + }, + }; + + group('BackupService creation', () { + test( + 'expands stored JSON for readability and retains banner preferences', + () async { + SharedPreferences.setMockInitialValues({ + 'app_settings': jsonEncode({ + 'theme_mode': 'dark', + 'upload_ipfs_api_key': 'ipfs-secret', + 'map_tile_api_key': 'stadia-secret', + 'custom_themes': [ + {'name': 'Example'}, + ], + 'path_history_sample': { + 'path_bytes': [1, 16, 255], + }, + }), + 'node_banner_txt': 'banner text', + 'node_banner_expires_ms': 123, + }); + PrefsManager.reset(); + await PrefsManager.initialize(); + addTearDown(PrefsManager.reset); + final connector = MeshCoreConnector(); + addTearDown(connector.dispose); + + final json = await const BackupService().createBackup( + items: {BackupItem.appSettings}, + connector: connector, + settings: AppSettings(), + password: '', + ); + final payload = jsonDecode(json) as Map; + expect(payload['items'], [BackupItem.appSettings.name]); + final preferences = + (payload['sections'] as Map)['appSettings'] + as Map; + final values = preferences['preferences'] as Map; + expect(values['app_settings'], isA>()); + final appSettings = values['app_settings'] as Map; + expect(appSettings, isNot(contains('upload_ipfs_api_key'))); + expect(appSettings, isNot(contains('map_tile_api_key'))); + expect(values['node_banner_txt'], 'banner text'); + expect(values['node_banner_expires_ms'], 123); + expect(json, contains('"theme_mode": "dark"')); + expect(json, contains('"path_bytes": [1, 16, 255]')); + expect(json, isNot(contains('ipfs-secret'))); + expect(json, isNot(contains('stadia-secret'))); + final inspected = await const BackupService().inspectImport( + contents: json, + password: '', + ); + expect(inspected.availableItems, contains(BackupItem.appSettings)); + expect(inspected.availableItems, isNot(contains(BackupItem.ipfsKey))); + expect( + inspected.availableItems, + isNot(contains(BackupItem.stadiaMapKey)), + ); + final settingsService = AppSettingsService(); + addTearDown(settingsService.dispose); + await const BackupService().restoreBackup( + contents: json, + password: '', + items: {BackupItem.appSettings}, + connector: connector, + appSettingsService: settingsService, + ); + final restored = + jsonDecode(PrefsManager.instance.getString('app_settings')!) + as Map; + expect( + (restored['path_history_sample'] + as Map)['path_bytes'], + [1, 16, 255], + ); + }, + ); + + test('backs up a sensitive key without unrelated app settings', () async { + SharedPreferences.setMockInitialValues({ + 'app_settings': jsonEncode({ + 'theme_mode': 'dark', + 'upload_ipfs_api_key': 'ipfs-secret', + 'map_tile_api_key': 'stadia-secret', + }), + }); + PrefsManager.reset(); + await PrefsManager.initialize(); + addTearDown(PrefsManager.reset); + final connector = MeshCoreConnector(); + addTearDown(connector.dispose); + + final json = await const BackupService().createBackup( + items: {BackupItem.ipfsKey}, + connector: connector, + settings: AppSettings(), + password: '', + ); + final payload = jsonDecode(json) as Map; + expect(payload['items'], [BackupItem.ipfsKey.name]); + final section = + (payload['sections'] as Map)['appSettings'] + as Map; + final preferences = section['preferences'] as Map; + expect(preferences.keys, {'app_settings'}); + expect(preferences['app_settings'], { + 'upload_ipfs_api_key': 'ipfs-secret', + }); + expect(json, isNot(contains('stadia-secret'))); + }); + + test( + 'restores a selected key without replacing other app preferences', + () async { + SharedPreferences.setMockInitialValues({ + 'app_settings': jsonEncode({ + 'theme_mode': 'light', + 'upload_ipfs_api_key': 'old-ipfs', + 'map_tile_api_key': 'existing-stadia', + }), + }); + PrefsManager.reset(); + await PrefsManager.initialize(); + addTearDown(PrefsManager.reset); + final connector = MeshCoreConnector(); + final settingsService = AppSettingsService(); + addTearDown(connector.dispose); + addTearDown(settingsService.dispose); + + final backup = await BackupService.encodeBackup({ + 'format': 'meshcore-open-backup', + 'version': 1, + 'sourcePublicKey': '', + 'items': [BackupItem.ipfsKey.name], + 'sections': { + 'appSettings': { + 'preferences': { + 'app_settings': {'upload_ipfs_api_key': 'new-ipfs'}, + }, + }, + }, + }, password: ''); + await const BackupService().restoreBackup( + contents: backup, + password: '', + items: {BackupItem.ipfsKey}, + connector: connector, + appSettingsService: settingsService, + ); + + final restored = + jsonDecode(PrefsManager.instance.getString('app_settings')!) + as Map; + expect(restored['theme_mode'], 'light'); + expect(restored['upload_ipfs_api_key'], 'new-ipfs'); + expect(restored['map_tile_api_key'], 'existing-stadia'); + }, + ); + }); + + group('BackupService import inspection', () { + test( + 'identifies only the fields present in an official app backup', + () async { + final publicKey = List.filled(32, 'a1').join(); + final contactKey = List.filled(32, 'b2').join(); + final privateKey = List.filled(64, 'c3').join(); + final json = jsonEncode({ + 'name': 'Test node', + 'public_key': publicKey, + 'private_key': privateKey, + 'radio_settings': { + 'frequency': 869618, + 'bandwidth': 62500, + 'spreading_factor': 8, + 'coding_rate': 8, + 'tx_power': 22, + }, + 'position_settings': {'latitude': '47.5', 'longitude': '7.8'}, + 'other_settings': {'advert_location_policy': 0}, + 'auto_add_settings': {'auto_add_chat': true}, + 'channels': [ + {'name': 'Public', 'secret': List.filled(16, '01').join()}, + ], + 'contacts': [ + { + 'type': 1, + 'name': 'Contact', + 'custom_name': null, + 'public_key': contactKey, + 'flags': 0, + 'latitude': '0.0', + 'longitude': '0.0', + 'last_advert': 1, + 'last_modified': 1, + 'out_path_list': null, + }, + ], + }).replaceFirst('"name":"Test node",', '"name":"Test node"'); + + final inspected = await const BackupService().inspectImport( + contents: json, + password: '', + ); + expect(inspected.isOfficial, isTrue); + expect( + inspected.availableItems, + containsAll({ + BackupItem.deviceName, + BackupItem.privateKey, + BackupItem.publicKey, + BackupItem.radioSettings, + BackupItem.location, + BackupItem.contactSettings, + BackupItem.privacySettings, + BackupItem.channels, + BackupItem.contacts, + }), + ); + for (final item in [ + BackupItem.regions, + BackupItem.appSettings, + BackupItem.perContactSettings, + BackupItem.contactGroups, + BackupItem.contactHistory, + BackupItem.discoveredContacts, + BackupItem.channelFilters, + BackupItem.channelSettings, + BackupItem.communities, + BackupItem.channelHistory, + ]) { + expect(inspected.availableItems, isNot(contains(item))); + } + }, + ); + + test('reports only selected sections in a MeshCore Open backup', () async { + final json = await BackupService.encodeBackup({ + ...payload, + 'items': [BackupItem.deviceName.name, BackupItem.channels.name], + }, password: ''); + final inspected = await const BackupService().inspectImport( + contents: json, + password: '', + ); + expect(inspected.isOfficial, isFalse); + expect(inspected.availableItems, { + BackupItem.deviceName, + BackupItem.channels, + }); + }); + }); + + group('BackupService file encoding', () { + test('writes readable JSON when the password is empty', () async { + final file = await BackupService.encodeBackup(payload, password: ''); + expect(jsonDecode(file), payload); + expect(await BackupService.decodeBackup(file, password: ''), payload); + }); + + test('encrypts and restores payload when a password is provided', () async { + final file = await BackupService.encodeBackup( + payload, + password: 'correct horse battery staple', + ); + expect(file, contains('meshcore-open-encrypted-backup')); + expect(file, isNot(contains('private-key-data'))); + expect( + await BackupService.decodeBackup( + file, + password: 'correct horse battery staple', + ), + payload, + ); + }); + + test('rejects a wrong password', () async { + final file = await BackupService.encodeBackup(payload, password: 'right'); + await expectLater( + BackupService.decodeBackup(file, password: 'wrong'), + throwsFormatException, + ); + }); + }); +} diff --git a/untranslated.json b/untranslated.json index c7b11627..e3fb0acb 100644 --- a/untranslated.json +++ b/untranslated.json @@ -8,13 +8,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -41,13 +61,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -74,13 +114,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -107,13 +167,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -140,13 +220,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -173,13 +273,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -206,13 +326,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -239,13 +379,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -272,13 +432,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -305,13 +485,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -338,13 +538,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -371,13 +591,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -404,13 +644,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -437,13 +697,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -470,13 +750,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -503,13 +803,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -536,13 +856,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts",