feat: add yggdrasil metadata endpoint and support authlib-injector
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user