cleanup imports

This commit is contained in:
Bilal Elmoussaoui 2025-02-13 12:17:09 +01:00
parent 85b8ccea35
commit a111a1b41f
3 changed files with 7 additions and 28 deletions

View file

@ -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::cmp::Ordering;
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};
use std::time::SystemTime; use crate::lib_ykoath2::CredentialIDData;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct OathCredential { pub struct OathCredential {

View file

@ -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 regex::Regex;
use std::{ use std::fmt::Display;
fmt::Write,
str::{self}, use crate::lib_ykoath2::{OathType, Tag, DEFAULT_PERIOD};
};
#[derive(Debug, Eq, PartialEq, Clone)] #[derive(Debug, Eq, PartialEq, Clone)]
pub struct CredentialIDData { pub struct CredentialIDData {
@ -48,7 +43,7 @@ impl CredentialIDData {
// Function to parse the credential ID // Function to parse the credential ID
fn parse_cred_id(cred_id: &[u8], oath_type: OathType) -> (Option<String>, String, u32) { fn parse_cred_id(cred_id: &[u8], oath_type: OathType) -> (Option<String>, String, u32) {
let data = match str::from_utf8(cred_id) { let data = match std::str::from_utf8(cred_id) {
Ok(d) => d, Ok(d) => d,
Err(_) => return (None, String::new(), 0), // Handle invalid UTF-8 Err(_) => return (None, String::new(), 0), // Handle invalid UTF-8
}; };

View file

@ -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 iso7816_tlv::simple::{Tag as TlvTag, Tlv};
use ouroboros::self_referencing; use ouroboros::self_referencing;
use std::collections::HashMap; use std::collections::HashMap;
use std::fmt::Display; use std::fmt::Display;
use std::str::{self};
use apdu_core::{Command, Response}; use apdu_core::{Command, Response};
@ -14,6 +9,8 @@ use pcsc::{Card, Transaction};
use std::ffi::CString; use std::ffi::CString;
use crate::lib_ykoath2::{ErrorResponse, Instruction, SuccessResponse, Tag};
#[derive(PartialEq, Eq, Debug)] #[derive(PartialEq, Eq, Debug)]
pub enum FormattableErrorResponse { pub enum FormattableErrorResponse {
NoError, NoError,