aboutsummaryrefslogtreecommitdiff
path: root/azalea-auth/src
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-10-12 23:01:54 +0300
committermat <git@matdoes.dev>2025-10-12 23:01:54 +0300
commitee2575794e91b9457a74a95daf1dcc707058cd58 (patch)
treedf725850ef18ded5ce3f6552e17095d0f704ae84 /azalea-auth/src
parent1a1402954b07cd77615d0afc026c73b008787f51 (diff)
downloadazalea-drasl-ee2575794e91b9457a74a95daf1dcc707058cd58.tar.xz
upgrade deps and clean up lots of doc comments
Diffstat (limited to 'azalea-auth/src')
-rw-r--r--azalea-auth/src/auth.rs40
-rw-r--r--azalea-auth/src/sessionserver.rs5
2 files changed, 25 insertions, 20 deletions
diff --git a/azalea-auth/src/auth.rs b/azalea-auth/src/auth.rs
index d54194c9..d45547bc 100644
--- a/azalea-auth/src/auth.rs
+++ b/azalea-auth/src/auth.rs
@@ -18,21 +18,24 @@ use crate::cache::{self, CachedAccount, ExpiringValue};
#[derive(Default)]
pub struct AuthOpts<'a> {
- /// Whether we should check if the user actually owns the game. This will
- /// fail if the user has Xbox Game Pass! Note that this isn't really
- /// necessary, since getting the user profile will check this anyways.
+ /// Whether we should check if the user actually owns the game.
+ ///
+ /// This will fail if the user has Xbox Game Pass. Note that this isn't
+ /// really necessary, since getting the user profile will check this
+ /// anyways.
pub check_ownership: bool,
- // /// Whether we should get the Minecraft profile data (i.e. username, uuid,
- // /// skin, etc) for the player.
- // pub get_profile: bool,
- /// The directory to store the cache in. If this is not set, caching is not
- /// done.
+ /// The directory to store the cache in.
+ ///
+ /// If this is `None`, azalea-auth will not keep its own cache.
pub cache_file: Option<PathBuf>,
- /// If you choose to use your own Microsoft authentication instead of using
- /// Nintendo Switch, just put your client_id here.
+ /// An override for the Microsoft Client ID to authenticate with.
+ ///
+ /// The default client ID is for Nintendo Switch, but you can replace this
+ /// if you'd like authentication to have your own branding.
+ ///
+ /// For more information about this, see <https://minecraft.wiki/w/Microsoft_authentication#Microsoft_OAuth2_flow>.
pub client_id: Option<&'a str>,
- /// If you want to use custom scope instead of default one, just put your
- /// scope here.
+ /// An override for the OAuth2 scope to authenticate with.
pub scope: Option<&'a str>,
}
@@ -59,12 +62,11 @@ pub enum AuthError {
GetXboxLiveAuth(#[from] XboxLiveAuthError),
}
-/// Authenticate with Microsoft. If the data isn't cached,
-/// they'll be asked to go to log into Microsoft in a web page.
+/// Authenticate with Microsoft. If the data isn't cached, the user will be
+/// asked to go to log into Microsoft in a web page.
///
/// The cache key is an arbitrary string that's used to identify the account in
-/// the future. As a convention, we usually prefer to put the account email
-/// here.
+/// the future. The account email is often used for this.
///
/// If you want to use your own code to cache or show the auth code to the user
/// in a different way, use [`get_ms_link_code`], [`get_ms_auth_token`],
@@ -344,8 +346,10 @@ pub async fn get_ms_link_code(
.await?)
}
-/// Wait until the user logged into Microsoft with the given code. You get the
-/// device code response needed for this function from [`get_ms_link_code`].
+/// Wait until the user logged into Microsoft with the given code.
+///
+/// You get the device code response needed for this function from
+/// [`get_ms_link_code`].
///
/// You should pass the response from this to [`get_minecraft_token`].
pub async fn get_ms_auth_token(
diff --git a/azalea-auth/src/sessionserver.rs b/azalea-auth/src/sessionserver.rs
index 87d0e32c..317d09fa 100644
--- a/azalea-auth/src/sessionserver.rs
+++ b/azalea-auth/src/sessionserver.rs
@@ -53,8 +53,9 @@ pub struct ForbiddenError {
static REQWEST_CLIENT: LazyLock<reqwest::Client> = LazyLock::new(reqwest::Client::new);
/// Tell Mojang's servers that you are going to join a multiplayer server,
-/// which is required to join online-mode servers. The server ID is an empty
-/// string.
+/// which is required to join online-mode servers.
+///
+/// The server ID should typically be an empty string.
pub async fn join(
access_token: &str,
public_key: &[u8],