prople_crypto/passphrase/
types.rs1pub mod errors {
3 use rst_common::with_errors::thiserror::{self, Error};
4
5 pub use crate::errors::CommonError;
6
7 #[derive(Debug, Error, PartialEq)]
9 pub enum PassphraseError {
10 #[error("passphrase: unable to build params: `{0}`")]
11 BuildParamsError(String),
12
13 #[error("passphrase: unable to hash password: `{0}`")]
14 HashPasswordError(String),
15
16 #[error("passphrase: unable to parse salt: `{0}`")]
17 ParseSaltError(String),
18 }
19}
20
21pub type KeyBytesRange = [u8; 32];
22
23use crate::types::Value;
24
25#[derive(Clone, Debug)]
26pub struct SaltBytes(Vec<u8>);
27
28impl Value<Vec<u8>> for SaltBytes {
29 fn get(&self) -> Result<Vec<u8>, errors::CommonError> {
30 Ok(self.0.to_owned())
31 }
32}
33
34impl From<Vec<u8>> for SaltBytes {
35 fn from(value: Vec<u8>) -> Self {
36 SaltBytes(value)
37 }
38}