# jwt **Repository Path**: kivensoft/jwt_rs ## Basic Information - **Project Name**: jwt - **Description**: JSON web token library - **Primary Language**: Unknown - **License**: GPL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-10-12 - **Last Updated**: 2025-05-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # jwt -- simple JSON web token library 简单的jwt实现库 --- #### 项目地址 ###### 第三方依赖 * log * anyhow * serde * serde_json * base64 * sha2 * hmac * rsa [optional] --- ###### 添加依赖 `cargo add --git https://gitee.com/kivensoft/jwt_rs jwt` ###### 使用 ```rust use jwt; use serde_json; fn main() { let s = jwt::encode(&serde_json::json!({ "userId": 1, "username": "admin", }), "password", "my_issuer", 86400).unwrap(); let s2 = jwt::decode(&s, "password", "accinfo").unwrap(); assert_eq!("admin", s2["username"].as_str()); } ```