[][src]Struct forge_wallet::Wallet

pub struct Wallet {
    pub w_type: WalletType,
    pub sk: Vec<u8>,
    pub pk: Vec<u8>,
    pub address: String,
}

Fields

w_type: WalletTypesk: Vec<u8>pk: Vec<u8>address: String

Methods

impl Wallet[src]

pub fn create_default_wallet() -> Result<Wallet>[src]

pub fn from_wallet_type(w_type: &WalletType) -> Result<Wallet>[src]

pub fn from_address(addr: &str) -> Result<Wallet>[src]

pub fn from_pk(pk: &[u8], w_type: &WalletType) -> Result<Wallet>[src]

pub fn from_sk(sk: &[u8], w_type: &WalletType) -> Result<Wallet>[src]

pub fn to_json(&self) -> Result<Value>[src]

pub fn from_json(j: Value) -> Result<Wallet>[src]

all Wallet fields must be in value, serde_json::from_value will failed if lost some fields.

pub fn verify(&self, message: &[u8], signature: &[u8]) -> Result<bool>[src]

pub fn hash(&self, message: &[u8]) -> Result<Vec<u8>>[src]

pub fn sign(&self, message: &[u8]) -> Result<Vec<u8>>[src]

pub fn format_wallet(&mut self) -> Result<()>[src]

add lost fields

pub fn is_valid(wallet: &Wallet) -> bool[src]

wallet is valid or not? did_type valid? sk, pk match? address, pk match? address, did_type match?

Trait Implementations

impl Clone for Wallet[src]

impl Default for Wallet[src]

impl PartialEq<Wallet> for Wallet[src]

impl Debug for Wallet[src]

impl Serialize for Wallet[src]

impl<'de> Deserialize<'de> for Wallet[src]

Auto Trait Implementations

impl Send for Wallet

impl Sync for Wallet

impl Unpin for Wallet

impl UnwindSafe for Wallet

impl RefUnwindSafe for Wallet

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]