fix(sdk): Don't include access and refresh token in Debug output of Session
//! User sessions.
+use std::fmt;
+
use ruma::{api::client::session::refresh_token, OwnedDeviceId, OwnedUserId};
use serde::{Deserialize, Serialize};
@@ -36,7 +38,7 @@ use serde::{Deserialize, Serialize};
///
/// assert_eq!(session.device_id.as_str(), "MYDEVICEID");
/// ```
-#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
+#[derive(Clone, Eq, Hash, PartialEq, Serialize, Deserialize)]
pub struct Session {
/// The access token used for this session.
pub access_token: String,
@@ -66,6 +68,15 @@ impl Session {
}
}
+impl fmt::Debug for Session {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ f.debug_struct("Session")
+ .field("user_id", &self.user_id)
+ .field("device_id", &self.device_id)
+ .finish_non_exhaustive()
+ }
+}
+
impl From<ruma::api::client::session::login::v3::Response> for Session {
fn from(response: ruma::api::client::session::login::v3::Response) -> Self {
Self {
