feat(account): add grpc to communicate with account server
This commit is contained in:
parent
6984a20bdd
commit
cb6a6f9028
15 changed files with 797 additions and 30 deletions
|
|
@ -1,20 +1,29 @@
|
|||
use std::io::Cursor;
|
||||
use log::{error, info};
|
||||
use crate::grpc::account;
|
||||
use crate::nex::account::Account;
|
||||
use crate::rmc::message::RMCMessage;
|
||||
use crate::rmc::response::{ErrorCode, RMCResponse, RMCResponseResult};
|
||||
use crate::rmc::structures::{string, any, RmcSerialize};
|
||||
use crate::rmc::structures::any::Any;
|
||||
|
||||
pub fn login_ex(rmcmessage: &RMCMessage, name: &str) -> RMCResponseResult{
|
||||
pub async fn login_ex(rmcmessage: &RMCMessage, secure_server_account: &Account , pid: u32) -> RMCResponseResult{
|
||||
// todo: figure out how the AuthenticationInfo struct works, parse it and validate login info
|
||||
|
||||
let Ok(mut client) = account::Client::new().await else {
|
||||
return rmcmessage.error_result_with_code(ErrorCode::Core_Exception);
|
||||
};
|
||||
|
||||
let Ok(passwd) = client.get_nex_password(pid).await else{
|
||||
return rmcmessage.error_result_with_code(ErrorCode::Core_Exception);
|
||||
};
|
||||
|
||||
|
||||
|
||||
return rmcmessage.error_result_with_code(ErrorCode::Core_InvalidArgument);
|
||||
}
|
||||
|
||||
pub fn login_ex_raw_params(rmcmessage: &RMCMessage, account: &Account) -> RMCResponseResult{
|
||||
pub async fn login_ex_raw_params(rmcmessage: &RMCMessage, (secure_server_account): (&Account)) -> RMCResponseResult{
|
||||
let mut reader = Cursor::new(&rmcmessage.rest_of_data);
|
||||
|
||||
let Ok(str) = String::deserialize(&mut reader) else {
|
||||
|
|
@ -37,5 +46,9 @@ pub fn login_ex_raw_params(rmcmessage: &RMCMessage, account: &Account) -> RMCRes
|
|||
}
|
||||
}
|
||||
|
||||
login_ex(rmcmessage, &str)
|
||||
let Ok(pid) = str.parse() else {
|
||||
return rmcmessage.error_result_with_code(ErrorCode::Core_InvalidArgument);
|
||||
};
|
||||
|
||||
login_ex(rmcmessage, secure_server_account, pid).await
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue