summaryrefslogtreecommitdiffstats
path: root/src/client/database.rs
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-01 19:19:49 +0100
committersalmonik <salmonik@tuta.io>2026-11-01 19:19:49 +0100
commit24e3bb54db579fb9aad8df2a591527dc77fe4cb4 (patch)
treeaf9a0c290f2675068e8396823f641f24bbe4d308 /src/client/database.rs
parentv4.0.6: move the prompt editor and key mapping out of the core (diff)
downloadzagan-bet-24e3bb54db579fb9aad8df2a591527dc77fe4cb4.tar.gz
zagan-bet-24e3bb54db579fb9aad8df2a591527dc77fe4cb4.zip
v4.0.7: finish the Phase 1 boundary with a command shell
The terminal command line moves to client::shell: a typed line becomes a core Command or an adapter action (connect, login, register, set-credential, host maintenance). ClientCore loses submit_line and the last TUI-shaped effects (Interactive, SetPrompt, ListHosts, ForgetHost, AnimateRoulette); the adapter animates roulette from the Result view. Adds forget-login, which drops the stored credential for the pinned key and keeps trust, distinct from logout (session only) and forget-host (trust too).
Diffstat (limited to 'src/client/database.rs')
-rw-r--r--src/client/database.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/client/database.rs b/src/client/database.rs
index c4601b5..40ee8b4 100644
--- a/src/client/database.rs
+++ b/src/client/database.rs
@@ -151,6 +151,21 @@ pub fn forget_host(conn: &Connection, host: &str) -> Result<ForgetOutcome, rusql
151 }) 151 })
152} 152}
153 153
154/// Forget the saved login for a server identity ("forget saved login").
155///
156/// Trust is untouched: the pinned key stays in `hosts`, so the next connection
157/// only asks for a password. Returns whether a credential was actually stored.
158pub fn forget_credentials(
159 conn: &Connection,
160 fingerprint: &str,
161) -> Result<bool, rusqlite::Error> {
162 let removed = conn.execute(
163 "DELETE FROM credentials WHERE fingerprint = ?1",
164 [fingerprint],
165 )?;
166 Ok(removed > 0)
167}
168
154/// List all remembered hosts with their fingerprints. 169/// List all remembered hosts with their fingerprints.
155pub fn get_all_hosts(conn: &Connection) -> Vec<(String, Option<String>)> { 170pub fn get_all_hosts(conn: &Connection) -> Vec<(String, Option<String>)> {
156 let mut stmt = conn 171 let mut stmt = conn