cargo fmt

This commit is contained in:
Carson McManus 2021-08-08 12:34:06 -04:00
parent a808fa1fe6
commit 52d247f102
4 changed files with 48 additions and 34 deletions

View file

@ -8,7 +8,9 @@ use std::{
path::Path,
sync::{Arc, Mutex},
};
use steamguard::{steamapi, Confirmation, ConfirmationType, SteamGuardAccount, UserLogin, LoginError};
use steamguard::{
steamapi, Confirmation, ConfirmationType, LoginError, SteamGuardAccount, UserLogin,
};
use termion::{
event::{Event, Key},
input::TermRead,

View file

@ -1,6 +1,5 @@
use anyhow::Result;
pub use confirmation::{Confirmation, ConfirmationType};
pub use userlogin::{LoginError, UserLogin};
use hmacsha1::hmac_sha1;
use log::*;
use reqwest::{
@ -11,6 +10,7 @@ use reqwest::{
use scraper::{Html, Selector};
use serde::{Deserialize, Serialize};
use std::{collections::HashMap, convert::TryInto, thread, time};
pub use userlogin::{LoginError, UserLogin};
#[macro_use]
extern crate lazy_static;
#[macro_use]

View file

@ -6,7 +6,7 @@ use reqwest::{
header::{HeaderMap, HeaderName, HeaderValue, SET_COOKIE},
Url,
};
use serde::{Deserialize, Serialize, Deserializer};
use serde::{Deserialize, Deserializer, Serialize};
use std::iter::FromIterator;
use std::str::FromStr;
use std::time::{SystemTime, UNIX_EPOCH};
@ -299,21 +299,33 @@ fn test_oauth_data_parse() {
assert_eq!(oauth.steamid, "78562647129469312");
assert_eq!(oauth.oauth_token, "fd2fdb3d0717bcd2220d98c7ec61c7bd");
assert_eq!(oauth.wgtoken, "72E7013D598A4F68C7E268F6FA3767D89D763732");
assert_eq!(oauth.wgtoken_secure, "21061EA13C36D7C29812CAED900A215171AD13A2");
assert_eq!(
oauth.wgtoken_secure,
"21061EA13C36D7C29812CAED900A215171AD13A2"
);
assert_eq!(oauth.webcookie, "6298070A226E5DAD49938D78BCF36F7A7118FDD5");
}
#[test]
fn test_login_response_parse() {
let result = serde_json::from_str::<LoginResponse>(include_str!("fixtures/api-responses/login-response1.json"));
let result = serde_json::from_str::<LoginResponse>(include_str!(
"fixtures/api-responses/login-response1.json"
));
assert!(matches!(result, Ok(_)), "got error: {}", result.unwrap_err());
assert!(
matches!(result, Ok(_)),
"got error: {}",
result.unwrap_err()
);
let resp = result.unwrap();
let oauth = resp.oauth.unwrap();
assert_eq!(oauth.steamid, "78562647129469312");
assert_eq!(oauth.oauth_token, "fd2fdb3d0717bad2220d98c7ec61c7bd");
assert_eq!(oauth.wgtoken, "72E7013D598A4F68C7E268F6FA3767D89D763732");
assert_eq!(oauth.wgtoken_secure, "21061EA13C36D7C29812CAED900A215171AD13A2");
assert_eq!(
oauth.wgtoken_secure,
"21061EA13C36D7C29812CAED900A215171AD13A2"
);
assert_eq!(oauth.webcookie, "6298070A226E5DAD49938D78BCF36F7A7118FDD5");
}

View file

@ -1,7 +1,7 @@
use crate::steamapi::{LoginResponse, RsaResponse, Session, SteamApiClient};
use log::*;
use rsa::{PublicKey, RsaPublicKey};
use std::time::{SystemTime, UNIX_EPOCH};
use crate::steamapi::{SteamApiClient, LoginResponse, RsaResponse, Session};
#[derive(Debug)]
pub enum LoginError {