From e9ba9c5f51f1a165dcf4c24580ac10c4471162c8 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Sun, 18 Jul 2021 12:31:33 +0800 Subject: [PATCH] chore: reorder use --- src/chall.rs | 2 +- src/fido.rs | 2 +- src/main.rs | 1 - src/pgp.rs | 12 ++++++------ src/pgpcarddecrypt.rs | 2 +- src/pgpcardlist.rs | 2 +- src/pgpcardsign.rs | 2 +- src/piv.rs | 10 +++++----- src/register.rs | 4 ++-- src/sign.rs | 4 ++-- 10 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/chall.rs b/src/chall.rs index db5a5ee..1ad325c 100644 --- a/src/chall.rs +++ b/src/chall.rs @@ -1,7 +1,7 @@ +use std::ops::Deref; use clap::{ArgMatches, SubCommand, App, Arg}; use yubico_manager::Yubico; use yubico_manager::config::{Config, Mode, Slot}; -use std::ops::Deref; use rust_util::util_clap::{Command, CommandError}; pub struct CommandImpl; diff --git a/src/fido.rs b/src/fido.rs index db1c50a..46d7c65 100644 --- a/src/fido.rs +++ b/src/fido.rs @@ -1,10 +1,10 @@ use std::fmt; use std::thread; use std::sync::mpsc::{channel, Sender}; +use rand::Rng; use serde::{Deserialize, Serialize}; use authenticator::{StatusUpdate, RegisterResult}; use base64::URL_SAFE_NO_PAD; -use rand::Rng; use rust_util::XResult; #[derive(Clone, Debug, Serialize, Deserialize)] diff --git a/src/main.rs b/src/main.rs index 7057bd3..9bdf3fe 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,6 @@ #[macro_use] extern crate rust_util; -// mod cmd; mod fido; mod digest; mod register; diff --git a/src/pgp.rs b/src/pgp.rs index 6a73487..89de3ff 100644 --- a/src/pgp.rs +++ b/src/pgp.rs @@ -1,13 +1,13 @@ +use pem::Pem; use clap::{ArgMatches, SubCommand, App, Arg}; -use sequoia_openpgp::parse::Parse; -use sequoia_openpgp::parse::{PacketParser, PacketParserResult}; -use sequoia_openpgp::Packet; -use sequoia_openpgp::packet::{Key, Signature}; use chrono::{DateTime, Local}; use openssl::rsa::Rsa; -use sequoia_openpgp::crypto::mpi::PublicKey; use openssl::bn::BigNum; -use pem::Pem; +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 rust_util::util_clap::{Command, CommandError}; diff --git a/src/pgpcarddecrypt.rs b/src/pgpcarddecrypt.rs index 8ff5e97..53a2f5f 100644 --- a/src/pgpcarddecrypt.rs +++ b/src/pgpcarddecrypt.rs @@ -1,6 +1,6 @@ +use std::collections::BTreeMap; use clap::{ArgMatches, SubCommand, App, Arg}; use openpgp_card::DecryptMe; -use std::collections::BTreeMap; use rust_util::util_clap::{Command, CommandError}; pub struct CommandImpl; diff --git a/src/pgpcardlist.rs b/src/pgpcardlist.rs index 685f9fa..91a9afc 100644 --- a/src/pgpcardlist.rs +++ b/src/pgpcardlist.rs @@ -1,6 +1,6 @@ +use std::collections::BTreeMap; use clap::{ArgMatches, SubCommand, App, Arg}; use openpgp_card::{OpenPGPCard, DecryptMe, Hash, KeyType}; -use std::collections::BTreeMap; use rust_util::util_clap::{Command, CommandError}; pub struct CommandImpl; diff --git a/src/pgpcardsign.rs b/src/pgpcardsign.rs index 56cf8fd..7fe5342 100644 --- a/src/pgpcardsign.rs +++ b/src/pgpcardsign.rs @@ -1,7 +1,7 @@ +use std::collections::BTreeMap; use clap::{ArgMatches, SubCommand, App, Arg}; use openpgp_card::Hash; use rust_util::XResult; -use std::collections::BTreeMap; use rust_util::util_clap::{Command, CommandError}; pub struct CommandImpl; diff --git a/src/piv.rs b/src/piv.rs index effc590..e315f23 100644 --- a/src/piv.rs +++ b/src/piv.rs @@ -1,14 +1,14 @@ 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 rust_util::XResult; -use sha2::Sha256; use x509_parser::parse_x509_certificate; -use pem::Pem; -use digest::Digest; +use rust_util::XResult; use rust_util::util_msg::MessageType; -use chrono::Local; use rust_util::util_clap::{Command, CommandError}; pub struct CommandImpl; diff --git a/src/register.rs b/src/register.rs index 6fdac3e..2224267 100644 --- a/src/register.rs +++ b/src/register.rs @@ -1,12 +1,12 @@ +use std::sync::mpsc::channel; use clap::{ArgMatches, SubCommand, App, Arg}; use authenticator::authenticatorservice::AuthenticatorService; use authenticator::statecallback::StateCallback; use authenticator::RegisterFlags; -use std::sync::mpsc::channel; +use rust_util::util_clap::{Command, CommandError}; use crate::fido; use crate::digest; use crate::fido::{U2fV2Challenge, U2fRegistrationData}; -use rust_util::util_clap::{Command, CommandError}; pub struct CommandImpl; diff --git a/src/sign.rs b/src/sign.rs index 0f43d15..a25c313 100644 --- a/src/sign.rs +++ b/src/sign.rs @@ -1,12 +1,12 @@ +use std::sync::mpsc::channel; use clap::{ArgMatches, SubCommand, App, Arg}; use authenticator::{KeyHandle, AuthenticatorTransports, SignFlags}; -use std::sync::mpsc::channel; use authenticator::statecallback::StateCallback; use authenticator::authenticatorservice::AuthenticatorService; +use rust_util::util_clap::{Command, CommandError}; use crate::fido; use crate::digest; use crate::fido::U2fV2Challenge; -use rust_util::util_clap::{Command, CommandError}; pub struct CommandImpl;