feat: v1.11.3

This commit is contained in:
2025-03-24 23:28:24 +08:00
parent 8aeb47c66f
commit d4fce3f4fc

View File

@@ -10,8 +10,8 @@ use std::collections::BTreeMap;
use crate::cmd_signjwt::{build_jwt_parts, merge_header_claims, merge_payload_claims}; use crate::cmd_signjwt::{build_jwt_parts, merge_header_claims, merge_payload_claims};
use crate::ecdsautil::parse_ecdsa_to_rs; use crate::ecdsautil::parse_ecdsa_to_rs;
use crate::{hmacutil, util};
use crate::keyutil::{parse_key_uri, KeyUri}; use crate::keyutil::{parse_key_uri, KeyUri};
use crate::{hmacutil, util};
const SEPARATOR: &str = "."; const SEPARATOR: &str = ".";
@@ -24,7 +24,7 @@ impl Command for CommandImpl {
fn subcommand<'a>(&self) -> App<'a, 'a> { fn subcommand<'a>(&self) -> App<'a, 'a> {
SubCommand::with_name(self.name()).about("Sign JWT subcommand") SubCommand::with_name(self.name()).about("Sign JWT subcommand")
.arg(Arg::with_name("private-key").short("k").long("private-key").takes_value(true).help("Private key representation")) .arg(Arg::with_name("key").long("key").required(true).takes_value(true).help("Key uri"))
.arg(Arg::with_name("key-id").short("K").long("key-id").takes_value(true).help("Header key ID")) .arg(Arg::with_name("key-id").short("K").long("key-id").takes_value(true).help("Header key ID"))
.arg(Arg::with_name("claims").short("C").long("claims").takes_value(true).multiple(true).help("Claims, key:value")) .arg(Arg::with_name("claims").short("C").long("claims").takes_value(true).multiple(true).help("Claims, key:value"))
.arg(Arg::with_name("payload").short("P").long("payload").takes_value(true).help("Claims in JSON")) .arg(Arg::with_name("payload").short("P").long("payload").takes_value(true).help("Claims in JSON"))
@@ -42,7 +42,7 @@ impl Command for CommandImpl {
let mut json = BTreeMap::<&'_ str, String>::new(); let mut json = BTreeMap::<&'_ str, String>::new();
let private_key = opt_value_result!( let private_key = opt_value_result!(
sub_arg_matches.value_of("private-key"), sub_arg_matches.value_of("key"),
"Private key PKCS#8 DER base64 encoded or PEM" "Private key PKCS#8 DER base64 encoded or PEM"
); );
let private_key = hmacutil::try_hmac_decrypt_to_string(private_key)?; let private_key = hmacutil::try_hmac_decrypt_to_string(private_key)?;