Skip to content

Commit

Permalink
chore(README, project metadata): preparing for crates.io release
Browse files Browse the repository at this point in the history
  • Loading branch information
VIAL Sébastien committed Nov 19, 2023
1 parent ba979fc commit e39b8c8
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
[package]
name = "tag_password"
description = "An advanced Rust library leveraging the type system to statically determine password hashing status for enhanced security."
license = "MIT"
license-file = "LICENSE"
documentation = "https://docs.rs/tag_password"
homepage = "https://devs.transitions.ag/"
repository = "https://github.com/TransitionsAg/tag_password"
readme = "README.md"
version = "0.1.0"
edition = "2021"

Expand Down
44 changes: 44 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,47 @@
//! # Transitions' password type
//!
//! `tag_password` is an simple Rust library designed to enhance security by leveraging the type system to
//! statically determine password hashing status. This approach ensures a clear distinction between plain text
//! and hashed passwords in your code, allowing for stronger security measures.
//!
//! ## Features
//!
//! - **Type-based Password Markers:** Two marker types, Hashed and Plain, are used to distinguish between
//! hashed and plain text passwords. These zero-sized types, combined with PhantomData, facilitate compile-time
//! checks for password status.
//!
//! - **Argon2 Hashing (Optional):** If the argon2 feature is enabled, the library provides hashing functionality
//! using Argon2, a secure password hashing algorithm.
//!
//! ## Usage
//!
//! Add the library to your current project using Cargo:
//!
//! ```sh
//! cargo add tag_password
//! ```
//!
//! Then create a new password and operate on them
//!
//! ```rust
//! use tag_password::Password;
//!
//! // Create a new plain text password
//! let plain_password = Password::new("my_password");
//! // Hash the plain text password using Argon2
//! let hashed_password = plain_password
//! .hash(None, &salt)
//! .expect("Hashing should not fail.");
//! // Verify a hashed password against a plain text password
//! hashed_password
//! .verify(None, plain_password)
//! .expect("Verification should not fail.");
//! ```
//!
//! ## License
//!
//! This project is licensed under the [MIT License](LICENSE).

#[cfg(feature = "argon2")]
use argon2::{password_hash::Salt, Argon2, PasswordHash, PasswordHasher, PasswordVerifier};
use std::{
Expand Down

0 comments on commit e39b8c8

Please sign in to comment.