Documentation
¶
Index ¶
- type APIKey
- type AuthService
- func (a *AuthService) CreateUser(ctx context.Context, email, password string) (*User, error)
- func (a *AuthService) GenerateAPIKey(ctx context.Context, userID, name string) (*APIKey, error)
- func (a *AuthService) GenerateJWT(user *User) (string, error)
- func (a *AuthService) ValidateAPIKey(ctx context.Context, key, secret string) (*User, error)
- func (a *AuthService) ValidateJWT(tokenString string) (*JWTClaims, error)
- func (a *AuthService) ValidatePassword(ctx context.Context, email, password string) (bool, error)
- type Database
- type JWTClaims
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIKey ¶
type APIKey struct {
ID string
UserID string
Name string
Key string // Public key (like AWS Access Key)
Secret string // Secret key (like AWS Secret Key)
Hash string // Hash of secret for storage
CreatedAt time.Time
LastUsed time.Time
}
APIKey represents an API key for S3 access
type AuthService ¶
type AuthService struct {
// contains filtered or unexported fields
}
AuthService handles authentication
func NewAuthService ¶
func NewAuthService(db Database) *AuthService
NewAuthService creates a new auth service
func (*AuthService) CreateUser ¶
CreateUser creates a new user account
func (*AuthService) GenerateAPIKey ¶
GenerateAPIKey creates a new API key
func (*AuthService) GenerateJWT ¶
func (a *AuthService) GenerateJWT(user *User) (string, error)
GenerateJWT creates a JWT token for web access
func (*AuthService) ValidateAPIKey ¶
ValidateAPIKey checks if API key is valid
func (*AuthService) ValidateJWT ¶
func (a *AuthService) ValidateJWT(tokenString string) (*JWTClaims, error)
ValidateJWT validates a JWT token
func (*AuthService) ValidatePassword ¶
ValidatePassword checks if password is correct
Click to show internal directories.
Click to hide internal directories.