this should be the last fix
All checks were successful
Build and Test / splatoon (push) Successful in 2m47s
Build and Test / wii-sports-club (push) Successful in 3m16s
Build and Test / friends (push) Successful in 4m8s
Build and Test / sonic-transformed (push) Successful in 4m13s
Build and Test / wii-u-chat (push) Successful in 4m13s
Build and Test / minecraft-wiiu (push) Successful in 4m15s
Build and Test / puyopuyo (push) Successful in 4m15s
Build and Test / splatoon-testfire (push) Successful in 4m15s
Build and Test / fast-racing-neo (push) Successful in 4m14s
Build and Test / mario-tennis (push) Successful in 4m15s
Build and Test / super-mario-maker (push) Successful in 4m23s

This commit is contained in:
red binder 2026-06-23 01:27:22 +02:00
commit 6f0e6c4516

View file

@ -84,7 +84,7 @@ pub struct UserData {
}
#[repr(C, packed)]
#[derive(Pod, Zeroable, Copy, Clone)]
#[derive(Pod, Zeroable, Copy, Clone, Debug)]
pub struct NascToken {
pub pid: i32,
pub time: [u8; 14],
@ -298,9 +298,18 @@ impl Secure for FriendsGuest {
}
}
// this is probably a horrible way to do this. it's 1:27am. fuck off please i'll fix it later.
fn decode_token(encoded_str: &str) -> Result<NascToken, &'static str> {
// i dont like the use of replace here as this will reallocate the entire string
// im gonna keep it though as long as noone comes up with a good alternative for this
// without complicating the code/making it far less readable/unnescesarily long
let standard_b64 = encoded_str.replace('.', "+").replace('-', "/").replace('*', "=");
let standard = general_purpose::STANDARD.decode(standard_b64).map_err(|_| "failed to convert")?;
let bytes = general_purpose::STANDARD
.decode(encoded_str)
.decode(standard)
.map_err(|_| "failed to decode Base64 string")?;
if bytes.len() != std::mem::size_of::<NascToken>() {
@ -348,6 +357,8 @@ impl AccountManagement for FriendsGuest {
ErrorCode::Authentication_InvalidParam
})?;
log::info!("decoded token: {:?}", decoded_token);
let mut client = NexAccountServiceClient::connect(NEX_ACCOUNT_URL.as_str())
.await
.map_err(|e| {