Skip to content

Commit

Permalink
Update keyring #325
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed Nov 10, 2024
1 parent 7b00aee commit d5c7291
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ sysinfo = "0.30.5"
argon2 = "0.4"
rand_core = { version = "0.6", features = ["std"] }
magic-crypt = "3.1.10"
keyring = "1.2.0"
keyring = "2.3.3"
once_cell = "1.15.0"
tauri-plugin-single-instance = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
rand = "0.8.5"
Expand Down
6 changes: 3 additions & 3 deletions core/src/encryption.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub fn decrypt_data(data: String) -> String {
pub fn set_entry(name: String, data: String, service: String) -> String {
let entry = keyring::Entry::new(&service, &name);

let res = entry.set_password(data.as_str());
let res = entry.expect("Failed to create entry").set_password(data.as_str());

match res {
Ok(_) => "ok".into(),
Expand All @@ -74,7 +74,7 @@ pub fn set_entry(name: String, data: String, service: String) -> String {
pub fn get_entry(name: String, service: String) -> String {
let entry = keyring::Entry::new(&service, &name);

let item = entry.get_password().unwrap_or_else(|error| "error".into());
let item = entry.expect("Failed to get entry").get_password().unwrap_or_else(|error| "error".into());

item.into()
}
Expand All @@ -83,7 +83,7 @@ pub fn get_entry(name: String, service: String) -> String {
pub fn delete_entry(name: String, service: String) {
let entry = keyring::Entry::new(&service, &name);

let item = entry.delete_password();
let item = entry.expect("Failed to delete entry").delete_password();
}

#[tauri::command]
Expand Down

0 comments on commit d5c7291

Please sign in to comment.