Documentation ¶
Index ¶
Constants ¶
View Source
const (
PasswordCharRepeatLimit = 4
)
View Source
const RootUsername = "root"
RootUsername is a reserved username for the admin deploying the application
Variables ¶
View Source
var ( ErrEmptyUsername = errors.New("username cannot be empty") ErrShortUsername = errors.New("username is too short") ErrLongUsername = errors.New("username is too long") ErrInvalidUsername = errors.New("invalid username") ErrEmptyName = errors.New("name cannot be empty") ErrShortName = errors.New("name is too short") ErrLongName = errors.New("name is too long") ErrInvalidName = errors.New("invalid name") ErrEmptyPassword = errors.New("password cannot be empty") ErrShortPassword = errors.New("password is too short") ErrLongPassword = errors.New("password is too long") ErrInvalidPassword = errors.New("invalid password") )
Functions ¶
func ValidateName ¶
ValidateName verifies if the input name is valid, returning an error if invalid
func ValidatePassword ¶
ValidatePassword verifies if the input password is valid, returning an error if invalid
func ValidateUsername ¶
ValidateUsername verifies if the input username is valid, returning an error if invalid
Types ¶
type Repository ¶
type Repository interface { // Create will create a user `u`, returning its ID and an error Create(ctx context.Context, u *User) (uint64, error) // Get returns the user identified by `username`, and an error Get(ctx context.Context, username string) (*User, error) // List returns all the users, and an error List(ctx context.Context) ([]*User, error) // Update will update the user `username` with its updated version `updated`. Returns an error Update(ctx context.Context, username string, updated *User) error // Delete removes the user identified by `username`, returning an error Delete(ctx context.Context, username string) error }
Repository describes the actions exposed by the users store
func WithTrace ¶
func WithTrace(r Repository) Repository
type User ¶
type User struct { ID uint64 `json:"id"` Username string `json:"username"` Name string `json:"name"` Hash string `json:"-"` Salt string `json:"-"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` }
User is a person (or entity) that uses the application to store secrets. They will have a unique username.
Click to show internal directories.
Click to hide internal directories.