cli_get_new_password

Function cli_get_new_password 

Source
pub fn cli_get_new_password(req_strength: u8) -> String
Expand description

Gets a new password from the user with confirmation and strength validation.

Prompts the user to enter a password twice for confirmation and validates it against a required strength level using the zxcvbn algorithm. The function will continue prompting until a password meeting all requirements is entered.

§Arguments

  • req_strength - Required password strength (0-4, where 4 is strongest)
    • 0: Too guessable
    • 1: Very guessable
    • 2: Somewhat guessable
    • 3: Safely unguessable
    • 4: Very unguessable

§Returns

Returns the validated password as a String.

§Example

use falcon_cli::cli_get_new_password;

// Require a password with strength level 3
let password = cli_get_new_password(3);
println!("Strong password created successfully");