3 unstable releases
0.2.1 | Nov 3, 2023 |
---|---|
0.2.0 | Nov 3, 2023 |
0.1.0 | Oct 30, 2023 |
#4 in #hd-wallet
35KB
761 lines
hdwallet-filecoin
Hierarchical Deterministic Wallet for filecoin.
This implemention follows:
- BIP-39 for mnemonic word
- BIP-32 for secp256k1 derivation
- EIP-2333 for bls12-381 derivation
- BIP-44 for hierarchical deterministic path
- Web3 Secret Storage Definition for keystore
Usage
use hdwallet_filecoin::{new_mnemonic, SecretKey};
fn main() {
let mnemonic = new_mnemonic().unwrap();
println!("{}", mnemonic);
let seed = mnemonic.to_seed("");
let sk = SecretKey::from_seed_bls(&seed).unwrap();
// You can also use SecretKey::from_seed_secp256k1 to generate a secp256k1 key
let pk = sk.public_key();
println!("{}", pk.address());
let msg = b"hello world";
let sig = sk.sign(msg).unwrap();
assert!(sig.verify(msg, &pk).is_ok());
}
Thanks to these projects for reference
Dependencies
~19MB
~499K SLoC