Struct emerald_rs::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]
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]
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
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]
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
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]
&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 Into<KeyFile> for CoreCrypto
[src]
impl Into<KeyFile> for SerializableKeyFileCore
[src]
impl Into<KeyFile> for SerializableKeyFileHD
[src]
impl Encodable for KeyFile
[src]
fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error>
[src]
Serialize a value using an Encoder
.
impl Debug for KeyFile
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Clone for KeyFile
[src]
fn clone(&self) -> KeyFile
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
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
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl PartialOrd for KeyFile
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
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
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
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
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 Ord for KeyFile
[src]
fn cmp(&self, other: &Self) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
impl Display for KeyFile
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more