[][src]Struct webchain_rs::keystore::KeyFile

pub struct KeyFile {
    pub visible: Option<bool>,
    pub name: Option<String>,
    pub description: Option<String>,
    pub address: Address,
    pub uuid: Uuid,
    pub crypto: CryptoType,
}

A keystore file (account private core encrypted with a passphrase)

Fields

visible: Option<bool>

Specifies if Keyfile is visible

name: Option<String>

User specified name

description: Option<String>

User specified description

address: Address

Address

uuid: Uuid

UUID v4

crypto: CryptoType

Methods

impl KeyFile[src]

pub fn decode(f: &str) -> Result<KeyFile, Error>[src]

Decode Keyfile from JSON Handles different variants of crypto section

impl KeyFile[src]

pub fn new(
    passphrase: &str,
    sec_level: &KdfDepthLevel,
    name: Option<String>,
    description: Option<String>
) -> Result<KeyFile, Error>
[src]

Creates a new KeyFile with specified passphrase at random (rand::OsRng)

Arguments

  • passphrase - password for key derivation function

pub fn new_custom<R: Rng>(
    pk: PrivateKey,
    passphrase: &str,
    kdf: Kdf,
    rng: &mut R,
    name: Option<String>,
    description: Option<String>
) -> Result<KeyFile, Error>
[src]

Creates a new KeyFile with specified PrivateKey, passphrase, key derivation function and with given custom random generator

Arguments

  • pk - a private key
  • passphrase - password for key derivation function
  • kdf - customized key derivation function
  • rnd - predefined random number generator

pub fn decrypt_address(&self, password: &str) -> Result<Address, Error>[src]

Decrypt public address from keystore file by a password

pub fn decrypt_key(&self, passphrase: &str) -> Result<PrivateKey, Error>[src]

Decrypt private key from keystore file by a password

pub fn encrypt_key(&mut self, pk: PrivateKey, passphrase: &str)[src]

Encrypt a new private key for keystore file with a passphrase

pub fn encrypt_key_custom<R: Rng>(
    &mut self,
    pk: PrivateKey,
    passphrase: &str,
    rng: &mut R
)
[src]

Encrypt a new private key for keystore file with a passphrase and with given custom random generator

Trait Implementations

impl Clone for KeyFile[src]

default fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Ord for KeyFile[src]

default fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

default fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

default fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Restrict a value to a certain interval. Read more

impl Eq for KeyFile[src]

impl Into<KeyFile> for HdwalletCrypto[src]

impl Into<KeyFile> for CoreCrypto[src]

impl Into<KeyFile> for SerializableKeyFileCore[src]

impl Into<KeyFile> for SerializableKeyFileHD[src]

impl PartialOrd<KeyFile> for KeyFile[src]

#[must_use]
default fn lt(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
default fn le(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
default fn gt(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
default fn ge(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl PartialEq<KeyFile> for KeyFile[src]

#[must_use]
default fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl Default for KeyFile[src]

impl From<Uuid> for KeyFile[src]

impl From<KeyFile> for AccountInfo[src]

impl Display for KeyFile[src]

impl Debug for KeyFile[src]

impl Encodable for KeyFile[src]

Auto Trait Implementations

impl Send for KeyFile

impl Sync for KeyFile

Blanket Implementations

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

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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

type Owned = T

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

impl<T, U> TryInto 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> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Typeable for T where
    T: Any

default fn get_type(&self) -> TypeId

Get the TypeId of this object.

impl<T> Erased for T