Packages / rupm

rs-auth-jwt 0.1.0

Sign, verify and decode HS256 JSON Web Tokens (RFC 7519), with exp and nbf checks

Install

cargo add rs-auth-jwt --registry rupm

In Ruststudio: Packages, search for rs-auth-jwt, Install.

Owner: Rust Studio. Licence: MIT OR Apache-2.0. Total downloads: 0. Published 2026-11-23.

Versions

README

# rs-auth-jwt

Sign, verify and decode HS256 JSON Web Tokens (RFC 7519), with exp and nbf checks

Add it with `rupm add rs-auth-jwt` (or `cargo add rs-auth-jwt --registry rupm`).

Matches the RFC 7515 and jwt.io HS256 examples. Only HS256 is accepted (tokens claiming none or any other algorithm are rejected). The HMAC-SHA-256 is unaudited and not constant-time, so this crate is not meant for security-critical use; use an audited JWT library for a production authentication system.

```rust
use serde_json::json;
let token = rs_auth_jwt::sign(&json!({"sub": "42", "exp": 4102444800u64}), b"secret").unwrap();
let claims = rs_auth_jwt::verify(&token, b"secret").unwrap();
assert_eq!(claims["sub"], "42");
assert!(rs_auth_jwt::verify(&token, b"wrong").is_err());
```