diff --git a/sdkserver/src/lib.rs b/sdkserver/src/lib.rs index 0dd39b4..a221d22 100644 --- a/sdkserver/src/lib.rs +++ b/sdkserver/src/lib.rs @@ -90,6 +90,11 @@ pub async fn start_sdkserver() -> Result<()> { sr_tools::SRTOOLS_UPLOAD_ENDPOINT, post(sr_tools::sr_tool_save), ) + .route( + auth::APN_LOGIN_BY_PASSWORD_ENDPOINT, + post(auth::apn_login_with_password), + ) + .route(auth::APN_VERIFY_TOKEN_ENDPOINT, post(auth::apn_veriy_token)) .layer( CorsLayer::new() .allow_origin(Any) diff --git a/sdkserver/src/services/auth.rs b/sdkserver/src/services/auth.rs index 9e9259b..8aeaded 100644 --- a/sdkserver/src/services/auth.rs +++ b/sdkserver/src/services/auth.rs @@ -3,8 +3,11 @@ use serde_json::json; pub const LOGIN_WITH_PASSWORD_ENDPOINT: &str = "/{product_name}/mdk/shield/api/login"; pub const LOGIN_WITH_SESSION_TOKEN_ENDPOINT: &str = "/{product_name}/mdk/shield/api/verify"; -pub const GRANTER_LOGIN_VERIFICATION_ENDPOINT: &str = "/{product_name}/combo/granter/login/v2/login"; +pub const GRANTER_LOGIN_VERIFICATION_ENDPOINT: &str = + "/{product_name}/combo/granter/login/v2/login"; pub const RISKY_API_CHECK_ENDPOINT: &str = "/account/risky/api/check"; +pub const APN_LOGIN_BY_PASSWORD_ENDPOINT: &str = "/account/ma-cn-passport/app/loginByPassword"; +pub const APN_VERIFY_TOKEN_ENDPOINT: &str = "/account/ma-cn-session/app/verify"; #[tracing::instrument] pub async fn login_with_password() -> Json { @@ -78,3 +81,51 @@ pub async fn risky_api_check() -> Json { "retcode": 0 })) } + +#[tracing::instrument] +pub async fn apn_login_with_password() -> Json { + Json(json!({ + "data": { + "token": { + "token": "mostsecuretokenever", + "token_type": 1 + }, + "user_info": { + "aid": "1337", + "mid": "1337", + "is_email_verify": 1, + "area_code": "**", + "country": "US", + "is_adult": 1, + "email": "motorized@wheel.chair" + } + }, + "message": "OK", + "retcode": 0 + })) +} + +#[tracing::instrument] +pub async fn apn_veriy_token() -> Json { + Json(json!({ + "data": { + "tokens": [ + { + "token": "mostsecuretokenever", + "token_type": 1 + } + ], + "user_info": { + "aid": "1337", + "mid": "1337", + "is_email_verify": 1, + "area_code": "**", + "country": "US", + "is_adult": 1, + "email": "motorized@wheel.chair" + } + }, + "message": "OK", + "retcode": 0 + })) +}