Skip to main content

StaticSecretExt

Trait StaticSecretExt 

Source
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§

Source

fn verify_file<P>(file: P) -> bool
where P: AsRef<Path>,

Check whether there is a file containing the crypto keys.

Source

fn new_with_os_rand() -> StaticSecret

Generate a new secret key with the OS random number generator.

Source

fn from_file<P>(file: P) -> Result<StaticSecret>
where P: AsRef<Path>,

Try to load the crypto keys from our file on the disk.

Source

fn save<P>(&self, file: P) -> Result<()>
where P: AsRef<Path>,

Save the crypto keys to the file on the disk.

Provided Methods§

Source

fn from_file_or_generate<P>(file: P) -> Result<StaticSecret>
where P: AsRef<Path>,

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.

Implementors§