No description
Find a file
2021-03-04 16:38:29 +05:30
.github/workflows docs workflow 2021-01-29 11:46:17 +05:30
examples examples 2021-01-29 11:42:59 +05:30
src got rid of rust_argon2 config lifetimes 2021-03-04 16:35:40 +05:30
.gitignore config and tests 2021-01-29 10:31:36 +05:30
Cargo.toml version bump 2021-03-04 16:38:29 +05:30
LICENSE-APACHE readme and license 2021-01-02 12:46:20 +05:30
LICENSE-MIT readme and license 2021-01-02 12:46:20 +05:30
README.md examples 2021-01-29 11:42:59 +05:30

Argon2-Creds

Argon2-Creds - convenient abstractions for managing credentials

Documentation CI (Linux) dependency status
codecov

Features

  • PRECIS Framework UsernameCaseMapped
  • Password hashing and validation using rust-argon2
  • Filters for words that might cause ambiguity. See Blacklist
  • Profanity filter
  • Email validation(Regex validation not verification)

Usage:

Add this to your Cargo.toml:

argon2-creds = { version = "0.1", git = "https://github.com/realaravinth/argon2-creds" }

Examples:

  1. The easiest way to use this crate is with the default configuration. See Default implementation for the default configuration.
use argon2_creds::Config;

fn main() {
    let config = Config::default();

    let password = "ironmansucks";
    let hash = config.password(password).unwrap();

    // email validation
    config.email(Some("batman@we.net")).unwrap();
    
    // process username
    let username = config.username("Realaravinth").unwrap(); // process username
    
    // generate hash
    let hash = config.password(password).unwrap();

    assert_eq!(username, "realaravinth");
    assert!(Config::verify(&hash, password).unwrap(), "verify hahsing");
}
  1. To gain fine-grained control over how credentials are managed, consider using [ConfigBuilder]:
 use argon2_creds::{ConfigBuilder, Config};

 fn main() {
     let config = ConfigBuilder::default()
         .salt_length(32)
         .username_case_mapped(false)
         .profanity(true)
         .blacklist(false)
         .argon2(argon2::Config::default())
         .build()
         .unwrap();

     let password = "ironmansucks";
     let hash = config.password(password).unwrap();

     // email validation
     config.email(Some("batman@we.net")).unwrap();
     
     // process username
     let username = config.username("Realaravinth").unwrap(); // process username
     
     // generate hash
     let hash = config.password(password).unwrap();

     assert_eq!(username, "realaravinth");
     assert!(Config::verify(&hash, password).unwrap(), "verify hahsing");
 }