feat: update base64 version

This commit is contained in:
2023-08-26 12:02:45 +08:00
parent 2ada122834
commit 1698e2d9f8
12 changed files with 47 additions and 24 deletions

View File

@@ -1,11 +1,13 @@
use std::collections::BTreeMap;
use clap::{App, Arg, ArgMatches, SubCommand};
use rust_util::{util_msg, XResult};
use rust_util::util_clap::{Command, CommandError};
use rust_util::util_msg::MessageType;
use rust_util::{util_msg, XResult};
use yubikey::piv::{AlgorithmId, SlotId};
use yubikey::{piv, YubiKey};
use yubikey::piv::{AlgorithmId, SlotId};
use crate::util::base64_encode;
pub struct CommandImpl;
@@ -61,11 +63,11 @@ impl Command for CommandImpl {
let mut json = BTreeMap::<&'_ str, String>::new();
json.insert("hash_hex", hex::encode(&hash));
json.insert("sign_hex", hex::encode(&sign_bytes));
json.insert("sign_base64", base64::encode(&sign_bytes));
json.insert("sign_base64", base64_encode(&sign_bytes));
println!("{}", serde_json::to_string_pretty(&json).unwrap());
} else {
success!("Signature HEX: {}", hex::encode(sign_bytes));
success!("Signature base64: {}", base64::encode(sign_bytes));
success!("Signature base64: {}", base64_encode(sign_bytes));
}
}
Ok(None)