Skip to content

Commit

Permalink
fix: mac chromium
Browse files Browse the repository at this point in the history
  • Loading branch information
thewh1teagle committed Oct 4, 2023
1 parent b5a8f1a commit 74f1ee5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion rookie-rs/src/chromium.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ fn get_v10_key(config: &BrowserConfig) -> Result<Vec<u8>, Box<dyn std::error::Er
let password = secrets::get_password(config.os_crypt_name.unwrap_or("")).unwrap_or("peanuts".to_string());
}
else if #[cfg(target_os = "macos")] {
let password = secrets::get_osx_keychain_password(config.osx_key_service, config.osx_key_user).unwrap_or("peanuts".to_string());
let key_service = config.osx_key_service.ok_or("missing osx_key_service")?;
let key_user = config.osx_key_user.ok_or("missing osx_key_user")?;
let password = secrets::get_osx_keychain_password(key_service, key_user).unwrap_or("peanuts".to_string());
}
}
pbkdf2_hmac::<Sha1>(password.as_bytes(), salt, iterations, &mut output);
Expand Down
4 changes: 2 additions & 2 deletions rookie-rs/src/secrets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cfg_if::cfg_if! {
if #[cfg(target_os = "linux")] {
// use dbus::arg::messageitem::MessageItem;
// use dbus::blocking::Connection;
// use std::{time::Duration};

pub fn get_password(os_crypt_name: &str) -> Result<String, Box<dyn std::error::Error>> {
// Attempt to get the password from libsecret
Expand Down Expand Up @@ -48,8 +49,7 @@ cfg_if::cfg_if! {

}
else if #[cfg(target_os = "macos")] {
use std::{time::Duration, process::Command};

use std::process::Command;
pub fn get_osx_keychain_password(osx_key_service: &str, osx_key_user: &str) -> Result<String, Box<dyn std::error::Error>> {
let cmd = Command::new("/usr/bin/security")
.args(&["-q", "find-generic-password", "-w", "-a", osx_key_user, "-s", osx_key_service])
Expand Down

0 comments on commit 74f1ee5

Please sign in to comment.