mirror of
https://github.com/zyycn/codex-proxy-rs.git
synced 2026-11-06 16:06:08 +00:00
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>
12 lines
408 B
Rust
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"))
|
|
}
|