Skip to content

Commit a2d91ea

Browse files
committed
debug: log keychain::store params + verify readback to diagnose missing entry
1 parent 165df18 commit a2d91ea

2 files changed

Lines changed: 18 additions & 6 deletions

File tree

src-tauri/src/auth.rs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,26 @@ pub mod keychain {
9090
}
9191

9292
pub fn store<R: Runtime>(_app: &AppHandle<R>, id: &Uuid, password: &str) -> AppResult<()> {
93-
let entry = keyring::Entry::new(SERVICE, &account(id))
94-
.map_err(|e| AppError::Keychain(e.to_string()))?;
95-
entry
96-
.set_password(password)
97-
.map_err(|e| AppError::Keychain(e.to_string()))
93+
tracing::info!("keychain::store service={SERVICE} account={id} len={}", password.len());
94+
let entry = keyring::Entry::new(SERVICE, &account(id)).map_err(|e| {
95+
tracing::warn!("keychain::store new failed: {e}");
96+
AppError::Keychain(e.to_string())
97+
})?;
98+
entry.set_password(password).map_err(|e| {
99+
tracing::warn!("keychain::store set_password failed: {e}");
100+
AppError::Keychain(e.to_string())
101+
})?;
102+
// Immediately read it back to verify it actually landed.
103+
match entry.get_password() {
104+
Ok(p) if p == password => tracing::info!("keychain::store verified ({} bytes)", p.len()),
105+
Ok(p) => tracing::warn!("keychain::store readback mismatch ({} bytes vs {} expected)", p.len(), password.len()),
106+
Err(e) => tracing::warn!("keychain::store readback failed: {e}"),
107+
}
108+
Ok(())
98109
}
99110

100111
pub fn read<R: Runtime>(_app: &AppHandle<R>, id: &Uuid) -> AppResult<String> {
112+
tracing::debug!("keychain::read service={SERVICE} account={id}");
101113
let entry = keyring::Entry::new(SERVICE, &account(id))
102114
.map_err(|e| AppError::Keychain(e.to_string()))?;
103115
entry

src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
33
"productName": "Kryton",
4-
"version": "0.1.4",
4+
"version": "0.1.5",
55
"identifier": "app.kryton.desktop",
66
"build": {
77
"frontendDist": "../dist",

0 commit comments

Comments
 (0)