WIP: Auto-convert confid code

This commit is contained in:
Alex Page 2023-06-21 20:42:28 -04:00
parent 6f648b6556
commit eb0a567405
5 changed files with 1619 additions and 2 deletions

22
Cargo.lock generated
View file

@ -340,6 +340,26 @@ dependencies = [
"unicode-ident", "unicode-ident",
] ]
[[package]]
name = "thiserror"
version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "umskt" name = "umskt"
version = "0.1.0" version = "0.1.0"
@ -347,8 +367,10 @@ dependencies = [
"anyhow", "anyhow",
"bitreader", "bitreader",
"clap", "clap",
"libc",
"openssl", "openssl",
"serde_json", "serde_json",
"thiserror",
] ]
[[package]] [[package]]

View file

@ -9,5 +9,7 @@ edition = "2021"
anyhow = "1.0.71" anyhow = "1.0.71"
bitreader = "0.3.7" bitreader = "0.3.7"
clap = { version = "4.3.4", features = ["derive"] } clap = { version = "4.3.4", features = ["derive"] }
libc = "0.2.146"
openssl = { git = "https://github.com/anpage/rust-openssl.git" } openssl = { git = "https://github.com/anpage/rust-openssl.git" }
serde_json = "1.0" serde_json = "1.0"
thiserror = "1.0.40"

View file

@ -9,7 +9,7 @@ use openssl::{
}; };
use serde_json::{from_reader, from_str}; use serde_json::{from_reader, from_str};
use crate::{bink1998, bink2002, crypto::initialize_elliptic_curve}; use crate::{bink1998, bink2002, confid, crypto::initialize_elliptic_curve};
#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Mode { pub enum Mode {
@ -268,7 +268,11 @@ impl Cli {
} }
fn confirmation_id(&mut self) -> Result<()> { fn confirmation_id(&mut self) -> Result<()> {
todo!() if let Some(instid) = &self.options.instid {
let confirmation_id = confid::generate(instid)?;
println!("Confirmation ID: {confirmation_id}");
};
Ok(())
} }
fn print_key(pk: &str) { fn print_key(pk: &str) {

1588
src/confid.rs Normal file

File diff suppressed because it is too large Load diff

View file

@ -3,6 +3,7 @@ use anyhow::Result;
mod bink1998; mod bink1998;
mod bink2002; mod bink2002;
mod cli; mod cli;
mod confid;
mod crypto; mod crypto;
mod key; mod key;