Feature: Portable Client Settings and Server List #51

Closed
opened 2026-04-26 16:46:08 +00:00 by icub3d · 0 comments
Owner

Migrated from GitHub issue icub3d/decentcom#72
Original Author: @icub3d
Original Date: 2026-04-17T01:35:16Z


Feature: Portable Client Settings and Server List

Overview

When a user imports an existing identity (via seed phrase or backup), they currently start with a fresh client state: an empty server list, default theme, and default app settings. This is because this metadata is stored only in the client's localStorage and is not currently included in the identity recovery process. This feature aims to make the client experience portable by allowing users to export/import their "app state" alongside their identity.

Background

client/src/stores/appStore.ts uses zustand/middleware/persist to save the servers record and theme to localStorage, namespaced by the active public key. While this handles multi-account support on a single device, it doesn't help when moving to a new device. Decentralization means there's no central registry of servers a user has joined, so the client must explicitly "remember" these addresses.

Requirements

  • Users can export their app state (server list, theme, other settings) to a file.
  • Users can import an app state file during or after the setup process.
  • The existing "Key Backup" (.dckb) should optionally include this app metadata.
  • The app state should be encrypted when exported to ensure privacy of joined servers.
  • Developer Testing Assets: Provide deterministic seed phrases and backup files for test accounts (Alice, Bob) that match the server data seeded by scripts/test-setup.py.

Design

API / Interface Changes

  • New or updated Tauri commands in src-tauri/src/lib.rs to handle the extended backup format.
  • Update client/src/services/identity.ts to handle serialization of app state.

Data Model Changes

  • Extend the .dckb (DecentCom Key Backup) format to include an optional encrypted payload for app settings.

Component Changes

  • client/src/stores/appStore.ts: Add methods to serialize/deserialize the store state.
  • client/src/components/backup/KeyExport.tsx: Add a checkbox to "Include server list and settings" in the backup.
  • client/src/pages/Setup.tsx: Update the "Restore from Backup" flow to automatically rehydrate the app store if settings are found in the file.

Task List

Phase 1: Core Logic

  • Define the JSON schema for app state serialization.
  • Update appStore.ts with getStateForBackup() and loadFromBackup() methods.
  • Modify the Rust backend to support an optional encrypted metadata field in the backup file format.

Phase 2: UI & UX

  • Add the "Include Settings" toggle to the KeyExport UI.
  • Update the Setup page restore logic.
  • Add a confirmation dialog after import if settings were found and applied.

Phase 3: Developer Tooling & Testing

  • Generate 24-word seed phrases for the test-setup accounts (Alice, Bob, etc.) that match their seeded pubkeys.
  • Create a utility script to generate .dckb backup files containing Alice's server list.
  • Replace scripts/test-setup.py with a Rust binary at tools/test-setup/ using clap, anyhow, rusqlite, and keyring.

Test List

  • Unit test for app state serialization/deserialization.
  • Manual test: Add several servers, export backup with settings, delete app local storage, restore from backup, verify servers and theme are restored.
  • Verify that a backup without settings still restores the identity correctly.
  • Integration Test: Use the test seed phrase for Alice to import her identity and verify that her server list (Open, Private, Strict) is automatically populated from the import.

Open Questions

  • Should the app state be encrypted with the same passphrase as the key backup? (Recommendation: Yes, for UX simplicity).
  • Should we provide a separate "Settings Only" export/import for users who already have their keys set up?
**Migrated from GitHub issue icub3d/decentcom#72** **Original Author:** @icub3d **Original Date:** 2026-04-17T01:35:16Z --- # Feature: Portable Client Settings and Server List ## Overview When a user imports an existing identity (via seed phrase or backup), they currently start with a fresh client state: an empty server list, default theme, and default app settings. This is because this metadata is stored only in the client's `localStorage` and is not currently included in the identity recovery process. This feature aims to make the client experience portable by allowing users to export/import their "app state" alongside their identity. ## Background `client/src/stores/appStore.ts` uses `zustand/middleware/persist` to save the `servers` record and `theme` to `localStorage`, namespaced by the active public key. While this handles multi-account support on a single device, it doesn't help when moving to a new device. Decentralization means there's no central registry of servers a user has joined, so the client must explicitly "remember" these addresses. ## Requirements - [x] Users can export their app state (server list, theme, other settings) to a file. - [x] Users can import an app state file during or after the setup process. - [x] The existing "Key Backup" (.dckb) should optionally include this app metadata. - [x] The app state should be encrypted when exported to ensure privacy of joined servers. - [x] **Developer Testing Assets**: Provide deterministic seed phrases and backup files for test accounts (Alice, Bob) that match the server data seeded by `scripts/test-setup.py`. ## Design ### API / Interface Changes - New or updated Tauri commands in `src-tauri/src/lib.rs` to handle the extended backup format. - Update `client/src/services/identity.ts` to handle serialization of app state. ### Data Model Changes - Extend the `.dckb` (DecentCom Key Backup) format to include an optional encrypted payload for app settings. ### Component Changes - `client/src/stores/appStore.ts`: Add methods to serialize/deserialize the store state. - `client/src/components/backup/KeyExport.tsx`: Add a checkbox to "Include server list and settings" in the backup. - `client/src/pages/Setup.tsx`: Update the "Restore from Backup" flow to automatically rehydrate the app store if settings are found in the file. ## Task List ### Phase 1: Core Logic - [x] Define the JSON schema for app state serialization. - [x] Update `appStore.ts` with `getStateForBackup()` and `loadFromBackup()` methods. - [x] Modify the Rust backend to support an optional encrypted metadata field in the backup file format. ### Phase 2: UI & UX - [x] Add the "Include Settings" toggle to the `KeyExport` UI. - [x] Update the `Setup` page restore logic. - [x] Add a confirmation dialog after import if settings were found and applied. ### Phase 3: Developer Tooling & Testing - [x] Generate 24-word seed phrases for the `test-setup` accounts (Alice, Bob, etc.) that match their seeded pubkeys. - [x] Create a utility script to generate `.dckb` backup files containing Alice's server list. - [x] Replace `scripts/test-setup.py` with a Rust binary at `tools/test-setup/` using clap, anyhow, rusqlite, and keyring. ## Test List - [x] Unit test for app state serialization/deserialization. - [ ] Manual test: Add several servers, export backup with settings, delete app local storage, restore from backup, verify servers and theme are restored. - [ ] Verify that a backup *without* settings still restores the identity correctly. - [ ] **Integration Test**: Use the test seed phrase for Alice to import her identity and verify that her server list (Open, Private, Strict) is automatically populated from the import. ## Open Questions - Should the app state be encrypted with the same passphrase as the key backup? (Recommendation: Yes, for UX simplicity). - Should we provide a separate "Settings Only" export/import for users who already have their keys set up?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
icub3d/decentcom#51
No description provided.