summaryrefslogtreecommitdiffstats
path: root/src/auth
diff options
context:
space:
mode:
authorLibravatar bigfoot547 <[email protected]>2025-02-01 00:20:54 -0600
committerLibravatar bigfoot547 <[email protected]>2025-02-01 00:20:54 -0600
commit6a1bb0980facadcc22cbae27f57782050e7924a1 (patch)
treedafdd715f7fc3f42323bd20666bd653a73a30b68 /src/auth
parentdo clippy stuff and change line endings (diff)
random changes
Diffstat (limited to 'src/auth')
-rw-r--r--src/auth/msa.rs4
-rw-r--r--src/auth/types.rs4
-rw-r--r--src/auth/types/property_map.rs27
3 files changed, 24 insertions, 11 deletions
diff --git a/src/auth/msa.rs b/src/auth/msa.rs
index 404329b..add345c 100644
--- a/src/auth/msa.rs
+++ b/src/auth/msa.rs
@@ -119,8 +119,8 @@ impl XSTSAuthSuccessResponse {
self.get_display_claim("uhs")
}
- pub(super) fn get_xuid(&self) -> Option<Uuid> {
- self.get_display_claim("xid").and_then(|s| s.parse().ok()).map(|n| Uuid::from_u64_pair(0, n))
+ pub(super) fn get_xuid(&self) -> Option<&str> {
+ self.get_display_claim("xid")
}
pub(super) fn get_gamertag(&self) -> Option<&str> {
diff --git a/src/auth/types.rs b/src/auth/types.rs
index 79b89c9..b9cdaad 100644
--- a/src/auth/types.rs
+++ b/src/auth/types.rs
@@ -12,6 +12,8 @@ use uuid::Uuid;
pub struct Property {
pub name: String,
pub value: String,
+
+ #[serde(skip_serializing_if = "Option::is_none")]
pub signature: Option<String>
}
@@ -99,7 +101,7 @@ pub struct MinecraftPlayerInfo {
pub struct MsaUser {
#[serde(skip_serializing_if = "Option::is_none")]
pub player_profile: Option<PlayerProfile>,
- pub xuid: Option<Uuid>,
+ pub xuid: Option<String>,
pub gamertag: Option<String>,
#[serde(skip)] // this information is transient
diff --git a/src/auth/types/property_map.rs b/src/auth/types/property_map.rs
index 964b06f..ddfc9ce 100644
--- a/src/auth/types/property_map.rs
+++ b/src/auth/types/property_map.rs
@@ -2,22 +2,33 @@ use std::fmt::Formatter;
use multimap::MultiMap;
use serde::de::{SeqAccess, Visitor};
use serde::{Deserializer, Serializer};
-use serde::ser::SerializeSeq;
use crate::auth::Property;
pub type PropertyMap = MultiMap<String, Property>;
+pub mod legacy {
+ use serde::Serializer;
+ use super::PropertyMap;
+
+ pub fn serialize<S>(value: &PropertyMap, serializer: S) -> Result<S::Ok, S::Error>
+ where S: Serializer
+ {
+ serializer.collect_map(value.iter_all()
+ .filter_map(|(k, v)| {
+ if v.is_empty() {
+ None
+ } else {
+ Some((k, v.iter().map(|p| &p.value).collect::<Vec<_>>()))
+ }
+ }))
+ }
+}
+
pub fn serialize<S>(value: &PropertyMap, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer
{
- let mut seq = serializer.serialize_seq(Some(value.keys().len()))?;
-
- for (_, prop) in value.flat_iter() {
- seq.serialize_element(prop)?;
- }
-
- seq.end()
+ serializer.collect_seq(value.flat_iter().map(|(_, v)| v))
}
pub fn deserialize<'de, D>(deserializer: D) -> Result<PropertyMap, D::Error>