Skip to content

Commit

Permalink
feat(password): clone, partialeq, eq
Browse files Browse the repository at this point in the history
  • Loading branch information
VIAL Sébastien committed Nov 25, 2023
1 parent b266056 commit adb12aa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ documentation = "https://docs.rs/tag_password"
homepage = "https://devs.transitions.ag/"
repository = "https://github.com/TransitionsAg/tag_password"
readme = "README.md"
version = "0.1.3-pre3"
version = "0.1.3"
edition = "2021"

[dependencies]
Expand Down
4 changes: 3 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ use std::{
/// It serves as a zero-sized type without any fields, consuming no memory at runtime.
/// When paired with `PhantomData`, it enables compile-time checks to distinguish
/// between hashed and non-hashed password types.
#[derive(Clone, PartialEq, Eq)]
pub struct Hashed;

/// Marker type indicating a plain text password.
Expand All @@ -71,14 +72,15 @@ pub struct Hashed;
/// zero-sized type without any fields, consuming no memory at runtime.
/// When paired with `PhantomData`, it enables compile-time checks to differentiate
/// between plain text and hashed password types.
#[derive(Clone, PartialEq, Eq)]
pub struct Plain;

/// Represents password data that can be hashed and verified.
///
/// This struct encapsulates password data and supports hashing with the `hash` function,
/// which can be enabled with the `argon2` feature. It also provides verification
/// functionality via the `verify` function.
#[derive(Clone)]
#[derive(Clone, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Password<T: ?Sized>(PhantomData<T>, String);

Expand Down

0 comments on commit adb12aa

Please sign in to comment.