Files
IDP-Backend/internal/api/auth/domain/auth_domain.go

52 lines
1.0 KiB
Go

package domain
import "context"
type AuthRepository interface {
SaveOtpRequest(ctx context.Context, uuid string, code string) error
GetOtpRequest(ctx context.Context, uuid string) (*string, error)
}
type ErrOtpNotFound struct {
Uuid string
}
func (e ErrOtpNotFound) Error() string {
return "OTP request not found for UUID: " + e.Uuid
}
type ErrUserNotFound struct {
PhoneNumber string
}
func (e ErrUserNotFound) Error() string {
return "User not found with phone number: " + e.PhoneNumber
}
type ErrOtpInvalid struct {
Code string
Uuid string
}
func (e ErrOtpInvalid) Error() string {
return "Invalid OTP code: " + e.Code + " for UUID: " + e.Uuid
}
type ErrInvalidHydraAccept struct {
Message string
Uuid string
}
func (e ErrInvalidHydraAccept) Error() string {
return "Invalid Hydra accept request: " + e.Message + " for UUID: " + e.Uuid
}
type ErrInvalidPhoneNumber struct {
PhoneNumber string
Err error
}
func (e ErrInvalidPhoneNumber) Error() string {
return "Invalid phone number: " + e.PhoneNumber + ", error: " + e.Err.Error()
}