chore: use encrypted db with default db pass

This commit is contained in:
kaichaosun 2026-04-16 09:14:26 +08:00
parent 81b98be660
commit 3ada077429
No known key found for this signature in database
GPG Key ID: 223E0F992F4F03BF
2 changed files with 5 additions and 1 deletions

View File

@ -78,6 +78,7 @@ Data is stored in the `tmp/chat-cli-data/` directory:
| `<username>_state.json` | CLI state: username↔chat mappings, message history, active chat | | `<username>_state.json` | CLI state: username↔chat mappings, message history, active chat |
| `transport/<username>/` | Inbox directory for receiving messages | | `transport/<username>/` | Inbox directory for receiving messages |
The sqlite tables can be viewed with app `DB Browser for SQLite`, password is `123456`, config use `SQLCipher 4 defaults`.
## Example Session ## Example Session

View File

@ -68,7 +68,10 @@ impl ChatApp {
// Open or create the chat manager with file-based storage // Open or create the chat manager with file-based storage
let manager = ChatManager::new_from_store( let manager = ChatManager::new_from_store(
user_name, user_name,
ChatStorage::new(StorageConfig::File(db_path.to_string_lossy().to_string()))?, ChatStorage::new(StorageConfig::Encrypted {
path: db_path.to_string_lossy().to_string(),
key: "123456".to_string(),
})?,
) )
.context("Failed to open ChatManager")?; .context("Failed to open ChatManager")?;