### Intro `forge_wallet` implement by `Rust`. Based on [forge_crypter](https://crates.io/crates/forge_crypter), [forge_hasher](https://crates.io/crates/forge_hasher), [forge_signer](https://crates.io/crates/forge_signer), [forge_did](https://crates.io/crates/forge_did). The crate provides some help functions to help user create wallet. ### Struct Wallet ```rust pub struct Wallet { pub w_type: WalletType, pub sk: Vec, pub pk: Vec, pub address: String, } ``` ### API - ` create_default_wallet() -> Result` - ` from_wallet_type(w_type: &WalletType) -> Result` - ` from_address(addr: &str) -> Result` - ` from_pk(pk: &[u8], w_type: &WalletType) -> Result` - ` from_sk(sk: &[u8], w_type: &WalletType) -> Result` - ` from_json(j: Value) -> Result` - ` to_json(&self) -> Result` - ` verify(&self, message: &[u8], signature: &[u8]) -> Result` - ` hash(&self, message: &[u8]) -> Result>` - ` sign(&self, message: &[u8]) -> Result>` - ` format_wallet(&mut self) -> Result<()>` - ` is_valid(wallet: &Wallet) -> bool` ### Usage ```rust let wallet_type = WalletType { role_type: Some(RoleType::Application), key_type: Some(KeyType::Ed25519), hash_type: Some(HashType::Sha3), }; let wallet = from_wallet_type(&wallet_type)?; assert_eq!(wallet, from_sk(&wallet.sk, &wallet_type)?); let message = b"hello rust"; let signature = wallet.sign(message)?; assert!(wallet.verify(message, &signature))?; ```