diff --git a/fastcrypto-zkp/src/bn254/unit_tests/zk_login_tests.rs b/fastcrypto-zkp/src/bn254/unit_tests/zk_login_tests.rs index ec99b5f562..c3e2cb97fe 100644 --- a/fastcrypto-zkp/src/bn254/unit_tests/zk_login_tests.rs +++ b/fastcrypto-zkp/src/bn254/unit_tests/zk_login_tests.rs @@ -443,6 +443,7 @@ async fn test_get_jwks() { OIDCProvider::AwsTenant(("us-east-1".to_string(), "us-east-1_qPsZxYqd8".to_string())), OIDCProvider::KarrierOne, OIDCProvider::Credenza3, + OIDCProvider::Playtron, ] { let res = fetch_jwks(&p, &client).await; assert!(res.is_ok()); diff --git a/fastcrypto-zkp/src/bn254/utils.rs b/fastcrypto-zkp/src/bn254/utils.rs index f576082b18..f964e25115 100644 --- a/fastcrypto-zkp/src/bn254/utils.rs +++ b/fastcrypto-zkp/src/bn254/utils.rs @@ -85,7 +85,8 @@ pub fn get_oidc_url( OIDCProvider::Credenza3 => format!("https://accounts.credenza3.com/oauth2/authorize?client_id={}&response_type=token&scope=openid+profile+email+phone&redirect_uri={}&nonce={}&state=state", client_id, redirect_url, nonce), OIDCProvider::AwsTenant((region, tenant_id)) => format!("https://{}.auth.{}.amazoncognito.com/login?response_type=token&client_id={}&redirect_uri={}&nonce={}", tenant_id, region, client_id, redirect_url, nonce), OIDCProvider::TestIssuer => return Err(FastCryptoError::InvalidInput), // Test issuer does not issue JWTs interactively, this is not valid to call. - }) + OIDCProvider::Playtron => return Err(FastCryptoError::InvalidInput), // Playtron does not issue JWTs interactively, this is not valid to call. +}) } /// Return the token exchange URL for the given auth code. diff --git a/fastcrypto-zkp/src/bn254/zk_login.rs b/fastcrypto-zkp/src/bn254/zk_login.rs index e4a6b1b646..f89e6ea907 100644 --- a/fastcrypto-zkp/src/bn254/zk_login.rs +++ b/fastcrypto-zkp/src/bn254/zk_login.rs @@ -109,6 +109,8 @@ pub enum OIDCProvider { Credenza3, /// This is a test issuer that will return a JWT non-interactively. TestIssuer, + /// https://oauth2.playtron.one/.well-known/jwks.json + Playtron, } impl FromStr for OIDCProvider { @@ -126,6 +128,7 @@ impl FromStr for OIDCProvider { "Microsoft" => Ok(Self::Microsoft), "KarrierOne" => Ok(Self::KarrierOne), "Credenza3" => Ok(Self::Credenza3), + "Playtron" => Ok(Self::Playtron), _ => { let re = Regex::new( r"AwsTenant-region:(?P[^.]+)-tenant_id:(?P[^/]+)", @@ -156,6 +159,7 @@ impl ToString for OIDCProvider { Self::Microsoft => "Microsoft".to_string(), Self::KarrierOne => "KarrierOne".to_string(), Self::Credenza3 => "Credenza3".to_string(), + Self::Playtron => "Playtron".to_string(), Self::AwsTenant((region, tenant_id)) => { format!("AwsTenant-region:{}-tenant_id:{}", region, tenant_id) } @@ -213,6 +217,10 @@ impl OIDCProvider { "https://oauth.sui.io", "https://jwt-tester.mystenlabs.com/.well-known/jwks.json", ), + OIDCProvider::Playtron => ProviderConfig::new( + "https://oauth2.playtron.one", + "https://oauth2.playtron.one/.well-known/jwks.json", + ), } } @@ -228,6 +236,7 @@ impl OIDCProvider { "https://oauth.sui.io" => Ok(Self::TestIssuer), "https://accounts.karrier.one/" => Ok(Self::KarrierOne), "https://accounts.credenza3.com" => Ok(Self::Credenza3), + "https://oauth2.playtron.one" => Ok(Self::Playtron), iss if match_micrsoft_iss_substring(iss) => Ok(Self::Microsoft), _ => match parse_aws_iss_substring(iss) { Ok((region, tenant_id)) => {