Skip to content

Commit

Permalink
Add FanTV's OIDC provider on Zklogin
Browse files Browse the repository at this point in the history
  • Loading branch information
devan-ko committed Sep 12, 2024
1 parent d75fa17 commit ea73ad2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions fastcrypto-zkp/src/bn254/unit_tests/zk_login_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ async fn test_get_jwks() {
OIDCProvider::Credenza3,
OIDCProvider::Playtron,
OIDCProvider::Threedos,
OIDCProvider::FanTV,
] {
let res = fetch_jwks(&p, &client).await;
assert!(res.is_ok());
Expand Down
1 change: 1 addition & 0 deletions fastcrypto-zkp/src/bn254/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ pub fn get_oidc_url(
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.
OIDCProvider::Threedos => return Err(FastCryptoError::InvalidInput), // Threedos does not issue JWTs interactively yet, this is not valid to call.
OIDCProvider::FanTV => return Err(FastCryptoError::InvalidInput), // FanTV does not issue JWTs interactively yet, this is not valid to call.
})
}

Expand Down
9 changes: 9 additions & 0 deletions fastcrypto-zkp/src/bn254/zk_login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ pub enum OIDCProvider {
Playtron,
/// https://auth.3dos.io/.well-known/openid-configuration
Threedos,
/// https://fantv-apis.fantiger.com/v1/web3/jwks.json
FanTV,
}

impl FromStr for OIDCProvider {
Expand All @@ -134,6 +136,7 @@ impl FromStr for OIDCProvider {
"Credenza3" => Ok(Self::Credenza3),
"Playtron" => Ok(Self::Playtron),
"Threedos" => Ok(Self::Threedos),
"FanTV" => Ok(Self::FanTV),
_ => {
let re = Regex::new(
r"AwsTenant-region:(?P<region>[^.]+)-tenant_id:(?P<tenant_id>[^/]+)",
Expand Down Expand Up @@ -166,6 +169,7 @@ impl ToString for OIDCProvider {
Self::Credenza3 => "Credenza3".to_string(),
Self::Playtron => "Playtron".to_string(),
Self::Threedos => "Threedos".to_string(),
Self::FanTV => "FanTV".to_string(),
Self::AwsTenant((region, tenant_id)) => {
format!("AwsTenant-region:{}-tenant_id:{}", region, tenant_id)
}
Expand Down Expand Up @@ -231,6 +235,10 @@ impl OIDCProvider {
"https://auth.3dos.io",
"https://auth.3dos.io/.well-known/jwks.json",
),
OIDCProvider::FanTV => ProviderConfig::new(
"https://accounts.fantv.world",
"https://fantv-apis.fantiger.com/v1/web3/jwks.json",
),
}
}

Expand All @@ -248,6 +256,7 @@ impl OIDCProvider {
"https://accounts.credenza3.com" => Ok(Self::Credenza3),
"https://oauth2.playtron.one" => Ok(Self::Playtron),
"https://auth.3dos.io" => Ok(Self::Threedos),
"https://accounts.fantv.world" => Ok(Self::FanTV),
iss if match_micrsoft_iss_substring(iss) => Ok(Self::Microsoft),
_ => match parse_aws_iss_substring(iss) {
Ok((region, tenant_id)) => {
Expand Down
6 changes: 6 additions & 0 deletions fastcrypto-zkp/src/bn254/zklogin_test_vectors.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,11 @@
"kid": "6d361dc9637a275eb585a915af26198ff0d97326ca13f4baf0e4805f72f2a9a0",
"n": "y_8hHwq7w2yE4968sbQF98iGUhnu0BwyB5khTxVPAcUnMCYdp61zYcRWml2zdY4HAfq-Nnjb_pAli6I66Vpe9IE8Gf8uGRB0oYIo2S6tYMEe0lhRaEDYVbMdQkuKxTIYMNBXSd_kCHKJM1ZUAo7uFoq_bWuzt2hRG2-79z-Ycbiw0wil0rzFHlpNBKsBLKM4GSGUwOejaL2zCiE_rjf77AvOaJLRd4I_DBYG16t8D1BkxbhkcQCmOxYGG0NqjP3z0lz-w1ALqHCNfhzczZOsgaCrbSlcTKcBTq1syAUUhQmounW7nG5clBIfPQRVH7jCoPztiJUZg6Xz1AN6V07xn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