seperate cli stuff from library stuff, and put it in another crate

This commit is contained in:
Carson McManus 2021-07-31 12:24:49 -04:00
parent d6aedb771c
commit c6d9fd0d75
9 changed files with 56 additions and 3 deletions

23
Cargo.lock generated
View file

@ -1,5 +1,7 @@
# This file is automatically @generated by Cargo. # This file is automatically @generated by Cargo.
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3
[[package]] [[package]]
name = "adler" name = "adler"
version = "1.0.2" version = "1.0.2"
@ -1241,6 +1243,26 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" 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]] [[package]]
name = "steamguard-cli" name = "steamguard-cli"
version = "0.2.0" version = "0.2.0"
@ -1261,6 +1283,7 @@ dependencies = [
"serde_json", "serde_json",
"standback", "standback",
"stderrlog", "stderrlog",
"steamguard",
"termion", "termion",
"text_io", "text_io",
"uuid", "uuid",

View file

@ -1,3 +1,9 @@
[workspace]
members = [
"steamguard"
]
[package] [package]
name = "steamguard-cli" name = "steamguard-cli"
version = "0.2.0" version = "0.2.0"
@ -26,3 +32,4 @@ regex = "1"
lazy_static = "1.4.0" lazy_static = "1.4.0"
uuid = { version = "0.8", features = ["v4"] } uuid = { version = "0.8", features = ["v4"] }
termion = "1.5.6" termion = "1.5.6"
steamguard = { path = "./steamguard" }

View file

@ -2,7 +2,7 @@ use std::collections::HashMap;
use reqwest::{Url, cookie::{CookieStore}, header::COOKIE}; use reqwest::{Url, cookie::{CookieStore}, header::COOKIE};
use serde::Deserialize; use serde::Deserialize;
use serde_json::Value; use serde_json::Value;
use steamguard_cli::{SteamGuardAccount, steamapi::Session}; use steamguard::{SteamGuardAccount, steamapi::Session};
use log::*; use log::*;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]

View file

@ -3,7 +3,7 @@ use std::io::BufReader;
use std::path::Path; use std::path::Path;
use serde::{Serialize, Deserialize}; use serde::{Serialize, Deserialize};
use std::error::Error; use std::error::Error;
use steamguard_cli::SteamGuardAccount; use steamguard::SteamGuardAccount;
use log::*; use log::*;
#[derive(Debug, Serialize, Deserialize)] #[derive(Debug, Serialize, Deserialize)]

View file

@ -1,5 +1,5 @@
extern crate rpassword; extern crate rpassword;
use steamguard_cli::*; use steamguard::{SteamGuardAccount, Confirmation, ConfirmationType, steamapi};
use std::collections::HashSet; use std::collections::HashSet;
use std::{io::{Write, stdout, stdin}, path::Path}; use std::{io::{Write, stdout, stdin}, path::Path};
use clap::{App, Arg, crate_version}; use clap::{App, Arg, crate_version};

23
steamguard/Cargo.toml Normal file
View file

@ -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"