Extract codex-auth from codex-core

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Ahmed Ibrahim
2026-03-18 05:11:40 +00:00
parent 1cf68f940c
commit 184fb02a9a
18 changed files with 1119 additions and 728 deletions

View File

@@ -0,0 +1,20 @@
use super::*;
use pretty_assertions::assert_eq;
#[test]
fn parses_id_token_claims() {
let jwt = "eyJhbGciOiJub25lIn0.eyJlbWFpbCI6InVzZXJAZXhhbXBsZS5jb20iLCJodHRwczovL2FwaS5vcGVuYWkuY29tL2F1dGgiOnsiY2hhdGdwdF9wbGFuX3R5cGUiOiJwcm8iLCJjaGF0Z3B0X3VzZXJfaWQiOiJ1c2VyLTEiLCJjaGF0Z3B0X2FjY291bnRfaWQiOiJ3cy0xIn19.c2ln";
let claims = parse_chatgpt_jwt_claims(jwt).expect("jwt should parse");
assert_eq!(
claims,
IdTokenInfo {
email: Some("user@example.com".to_string()),
chatgpt_plan_type: Some(PlanType::Known(KnownPlan::Pro)),
chatgpt_user_id: Some("user-1".to_string()),
chatgpt_account_id: Some("ws-1".to_string()),
raw_jwt: jwt.to_string(),
}
);
}