Created
July 19, 2018 06:01
-
-
Save timxor/ff7793d20f5cf104165ec712e9bc5123 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate diesel; | |
extern crate payment_api; | |
use std::process::Command; | |
use payment_api::*; | |
fn main() { | |
let connection = establish_connection(); | |
// execute a cli to generate a key pair | |
let output = Command::new("/Users/tim.siwula/Desktop/parity/target/debug/./ethkey") | |
.arg("generate") | |
.arg("random") | |
.output() | |
.expect("./ethkey failed to execute"); | |
assert!(output.status.success()); | |
let data = String::from_utf8_lossy(&output.stdout); | |
// for s in data.lines() { | |
// println!("{:?}", s); | |
// } | |
// todo save secret, public and address to postgresql db | |
let mut secret = String::new(); | |
secret = data[9..73].to_string(); | |
println!("\nsecret = {:?}", secret); | |
let mut public = String::new(); | |
public = data[83..211].to_string(); | |
println!("\npublic = {:?}", public); | |
let mut address: String = "0x".to_owned(); | |
let borrowed_string: &str = &data[221..261]; | |
address.push_str(borrowed_string); | |
println!("\naddress = {:?}", address); | |
// todo finish creating function | |
// let user = create_user(&connection, secret, public, address); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment