[−][src]Struct libpasta::config::Config
Holds possible configuration options See the module level documentation for more information.
Implementations
impl Config
[src]
#[must_use]pub fn with_primitive(primitive: Primitive) -> Self
[src]
Create a new empty Config
for setting parameters.
pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self>
[src]
Generates a Config
from a .toml file.
Config files can be generated using the Config::to_string
method on
an existing config.
Errors
If the config file could not be opened
#[must_use]pub fn hash_password(&self, password: &str) -> String
[src]
Generates hash for a given password.
Will automatically generate a random salt. In the extreme case that the default source of randomness is unavailable, this will fallback to a seed generated when the library is initialised. An error will be logged when this happens. /// ## Panics A panic indicates a problem with the serialization mechanisms, and should be reported.
#[must_use]pub fn verify_password(&self, hash: &str, password: &str) -> bool
[src]
Verifies the provided password matches the inputted hash string.
If there is any error in processing the hash or password, this
will simply return false
.
pub fn verify_password_update_hash(
&self,
hash: &str,
password: &str
) -> HashUpdate
[src]
&self,
hash: &str,
password: &str
) -> HashUpdate
Verifies a supplied password against a previously computed password hash,
and performs an in-place update of the hash value if the password verifies.
Hence this needs to take a mutable String
reference.
#[must_use]pub fn migrate_hash(&self, hash: &str) -> Option<String>
[src]
Migrate the input hash to the current recommended hash.
Note that this does not require the password. This is for batch updating
of hashes, where the password is not available. This performs an onion
approach, returning new_hash(old_hash)
.
If the password is also available, the verify_password_update_hash
should
instead be used.
#[must_use]pub fn add_key(&self, key: &[u8]) -> String
[src]
Add a new key into the list of configured keys
pub fn set_primitive(&mut self, primitive: Primitive)
[src]
Set the default primitive
pub fn set_keyed_hash(&mut self, keyed: Primitive)
[src]
Set a keyed function to be applied after hashing.
pub fn set_key_source(&mut self, store: &'static dyn Store)
[src]
Sets the location of keys for keyed functions.
Trait Implementations
impl Debug for Config
[src]
impl Default for Config
[src]
impl<'de> Deserialize<'de> for Config
[src]
pub fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Display for Config
[src]
impl Serialize for Config
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl !UnwindSafe for Config
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,