[−][src]Crate mojang_api
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
server_auth
function. - 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.
Examples
Authenticating a client on a server:
#![feature(async_await)] // 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...
Structs
ProfileProperty | Represents a profile property returned in the server authentication request. |
ServerAuthResponse | Represents the response received when performing server-side authentication with the Mojang API. |
Enums
Error | Error type for this crate. |
Functions
server_auth | Performs server-side authentication using the given server hash and username. |
server_hash | 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. |
Type Definitions
Result | Result type used by this crate. This is equivalent
to |