auth

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package auth provides functions related to game authentication.

Index

Constants

This section is empty.

Variables

View Source
var MSA msaT

Functions

func ReadFromCache

func ReadFromCache() error

ReadFromCache reads an AuthStore into the global store from the file specified in env.AuthStorePath

This function should be run in order to load the authentication info from the cache. If it is not, the global AuthStore will be blank.

Types

type AuthStore

type AuthStore struct {
	MSA       msaAuthStore       `json:"msa"`
	XBL       xblAuthStore       `json:"xbl"`
	XSTS      xstsAuthStore      `json:"xsts"`
	Minecraft minecraftAuthStore `json:"minecraft"`
}

An AuthStore is an authentication store which stores necessary information to log in.

var Store AuthStore

Store is the global authentication store.

func (*AuthStore) Clear

func (store *AuthStore) Clear() error

Clear clears the store and writes it to the file specified in env.AuthStorePath

func (*AuthStore) WriteToCache

func (store *AuthStore) WriteToCache() error

WriteToCache writes the store to the file specified in env.AuthStorePath

type Session

type Session struct {
	UUID        string
	Username    string
	AccessToken string
}

A Session holds the necessary information to start Minecraft authenticated.

func Authenticate

func Authenticate() (Session, error)

Authenticate authenticates with all necessary endpoints, or cached data if available and returns a Session.

func AuthenticateWithCode

func AuthenticateWithCode(codeResp deviceCodeResponse) (Session, error)

AuthenticateWithCode authenticates with a device code.

This function blocks until the user has been authenticated, or another error has occurred.

func AuthenticateWithRedirect

func AuthenticateWithRedirect() (Session, error)

AuthenticateWithRedirect authenticates using the OAuth2 Code flow.

This function blocks until a response has been recieved on the local authentication server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL