mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 10:06:32 +08:00 
			
		
		
		
	 49a178ed20
			
		
	
	49a178ed20
	
	
	
		
			
			Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
		
			
				
	
	
		
			22 lines
		
	
	
		
			631 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			631 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| //! Module for tokenization-related functionality
 | |
| //!
 | |
| //! This module provides types and functions for handling tokenized payment data,
 | |
| //! including response structures and token generation utilities.
 | |
| 
 | |
| use common_enums::ApiVersion;
 | |
| use diesel;
 | |
| use serde::{Deserialize, Serialize};
 | |
| use time::PrimitiveDateTime;
 | |
| 
 | |
| use crate::{consts::TOKEN_LENGTH, id_type::GlobalTokenId};
 | |
| 
 | |
| #[cfg(all(feature = "v2", feature = "tokenization_v2"))]
 | |
| /// Generates a new token string
 | |
| ///
 | |
| /// # Returns
 | |
| /// A randomly generated token string of length `TOKEN_LENGTH`
 | |
| pub fn generate_token() -> String {
 | |
|     use nanoid::nanoid;
 | |
|     nanoid!(TOKEN_LENGTH)
 | |
| }
 |