summaryrefslogtreecommitdiffstats
path: root/src/client/database.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-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