auth

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 15 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// Deprecated: move to package download
	Authlibversion = "1.1.41"
	// Deprecated: move to package download
	Authlibsha1 = "64e96fc1e29e312a4d1e9d530f492cfa4b089cf1"
)

Variables

View Source
var (
	NotOk      = errors.New("not ok")
	NoProfiles = errors.New("No Available Profiles")
)
View Source
var (
	ErrNotSelctProFile = errors.New("ErrNotSelctProFile")
	ErrProFileNoExist  = errors.New("ErrProFileNoExist")
)
View Source
var (
	ErrChild         = errors.New("child account or not added to a Family")
	ErrXboxNotLinked = errors.New("xbox account not exist")
)
View Source
var (
	ErrCode    = errors.New("code invalid")
	ErrToken   = errors.New("Token invalid")
	ErrProfile = errors.New("DO NOT HAVE GAME")
)
View Source
var AccessTokenCanNotUse = errors.New("accessToken is can not use")
View Source
var Authliburls = []string{
	"https://authlib-injector.yushi.moe/artifact/41/authlib-injector-1.1.41.jar",
	"https://bmclapi2.bangbang93.com/mirrors/authlib-injector/artifact/41/authlib-injector-1.1.41.jar",
}

Deprecated: move to package download

View Source
var JsonNotTrue = errors.New("json not true")
View Source
var Transport = http.DefaultTransport.(*http.Transport).Clone()

Functions

func Getauthlibapi added in v1.2.0

func Getauthlibapi(api string) (apiaddress string, err error)

func ListAvailableProfileName added in v1.3.4

func ListAvailableProfileName(a Auth) []string

func Refresh

func Refresh(a *Auth) error

func Validate

func Validate(a Auth) error

Types

type Auth

type Auth struct {
	Username    string
	ClientToken string
	ID          string
	AccessToken string

	ApiAddress string
	// contains filtered or unexported fields
}

func Authenticate

func Authenticate(ApiAddress, username, email, password, clientToken string) (Auth, error)

Authenticate return accessToken, err

type ErrHttpCode added in v1.3.17

type ErrHttpCode struct {
	// contains filtered or unexported fields
}

func (ErrHttpCode) Error added in v1.3.17

func (e ErrHttpCode) Error() string

type MsToken added in v1.3.16

type MsToken struct {

	// Deprecated: Always nil
	ExpiresIn time.Time
	// contains filtered or unexported fields
}

func (*MsToken) Expires deprecated added in v1.3.16

func (m *MsToken) Expires() bool

Deprecated: use Refresh

func (*MsToken) Refresh added in v1.3.16

func (m *MsToken) Refresh() error

type Profile added in v1.3.0

type Profile struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	AccessToken string
	MsToken     MsToken
}

func GetProfile added in v1.3.0

func GetProfile(Authorization string) (*Profile, error)

func MsLogin added in v1.3.0

func MsLogin() (*Profile, error)

func MsLoginRefresh added in v1.3.16

func MsLoginRefresh(t *MsToken) (*Profile, error)

Jump to

Keyboard shortcuts

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