feat: v1.11.17
This commit is contained in:
52
src/cmd_external_sign.rs
Normal file
52
src/cmd_external_sign.rs
Normal file
@@ -0,0 +1,52 @@
|
||||
use crate::util;
|
||||
use clap::{App, Arg, ArgMatches, SubCommand};
|
||||
use rust_util::util_clap::{Command, CommandError};
|
||||
use serde_json::Value;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
pub struct CommandImpl;
|
||||
|
||||
impl Command for CommandImpl {
|
||||
fn name(&self) -> &str {
|
||||
"external_sign"
|
||||
}
|
||||
|
||||
fn subcommand<'a>(&self) -> App<'a, 'a> {
|
||||
SubCommand::with_name(self.name())
|
||||
.about("External sign subcommand")
|
||||
.arg(
|
||||
Arg::with_name("alg")
|
||||
.long("alg")
|
||||
.takes_value(true)
|
||||
.required(true)
|
||||
.help("Algorithm, e.g. RS256, RS384, RS512, ES256, ES384, ES512"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("parameter")
|
||||
.long("parameter")
|
||||
.takes_value(true)
|
||||
.required(true)
|
||||
.help("Parameter"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("message-base64")
|
||||
.long("message-base64")
|
||||
.takes_value(true)
|
||||
.required(true)
|
||||
.help("Message in base64"),
|
||||
)
|
||||
}
|
||||
|
||||
fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError {
|
||||
let _alg = sub_arg_matches.value_of("alg").unwrap();
|
||||
let _parameter = sub_arg_matches.value_of("parameter").unwrap();
|
||||
let _message_base64 = sub_arg_matches.value_of("message-base64").unwrap();
|
||||
|
||||
let mut json = BTreeMap::new();
|
||||
json.insert("success", Value::Bool(true));
|
||||
json.insert("signature_base64", "**".into());
|
||||
|
||||
util::print_pretty_json(&json);
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user