Intro
forge_wallet
implement by Rust
. Based on forge_crypter, forge_hasher, forge_signer, forge_did.
The crate provides some help functions to help user create wallet.
Struct Wallet
API
create_default_wallet() -> Result<Wallet>
from_wallet_type(w_type: &WalletType) -> Result<Wallet>
from_address(addr: &str) -> Result<Wallet>
from_pk(pk: &[u8], w_type: &WalletType) -> Result<Wallet>
from_sk(sk: &[u8], w_type: &WalletType) -> Result<Wallet>
from_json(j: Value) -> Result<Wallet>
to_json(&self) -> Result<Value>
verify(&self, message: &[u8], signature: &[u8]) -> Result<bool>
hash(&self, message: &[u8]) -> Result<Vec<u8>>
sign(&self, message: &[u8]) -> Result<Vec<u8>>
format_wallet(&mut self) -> Result<()>
is_valid(wallet: &Wallet) -> bool
Usage
let wallet_type = WalletType ;
let wallet = from_wallet_type?;
assert_eq!;
let message = b"hello rust";
let signature = wallet.sign?;
assert!?;