diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 13f1e54..01e2358 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -63,3 +63,18 @@ jobs: uses: codecov/codecov-action@v1 with: 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 diff --git a/README.md b/README.md index 67e10a3..bbde19b 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@
+[](https://realaravinth.github.io/argon2-creds/argon2_creds/index.html)
 {
-//! let username = "iamBatman";
-//! let password = "ironmansucks";
-//! let email = "iambatman@wayne.org";
+//! let config = Config::default();
//!
-//! let config = Config::default();
-//! 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");
+//! 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");
//! }
//! ```
//!
+//! 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
//!
//! In addition to this API documentation, other resources are available:
@@ -32,9 +72,7 @@
//!
//! * [Config]: This struct is the entry point to `argon2_creds`
//!
-//! * [User]: This struct represents a fully processed credentials
-//!
-//! * [Error]: This module provides essential types for errors that can occour during
+//! * [CredsError]: This module provides essential types for errors that can occour during
//! credential processing
//!
//! ## Features
@@ -52,5 +90,5 @@ pub mod config;
pub mod errors;
mod filters;
-pub use crate::config::Config;
+pub use crate::config::{Config, ConfigBuilder};
pub use crate::errors::{CredsError, CredsResult};