From a67e8dfe4b062ae61b9ecd4307b8fc9feba6d095 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Mon, 4 Apr 2022 16:09:10 +0800 Subject: [PATCH] feat: update u2f --- src/cmd_u2fregister.rs | 10 +++++----- src/cmd_u2fsign.rs | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/cmd_u2fregister.rs b/src/cmd_u2fregister.rs index 798d0fa..8a80a83 100644 --- a/src/cmd_u2fregister.rs +++ b/src/cmd_u2fregister.rs @@ -18,7 +18,7 @@ impl Command for CommandImpl { fn subcommand<'a>(&self) -> App<'a, 'a> { SubCommand::with_name(self.name()).about("FIDO U2F Register subcommand") .arg(Arg::with_name("app-id").short("a").long("app-id").default_value("https://example.com").help("App id")) - .arg(Arg::with_name("timeout").short("t").long("timeout").default_value("10").help("Timeout in seconds")) + .arg(Arg::with_name("timeout").short("t").long("timeout").default_value("30").help("Timeout in seconds")) .arg(Arg::with_name("json").long("json").help("JSON output")) } @@ -72,13 +72,13 @@ impl Command for CommandImpl { println!("{}", serde_json::to_string_pretty(&u2f_registration_data).unwrap()); } else { success!("Device info: {}", u2f_registration_data.device_info); - success!("Register challenge: {}", u2fv2_challenge_str); - success!("Register challenge base64: {}", base64::encode(&u2fv2_challenge_str)); + information!("Register challenge: {}", u2fv2_challenge_str); + information!("Register challenge base64: {}", base64::encode(&u2fv2_challenge_str)); if let Some(cert) = u2f_registration_data.attestation_cert_pem { - success!("Attestation certificate: {}", cert); + information!("Attestation certificate: {}", cert); } if let Some(device_name) = u2f_registration_data.device_name { - success!("Device name: {}", device_name); + information!("Device name: {}", device_name); } success!("Public key: {}", u2f_registration_data.pub_key); success!("Key handle: {}", u2f_registration_data.key_handle); diff --git a/src/cmd_u2fsign.rs b/src/cmd_u2fsign.rs index ed49f3b..9e59d16 100644 --- a/src/cmd_u2fsign.rs +++ b/src/cmd_u2fsign.rs @@ -18,7 +18,7 @@ impl Command for CommandImpl { fn subcommand<'a>(&self) -> App<'a, 'a> { SubCommand::with_name(self.name()).about("FIDO U2F Sign subcommand") .arg(Arg::with_name("app-id").short("a").long("app-id").default_value("https://example.com").help("App id")) - .arg(Arg::with_name("timeout").short("t").long("timeout").default_value("10").help("Timeout in seconds")) + .arg(Arg::with_name("timeout").short("t").long("timeout").default_value("30").help("Timeout in seconds")) .arg(Arg::with_name("public-key-hex").long("public-key-hex").takes_value(true).help("Public key hex")) .arg(Arg::with_name("key-handle").short("k").long("key-handle").takes_value(true).multiple(true).help("Key handle")) } @@ -83,14 +83,14 @@ impl Command for CommandImpl { let signature = &sign_data[5..]; success!("Device info: {}", &device_info); - success!("Sign challenge: {}", u2fv2_challenge_str); - success!("Sign challenge base64: {}", base64::encode(&u2fv2_challenge_str)); - success!("Sign result : {}", base64::encode(&sign_data)); - success!("- presence : {}", user_presence_flag); - success!("- counter : {}", u32::from_be_bytes([counter[0], counter[1], counter[2], counter[3]])); - success!("- signature: {}", base64::encode(&signature)); + information!("Sign challenge: {}", u2fv2_challenge_str); + information!("Sign challenge base64: {}", base64::encode(&u2fv2_challenge_str)); + information!("Sign result : {}", base64::encode(&sign_data)); + information!("- presence : {}", user_presence_flag); + information!("- counter : {}", u32::from_be_bytes([counter[0], counter[1], counter[2], counter[3]])); + information!("- signature: {}", base64::encode(&signature)); // success!("Key handle used: {}", base64::encode(&handle_used)); - success!("Key handle: {}", hex::encode(&handle_used)); + information!("Key handle: {}", hex::encode(&handle_used)); if let Some(public_key_hex) = sub_arg_matches.value_of("public-key-hex") { let public_key = opt_result!(hex::decode(public_key_hex), "Parse public key hex failed: {}");