2026-02-01 20:59:23 +01:00
|
|
|
use crate::rmc::structures::connection_data::{ConnectionData, ConnectionDataOld};
|
2026-03-24 15:48:56 +01:00
|
|
|
use cfg_if::cfg_if;
|
2026-01-27 14:44:10 +01:00
|
|
|
use macros::{method_id, rmc_proto};
|
2026-03-24 15:48:56 +01:00
|
|
|
use rnex_core::PID;
|
2025-09-21 15:59:27 +02:00
|
|
|
use rnex_core::rmc::response::ErrorCode;
|
|
|
|
|
use rnex_core::rmc::structures::any::Any;
|
|
|
|
|
use rnex_core::rmc::structures::qresult::QResult;
|
2025-03-23 10:54:01 +01:00
|
|
|
|
2026-03-24 15:48:56 +01:00
|
|
|
cfg_if! {
|
|
|
|
|
if #[cfg(feature = "nx")]{
|
2026-04-26 13:15:56 +02:00
|
|
|
type LoginExRet = (QResult, PID, Vec<u8>, ConnectionData, String, String);
|
|
|
|
|
type RequestTicketRet = (QResult, Vec<u8>, String);
|
2026-03-24 15:48:56 +01:00
|
|
|
} else {
|
2026-04-26 13:15:56 +02:00
|
|
|
type LoginExRet = (QResult, PID, Vec<u8>, ConnectionData, String);
|
|
|
|
|
type RequestTicketRet = (QResult, Vec<u8>);
|
2026-03-24 15:48:56 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-27 14:44:10 +01:00
|
|
|
/// This is the representation for `Ticket Granting`(for details see the
|
2025-03-23 10:54:01 +01:00
|
|
|
/// [kinnay wiki entry](https://github.com/kinnay/NintendoClients/wiki/Authentication-Protocol))
|
|
|
|
|
#[rmc_proto(10)]
|
|
|
|
|
pub trait Auth {
|
2025-03-24 23:31:25 +01:00
|
|
|
/// representation of the `Login` method(for details see the
|
|
|
|
|
/// [kinnay wiki entry](https://github.com/kinnay/NintendoClients/wiki/Authentication-Protocol))
|
2025-03-23 10:54:01 +01:00
|
|
|
#[method_id(1)]
|
2026-01-27 14:44:10 +01:00
|
|
|
async fn login(
|
|
|
|
|
&self,
|
|
|
|
|
name: String,
|
2026-03-24 15:48:56 +01:00
|
|
|
) -> Result<(QResult, PID, Vec<u8>, ConnectionDataOld, String), ErrorCode>;
|
2025-03-23 10:54:01 +01:00
|
|
|
|
2025-03-24 23:31:25 +01:00
|
|
|
/// representation of the `LoginEx` method(for details see the
|
|
|
|
|
/// [kinnay wiki entry](https://github.com/kinnay/NintendoClients/wiki/Authentication-Protocol))
|
2025-03-23 10:54:01 +01:00
|
|
|
#[method_id(2)]
|
2026-04-26 13:15:56 +02:00
|
|
|
async fn login_ex(&self, name: String, extra_data: Any) -> Result<LoginExRet, ErrorCode>;
|
2025-03-23 10:54:01 +01:00
|
|
|
|
|
|
|
|
#[method_id(3)]
|
|
|
|
|
async fn request_ticket(
|
|
|
|
|
&self,
|
2026-03-24 15:48:56 +01:00
|
|
|
source_pid: PID,
|
|
|
|
|
destination_pid: PID,
|
2026-04-26 13:15:56 +02:00
|
|
|
) -> Result<RequestTicketRet, ErrorCode>;
|
2026-03-24 15:48:56 +01:00
|
|
|
|
|
|
|
|
/// representation of the `RequestTicket` method(for details see the
|
|
|
|
|
/// [kinnay wiki entry](https://github.com/kinnay/NintendoClients/wiki/Authentication-Protocol))
|
2025-03-23 10:54:01 +01:00
|
|
|
|
2025-03-24 23:31:25 +01:00
|
|
|
/// representation of the `GetPID` method(for details see the
|
|
|
|
|
/// [kinnay wiki entry](https://github.com/kinnay/NintendoClients/wiki/Authentication-Protocol))
|
2025-03-23 10:54:01 +01:00
|
|
|
#[method_id(4)]
|
|
|
|
|
async fn get_pid(&self, username: String) -> Result<u32, ErrorCode>;
|
|
|
|
|
|
2025-03-24 23:31:25 +01:00
|
|
|
/// representation of the `LoginWithContext` method(for details see the
|
|
|
|
|
/// [kinnay wiki entry](https://github.com/kinnay/NintendoClients/wiki/Authentication-Protocol))
|
2025-03-23 10:54:01 +01:00
|
|
|
#[method_id(5)]
|
2026-03-24 15:48:56 +01:00
|
|
|
async fn get_name(&self, pid: PID) -> Result<String, ErrorCode>;
|
2025-03-24 23:31:25 +01:00
|
|
|
|
|
|
|
|
// `LoginWithContext` is left out here because we don't need it right now and versioning still
|
|
|
|
|
// needs to be figured out
|
2025-03-23 10:54:01 +01:00
|
|
|
}
|