Skip to content

Commit

Permalink
steamguard: add SteamGuardAccount::from_reader
Browse files Browse the repository at this point in the history
  • Loading branch information
dyc3 committed Aug 13, 2022
1 parent 0d90792 commit 9f1d692
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion steamguard/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use reqwest::{
use scraper::{Html, Selector};
pub use secrecy::{ExposeSecret, SecretString};
use serde::{Deserialize, Serialize};
use std::{collections::HashMap, convert::TryInto};
use std::{collections::HashMap, convert::TryInto, io::Read};
use steamapi::SteamApiClient;
pub use userlogin::{LoginError, UserLogin};
#[macro_use]
Expand Down Expand Up @@ -94,6 +94,13 @@ impl SteamGuardAccount {
};
}

pub fn from_reader<T>(r: T) -> anyhow::Result<Self>
where
T: Read,
{
Ok(serde_json::from_reader(r)?)
}

pub fn set_session(&mut self, session: steamapi::Session) {
self.session = Some(session.into());
}
Expand Down

0 comments on commit 9f1d692

Please sign in to comment.