From a12beebdc875c5603d8dc26ad79e9ad05c02b83a Mon Sep 17 00:00:00 2001 From: realaravinth Date: Fri, 17 Dec 2021 10:42:22 +0530 Subject: [PATCH] update deps and fix typos --- Cargo.toml | 12 ++++++------ README.md | 47 +++++++++++++++++++++++---------------------- examples/complex.rs | 2 +- examples/simple.rs | 2 +- src/config.rs | 8 ++++---- src/lib.rs | 8 ++++---- 6 files changed, 40 insertions(+), 39 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9f6b2fe..7d7af21 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,13 +3,13 @@ name = "argon2-creds" version = "0.2.1" authors = ["realaravinth "] description = "Convenient abstractions for all things credentials" -keywords = ["credentials", "password"] +keywords = ["credentials", "password", "argon2"] homepage = "https://github.com/realaravinth/argon2-creds" repository = "https://github.com/realaravinth/argon2-creds" documentation = "https://doc.rs/argon2-creds" license = "MIT OR Apache-2.0" readme = "README.md" -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] @@ -19,11 +19,11 @@ path = "src/lib.rs" [dependencies] rust-argon2 = "0.8.3" -derive_more = "0.99.11" +derive_more = "0.99.17" unicode-normalization = "0.1.6" -ammonia = "3.1.0" +ammonia = "3.1.2" validator = { version = "0.14.0", features = ["derive"]} lazy_static = "1.4.0" -regex = { version = "1.3.9", features = [ "perf-inline", "perf-dfa", "perf-literal", "perf-cache", "perf"]} -rand = "0.8.0" +regex = { version = "1.5.4", features = [ "perf-inline", "perf-dfa", "perf-literal", "perf-cache", "perf"]} +rand = "0.8.4" derive_builder = "0.10" diff --git a/README.md b/README.md index a05e76a..4cd56aa 100644 --- a/README.md +++ b/README.md @@ -8,56 +8,57 @@ ![CI (Linux)]() [![dependency status](https://deps.rs/repo/github/realaravinth/argon2-creds/status.svg)](https://deps.rs/repo/github/realaravinth/argon2-creds)
-[![codecov](https://codecov.io/gh/realaravinth/argon2-creds/branch/master/graph/badge.svg)](https://codecov.io/gh/realaravinth/argon2-creds) +[![codecov](https://codecov.io/gh/realaravinth/argon2-creds/branch/master/graph/badge.svg)](https://codecov.io/gh/realaravinth/argon2-creds) ## Features -- [x] PRECIS Framework [UsernameCaseMapped](https://tools.ietf.org/html/rfc8265#page-7) -- [x] Password hashing and validation using - [rust-argon2](https://crates.io/crates/rust-argon2) -- [x] Filters for words that might cause ambiguity. See -[Blacklist](https://github.com/shuttlecraft/The-Big-Username-Blacklist) -- [x] Profanity filter -- [x] Email validation(Regex validation not verification) + +- [x] PRECIS Framework [UsernameCaseMapped](https://tools.ietf.org/html/rfc8265#page-7) +- [x] Password hashing and validation using + [rust-argon2](https://crates.io/crates/rust-argon2) +- [x] Filters for words that might cause ambiguity. See + [Blacklist](https://github.com/shuttlecraft/The-Big-Username-Blacklist) +- [x] Profanity filter +- [x] Email validation(Regex validation not verification) ## Usage: Add this to your `Cargo.toml`: ```toml -argon2-creds = { version = "0.2", git = "https://github.com/realaravinth/argon2-creds" } +argon2-creds = "0.2" ``` ## Examples: 1. The easiest way to use this crate is with the default configuration. See `Default` - implementation for the default configuration. + implementation for the default configuration. - ```rust +```rust use argon2_creds::Config; fn main() { - let config = Config::default(); + let config = Config::default(); - let password = "ironmansucks"; + let password = "ironmansucks"; - // email validation - config.email(Some("batman@we.net")).unwrap(); + // email validation + config.email(Some("batman@we.net")).unwrap(); - // process username - let username = config.username("Realaravinth").unwrap(); // process username + // process username + let username = config.username("Realaravinth").unwrap(); // process username - // generate hash - let hash = config.password(password).unwrap(); + // generate hash + let hash = config.password(password).unwrap(); - assert_eq!(username, "realaravinth"); - assert!(Config::verify(&hash, password).unwrap(), "verify hahsing"); + assert_eq!(username, "realaravinth"); + assert!(Config::verify(&hash, password).unwrap(), "verify hashing"); } ``` 2. To gain fine-grained control over how credentials are managed, consider using - [ConfigBuilder]: + [ConfigBuilder]: ```rust use argon2_creds::{Config, ConfigBuilder, PasswordPolicyBuilder}; @@ -90,6 +91,6 @@ fn main() { let hash = config.password(password).unwrap(); assert_eq!(username, "realaravinth"); - assert!(Config::verify(&hash, password).unwrap(), "verify hahsing"); + assert!(Config::verify(&hash, password).unwrap(), "verify hashing"); } ``` diff --git a/examples/complex.rs b/examples/complex.rs index f8a35b7..55751a5 100644 --- a/examples/complex.rs +++ b/examples/complex.rs @@ -32,5 +32,5 @@ fn main() { let hash = config.password(password).unwrap(); assert_eq!(username, "realaravinth"); - assert!(Config::verify(&hash, password).unwrap(), "verify hahsing"); + assert!(Config::verify(&hash, password).unwrap(), "verify hashing"); } diff --git a/examples/simple.rs b/examples/simple.rs index 0d3d8dd..981ad18 100644 --- a/examples/simple.rs +++ b/examples/simple.rs @@ -19,5 +19,5 @@ fn main() { let hash = config.password(password).unwrap(); assert_eq!(username, "realaravinth"); - assert!(Config::verify(&hash, password).unwrap(), "verify hahsing"); + assert!(Config::verify(&hash, password).unwrap(), "verify hashing"); } diff --git a/src/config.rs b/src/config.rs index 8d63f0e..26cf357 100644 --- a/src/config.rs +++ b/src/config.rs @@ -42,7 +42,7 @@ pub struct PasswordPolicy { /// See [argon2 config][argon2::Config] #[builder(default = "argon2::Config::default()")] argon2: argon2::Config<'static>, - /// minium password length + /// minimum password length #[builder(default = "8")] min: usize, /// maximum password length(to protect against DoS attacks) @@ -72,7 +72,7 @@ impl Default for Config { } impl Config { - /// Mormalises, converts to lowercase and applies filters to the username + /// Normalises, converts to lowercase and applies filters to the username pub fn username(&self, username: &str) -> CredsResult { use ammonia::clean; use unicode_normalization::UnicodeNormalization; @@ -145,7 +145,7 @@ impl Config { Ok(status) } - /// Initialize filters accoding to configuration. + /// Initialize filters according to configuration. /// /// Filters are lazy initialized so there's a slight delay during the very first use of /// filter. By calling this method during the early stages of program execution, @@ -214,7 +214,7 @@ mod tests { assert_eq!(username, "realaravinth"); - assert!(Config::verify(&hash, password).unwrap(), "verify hahsing"); + assert!(Config::verify(&hash, password).unwrap(), "verify hashing"); } #[test] diff --git a/src/lib.rs b/src/lib.rs index 3ff5ee7..5db5c97 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -23,7 +23,7 @@ //! let hash = config.password(password).unwrap(); //! //! assert_eq!(username, "realaravinth"); -//! assert!(Config::verify(&hash, password).unwrap(), "verify hahsing"); +//! assert!(Config::verify(&hash, password).unwrap(), "verify hashing"); //! ``` //! //! 2. To gain fine-grained control over how credentials are managed, consider using @@ -53,7 +53,7 @@ //! let hash = config.password(password).unwrap(); //! //! assert_eq!(username, "realaravinth"); -//! assert!(Config::verify(&hash, password).unwrap(), "verify hahsing"); +//! assert!(Config::verify(&hash, password).unwrap(), "verify hashing"); //!``` //! //! ## Documentation & Community Resources @@ -65,7 +65,7 @@ //! //! * [Config]: This struct is the entry point to `argon2_creds` //! -//! * [CredsError]: This module provides essential types for errors that can occour during +//! * [CredsError]: This module provides essential types for errors that can occur during //! credential processing //! //! ## Features @@ -75,7 +75,7 @@ //! * Keep-alive and slow requests handling //! * Profanity filter based off of //! [List-of-Dirty-Naughty-Obscene-and-Otherwise-Bad-Words](https://github.com/LDNOOBW/List-of-Dirty-Naughty-Obscene-and-Otherwise-Bad-Words) -//! * Problamatic usernames filter based off of +//! * Problematic usernames filter based off of //! [The-Big-Username-Blacklist](https://github.com/marteinn/The-Big-Username-Blacklist) //! * Email validation using [validator](https://crates.io/validator)