Documentation ¶
Index ¶
Constants ¶
View Source
const ( MinLength = 8 MaxLength = 99 DefaultTTL = 24 * 182 * time.Hour )
constant rules
Variables ¶
View Source
var ( ErrNilOwnerID = errors.New("owner id is zero") ErrZeroKind = errors.New("password kind is zero") ErrNilPasswordStore = errors.New("password store is nil") ErrEmptyPassword = errors.New("empty password is forbidden") ErrPasswordNotFound = errors.New("password not found") ErrShortPassword = errors.New("password is too short") ErrLongPassword = errors.New("password is too long") ErrUnsafePassword = errors.New("password is too unsafe") ErrInfeasibleSafety = errors.New("password safety is infeasible with such length and score") )
Functions ¶
func EvaluatePasswordStrength ¶
EvaluatePasswordStrength evaluates password's strength by checking length, complexity, characters used etc.
Types ¶
type Manager ¶
type Manager interface { Upsert(ctx context.Context, p Password) error Get(ctx context.Context, o Owner) (p Password, err error) Delete(ctx context.Context, o Owner) error }
userManager describes the behaviour of a user password manager
func NewManager ¶
NewManager initializes the default user password manager
type Password ¶
type Password struct { Owner Hash []byte `db:"hash" json:"-"` CreatedAt time.Time `db:"created_at" json:"-"` UpdatedAt time.Time `db:"updated_at" json:"-"` ExpireAt time.Time `db:"expire_at" json:"-"` IsChangeRequired bool `db:"is_change_required" json:"-"` }
Password object TODO: use byte array instead of slice for password hash
func NewFromInput ¶
NewFromInput creates a hash from a given raw password byte slice
type PostgreSQLStore ¶
type PostgreSQLStore struct {
// contains filtered or unexported fields
}
func (*PostgreSQLStore) Delete ¶
func (s *PostgreSQLStore) Delete(ctx context.Context, o Owner) (err error)
DeletePolicy deletes a stored password
Click to show internal directories.
Click to hide internal directories.