/// Create jwt token by making use of user id.
Create jwt token by making use of user id.
Create jwt token by making use of user id .
pub fn generate_jwt(uid: uuid::Uuid) -> String {
    let now = Utc::now().timestamp_nanos() / 1_000_000_000; // nanosecond -> second
    let payload = UserToken {
        iat: now,
        exp: now + ONE_WEEK,
        user_id: uid,
    };
    jsonwebtoken::encode(
        &Header::default(),
        &payload,
        &EncodingKey::from_secret(KEY),
    )
    .unwrap()
}
pub fn generate_jwt ( uid : uuid :: Uuid ) -> String { let now = Utc :: now ( ) . timestamp_nanos ( ) / 1_000_000_000 ; // nanosecond -> second let payload = UserToken { iat : now , exp : now + ONE_WEEK , user_id : uid , } ; jsonwebtoken :: encode ( & Header :: default ( ) , & payload , & EncodingKey :: from_secret ( KEY ) , ) . unwrap ( ) }
Create jwt token by making use of user id.
Create jwt token by making use of user id .
uid
uuid::Uuid