feat(app): allow hexadecimal HMAC key specification and redact keys from debug output
This commit is contained in:
14 files changed
+72
-40
No files matched your search
@@ -26,8 +26,9 @@ pub struct CommonClientArgs {
|
||||
#[arg(long, default_value_t = 0, value_parser = parse_length)]
|
||||
pub length: u32,
|
||||
|
||||
/// HMAC key.
|
||||
#[arg(long, value_parser = parse_hmac_key)]
|
||||
// Decode during configuration preparation so Clap cannot echo rejected keys.
|
||||
/// HMAC key: literal UTF-8 or lowercase 0x followed by hexadecimal bytes.
|
||||
#[arg(long)]
|
||||
pub hmac: Option<String>,
|
||||
|
||||
/// Clock mode to request.
|
||||
@@ -267,13 +268,6 @@ pub fn parse_length(input: &str) -> Result<u32, String> {
|
||||
Ok(length)
|
||||
}
|
||||
|
||||
pub fn parse_hmac_key(input: &str) -> Result<String, String> {
|
||||
if input.is_empty() {
|
||||
return Err("HMAC key must not be empty".to_owned());
|
||||
}
|
||||
Ok(input.to_owned())
|
||||
}
|
||||
|
||||
pub fn parse_server_fill(input: &str) -> Result<String, String> {
|
||||
if input.is_empty() {
|
||||
return Err("server fill must not be empty".to_owned());
|
||||
|
||||
Reference in new issue
Block a user