1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//! A simple library to read JSON keyfiles and sign Ethereum stuff.
//!
//! How to use it?
//! ```rust
//! use ethsign::{Protected, KeyFile};
//!
//! fn main() {
//! let file = std::fs::File::open("./res/wallet.json").unwrap();
//! let key: KeyFile = serde_json::from_reader(file).unwrap();
//! let password: Protected = "".into();
//! let secret = key.to_secret_key(&password).unwrap();
//! let message = [1_u8; 32];
//!
//! // Sign the message
//! let signature = secret.sign(&message).unwrap();
//! println!("{:?}", signature);
//!
//! // Recover the signer
//! let public = signature.recover(&message).unwrap();
//! println!("{:?}", public);
//!
//! // Verify the signature
//! let res = public.verify(&signature, &message).unwrap();
//! println!("{}", if res { "signature correct" } else { "invalid signature" });
//! }
//! ```
use ethsign_crypto as crypto;
pub use ;