Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
KJHJason committed Jun 21, 2024
1 parent 73e31c5 commit 31f6ca8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,38 +24,38 @@
//! ```rust
//! use hmac_serialiser::{Encoder, HmacSigner, KeyInfo, Payload, Algorithm};
//! use serde::{Serialize, Deserialize};
//!
//!
//! #[derive(Serialize, Deserialize, Debug)]
//! struct UserData {
//! // Add your data fields here
//! username: String,
//! email: String,
//! }
//!
//!
//! impl Payload for UserData {
//! fn get_exp(&self) -> Option<chrono::DateTime<chrono::Utc>> {
//! // Add logic to retrieve expiration time if needed
//! None
//! }
//! }
//!
//!
//! fn main() {
//! // Define your secret key, salt, and optional info
//! let key_info = KeyInfo {
//! key: b"your_secret_key".to_vec(),
//! salt: b"your_salt".to_vec(),
//! info: vec![], // empty info
//! };
//!
//!
//! // Initialize the HMAC signer
//! let signer = HmacSigner::new(key_info, Algorithm::SHA256, Encoder::UrlSafeNoPadding);
//!
//!
//! // Serialize your data
//! let user_data = UserData {
//! username: "user123".to_string(),
//! email: "[email protected]".to_string(),
//! };
//!
//!
//! // Sign the data (safe to use by clients)
//! let token = signer.sign(&user_data);
//! println!("Token: {}", token);
Expand Down

0 comments on commit 31f6ca8

Please sign in to comment.