diff --git a/Cargo.toml b/Cargo.toml index 5a9bd08..46071e8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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"} diff --git a/rustwallet.h b/rustwallet.h new file mode 100644 index 0000000..448c162 --- /dev/null +++ b/rustwallet.h @@ -0,0 +1,22 @@ +#include +#include +#include +#include + +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); diff --git a/scripts/ios_build.sh b/scripts/ios_build.sh index 25cc3b0..973dcd4 100755 --- a/scripts/ios_build.sh +++ b/scripts/ios_build.sh @@ -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 diff --git a/src/wallet/wallet_impl.rs b/src/wallet/wallet_impl.rs index d3937f4..0f74478 100644 --- a/src/wallet/wallet_impl.rs +++ b/src/wallet/wallet_impl.rs @@ -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)