diff --git a/src/lib_ykoath2/oath_credential.rs b/src/lib_ykoath2/oath_credential.rs index 70afe8f..6cc0140 100644 --- a/src/lib_ykoath2/oath_credential.rs +++ b/src/lib_ykoath2/oath_credential.rs @@ -1,20 +1,7 @@ -#[crate_type = "lib"] -use crate::lib_ykoath2::*; -/// Utilities for interacting with YubiKey OATH/TOTP functionality -extern crate pcsc; -use pbkdf2::pbkdf2_hmac_array; -use regex::Regex; -use sha1::Sha1; - -use std::str::{self}; - -use base64::{engine::general_purpose, Engine as _}; -use hmac::{Hmac, Mac}; - use std::cmp::Ordering; use std::hash::{Hash, Hasher}; -use std::time::SystemTime; +use crate::lib_ykoath2::CredentialIDData; #[derive(Debug, Clone)] pub struct OathCredential { diff --git a/src/lib_ykoath2/oath_credentialid.rs b/src/lib_ykoath2/oath_credentialid.rs index df7ff2b..08191a1 100644 --- a/src/lib_ykoath2/oath_credentialid.rs +++ b/src/lib_ykoath2/oath_credentialid.rs @@ -1,13 +1,8 @@ -#![crate_type = "lib"] -use crate::lib_ykoath2::*; -/// Utilities for interacting with YubiKey OATH/TOTP functionality -extern crate pcsc; use regex::Regex; -use std::{ - fmt::Write, - str::{self}, -}; +use std::fmt::Display; + +use crate::lib_ykoath2::{OathType, Tag, DEFAULT_PERIOD}; #[derive(Debug, Eq, PartialEq, Clone)] pub struct CredentialIDData { @@ -48,7 +43,7 @@ impl CredentialIDData { // Function to parse the credential ID fn parse_cred_id(cred_id: &[u8], oath_type: OathType) -> (Option, String, u32) { - let data = match str::from_utf8(cred_id) { + let data = match std::str::from_utf8(cred_id) { Ok(d) => d, Err(_) => return (None, String::new(), 0), // Handle invalid UTF-8 }; diff --git a/src/lib_ykoath2/transaction.rs b/src/lib_ykoath2/transaction.rs index a2bdf45..a7817b1 100644 --- a/src/lib_ykoath2/transaction.rs +++ b/src/lib_ykoath2/transaction.rs @@ -1,12 +1,7 @@ -#[crate_type = "lib"] -use crate::lib_ykoath2::*; -/// Utilities for interacting with YubiKey OATH/TOTP functionality -extern crate pcsc; use iso7816_tlv::simple::{Tag as TlvTag, Tlv}; use ouroboros::self_referencing; use std::collections::HashMap; use std::fmt::Display; -use std::str::{self}; use apdu_core::{Command, Response}; @@ -14,6 +9,8 @@ use pcsc::{Card, Transaction}; use std::ffi::CString; +use crate::lib_ykoath2::{ErrorResponse, Instruction, SuccessResponse, Tag}; + #[derive(PartialEq, Eq, Debug)] pub enum FormattableErrorResponse { NoError,