todo: fix UserData decryption
This commit is contained in:
@@ -14,6 +14,7 @@ use nyquest::{
|
||||
header::{ACCEPT_ENCODING, CONTENT_ENCODING, EXPECT, USER_AGENT},
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use spdlog::debug;
|
||||
|
||||
pub trait MaiVersion {
|
||||
const AES_KEY: &[u8; 32];
|
||||
@@ -24,7 +25,7 @@ pub trait MaiVersion {
|
||||
|
||||
pub trait MaiVersionExt: MaiVersion {
|
||||
fn encode(data: impl AsRef<[u8]>) -> Result<Vec<u8>, ApiError>;
|
||||
fn decode(data: impl AsMut<[u8]>) -> Result<Vec<u8>, ApiError>;
|
||||
fn decode(data: impl AsRef<[u8]>) -> Result<Vec<u8>, ApiError>;
|
||||
|
||||
fn api_hash(api: APIMethod) -> String {
|
||||
let api_name: &str = api.into();
|
||||
@@ -78,6 +79,9 @@ pub trait MaiVersionExt: MaiVersion {
|
||||
.await
|
||||
.map_err(|_| ApiError::JoinError)??;
|
||||
let data = client.request(req).await?.bytes().await?;
|
||||
|
||||
debug!("received: {data:?}");
|
||||
|
||||
let decoded = spawn_blocking(move || Self::decode(data))
|
||||
.await
|
||||
.map_err(|_| ApiError::JoinError)??;
|
||||
|
||||
Reference in New Issue
Block a user