[][src]Struct emerald_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

Implementations

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]

impl Debug for KeyFile[src]

impl Default for KeyFile[src]

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

impl Display for KeyFile[src]

impl Eq for KeyFile[src]

impl From<KeyFile> for AccountInfo[src]

impl From<Uuid> 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 Ord for KeyFile[src]

impl PartialEq<KeyFile> for KeyFile[src]

impl PartialOrd<KeyFile> for KeyFile[src]

impl Serialize for KeyFile[src]

impl StructuralEq for KeyFile[src]

Auto Trait Implementations

impl RefUnwindSafe for KeyFile

impl Send for KeyFile

impl Sync for KeyFile

impl Unpin for KeyFile

impl UnwindSafe for KeyFile

Blanket Implementations

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

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

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

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

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

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

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, U> TryInto<U> for T where
    U: TryFrom<T>, 

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