5 releases

0.0.6 Jan 7, 2024
0.0.5 Aug 31, 2023
0.0.3 Dec 4, 2022
0.0.2 Oct 17, 2022
0.0.1 Oct 17, 2022

#306 in Authentication


Used in 2 crates

MPL-2.0 license

10KB
178 lines

Generate htpasswd files with bcrypt passwords.

Example

use std::error::Error;
use passivized_htpasswd::errors::HtpasswdError;
use passivized_htpasswd::Htpasswd;

fn setup_credentials() -> Result<(), Box<dyn Error>> {
    let mut credentials = Htpasswd::new();

    credentials.set("John Doe", "Don't hardcode")?;
    credentials.write_to_path("www/.htpasswd")?;

    Ok(())
}

lib.rs:

Generate Apache .htpasswd files using bcrypt.

Example

use std::error::Error;
use passivized_htpasswd::errors::HtpasswdError;
use passivized_htpasswd::Htpasswd;

fn setup_credentials() -> Result<(), Box<dyn Error>> {
    let mut credentials = Htpasswd::new();

    credentials.set("John Doe", "Don't hardcode")?;
    credentials.write_to_path("www/.htpasswd")?;

    Ok(())
}

Dependencies

~2.4–3MB
~60K SLoC