From 1df30ee83e20a39baa3b416518f3b01f6c56e8ff Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Thu, 13 Apr 2017 15:26:07 +0300 Subject: [PATCH] added missing docs (#5452) --- ethstore/src/account/crypto.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ethstore/src/account/crypto.rs b/ethstore/src/account/crypto.rs index 8c4825a22..343e44cb4 100755 --- a/ethstore/src/account/crypto.rs +++ b/ethstore/src/account/crypto.rs @@ -73,10 +73,12 @@ impl From for String { } impl Crypto { + /// Encrypt account secret pub fn with_secret(secret: &Secret, password: &str, iterations: u32) -> Self { Crypto::with_plain(&*secret, password, iterations) } + /// Encrypt custom plain data pub fn with_plain(plain: &[u8], password: &str, iterations: u32) -> Self { let salt: [u8; 32] = Random::random(); let iv: [u8; 16] = Random::random(); @@ -113,6 +115,7 @@ impl Crypto { } } + /// Try to decrypt and convert result to account secret pub fn secret(&self, password: &str) -> Result { if self.ciphertext.len() > 32 { return Err(Error::InvalidSecret); @@ -122,6 +125,7 @@ impl Crypto { Ok(Secret::from_slice(&secret)?) } + /// Try to decrypt and return result as is pub fn decrypt(&self, password: &str) -> Result, Error> { let expected_len = self.ciphertext.len(); self.do_decrypt(password, expected_len)