backend/internal/auth/types.go
2025-06-15 12:53:27 +02:00

57 lines
1.6 KiB
Go

/*
Copyright (C) 2025 hexlocation (hex@iwakura.rip) & grngxd (grng@iwakura.rip)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package auth
import (
"time"
"github.com/golang-jwt/jwt/v5"
)
type TokenResponse struct {
AccessToken string `json:"access_token"`
TokenType string `json:"token_type"`
ExpiresIn int64 `json:"expires_in"`
RefreshToken string `json:"refresh_token"`
Scope string `json:"scope"`
}
type User struct {
ID string `json:"id" gorm:"primaryKey"`
Username string `json:"username"`
Blacklisted bool `json:"blacklisted"`
Email string `json:"email"`
CreatedAt time.Time `json:"created_at"`
}
type AvatarDecorationData struct {
Asset string
SkuID string
}
type ExchangeCodeRequest struct {
GrantType string `json:"grant_type"`
Code string `json:"code"`
RedirectUri string `json:"redirect_uri"`
}
type Claims struct {
User User `json:"user"`
Exp uint64 `json:"exp"`
jwt.RegisteredClaims
}