bedrock_jwt/
lib.rs

1//! # bedrock-jwt
2//! A library for verifying JWT tokens for Minecraft: Bedrock Edition.
3//!
4//! This library provides functionality to verify the authenticity of a chain of JWT tokens
5//! provided by a client, ensuring that the player's identity is valid and trusted.
6//!
7//! ## Features
8//!
9//! - JWT chain verification
10//! - Player data extraction
11//! - Public key handling from Base64 encoded strings
12//!
13//! ## Usage
14//!
15//! The primary entry point for this library is the `verify_chain` function, which takes a slice
16//! of JWT tokens and a Mojang public key to perform verification.
17//!
18//! ```rust,no_run
19//! use bedrock_jwt::verifier::{verify_chain, PlayerClaims};
20//!
21//! let tokens = vec![
22//!     "first_jwt_token",
23//!     "second_jwt_token",
24//!     "third_jwt_token",
25//! ];
26//! let mojang_public_key = "your_mojang_public_key";
27//!
28//! match verify_chain(&tokens, mojang_public_key) {
29//!     Ok(claims) => {
30//!         println!("Successfully verified player: {}", claims.display_name);
31//!     }
32//!     Err(e) => {
33//!         eprintln!("Verification failed: {}", e);
34//!     }
35//! }
36//! ```
37
38pub mod verifier;
39
40pub use verifier::*;