70 lines
2.7 KiB
Go
70 lines
2.7 KiB
Go
package models
|
||
|
||
// Agent представляет информацию о лаунчере, который делает запрос
|
||
type Agent struct {
|
||
Name string `json:"name"` // "Minecraft"
|
||
Version int `json:"version"` // 1
|
||
}
|
||
|
||
// AuthenticateRequest - это тело запроса на /authserver/authenticate
|
||
type AuthenticateRequest struct {
|
||
Agent Agent `json:"agent"`
|
||
Username string `json:"username"`
|
||
Password string `json:"password"`
|
||
ClientToken string `json:"clientToken"`
|
||
}
|
||
|
||
// ProfileInfo содержит краткую информацию о профиле игрока
|
||
type ProfileInfo struct {
|
||
ID string `json:"id"` // UUID пользователя без дефисов
|
||
Name string `json:"name"` // Никнейм пользователя
|
||
}
|
||
|
||
// AuthenticateResponse - это тело успешного ответа
|
||
type AuthenticateResponse struct {
|
||
AccessToken string `json:"accessToken"`
|
||
ClientToken string `json:"clientToken"`
|
||
AvailableProfiles []ProfileInfo `json:"availableProfiles"`
|
||
SelectedProfile ProfileInfo `json:"selectedProfile"`
|
||
User *UserProperty `json:"user,omitempty"` // Необязательное поле с доп. свойствами
|
||
}
|
||
|
||
// UserProperty - часть ответа, может содержать доп. свойства пользователя
|
||
type UserProperty struct {
|
||
ID string `json:"id"` // UUID пользователя
|
||
Properties []any `json:"properties"` // Обычно пустой массив
|
||
}
|
||
|
||
// TextureInfo содержит URL для конкретной текстуры
|
||
type TextureInfo struct {
|
||
URL string `json:"url"`
|
||
}
|
||
|
||
// Textures содержит ссылки на скин и плащ
|
||
type Textures struct {
|
||
SKIN *TextureInfo `json:"SKIN,omitempty"`
|
||
CAPE *TextureInfo `json:"CAPE,omitempty"`
|
||
}
|
||
|
||
// ProfilePropertyValue - это закодированное в Base64 значение свойства textures
|
||
type ProfilePropertyValue struct {
|
||
Timestamp int64 `json:"timestamp"`
|
||
ProfileID string `json:"profileId"`
|
||
ProfileName string `json:"profileName"`
|
||
Textures Textures `json:"textures"`
|
||
}
|
||
|
||
// ProfileProperty - это свойство 'textures' в ответе
|
||
type ProfileProperty struct {
|
||
Name string `json:"name"` // Всегда "textures"
|
||
Value string `json:"value"` // Base64(ProfilePropertyValue)
|
||
Signature string `json:"signature"` // Base64(RSA-SHA1(Value))
|
||
}
|
||
|
||
// SessionProfileResponse - это ответ от /sessionserver/session/minecraft/profile/{uuid}
|
||
type SessionProfileResponse struct {
|
||
ID string `json:"id"`
|
||
Name string `json:"name"`
|
||
Properties []ProfileProperty `json:"properties"`
|
||
}
|