diff --git a/steamguard/src/lib.rs b/steamguard/src/lib.rs index 0f02adb..59fb957 100644 --- a/steamguard/src/lib.rs +++ b/steamguard/src/lib.rs @@ -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] @@ -94,6 +94,13 @@ impl SteamGuardAccount { }; } + pub fn from_reader(r: T) -> anyhow::Result + where + T: Read, + { + Ok(serde_json::from_reader(r)?) + } + pub fn set_session(&mut self, session: steamapi::Session) { self.session = Some(session.into()); }