Skip to content

Commit

Permalink
Arden Provider
Browse files Browse the repository at this point in the history
  • Loading branch information
1NickPappas committed Sep 16, 2024
1 parent 3366c26 commit a81e34c
Show file tree
Hide file tree
Showing 4 changed files with 19 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 @@ -447,6 +447,7 @@ async fn test_get_jwks() {
OIDCProvider::Threedos,
OIDCProvider::Onefc,
OIDCProvider::FanTV,
OIDCProvider::Arden,
] {
let res = fetch_jwks(&p, &client).await;
assert!(res.is_ok());
Expand Down
3 changes: 3 additions & 0 deletions fastcrypto-zkp/src/bn254/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ pub fn get_oidc_url(
OIDCProvider::KarrierOne => format!("https://accounts.karrier.one/Account/PhoneLogin?ReturnUrl=/connect/authorize?nonce={}&redirect_uri={}&response_type=id_token&scope=openid&client_id={}", nonce, redirect_url, client_id),
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::Onefc => format!("https://login.onepassport.onefc.com/de3ee5c1-5644-4113-922d-e8336569a462/b2c_1a_prod_signupsignin_onesuizklogin/oauth2/v2.0/authorize?client_id={}&scope=openid&response_type=id_token&redirect_uri={}&nonce={}", client_id, redirect_url, nonce),

OIDCProvider::Arden => format!("https://api.arden.cc/auth/authorize?client_id={}&scope=openid&response_type=id_token&redirect_uri={}&nonce={}", 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),
// this URL is only useful if CLI testing from Sui is needed, can ignore if a frontend test plan is in place
_ => return Err(FastCryptoError::InvalidInput)
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 @@ -119,6 +119,8 @@ pub enum OIDCProvider {
Onefc,
/// https://accounts.fantv.world/.well-known/openid-configuration
FanTV,
/// https://api.arden.cc/auth/jwks
Arden,
}

impl FromStr for OIDCProvider {
Expand All @@ -140,6 +142,7 @@ impl FromStr for OIDCProvider {
"Threedos" => Ok(Self::Threedos),
"Onefc" => Ok(Self::Onefc),
"FanTV" => Ok(Self::FanTV),
"Arden" => Ok(Self::Arden),
_ => {
let re = Regex::new(
r"AwsTenant-region:(?P<region>[^.]+)-tenant_id:(?P<tenant_id>[^/]+)",
Expand Down Expand Up @@ -174,6 +177,7 @@ impl ToString for OIDCProvider {
Self::Threedos => "Threedos".to_string(),
Self::Onefc => "Onefc".to_string(),
Self::FanTV => "FanTV".to_string(),
Self::Arden => "Arden".to_string(),
Self::AwsTenant((region, tenant_id)) => {
format!("AwsTenant-region:{}-tenant_id:{}", region, tenant_id)
}
Expand Down Expand Up @@ -247,6 +251,10 @@ impl OIDCProvider {
"https://accounts.fantv.world",
"https://fantv-apis.fantiger.com/v1/web3/jwks.json",
),
OIDCProvider::Arden => ProviderConfig::new(
"https://oidc.arden.cc",
"https://api.arden.cc/auth/jwks",
),
}
}

Expand All @@ -268,6 +276,7 @@ impl OIDCProvider {
Ok(Self::Onefc)
}
"https://accounts.fantv.world" => Ok(Self::FanTV),
"https://oidc.arden.cc" => Ok(Self::Arden),
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 @@ -52,5 +52,11 @@
"kid": "O5ryxF-zMCLmS6hQhcTC3pAAhQ4YYPEHoiQt1qx_86o",
"n": "mBi1td_GT0MubU5Lfeg4P4XsMUzpzcxuI9Yb1xDOpWFekEZF0TwTLJ6v4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