Crate passforge

Source
Expand description

§PassForge

passforge is a robust and flexible password generation library that allows users to create secure passwords and passphrases with various customization options. It also provides functionality for evaluating password strength and allows for easy extension through the Generator and StrengthEvaluator.

§Features

  • Generate passwords with customizable length and character sets
  • Create passphrases using a word list
  • Evaluate password strength using the zxcvbn algorithm
  • Command-line interface for easy use
  • Extendible through Generator and StrengthEvaluator traits.

§Getting Started

To use PassForge in your project, add the following to your Cargo.toml:

[dependencies]
passforge = "0.1.0"

Then, you can use the library in your Rust code as shown in the examples below.

§Examples

Generating a Password

use passforge::{PasswordConfig, PasswordGenerator, Generator, Length};

let config = PasswordConfig::new(Length::Single(16), true, true, true);
let password = PasswordGenerator::generate(&config).expect("Failed to generate password");
println!("Generated password: {}", password);

Creating a Passphrase

use passforge::{PassphraseConfig, PassphraseGenerator, Generator, WordList};

let config = PassphraseConfig::new(4, "-".to_string(), WordList::Default);
let passphrase = PassphraseGenerator::generate(&config).expect("Failed to generate passphrase");
println!("Generated passphrase: {}", passphrase);

Evaluating Password Strength

use passforge::{ZxcvbnAnalysis, StrengthEvaluator};

let password = "example_password".into();
let strength = ZxcvbnAnalysis::evaluate(&password).expect("Failed to evaluate password");
println!("Password strength: {}", strength);

Re-exports§

pub use config::Length;
pub use config::PassphraseConfig;
pub use config::PassphraseConfigBuilder;
pub use config::PasswordConfig;
pub use config::PasswordConfigBuilder;
pub use config::WordList;
pub use error::PassForgeError;
pub use generator::Generator;
pub use generator::PassphraseGenerator;
pub use generator::PasswordGenerator;
pub use strength_evaluator::StrengthEvaluator;
pub use strength_evaluator::ZxcvbnAnalysis;

Modules§

config
Configuration structures for password and passphrase generation, This module defines the configuration structures for password and passphrase generation.
error
Custom error types used throughout the crate to provide detailed information about failure conditions. This module defines custom error types for the PassForge library.
generator
Core generation functionality for passwords and passphrases, implementing the Generator trait for different types of generators. This module defines the core generation functionality for passwords and passphrases.
strength_evaluator
Password strength evaluation functionality using the zxcvbn algorithm, providing detailed analysis of password security. Extendible by implementing the StrengthEvaluator trait This module defines the interface for password strength evaluation.