2025-01-26 12:09:56 +01:00
|
|
|
mod method_login_ex;
|
2025-02-01 20:59:53 +01:00
|
|
|
mod method_login;
|
2025-02-02 20:25:22 +01:00
|
|
|
mod ticket_generation;
|
|
|
|
|
mod method_request_ticket;
|
2025-01-26 12:09:56 +01:00
|
|
|
|
2025-01-26 23:21:35 +01:00
|
|
|
use crate::define_protocol;
|
2025-02-02 20:25:22 +01:00
|
|
|
use crate::grpc::account;
|
2025-02-01 19:42:45 +01:00
|
|
|
use crate::nex::account::Account;
|
2025-02-01 20:59:53 +01:00
|
|
|
use crate::protocols::auth::method_login::login_raw_params;
|
2025-02-02 20:25:22 +01:00
|
|
|
use crate::protocols::auth::method_login_ex::login_ex_raw_params;
|
|
|
|
|
use crate::protocols::auth::method_request_ticket::request_ticket_raw_params;
|
2025-01-26 12:09:56 +01:00
|
|
|
|
2025-02-02 20:25:22 +01:00
|
|
|
#[derive(Copy, Clone)]
|
|
|
|
|
pub struct AuthProtocolConfig {
|
|
|
|
|
pub secure_server_account: &'static Account,
|
|
|
|
|
pub build_name: &'static str,
|
|
|
|
|
pub station_url: &'static str
|
|
|
|
|
}
|
2025-01-26 12:09:56 +01:00
|
|
|
|
2025-01-26 23:21:35 +01:00
|
|
|
define_protocol!{
|
2025-02-02 20:25:22 +01:00
|
|
|
10(proto_data: AuthProtocolConfig) => {
|
2025-02-01 20:59:53 +01:00
|
|
|
0x01 => login_raw_params,
|
2025-02-02 20:25:22 +01:00
|
|
|
0x02 => login_ex_raw_params,
|
|
|
|
|
0x03 => request_ticket_raw_params
|
2025-01-26 23:21:35 +01:00
|
|
|
}
|
2025-02-01 20:59:53 +01:00
|
|
|
}
|
2025-02-02 20:25:22 +01:00
|
|
|
|
|
|
|
|
async fn get_login_data_by_pid(pid: u32) -> Option<(u32, [u8; 16])> {
|
|
|
|
|
let Ok(mut client) = account::Client::new().await else {
|
|
|
|
|
return None
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
let Ok(passwd) = client.get_nex_password(pid).await else{
|
|
|
|
|
return None
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Some((pid, passwd))
|
|
|
|
|
}
|