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

2
Cargo.lock generated
View File

@@ -1880,7 +1880,7 @@ dependencies = [
[[package]]
name = "tiny-encrypt"
version = "1.9.1"
version = "1.9.2"
dependencies = [
"aes-gcm-stream",
"base64 0.22.1",

View File

@@ -1,6 +1,6 @@
[package]
name = "tiny-encrypt"
version = "1.9.1"
version = "1.9.2"
edition = "2021"
license = "MIT"
description = "A simple and tiny file encrypt tool"

View File

@@ -1,6 +1,10 @@
_:
@just --list
# publish
publish:
cargo publish --registry crates-io
# Install local
install:
cargo install --path .
@@ -27,5 +31,4 @@ try-build-all:
cargo build --no-default-features --features smartcard
cargo build --no-default-features --features decrypt
cargo build --no-default-features --features macos
cargo build --no-default-features --features secure-enclave
cargo build

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,