Versions in this module Expand all Collapse all v0 v0.3.0 Sep 12, 2018 Changes in this version + var EmptyIP = net.IP + func GetRandReader() io.Reader + func SetRandReader(reader io.Reader) v0.2.1 Mar 28, 2018 Changes in this version + var ErrPasswordUnchanged = errors.New("Password unchanged") v0.2.0 Mar 28, 2018 Changes in this version type Credential + func (c *Credential) ChangePassword(oldPassword, newPassword string) error + func (c *Credential) ChangePasswordWithConfig(config Config, oldPassword, newPassword string) error + func (c *Credential) ChangePasswordWithConfigAndIP(config Config, oldPassword, newPassword string, ip net.IP) error + func (c *Credential) ChangePasswordWithIP(oldPassword, newPassword string, ip net.IP) error v0.1.0 Jan 25, 2018 Changes in this version + var DefaultConfig = Config + var DefaultWorkFactor = map[Kdf]WorkFactor + func WorkFactorsEqual(a, b WorkFactor) bool + type AtLeastNRunes struct + N int + func (pp AtLeastNRunes) PasswordAcceptable(password string) error + type AuditLogger interface + LastN func(userID UserID, n int) []Log + LastNWithTypes func(userID UserID, n int, auditTypes ...AuditType) []Log + Log func(UserID, AuditType, net.IP) + type AuditType uint + const AuthnFailed + const AuthnSucceeded + const UpgradedKdf + type BcryptWorkFactor struct + Cost int + func (wf *BcryptWorkFactor) Marshal() ([]int, error) + func (wf *BcryptWorkFactor) Unmarshal(p []int) error + type Config struct + AuditLogger AuditLogger + Kdf Kdf + KeyLength int + PasswordPolicies []PasswordPolicy + SaltSize int + Store CredentialStore + WorkFactor WorkFactor + func (c Config) NewCredential(userID UserID, password string) (*Credential, error) + type Credential struct + Hash []byte + Kdf Kdf + Salt []byte + UserID UserID + WorkFactor WorkFactor + func NewCredential(userID UserID, password string) (*Credential, error) + func (c *Credential) MatchesPassword(password string) (matched, updated bool) + func (c *Credential) MatchesPasswordWithConfig(config Config, password string) (matched, updated bool) + func (c *Credential) MatchesPasswordWithConfigAndIP(config Config, password string, ip net.IP) (matched, updated bool) + func (c *Credential) MatchesPasswordWithIP(password string, ip net.IP) (matched, updated bool) + func (c *Credential) MeetsConfig(config Config) bool + func (c *Credential) NeedsUpdate() bool + func (c *Credential) Reset(oldPassword, newPassword string) (updated bool, err error) + func (c *Credential) ResetWithConfig(config Config, oldPassword, newPassword string) (updated bool, err error) + func (c *Credential) ResetWithConfigAndIP(config Config, oldPassword, newPassword string, ip net.IP) (updated bool, err error) + func (c *Credential) ResetWithIP(oldPassword, newPassword string, ip net.IP) (updated bool, err error) + type CredentialStore interface + Load func(UserID) (*Credential, error) + LoadContext func(context.Context, UserID) (*Credential, error) + Store func(*Credential) error + StoreContext func(context.Context, *Credential) error + type DummyAuditLogger struct + func (al *DummyAuditLogger) LastN(userID UserID, n int) []Log + func (al *DummyAuditLogger) LastNWithTypes(userID UserID, n int, auditTypes ...AuditType) []Log + func (al *DummyAuditLogger) Log(UserID, AuditType, net.IP) + type DummyCredentialStore struct + func (d DummyCredentialStore) Load(UserID) (*Credential, error) + func (d DummyCredentialStore) LoadContext(context.Context, UserID) (*Credential, error) + func (d DummyCredentialStore) Store(*Credential) error + func (d DummyCredentialStore) StoreContext(context.Context, *Credential) error + type Kdf uint + const Bcrypt + const Pbkdf2Sha256 + const Pbkdf2Sha3_256 + const Pbkdf2Sha3_512 + const Pbkdf2Sha512 + const Scrypt + type Log struct + IP net.IP + Time time.Time + Type AuditType + UserID UserID + type MemoryAuditLogger struct + func (al *MemoryAuditLogger) LastN(userID UserID, n int) []Log + func (al *MemoryAuditLogger) LastNWithTypes(userID UserID, n int, auditTypes ...AuditType) (logs []Log) + func (al *MemoryAuditLogger) Log(userID UserID, at AuditType, ip net.IP) + type NotCommonPasswordNaive struct + CommonPasswords map[string]bool + func (pp NotCommonPasswordNaive) PasswordAcceptable(password string) error + type PasswordPoliciesNotMet struct + UnMetPasswordPolicies []PasswordPolicyError + func (e PasswordPoliciesNotMet) Error() string + type PasswordPolicy interface + PasswordAcceptable func(string) error + type PasswordPolicyError struct + Err error + PasswordPolicy PasswordPolicy + func (e PasswordPolicyError) Error() string + type Pbkdf2WorkFactor struct + Iter int + func (wf *Pbkdf2WorkFactor) Marshal() ([]int, error) + func (wf *Pbkdf2WorkFactor) Unmarshal(p []int) error + type ScryptWorkFactor struct + N int + P int + R int + func (wf *ScryptWorkFactor) Marshal() ([]int, error) + func (wf *ScryptWorkFactor) Unmarshal(p []int) error + type UserID uint64 + type WorkFactor interface + Marshal func() ([]int, error) + Unmarshal func([]int) error + func NewWorkFactorForKdf(kdf Kdf) (WorkFactor, error)