mirror of
https://github.com/LordGrimmauld/yubi-oath-rs.git
synced 2025-03-03 21:34:40 +01:00
enable some rustfmt nightly features
to keep the grouping automatically
This commit is contained in:
parent
7767b6e171
commit
821229af35
5 changed files with 19 additions and 19 deletions
3
.rustfmt.toml
Normal file
3
.rustfmt.toml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
imports_granularity = "Crate"
|
||||||
|
format_code_in_doc_comments = true
|
||||||
|
group_imports = "StdExternalCrate"
|
15
src/lib.rs
15
src/lib.rs
|
@ -4,15 +4,13 @@ mod transaction;
|
||||||
use transaction::*;
|
use transaction::*;
|
||||||
mod oath_credential;
|
mod oath_credential;
|
||||||
mod oath_credentialid;
|
mod oath_credentialid;
|
||||||
use oath_credential::*;
|
|
||||||
use oath_credentialid::*;
|
|
||||||
/// Utilities for interacting with YubiKey OATH/TOTP functionality
|
/// Utilities for interacting with YubiKey OATH/TOTP functionality
|
||||||
use std::{fmt::Display, time::Duration};
|
use std::{fmt::Display, time::Duration, time::SystemTime};
|
||||||
|
|
||||||
use base64::{engine::general_purpose, Engine as _};
|
use base64::{engine::general_purpose, Engine as _};
|
||||||
use hmac::{Hmac, Mac};
|
use hmac::{Hmac, Mac};
|
||||||
|
use oath_credential::*;
|
||||||
use std::time::SystemTime;
|
use oath_credentialid::*;
|
||||||
|
|
||||||
fn _get_device_id(salt: Vec<u8>) -> String {
|
fn _get_device_id(salt: Vec<u8>) -> String {
|
||||||
let result = HashAlgo::Sha256.get_hash_fun()(salt.leak());
|
let result = HashAlgo::Sha256.get_hash_fun()(salt.leak());
|
||||||
|
@ -221,7 +219,8 @@ impl<'a> OathSession<'a> {
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Read the OATH codes from the device, calculate TOTP codes that don't need touch
|
/// Read the OATH codes from the device, calculate TOTP codes that don't
|
||||||
|
/// need touch
|
||||||
pub fn calculate_oath_codes(
|
pub fn calculate_oath_codes(
|
||||||
&self,
|
&self,
|
||||||
) -> Result<Vec<RefreshableOathCredential>, FormattableErrorResponse> {
|
) -> Result<Vec<RefreshableOathCredential>, FormattableErrorResponse> {
|
||||||
|
@ -242,8 +241,8 @@ impl<'a> OathSession<'a> {
|
||||||
let id_data = CredentialIDData::from_tlv(cred_id.value(), meta.tag());
|
let id_data = CredentialIDData::from_tlv(cred_id.value(), meta.tag());
|
||||||
let code = OathCodeDisplay::from_tlv(meta);
|
let code = OathCodeDisplay::from_tlv(meta);
|
||||||
|
|
||||||
/* println!("id bytes: {:?}", cred_id.value());
|
// println!("id bytes: {:?}", cred_id.value());
|
||||||
println!("id recon: {:?}", id_data.format_cred_id()); */
|
// println!("id recon: {:?}", id_data.format_cred_id());
|
||||||
|
|
||||||
let cred = OathCredential {
|
let cred = OathCredential {
|
||||||
device_id: self.name.clone(),
|
device_id: self.name.clone(),
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
use std::cmp::Ordering;
|
use std::{
|
||||||
use std::hash::{Hash, Hasher};
|
cmp::Ordering,
|
||||||
|
hash::{Hash, Hasher},
|
||||||
|
};
|
||||||
|
|
||||||
use crate::CredentialIDData;
|
use crate::CredentialIDData;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use regex::Regex;
|
|
||||||
|
|
||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
|
|
||||||
|
use regex::Regex;
|
||||||
|
|
||||||
use crate::{OathType, Tag, DEFAULT_PERIOD};
|
use crate::{OathType, Tag, DEFAULT_PERIOD};
|
||||||
|
|
||||||
#[derive(Debug, Eq, PartialEq, Clone)]
|
#[derive(Debug, Eq, PartialEq, Clone)]
|
||||||
|
|
|
@ -1,14 +1,10 @@
|
||||||
use iso7816_tlv::simple::{Tag as TlvTag, Tlv};
|
use std::{collections::HashMap, ffi::CString, fmt::Display};
|
||||||
use ouroboros::self_referencing;
|
|
||||||
use std::collections::HashMap;
|
|
||||||
use std::fmt::Display;
|
|
||||||
|
|
||||||
use apdu_core::{Command, Response};
|
use apdu_core::{Command, Response};
|
||||||
|
use iso7816_tlv::simple::{Tag as TlvTag, Tlv};
|
||||||
|
use ouroboros::self_referencing;
|
||||||
use pcsc::{Card, Transaction};
|
use pcsc::{Card, Transaction};
|
||||||
|
|
||||||
use std::ffi::CString;
|
|
||||||
|
|
||||||
use crate::{ErrorResponse, Instruction, SuccessResponse, Tag};
|
use crate::{ErrorResponse, Instruction, SuccessResponse, Tag};
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Debug)]
|
#[derive(PartialEq, Eq, Debug)]
|
||||||
|
|
Loading…
Add table
Reference in a new issue