Files
codex-proxy-rs/backend/tests/support/jwt.rs
T
zyycnandCodex 1e99c5037d refactor: migrate backend to Rust 1.97 and edition 2024
Unify the local, CI, release, and container toolchains on Rust 1.97.

Move update configuration, release caching, and event delivery into service-owned state, apply Edition 2024 idioms, and refresh repository ignore rules and documentation.

Co-authored-by: Codex <noreply@openai.com>
2026-07-12 19:10:56 +08:00

12 lines
408 B
Rust

use base64::{Engine as _, engine::general_purpose::URL_SAFE_NO_PAD};
use serde_json::{Value, json};
pub(crate) fn unsigned_jwt(payload: &Value) -> String {
let header = json!({"alg": "none", "typ": "JWT"});
format!("{}.{}.", jwt_part(&header), jwt_part(payload))
}
fn jwt_part(value: &Value) -> String {
URL_SAFE_NO_PAD.encode(serde_json::to_vec(value).expect("test jwt json should encode"))
}