feat: update script-sign.rs
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
//! clap = { version = "4.5", features = ["derive"] }
|
||||
//! rust_util = "0.6"
|
||||
//! script-sign = "0.1"
|
||||
//! zeroizing-alloc = "0.1.0"
|
||||
//! ```
|
||||
|
||||
use clap::Parser;
|
||||
@@ -13,6 +14,11 @@ use script_sign::{KeyMap, Script};
|
||||
use std::fs;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use zeroizing_alloc::ZeroAlloc;
|
||||
|
||||
#[global_allocator]
|
||||
static ALLOC: ZeroAlloc<std::alloc::System> = ZeroAlloc(std::alloc::System);
|
||||
|
||||
/// Script signing tool
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(version, about, long_about = None, bin_name = "script-sign.rs")]
|
||||
@@ -20,6 +26,9 @@ struct Args {
|
||||
/// Force sign script
|
||||
#[arg(long)]
|
||||
force: bool,
|
||||
/// PIN
|
||||
#[arg(long)]
|
||||
pin: Option<String>,
|
||||
/// Script file path
|
||||
scripts: Vec<PathBuf>,
|
||||
}
|
||||
@@ -86,7 +95,7 @@ fn main() {
|
||||
|
||||
if continue_sign {
|
||||
information!("Prepare sign script: {}", script_path.display());
|
||||
match script.sign() {
|
||||
match script.sign_with_pin(args.pin.clone()) {
|
||||
Ok(_) => match fs::write(script_path, &script.as_string()) {
|
||||
Ok(_) => {
|
||||
success!("Sign script success: {}", script_path.display());
|
||||
@@ -103,5 +112,5 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20250123T234540+08:00.MEUCIAb0abnvE+G4FEjtZKVI
|
||||
// HiXhtIOWiOT4fQrK/8Dy4iGCAiEAxGRSBDSdnsWJTfof/oJzOKDwlgEZoCpy9HSz3OQQH6M=
|
||||
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260122T001025+08:00.MEUCIQDwfnm2/rVME/ponBv4
|
||||
// 6rPwTGmIrq8DucJCyk3kiI0LZwIgPkQrBuV3g9gy77XJnSK2xvttOPmRaO5HogiIb16TSvA=
|
||||
|
||||
Reference in New Issue
Block a user