Struct emerald_core::keystore::KeyFile
[−]
[src]
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]
fn decode(f: String) -> Result<KeyFile, Error>
Decode Keyfile from JSON
Handles different variants of crypto section
fn flush<P: AsRef<Path>>(
&self,
dir: P,
filename: Option<&str>
) -> Result<(), Error>
&self,
dir: P,
filename: Option<&str>
) -> Result<(), Error>
Serializes into JSON file with the name format UTC--<timestamp>Z--<uuid>
Arguments
dir- path to destination directoryaddr- a public address (optional)
fn search_by_address<P: AsRef<Path>>(
addr: &Address,
path: P
) -> Result<(PathBuf, KeyFile), Error>
addr: &Address,
path: P
) -> Result<(PathBuf, KeyFile), Error>
Search of KeyFile by specified Address
Returns set of filepath and Keyfile
Arguments
path- path with keystore files
impl KeyFile[src]
fn new(
passphrase: &str,
sec_level: &KdfDepthLevel,
name: Option<String>,
description: Option<String>
) -> Result<KeyFile, Error>
passphrase: &str,
sec_level: &KdfDepthLevel,
name: Option<String>,
description: Option<String>
) -> Result<KeyFile, Error>
Creates a new KeyFile with specified passphrase at random (rand::OsRng)
Arguments
passphrase- password for key derivation function
fn new_custom<R: Rng>(
pk: PrivateKey,
passphrase: &str,
kdf: Kdf,
rng: &mut R,
name: Option<String>,
description: Option<String>
) -> Result<KeyFile, Error>
pk: PrivateKey,
passphrase: &str,
kdf: Kdf,
rng: &mut R,
name: Option<String>,
description: Option<String>
) -> Result<KeyFile, Error>
Creates a new KeyFile with specified PrivateKey, passphrase, key derivation function
and with given custom random generator
Arguments
pk- a private keypassphrase- password for key derivation functionkdf- customized key derivation functionrnd- predefined random number generator
fn decrypt_address(&self, passphrase: &str) -> Result<Address, Error>
Decrypt public address from keystore file by a passphrase
fn decrypt_key(&self, passphrase: &str) -> Result<PrivateKey, Error>
Decrypt private key from keystore file by a passphrase
fn encrypt_key(&mut self, pk: PrivateKey, passphrase: &str)
Encrypt a new private key for keystore file with a passphrase
fn encrypt_key_custom<R: Rng>(
&mut self,
pk: PrivateKey,
passphrase: &str,
rng: &mut R
)
&mut self,
pk: PrivateKey,
passphrase: &str,
rng: &mut R
)
Encrypt a new private key for keystore file with a passphrase and with given custom random generator
Trait Implementations
impl Encodable for KeyFile[src]
impl Debug for KeyFile[src]
impl Clone for KeyFile[src]
fn clone(&self) -> KeyFile
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0
Performs copy-assignment from source. Read more
impl Eq for KeyFile[src]
impl Default for KeyFile[src]
impl From<Uuid> for KeyFile[src]
impl PartialEq for KeyFile[src]
fn eq(&self, other: &Self) -> bool
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Rhs) -> bool1.0.0
This method tests for !=.
impl PartialOrd for KeyFile[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool1.0.0
This method tests less than (for self and other) and is used by the < operator. Read more
fn le(&self, other: &Rhs) -> bool1.0.0
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
fn gt(&self, other: &Rhs) -> bool1.0.0
This method tests greater than (for self and other) and is used by the > operator. Read more
fn ge(&self, other: &Rhs) -> bool1.0.0
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
impl Ord for KeyFile[src]
fn cmp(&self, other: &Self) -> Ordering
This method returns an Ordering between self and other. Read more
fn max(self, other: Self) -> Self
ord_max_min)Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
ord_max_min)Compares and returns the minimum of two values. Read more