diff --git a/Cargo.lock b/Cargo.lock index 80a1ce1..09b3e5a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "adler" version = "1.0.2" @@ -1241,6 +1243,26 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" +[[package]] +name = "steamguard" +version = "0.1.0" +dependencies = [ + "anyhow", + "base64", + "cookie", + "hmac-sha1", + "lazy_static 1.4.0", + "log", + "rand", + "regex", + "reqwest", + "rsa", + "serde", + "serde_json", + "standback", + "uuid", +] + [[package]] name = "steamguard-cli" version = "0.2.0" @@ -1261,6 +1283,7 @@ dependencies = [ "serde_json", "standback", "stderrlog", + "steamguard", "termion", "text_io", "uuid", diff --git a/Cargo.toml b/Cargo.toml index 88bdf7e..8026e97 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,9 @@ +[workspace] + +members = [ + "steamguard" +] + [package] name = "steamguard-cli" version = "0.2.0" @@ -26,3 +32,4 @@ regex = "1" lazy_static = "1.4.0" uuid = { version = "0.8", features = ["v4"] } termion = "1.5.6" +steamguard = { path = "./steamguard" } diff --git a/src/accountlinker.rs b/src/accountlinker.rs index 51f6fa0..5e039c6 100644 --- a/src/accountlinker.rs +++ b/src/accountlinker.rs @@ -2,7 +2,7 @@ use std::collections::HashMap; use reqwest::{Url, cookie::{CookieStore}, header::COOKIE}; use serde::Deserialize; use serde_json::Value; -use steamguard_cli::{SteamGuardAccount, steamapi::Session}; +use steamguard::{SteamGuardAccount, steamapi::Session}; use log::*; #[derive(Debug, Clone)] diff --git a/src/accountmanager.rs b/src/accountmanager.rs index 8c36dea..625095f 100644 --- a/src/accountmanager.rs +++ b/src/accountmanager.rs @@ -3,7 +3,7 @@ use std::io::BufReader; use std::path::Path; use serde::{Serialize, Deserialize}; use std::error::Error; -use steamguard_cli::SteamGuardAccount; +use steamguard::SteamGuardAccount; use log::*; #[derive(Debug, Serialize, Deserialize)] diff --git a/src/main.rs b/src/main.rs index c75d8bf..15278e0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,5 @@ extern crate rpassword; -use steamguard_cli::*; +use steamguard::{SteamGuardAccount, Confirmation, ConfirmationType, steamapi}; use std::collections::HashSet; use std::{io::{Write, stdout, stdin}, path::Path}; use clap::{App, Arg, crate_version}; diff --git a/steamguard/Cargo.toml b/steamguard/Cargo.toml new file mode 100644 index 0000000..d31c89c --- /dev/null +++ b/steamguard/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "steamguard" +version = "0.1.0" +edition = "2018" +description = "Library for generating 2fa codes for Steam and responding to mobile confirmations." + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +anyhow = "^1.0" +hmac-sha1 = "^0.1" +base64 = "0.13.0" +reqwest = { version = "0.11", features = ["blocking", "json", "cookies", "gzip"] } +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +rsa = "0.5.0" +rand = "0.8.4" +standback = "0.2.17" # required to fix a compilation error on a transient dependency +cookie = "0.14" +regex = "1" +lazy_static = "1.4.0" +uuid = { version = "0.8", features = ["v4"] } +log = "0.4.14" diff --git a/src/confirmation.rs b/steamguard/src/confirmation.rs similarity index 100% rename from src/confirmation.rs rename to steamguard/src/confirmation.rs diff --git a/src/lib.rs b/steamguard/src/lib.rs similarity index 100% rename from src/lib.rs rename to steamguard/src/lib.rs diff --git a/src/steamapi.rs b/steamguard/src/steamapi.rs similarity index 100% rename from src/steamapi.rs rename to steamguard/src/steamapi.rs