diff --git a/src/cmd_chall.rs b/src/cmd_chall.rs index 9632212..97c7c3e 100644 --- a/src/cmd_chall.rs +++ b/src/cmd_chall.rs @@ -1,9 +1,10 @@ -use std::ops::Deref; -use clap::{ArgMatches, SubCommand, App, Arg}; -use yubico_manager::Yubico; -use yubico_manager::config::{Config, Mode, Slot}; -use rust_util::util_clap::{Command, CommandError}; use std::collections::BTreeMap; +use std::ops::Deref; + +use clap::{App, Arg, ArgMatches, SubCommand}; +use rust_util::util_clap::{Command, CommandError}; +use yubico_manager::config::{Config, Mode, Slot}; +use yubico_manager::Yubico; pub struct CommandImpl; diff --git a/src/cmd_challconfig.rs b/src/cmd_challconfig.rs index b33bfd8..03470ec 100644 --- a/src/cmd_challconfig.rs +++ b/src/cmd_challconfig.rs @@ -1,9 +1,9 @@ -use clap::{ArgMatches, SubCommand, App, Arg}; -use yubico_manager::Yubico; -use yubico_manager::config::Config; -use yubico_manager::hmacmode::HmacKey; -use yubico_manager::configure::DeviceModeConfig; +use clap::{App, Arg, ArgMatches, SubCommand}; use rust_util::util_clap::{Command, CommandError}; +use yubico_manager::config::Config; +use yubico_manager::configure::DeviceModeConfig; +use yubico_manager::hmacmode::HmacKey; +use yubico_manager::Yubico; pub struct CommandImpl; diff --git a/src/cmd_pgp.rs b/src/cmd_pgp.rs index a937755..307f9da 100644 --- a/src/cmd_pgp.rs +++ b/src/cmd_pgp.rs @@ -1,15 +1,15 @@ -use pem::Pem; -use clap::{ArgMatches, SubCommand, App, Arg}; use chrono::{DateTime, Local}; -use openssl::rsa::Rsa; +use clap::{App, Arg, ArgMatches, SubCommand}; use openssl::bn::BigNum; -use sequoia_openpgp::Packet; -use sequoia_openpgp::parse::Parse; -use sequoia_openpgp::packet::{Key, Signature}; -use sequoia_openpgp::crypto::mpi::PublicKey; -use sequoia_openpgp::parse::{PacketParser, PacketParserResult}; -use sequoia_openpgp::packet::signature::subpacket::SubpacketTag; +use openssl::rsa::Rsa; +use pem::Pem; use rust_util::util_clap::{Command, CommandError}; +use sequoia_openpgp::crypto::mpi::PublicKey; +use sequoia_openpgp::Packet; +use sequoia_openpgp::packet::{Key, Signature}; +use sequoia_openpgp::packet::signature::subpacket::SubpacketTag; +use sequoia_openpgp::parse::{PacketParser, PacketParserResult}; +use sequoia_openpgp::parse::Parse; pub struct CommandImpl; diff --git a/src/cmd_pgpcarddecrypt.rs b/src/cmd_pgpcarddecrypt.rs index 0bdcc50..435aeb0 100644 --- a/src/cmd_pgpcarddecrypt.rs +++ b/src/cmd_pgpcarddecrypt.rs @@ -1,5 +1,6 @@ use std::collections::BTreeMap; -use clap::{ArgMatches, SubCommand, App, Arg}; + +use clap::{App, Arg, ArgMatches, SubCommand}; use openpgp_card::DecryptMe; use rust_util::util_clap::{Command, CommandError}; diff --git a/src/cmd_pgpcardlist.rs b/src/cmd_pgpcardlist.rs index c263f74..ea01abf 100644 --- a/src/cmd_pgpcardlist.rs +++ b/src/cmd_pgpcardlist.rs @@ -1,6 +1,7 @@ use std::collections::BTreeMap; -use clap::{ArgMatches, SubCommand, App, Arg}; -use openpgp_card::{OpenPGPCard, DecryptMe, Hash, KeyType}; + +use clap::{App, Arg, ArgMatches, SubCommand}; +use openpgp_card::{DecryptMe, Hash, KeyType, OpenPGPCard}; use rust_util::util_clap::{Command, CommandError}; pub struct CommandImpl; diff --git a/src/cmd_pgpcardsign.rs b/src/cmd_pgpcardsign.rs index 7fe5342..c5f9654 100644 --- a/src/cmd_pgpcardsign.rs +++ b/src/cmd_pgpcardsign.rs @@ -1,8 +1,9 @@ use std::collections::BTreeMap; -use clap::{ArgMatches, SubCommand, App, Arg}; + +use clap::{App, Arg, ArgMatches, SubCommand}; use openpgp_card::Hash; -use rust_util::XResult; use rust_util::util_clap::{Command, CommandError}; +use rust_util::XResult; pub struct CommandImpl; diff --git a/src/cmd_piv.rs b/src/cmd_piv.rs index dd6acd4..b42bb5e 100644 --- a/src/cmd_piv.rs +++ b/src/cmd_piv.rs @@ -1,15 +1,16 @@ use std::time::Duration; -use pem::Pem; -use sha2::Sha256; -use digest::Digest; + use chrono::Local; -use clap::{ArgMatches, SubCommand, App, Arg}; -use yubikey::{YubiKey, Certificate}; -use yubikey::piv::SlotId; -use x509_parser::parse_x509_certificate; -use rust_util::XResult; -use rust_util::util_msg::MessageType; +use clap::{App, Arg, ArgMatches, SubCommand}; +use digest::Digest; +use pem::Pem; use rust_util::util_clap::{Command, CommandError}; +use rust_util::util_msg::MessageType; +use rust_util::XResult; +use sha2::Sha256; +use x509_parser::parse_x509_certificate; +use yubikey::{Certificate, YubiKey}; +use yubikey::piv::SlotId; pub struct CommandImpl; diff --git a/src/cmd_pivsign.rs b/src/cmd_pivsign.rs index 89eb9d0..2587b54 100644 --- a/src/cmd_pivsign.rs +++ b/src/cmd_pivsign.rs @@ -1,4 +1,5 @@ use std::collections::BTreeMap; + use clap::{App, Arg, ArgMatches, SubCommand}; use rust_util::util_clap::{Command, CommandError}; use yubikey::piv::{AlgorithmId, SlotId}; diff --git a/src/cmd_register.rs b/src/cmd_register.rs index 277d043..e2b96cc 100644 --- a/src/cmd_register.rs +++ b/src/cmd_register.rs @@ -1,12 +1,14 @@ use std::sync::mpsc::channel; -use clap::{ArgMatches, SubCommand, App, Arg}; + use authenticator::authenticatorservice::AuthenticatorService; -use authenticator::statecallback::StateCallback; use authenticator::RegisterFlags; +use authenticator::statecallback::StateCallback; +use clap::{App, Arg, ArgMatches, SubCommand}; use rust_util::util_clap::{Command, CommandError}; -use crate::fido; + use crate::digest; -use crate::fido::{U2fV2Challenge, U2fRegistrationData}; +use crate::fido; +use crate::fido::{U2fRegistrationData, U2fV2Challenge}; pub struct CommandImpl; diff --git a/src/cmd_sign.rs b/src/cmd_sign.rs index f4f0448..2e60b0f 100644 --- a/src/cmd_sign.rs +++ b/src/cmd_sign.rs @@ -1,11 +1,13 @@ use std::sync::mpsc::channel; -use clap::{ArgMatches, SubCommand, App, Arg}; -use authenticator::{KeyHandle, AuthenticatorTransports, SignFlags}; -use authenticator::statecallback::StateCallback; + +use authenticator::{AuthenticatorTransports, KeyHandle, SignFlags}; use authenticator::authenticatorservice::AuthenticatorService; +use authenticator::statecallback::StateCallback; +use clap::{App, Arg, ArgMatches, SubCommand}; use rust_util::util_clap::{Command, CommandError}; -use crate::fido; + use crate::digest; +use crate::fido; use crate::fido::U2fV2Challenge; pub struct CommandImpl; diff --git a/src/digest.rs b/src/digest.rs index c47528f..aa0938c 100644 --- a/src/digest.rs +++ b/src/digest.rs @@ -1,4 +1,5 @@ use sha2::{Digest, Sha256, Sha384, Sha512}; + // use sha1::Sha1; // pub fn sha1(input: &str) -> Vec { diff --git a/src/fido.rs b/src/fido.rs index 46d7c65..d70a1a7 100644 --- a/src/fido.rs +++ b/src/fido.rs @@ -1,11 +1,12 @@ use std::fmt; -use std::thread; use std::sync::mpsc::{channel, Sender}; -use rand::Rng; -use serde::{Deserialize, Serialize}; -use authenticator::{StatusUpdate, RegisterResult}; +use std::thread; + +use authenticator::{RegisterResult, StatusUpdate}; use base64::URL_SAFE_NO_PAD; +use rand::Rng; use rust_util::XResult; +use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Serialize, Deserialize)] pub struct U2FDeviceInfo { diff --git a/src/main.rs b/src/main.rs index 90ed221..a3fdf9d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,9 @@ #[macro_use] extern crate rust_util; +use clap::{App, AppSettings, ArgMatches}; +use rust_util::util_clap::{Command, CommandError}; + mod fido; mod digest; mod cmd_register; @@ -15,9 +18,6 @@ mod cmd_pivsign; mod cmd_chall; mod cmd_challconfig; -use clap::{App, AppSettings, ArgMatches}; -use rust_util::util_clap::{CommandError, Command}; - pub struct DefaultCommandImpl; impl DefaultCommandImpl { diff --git a/src/pgpcardutil.rs b/src/pgpcardutil.rs index 4a98253..2784ff3 100644 --- a/src/pgpcardutil.rs +++ b/src/pgpcardutil.rs @@ -1,5 +1,5 @@ +use openpgp_card::{OpenPGPCard, OpenPGPCardUser}; use rust_util::XResult; -use openpgp_card::{OpenPGPCardUser, OpenPGPCard}; pub fn get_card_user_sw1_81(pass: &str) -> XResult { match OpenPGPCard::list_cards() {