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