feat: auth handlers

This commit is contained in:
2025-09-07 16:45:20 +03:30
parent 5c5df48644
commit f4e5e074d3
11 changed files with 227 additions and 4 deletions
+2 -2
View File
@@ -17,7 +17,7 @@ import (
type AuthService interface {
GenerateChallenge(ctx context.Context, pubKey string) (*domain.Challenge, error)
Authenticate(ctx context.Context, pubKey string, signature string, challenge *domain.Challenge, chainID uint) (*UserToken, error)
Authenticate(ctx context.Context, pubKey string, signature string, challenge *domain.Challenge, chainID uint, ipAddress, userAgent string) (*UserToken, error)
}
type authService struct {
@@ -61,7 +61,7 @@ func (s *authService) GenerateChallenge(ctx context.Context, pubKey string) (*do
return challenge, nil
}
func (s *authService) Authenticate(ctx context.Context, pubKey string, signature string, challenge *domain.Challenge, chainID uint) (*UserToken, error) {
func (s *authService) Authenticate(ctx context.Context, pubKey string, signature string, challenge *domain.Challenge, chainID uint, ipAddress, userAgent string) (*UserToken, error) {
_, err := common.IsValidPublicKey(pubKey)
if err != nil {
return nil, fmt.Errorf("invalid public key: %w", err)