Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrAccountNotFound = errors.New("no such account")
)
View Source
var ErrInvalidType = errors.New("invalid account type")
View Source
var ErrNoCredentials = errors.New("no credentials found")
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { UUID string `json:"uuid"` Profile struct { Username string `json:"username"` } `json:"profile"` Type Type `json:"type"` // Source is the token data for the auth Type. // Either MicrosoftTokenData or (todo) MojangTokenData. Source interface{} `json:"source"` }
func (*Account) UnmarshalJSON ¶
type Credentials ¶
type Keychain ¶
type Keychain interface { Get(key string) (*Credentials, error) Set(key string, credentials *Credentials) error }
Keychain is an interface for storing and retrieving account credentials, with support for using both a high security system keyring (eg Keychain on macOS, gnome keyring) and a local file.
func NewKeychain ¶
type MSOBeginPolling ¶
type MSOBeginPolling func()
type MSOPromptCallback ¶
type MSOPromptCallback func(verificationUrl, userCode string)
type Manager ¶
type Manager interface { // GetDefault returns the default account, or the empty string if there is no account set GetDefault() string // SetDefault replaces the default account with the given account, or an error if the account // does not exist (ErrAccountNotFound) or another error occurred // // The Manager is not resposible for persisting the change, Save should be called afterwards. SetDefault(uuid string) error Accounts() []string // GetAccount returns the account with the given value, or nil if it cannot be found. // Either a (case-insensitive) name, or a UUID (with/without dashes) can be matched GetAccount(value string) *Account // GetAccountToken returns a _minecraft_ access token for the given account. // The given value may be a (case-insensitive) name, or a UUID (with/without dashes). // // This function will always return an active token, using the refresh token if necessary. GetAccountToken(value string) (string, error) // LoginMicrosoft handles logging into a new Microsoft account // // The Manager is not responsible for persisting the account to its storage mechanism, Save should be called. LoginMicrosoft(promptCallback MSOPromptCallback) (*Account, error) Save() error }
type MicrosoftTokenData ¶
type MicrosoftTokenData struct {
UserHash string `json:"userHash"`
}
Click to show internal directories.
Click to hide internal directories.