feat: v1.8.2, fix compile issue
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -1871,7 +1871,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tiny-encrypt"
|
||||
version = "1.8.1"
|
||||
version = "1.8.2"
|
||||
dependencies = [
|
||||
"aes-gcm-stream",
|
||||
"base64 0.22.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tiny-encrypt"
|
||||
version = "1.8.1"
|
||||
version = "1.8.2"
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
description = "A simple and tiny file encrypt tool"
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
use crate::cmd_decrypt::try_decrypt_key;
|
||||
use crate::config::TinyEncryptConfig;
|
||||
use crate::consts::TINY_ENC_CONFIG_FILE;
|
||||
use crate::spec::TinyEncryptEnvelop;
|
||||
@@ -155,6 +154,7 @@ pub fn simple_encrypt(cmd_simple_encrypt: CmdSimpleEncrypt) -> XResult<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(feature = "decrypt")]
|
||||
pub fn simple_decrypt(cmd_simple_decrypt: CmdSimpleDecrypt) -> XResult<()> {
|
||||
let direct_output = cmd_simple_decrypt.direct_output;
|
||||
if let Err(inner_result_error) = inner_simple_decrypt(cmd_simple_decrypt) {
|
||||
@@ -195,6 +195,7 @@ pub fn inner_simple_encrypt(cmd_simple_encrypt: CmdSimpleEncrypt) -> XResult<()>
|
||||
CmdResult::success(&simple_encrypt_result).print_exit(cmd_simple_encrypt.direct_output);
|
||||
}
|
||||
|
||||
#[cfg(feature = "decrypt")]
|
||||
pub fn inner_simple_decrypt(cmd_simple_decrypt: CmdSimpleDecrypt) -> XResult<()> {
|
||||
let config = TinyEncryptConfig::load(TINY_ENC_CONFIG_FILE).ok();
|
||||
|
||||
@@ -236,7 +237,7 @@ pub fn inner_simple_decrypt(cmd_simple_decrypt: CmdSimpleDecrypt) -> XResult<()>
|
||||
if filter_envelops.len() > 1 {
|
||||
return simple_error!("too many envelops: {:?}, len: {}", cmd_simple_decrypt.key_id, filter_envelops.len());
|
||||
}
|
||||
let value = try_decrypt_key(&config, filter_envelops[0], &pin, &slot, false)?;
|
||||
let value = crate::cmd_decrypt::try_decrypt_key(&config, filter_envelops[0], &pin, &slot, false)?;
|
||||
if cmd_simple_decrypt.direct_output && output_format == "plain" {
|
||||
io::stdout().write_all(&value).expect("unable to write to stdout");
|
||||
exit(0);
|
||||
|
||||
@@ -15,6 +15,7 @@ pub use cmd_encrypt::encrypt;
|
||||
pub use cmd_encrypt::encrypt_single;
|
||||
pub use cmd_encrypt::encrypt_single_file_out;
|
||||
pub use cmd_simple_encrypt_decrypt::simple_encrypt;
|
||||
#[cfg(feature = "decrypt")]
|
||||
pub use cmd_simple_encrypt_decrypt::simple_decrypt;
|
||||
#[cfg(feature = "decrypt")]
|
||||
pub use cmd_execenv::CmdExecEnv;
|
||||
|
||||
@@ -29,6 +29,7 @@ enum Commands {
|
||||
/// Simple encrypt message
|
||||
#[command(arg_required_else_help = true)]
|
||||
SimpleEncrypt(CmdSimpleEncrypt),
|
||||
#[cfg(feature = "decrypt")]
|
||||
/// Simple decrypt message
|
||||
#[command(arg_required_else_help = true)]
|
||||
SimpleDecrypt(CmdSimpleDecrypt),
|
||||
@@ -67,6 +68,7 @@ fn main() -> XResult<()> {
|
||||
match args.command {
|
||||
Commands::Encrypt(cmd_encrypt) => tiny_encrypt::encrypt(cmd_encrypt),
|
||||
Commands::SimpleEncrypt(cmd_simple_encrypt) => tiny_encrypt::simple_encrypt(cmd_simple_encrypt),
|
||||
#[cfg(feature = "decrypt")]
|
||||
Commands::SimpleDecrypt(cmd_simple_decrypt) => tiny_encrypt::simple_decrypt(cmd_simple_decrypt),
|
||||
#[cfg(feature = "decrypt")]
|
||||
Commands::Decrypt(cmd_decrypt) => tiny_encrypt::decrypt(cmd_decrypt),
|
||||
|
||||
Reference in New Issue
Block a user