data

package
v0.0.0-...-18e7427 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const MojangAPI = "https://api.minecraftservices.com"

Variables

View Source
var DefaultAuth = Auth{DefaultProfile, Microsoft{}, KeyPair{}} // Offline-mode by default
View Source
var DefaultProfile = Profile{"Steve", "5627dd98-e6be-3c21-b8a8-e92344183641"}

Functions

func Do

func Do(req *http.Request) (*http.Response, error)

func ExtractValue

func ExtractValue(url, key string) string

func Match

func Match(regex, content string) string

func PreAuthData

func PreAuthData(r io.Reader) (string, string, error)

func VerifyMessage

func VerifyMessage(hash, signature []byte) bool

func VerifySignature

func VerifySignature(profilePubKey, signature []byte) bool

VerifySignature has the same functional as net.minecraft.world.entity.player.ProfilePublicKey.Data#validateSignature

Types

type Auth

type Auth struct {
	Profile
	Microsoft
	KeyPair
}

func (*Auth) ChangeName

func (a *Auth) ChangeName(name string) error

func (*Auth) ChangeSkin

func (a *Auth) ChangeSkin(variant, skinURL string) error

func (*Auth) HideCape

func (a *Auth) HideCape() error

func (*Auth) NameAvailable

func (a *Auth) NameAvailable(name string) (bool, error)

func (*Auth) ResetSkin

func (a *Auth) ResetSkin() error

func (*Auth) SessionID

func (a *Auth) SessionID() string

func (*Auth) ShowCape

func (a *Auth) ShowCape(capeid string) error

type DeviceCodeRequest

type DeviceCodeRequest struct {
	UserCode        string `json:"user_code"`
	DeviceCode      string `json:"device_code"`
	VerificationURI string `json:"verification_uri"`
	ExpiresIn       int64  `json:"expires_in"`
	Interval        int64  `json:"interval"`
	Message         string `json:"message"`
}

type DeviceCodeResponse

type DeviceCodeResponse struct {
	Microsoft
	Error string `json:"error"`
}

type KeyPair

type KeyPair struct {
	Pair struct {
		PrivateKey string `json:"privateKey"`
		PublicKey  string `json:"publicKey"`
	} `json:"keyPair"`
	PublicKeySignature   string    `json:"publicKeySignature"`
	PublicKeySignatureV2 string    `json:"publicKeySignatureV2"`
	ExpiresAt            time.Time `json:"expiresAt"`
	RefreshedAfter       time.Time `json:"refreshedAfter"`
}

func (KeyPair) ToSession

func (k KeyPair) ToSession(uuid string) PlayerSession

func (KeyPair) WriteTo

func (k KeyPair) WriteTo(w io.Writer) (int64, error)

type Microsoft

type Microsoft struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	ExpiresIn    int64  `json:"expires_in"`
	ExpiresAt    int64  `json:"expires_at"`
}

type PlayerSession

type PlayerSession struct {
	KeyPair
	UUID string
}

func (PlayerSession) WriteTo

func (k PlayerSession) WriteTo(w io.Writer) (int64, error)

type Profile

type Profile struct {
	Name string `json:"name"`
	UUID string `json:"id"`
}

type PublicKey

type PublicKey struct {
	ExpiresAt int64
	PublicKey *rsa.PublicKey
	Signature []byte
}

func (*PublicKey) ReadFrom

func (pub *PublicKey) ReadFrom(r io.Reader) (int64, error)

func (*PublicKey) Verify

func (pub *PublicKey) Verify() bool

func (PublicKey) WriteTo

func (pub PublicKey) WriteTo(w io.Writer) (int64, error)

type XboxLiveAuth

type XboxLiveAuth struct {
	DisplayClaims struct {
		Xui []struct {
			Uhs string `json:"uhs"`
		} `json:"xui"`
	} `json:"DisplayClaims"`
	IssueInstant string `json:"IssueInstant"`
	NotAfter     string `json:"NotAfter"`
	Token        string `json:"Token"`
}

Jump to

Keyboard shortcuts

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