update deps and fix typos
This commit is contained in:
parent
2a3df16a61
commit
a12beebdc8
6 changed files with 40 additions and 39 deletions
12
Cargo.toml
12
Cargo.toml
|
@ -3,13 +3,13 @@ name = "argon2-creds"
|
|||
version = "0.2.1"
|
||||
authors = ["realaravinth <realaravinth@batsense.net>"]
|
||||
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"
|
||||
|
|
11
README.md
11
README.md
|
@ -13,11 +13,12 @@
|
|||
</div>
|
||||
|
||||
## 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)
|
||||
[Blacklist](https://github.com/shuttlecraft/The-Big-Username-Blacklist)
|
||||
- [x] Profanity filter
|
||||
- [x] Email validation(Regex validation not verification)
|
||||
|
||||
|
@ -26,7 +27,7 @@
|
|||
Add this to your `Cargo.toml`:
|
||||
|
||||
```toml
|
||||
argon2-creds = { version = "0.2", git = "https://github.com/realaravinth/argon2-creds" }
|
||||
argon2-creds = "0.2"
|
||||
```
|
||||
|
||||
## Examples:
|
||||
|
@ -34,7 +35,7 @@ argon2-creds = { version = "0.2", git = "https://github.com/realaravinth/argon2-
|
|||
1. The easiest way to use this crate is with the default configuration. See `Default`
|
||||
implementation for the default configuration.
|
||||
|
||||
```rust
|
||||
```rust
|
||||
use argon2_creds::Config;
|
||||
|
||||
fn main() {
|
||||
|
@ -52,7 +53,7 @@ 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");
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -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");
|
||||
}
|
||||
```
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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<String> {
|
||||
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]
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue