use matrix_sdk_base::ruma::{OwnedDeviceId, OwnedUserId};
use serde::{Deserialize, Serialize};
use url::Url;
#[derive(Serialize, Deserialize, Debug)]
pub struct RestoreToken {
pub is_guest: bool,
pub homeurl: Url,
pub session: CustomAuthSession,
pub db_passphrase: Option<String>,
#[serde(default, skip_serializing)]
#[allow(dead_code)]
media_cache_base_path: Option<String>,
}
impl RestoreToken {
pub fn serialized(
session: CustomAuthSession,
homeurl: Url,
is_guest: bool,
db_passphrase: Option<String>,
) -> serde_json::Result<String> {
serde_json::to_string(&RestoreToken {
session,
homeurl,
is_guest,
db_passphrase,
media_cache_base_path: None,
})
}
}
#[derive(Serialize, Deserialize, Debug)]
pub struct CustomAuthSession {
pub user_id: OwnedUserId,
pub device_id: OwnedDeviceId,
pub access_token: String,
}