docs
This commit is contained in:
parent
1023ad24dc
commit
496cdc9af2
3 changed files with 68 additions and 14 deletions
15
.github/workflows/linux.yml
vendored
15
.github/workflows/linux.yml
vendored
|
@ -63,3 +63,18 @@ jobs:
|
||||||
uses: codecov/codecov-action@v1
|
uses: codecov/codecov-action@v1
|
||||||
with:
|
with:
|
||||||
file: cobertura.xml
|
file: cobertura.xml
|
||||||
|
|
||||||
|
- name: generate documentation
|
||||||
|
if: matrix.version == 'stable' && (github.repository == 'realaravinth/damn-vuln-blockchain')
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: doc
|
||||||
|
args: --no-deps --workspace --all-features
|
||||||
|
|
||||||
|
- name: Deploy to GitHub Pages
|
||||||
|
if: matrix.version == 'stable' && (github.repository == 'realaravinth/damn-vuln-blockchain')
|
||||||
|
uses: JamesIves/github-pages-deploy-action@3.7.1
|
||||||
|
with:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
BRANCH: gh-pages
|
||||||
|
FOLDER: target/doc
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
|
||||||
|
[![Documentation](https://img.shields.io/badge/docs-master-blue)](https://realaravinth.github.io/argon2-creds/argon2_creds/index.html)
|
||||||
![CI (Linux)](<https://github.com/realaravinth/argon2-creds/workflows/CI%20(Linux)/badge.svg>)
|
![CI (Linux)](<https://github.com/realaravinth/argon2-creds/workflows/CI%20(Linux)/badge.svg>)
|
||||||
[![dependency status](https://deps.rs/repo/github/realaravinth/argon2-creds/status.svg)](https://deps.rs/repo/github/realaravinth/argon2-creds)
|
[![dependency status](https://deps.rs/repo/github/realaravinth/argon2-creds/status.svg)](https://deps.rs/repo/github/realaravinth/argon2-creds)
|
||||||
<br />
|
<br />
|
||||||
|
|
66
src/lib.rs
66
src/lib.rs
|
@ -3,25 +3,65 @@
|
||||||
//!
|
//!
|
||||||
//! ## Example
|
//! ## Example
|
||||||
//!
|
//!
|
||||||
|
//! 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;
|
//! use argon2_creds::Config;
|
||||||
//!
|
//!
|
||||||
//! fn main() {
|
//! fn main() {
|
||||||
//! let username = "iamBatman";
|
//! let config = Config::default();
|
||||||
//! let password = "ironmansucks";
|
|
||||||
//! let email = "iambatman@wayne.org";
|
|
||||||
//!
|
//!
|
||||||
//! let config = Config::default();
|
//! let password = "ironmansucks";
|
||||||
//! let hash = config.password(password).unwrap();
|
//! let hash = config.password(password).unwrap();
|
||||||
//! config.email(Some("batman@we.net")).unwrap();
|
|
||||||
//! let username = config.username("Realaravinth").unwrap();
|
|
||||||
//! let hash = config.password(password).unwrap();
|
|
||||||
//! assert_eq!(username, "realaravinth");
|
|
||||||
//! assert!(Config::verify(&hash, password).unwrap(), "verify hahsing");
|
|
||||||
//!
|
//!
|
||||||
|
//! // 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");
|
||||||
//! }
|
//! }
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
|
//! 2. To gain fine-grained control over how credentials are managed, consider using
|
||||||
|
//! [ConfigBuilder]:
|
||||||
|
//!
|
||||||
|
//!```rust
|
||||||
|
//! 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");
|
||||||
|
//! }
|
||||||
|
//!```
|
||||||
|
//!
|
||||||
//! ## Documentation & Community Resources
|
//! ## Documentation & Community Resources
|
||||||
//!
|
//!
|
||||||
//! In addition to this API documentation, other resources are available:
|
//! In addition to this API documentation, other resources are available:
|
||||||
|
@ -32,9 +72,7 @@
|
||||||
//!
|
//!
|
||||||
//! * [Config]: This struct is the entry point to `argon2_creds`
|
//! * [Config]: This struct is the entry point to `argon2_creds`
|
||||||
//!
|
//!
|
||||||
//! * [User]: This struct represents a fully processed credentials
|
//! * [CredsError]: This module provides essential types for errors that can occour during
|
||||||
//!
|
|
||||||
//! * [Error]: This module provides essential types for errors that can occour during
|
|
||||||
//! credential processing
|
//! credential processing
|
||||||
//!
|
//!
|
||||||
//! ## Features
|
//! ## Features
|
||||||
|
@ -52,5 +90,5 @@ pub mod config;
|
||||||
pub mod errors;
|
pub mod errors;
|
||||||
mod filters;
|
mod filters;
|
||||||
|
|
||||||
pub use crate::config::Config;
|
pub use crate::config::{Config, ConfigBuilder};
|
||||||
pub use crate::errors::{CredsError, CredsResult};
|
pub use crate::errors::{CredsError, CredsResult};
|
||||||
|
|
Loading…
Reference in a new issue