feat: add yggdrasil metadata endpoint and support authlib-injector

This commit is contained in:
2026-01-29 17:08:52 +03:00
parent a1e022e966
commit f1d763e056
4 changed files with 88 additions and 2 deletions

View File

@@ -158,3 +158,19 @@ func (s *ProfileService) UpdateUserSkin(ctx context.Context, userID int, file mu
return s.UserRepo.UpdateSkinHash(ctx, userID, hash)
}
// GetPublicKey возвращает публичный ключ в формате PEM
func (s *ProfileService) GetPublicKey() (string, error) {
pubKey := &s.privateKey.PublicKey
pubASN1, err := x509.MarshalPKIXPublicKey(pubKey)
if err != nil {
return "", err
}
pubBytes := pem.EncodeToMemory(&pem.Block{
Type: "PUBLIC KEY",
Bytes: pubASN1,
})
return string(pubBytes), nil
}