pub trait StaticSecretExt {
// Required methods
fn verify_file<P>(file: P) -> bool
where P: AsRef<Path>;
fn new_with_os_rand() -> StaticSecret;
fn from_file<P>(file: P) -> Result<StaticSecret>
where P: AsRef<Path>;
fn save<P>(&self, file: P) -> Result<()>
where P: AsRef<Path>;
// Provided method
fn from_file_or_generate<P>(file: P) -> Result<StaticSecret>
where P: AsRef<Path> { ... }
}Expand description
Add functions to the crypto secret key to make it easier to use.
Required Methods§
Sourcefn verify_file<P>(file: P) -> bool
fn verify_file<P>(file: P) -> bool
Check whether there is a file containing the crypto keys.
Sourcefn new_with_os_rand() -> StaticSecret
fn new_with_os_rand() -> StaticSecret
Generate a new secret key with the OS random number generator.
Sourcefn from_file<P>(file: P) -> Result<StaticSecret>
fn from_file<P>(file: P) -> Result<StaticSecret>
Try to load the crypto keys from our file on the disk.
Provided Methods§
Sourcefn from_file_or_generate<P>(file: P) -> Result<StaticSecret>
fn from_file_or_generate<P>(file: P) -> Result<StaticSecret>
Try to load the crypto key or generate a new one.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.