This repository was archived by the owner on Nov 6, 2022. It is now read-only.
Commit d290719 1 parent 4646e03 commit d290719 Copy full SHA for d290719
File tree 1 file changed +40
-0
lines changed
1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ use dotenv:: dotenv;
2
+ use secp256k1:: Secp256k1 ;
3
+
4
+ use terra_rust_cli:: cli_helpers;
5
+
6
+ async fn run ( ) -> anyhow:: Result < ( ) > {
7
+ let cli = cli_helpers:: gen_cli ( "pubkey" , "pubkey" ) ;
8
+ let matches = cli. get_matches ( ) ;
9
+ let secp = Secp256k1 :: new ( ) ;
10
+ let private_key = cli_helpers:: get_private_key ( & secp, & matches) ?;
11
+
12
+ let msg = "mary had a little lamb. I ate, coz lamb is delicious" ;
13
+ // let signature = from_key.sign(&secp, &cli.message)?;
14
+ let signature = private_key. sign ( & secp, & msg) ?;
15
+
16
+ println ! ( "PubKeySig={}" , signature. pub_key. value) ;
17
+
18
+ Ok ( ( ) )
19
+ }
20
+
21
+ #[ tokio:: main]
22
+ async fn main ( ) {
23
+ dotenv ( ) . ok ( ) ;
24
+ env_logger:: init ( ) ;
25
+
26
+ if let Err ( ref err) = run ( ) . await {
27
+ log:: error!( "{}" , err) ;
28
+ err. chain ( )
29
+ . skip ( 1 )
30
+ . for_each ( |cause| log:: error!( "because: {}" , cause) ) ;
31
+
32
+ // The backtrace is not always generated. Try to run this example
33
+ // with `$env:RUST_BACKTRACE=1`.
34
+ // if let Some(backtrace) = e.backtrace() {
35
+ // log::debug!("backtrace: {:?}", backtrace);
36
+ // }
37
+
38
+ :: std:: process:: exit ( 1 ) ;
39
+ }
40
+ }
You can’t perform that action at this time.
0 commit comments