feat: v1.9.2, fix compile issue

This commit is contained in:
2025-03-26 23:49:42 +08:00
parent d831b606cd
commit 4ad735d840
4 changed files with 13 additions and 3 deletions

View File

@@ -569,12 +569,19 @@ fn try_decrypt_se_key_ecdh(config: &Option<TinyEncryptConfig>,
return simple_error!("Not enough arguments for: {}", &envelop.kid);
}
#[cfg(feature = "macos")]
let private_key_base64 = if let Ok(keychain_key) = KeychainKey::parse(&config_envelop_args[0]) {
let key = opt_value_result!(keychain_key.get_password()?, "Key: {} not found", &keychain_key.to_str());
opt_result!(String::from_utf8(key), "Parse key failed: {}")
} else {
config_envelop_args[0].clone()
};
#[cfg(not(feature = "macos"))]
let private_key_base64 = if config_envelop_args[0].starts_with("keychain:") {
return simple_error!("Require macos feature: {}", &config_envelop_args[0]);
} else {
config_envelop_args[0].clone()
};
let shared_secret = opt_result!(util_keychainkey::decrypt_data(
&private_key_base64,