Documentation ¶
Index ¶
Constants ¶
View Source
const ( MasterPasswordType uint8 = 0 UserPasswordType uint8 = 1 )
Password types
View Source
const ( RSCUnspecified = 0 RSCSucceed = 1 RSCFailed = 2 )
RegisterStatusCode
View Source
const ( RoleIdSuperadmin uint8 = 1 RoleIdAdmin uint8 = 2 RoleIdUser uint8 = 3 )
Known roleIds
View Source
const (
RedisPrefixGranted = "auth:granted"
)
View Source
const (
RegexEmail = `^[a-zA-Z0-9.!#$%&'*/=?^_` + "`" + `{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$`
)
Variables ¶
View Source
var ( // Generic errors ErrNotFound = errors.New("Not found") ErrNoArg = errors.New("No argument given") ErrInternal = errors.New("Internal error") // Specific errors ErrInvalidMethod = errors.New("Invalid method") ErrInvalidUsernamePassword = errors.New("Invalid username/password") ErrPasswordIsTooWeak = errors.New("Password is too weak") ErrMalformedEmail = errors.New("Malformed email") ErrInvalidUserIdType = errors.New("Invalid user ID type") ErrUserNotFound = errors.New("User not found") ErrUserIsBlocked = errors.New("User is blocked") )
Known gRPC errors
View Source
var ( MapGRPCErrCodes = map[error]codes.Code{ ErrInvalidMethod: codes.InvalidArgument, ErrInvalidUsernamePassword: codes.InvalidArgument, ErrMalformedEmail: codes.InvalidArgument, ErrInvalidUserIdType: codes.InvalidArgument, ErrPasswordIsTooWeak: codes.FailedPrecondition, ErrNoArg: codes.FailedPrecondition, ErrNotFound: codes.NotFound, ErrUserNotFound: codes.NotFound, ErrUserIsBlocked: codes.Aborted, ErrInternal: codes.Internal, } )
All client-safe errors goes here
View Source
var ValidUserIdTypes = []UserIdType{UserIdTypeUsername, UserIdTypeEmail, UserIdTypePhoneNumber}
Functions ¶
This section is empty.
Types ¶
type LoginMethod ¶
type LoginMethod uint8
const ( LoginMethodLogin LoginMethod = 1 LoginMethodRecovery LoginMethod = 2 )
Login methods
type UserIdType ¶
type UserIdType string
const ( UserIdTypeUsername UserIdType = "username" UserIdTypeEmail UserIdType = "email" UserIdTypePhoneNumber UserIdType = "phone_number" )
User identifier types
func (*UserIdType) Validate ¶
func (u *UserIdType) Validate() error
Click to show internal directories.
Click to hide internal directories.