A simple, easy-to-use library for interfacing with the Mojang API.
All functions involving IO in this crate are asynchronous and utilize async/await. As a result, you will have to use nightly Rust until async/await is stabilized.
This crate provides a number of functions:
- Server-side authentication with the Mojang API, used to verify
that clients have logged in correctly. This is available using the
- Obtaining the "server hash" required for authentication, available using
server_hash. Since Mojang uses abnormal hash digests for obtaining the value, this crate provides a simple way to obtain it.
Authenticating a client on a server:
// Obtain the "server hash" let server_hash = mojang_api::server_hash( "", // Note that the "server ID" is always an empty string shared_secret, public_key, ); // Make the API request let response = mojang_api::server_auth(&server_hash, username).await?; // Now do something with it...
Represents the response received from the client authentication endpoint.
Represents a profile property returned in the server authentication request.
Information about a user's profile, including their name, UUID, etc. Similar to
Represents the response received when performing server-side authentication with the Mojang API.
Information about a user, including UUID, email, username, etc.
Error type for this crate.
Performs client-side authentication with the given access token and server hash.
Authenticates a user, returning a client access token and metadata for the user.
Generates a digest for the given hasher using Minecraft's unorthodox hex digestion method.
Performs server-side authentication using the given server hash and username.
Computes the "server hash" required for authentication based on the server ID, the shared secret used for communication with the client, and the server's public RSA key.
Result type used by this crate. This is equivalent