移除一些无用代码

This commit is contained in:
cebgcontract 2022-10-22 13:09:38 +08:00
parent b0cd7fbc18
commit 81712b16d1
4 changed files with 24 additions and 19 deletions

View File

@ -23,5 +23,5 @@ serde = { version = "1.0.145", features = ["derive"]}
serde_json = "1.0.85"
shamir_secret_sharing = "0.1.1"
tiny-keccak = "1.5"
web3 = { version = "0.18.0", features = ["signing"] }
web3 = { version = "0.18.0"}

22
rustwallet.h Normal file
View File

@ -0,0 +1,22 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
typedef struct CWallet {
char *public_key;
char *private_key;
char *public_addr;
} CWallet;
struct CWallet generate_cwallet(void);
void free_cwallet(struct CWallet cw);
void save_wallet(const struct CWallet *cw);
struct CWallet fetch_cwallet(void);
void sign(void);
void sss_sign(const char *msg);

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
# building
cbindgen src/lib.rs -l c > rustywallet.h
cbindgen src/lib.rs -l c > rustwallet.h
cargo lipo --release
# moving files to the ios project

View File

@ -125,23 +125,6 @@ impl Wallet {
let pk = SecretKey::from_str(&self.secret_key).expect("32 bytes, within curve order");
// println!("secret key: {:?}", pk);
// let key = SecretKeyRef::new(&pk);
// let signature = key
// .sign(message_hash.as_bytes(), None)
// .expect("hash is non-zero 32-bytes; qed");
// let v = signature
// .v
// .try_into()
// .expect("signature recovery in electrum notation always fits in a u8");
// let mut bytes = Vec::with_capacity(65);
// bytes.extend_from_slice(signature.r.as_bytes());
// bytes.extend_from_slice(signature.s.as_bytes());
// bytes.push(v);
// let str_sign = hex::encode(bytes);
// println!("web3 sign: {:?}", str_sign);
let message_to_hash = Message::from_slice(message_hash.as_ref()).unwrap();
let (recovery_id, signature) = secp
.sign_ecdsa_recoverable(&message_to_hash, &pk)