| Crates.io | kjwt |
| lib.rs | kjwt |
| version | 1.0.7 |
| created_at | 2025-05-24 08:09:05.116552+00 |
| updated_at | 2025-05-24 08:14:51.581567+00 |
| description | mini JSON Web Token library |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1687131 |
| size | 54,996 |
简单的jwt实现库
https://gitee.com/kivensoft/jwt_rs
cargo add --git https://gitee.com/kivensoft/jwt_rs jwt
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());
}