Skip to content

server.internal.auth

Constants #

const mojang_public_key = 'MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAECRXueJeTDqNRRgJi/vlRufByu/2G0i2Ebt6YMar5QX/R0DIIyrJMcUpruK4QveTfJSTp3Shlq4Gk34cD/4GUWwkv0DVuzeuB+tXija7HBxii03NHDbPAD0AKnLr2wdAp'

fn decode_jwt #

fn decode_jwt(token string) !Jwt

fn parse_login_chain #

fn parse_login_chain(auth_info_json string, require_xbox bool) !Identity

parse_login_chain verifies the JWT signature chain and returns the client identity. Trust boundary: when the chain is self-signed (offline mode) the signatures are valid but prove nothing about who the player is - xbox_authenticated is only true when the chain roots in Mojang's public key. Callers must treat display_name/xuid as unverified unless xbox_authenticated.

fn verify_jwt #

fn verify_jwt(token string, public_key_b64 string) !bool

struct Identity #

struct Identity {
pub:
	xuid               string
	uuid               string
	display_name       string
	xbox_authenticated bool
	client_public_key  string
}

struct Jwt #

struct Jwt {
pub:
	header  map[string]json2.Any
	payload map[string]json2.Any
}