feat(profile): implement yggdrasil profile signing

This commit is contained in:
2025-06-15 17:09:36 +03:00
parent 4d42cfff2d
commit 056aa05c50
6 changed files with 254 additions and 2 deletions

View File

@@ -34,3 +34,36 @@ 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"`
}

View File

@@ -24,3 +24,11 @@ type RegisterRequest struct {
Email string `json:"email"`
Password string `json:"password"`
}
type Profile struct {
ID int `json:"-"`
UserID int `json:"-"`
SkinHash string `json:"skin_hash,omitempty"`
CapeHash string `json:"cape_hash,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}