Lev
5 years ago
8 changed files with 86 additions and 42 deletions
@ -1,14 +0,0 @@
|
||||
extern crate rand; |
||||
use serde::{Serialize, Deserialize}; |
||||
|
||||
#[derive(Serialize, Deserialize, Debug, PartialEq)] |
||||
pub struct PublicKey { |
||||
pub id: u64 |
||||
} |
||||
|
||||
#[derive(Serialize, Deserialize, Debug, PartialEq)] |
||||
pub struct SecretKey {} |
||||
|
||||
pub fn gen_keys() -> (PublicKey, SecretKey) { |
||||
(PublicKey { id: rand::random::<u64>() }, SecretKey {}) |
||||
} |
@ -0,0 +1,32 @@
|
||||
extern crate rand; |
||||
|
||||
use serde::{Serialize, Deserialize}; |
||||
|
||||
#[derive(Serialize, Deserialize, Debug, PartialEq)] |
||||
pub struct PublicKey { |
||||
pub id: u64 |
||||
} |
||||
|
||||
#[derive(Serialize, Deserialize, Debug, PartialEq)] |
||||
pub struct KeyPack { |
||||
pub public_key: PublicKey, |
||||
secret_key: u64, |
||||
} |
||||
|
||||
impl KeyPack { |
||||
pub fn gen() -> KeyPack { |
||||
KeyPack { public_key: PublicKey { id: rand::random::<u64>() }, secret_key: 0 } |
||||
} |
||||
} |
||||
|
||||
impl PublicKey { |
||||
pub fn verify_sign(self, sign: u64) -> bool { |
||||
true |
||||
} |
||||
} |
||||
|
||||
impl KeyPack { |
||||
pub fn sign(self, msg: u64) -> u64 { |
||||
0 |
||||
} |
||||
} |
@ -1,16 +1,14 @@
|
||||
use crate::transport::Transport; |
||||
use crate::addresses::{PublicKey, SecretKey, gen_keys}; |
||||
use crate::crypto::{PublicKey, KeyPack}; |
||||
|
||||
|
||||
pub struct IronForce { |
||||
transport: Transport, |
||||
public: PublicKey, |
||||
secret: SecretKey, |
||||
key_pack: KeyPack |
||||
} |
||||
|
||||
impl IronForce { |
||||
pub fn new() -> IronForce { |
||||
let (public, secret) = gen_keys(); |
||||
IronForce { transport: Transport {}, public, secret } |
||||
pub fn gen() -> IronForce { |
||||
IronForce { transport: Transport {}, key_pack: KeyPack::gen() } |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue