Documentation
¶
Index ¶
- type EmailConfig
- type Store
- func (s *Store) ChangeAccountEmail(id int, newEmail string) error
- func (s *Store) ChangeAccountPassword(id int, newPassword string) error
- func (s *Store) ChangeLastLogin(id int) error
- func (s *Store) DeleteAccount(id int) error
- func (s *Store) DeleteEmailVerificationCodes(id int) error
- func (s *Store) GenerateBackupCodes(id int, lenght, number int) ([]string, error)
- func (s *Store) GenerateEmailVerificationCode() (string, error)
- func (s *Store) GenerateTOTP(issuer, email, algorithm string) (secret string, qr image.Image, err error)
- func (s *Store) GetAccountByEmail(email string) (*types.Account, error)
- func (s *Store) GetAccountByID(id int) (*types.Account, error)
- func (s *Store) InitJWT(secret string) *jwtauth.JWTAuth
- func (s *Store) InitSMTP(address string, port int, username, password, from string) *EmailConfig
- func (s *Store) InvalidateAllSessions(accountID int) error
- func (s *Store) InvalidateSession(token string) error
- func (s *Store) IsEmailVerificationCodeValid(id int, code string) (bool, error)
- func (s *Store) IsTOTPBackupCodeValid(id int, code string) (bool, error)
- func (s *Store) IsTokenValid(token string) (exists bool, err error)
- func (s *Store) LockAccount(id int, lockTime time.Time) error
- func (s *Store) NewAccount(email, hashedPassword string) error
- func (s *Store) NewBackupCodes(id int, codes []string) error
- func (s *Store) NewEmailVerificationCode(id int, code string) error
- func (s *Store) NewJWT(claims map[string]interface{}) (string, error)
- func (s *Store) NewTOTP(id int, secret string) error
- func (s *Store) Ping() error
- func (s *Store) ResetLoginAttempts(id int) error
- func (s *Store) SendEmail(to, subject, message string) error
- func (s *Store) StartSessionCleanup(interval time.Duration)
- func (s *Store) ToggleAccount2FA(id int, value bool) error
- func (s *Store) TrackLoginAttempts(id, attempts int) error
- func (s *Store) ValidateTOTP(id int, code, algorithm string, skew uint) (bool, error)
- func (s *Store) VerifyAccount(id int) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EmailConfig ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) ChangeAccountEmail ¶
Updates an account email address
func (*Store) ChangeAccountPassword ¶
Changes an account password
func (*Store) ChangeLastLogin ¶
Changes an account last login
func (*Store) DeleteEmailVerificationCodes ¶
Deletes an email verification code
func (*Store) GenerateBackupCodes ¶
Generates a new set of backup codes
func (*Store) GenerateEmailVerificationCode ¶
Generates a email verification code
func (*Store) GenerateTOTP ¶
func (s *Store) GenerateTOTP(issuer, email, algorithm string) (secret string, qr image.Image, err error)
Genereates a new TOTP secret key and QR code
func (*Store) GetAccountByEmail ¶
Queries the database for an account with a given email
func (*Store) GetAccountByID ¶
Queries the database for an account with a given id
func (*Store) InitSMTP ¶
func (s *Store) InitSMTP(address string, port int, username, password, from string) *EmailConfig
func (*Store) InvalidateAllSessions ¶
Invalidats all JWTs for an account
func (*Store) InvalidateSession ¶
Invalidates JWTs
func (*Store) IsEmailVerificationCodeValid ¶
Compares payload and database email verification codes
func (*Store) IsTOTPBackupCodeValid ¶
Validates a TOTP backup code and consumes it
func (*Store) IsTokenValid ¶
Verifies the JWT is active
func (*Store) LockAccount ¶
Lockes an account
func (*Store) NewAccount ¶
Inserts a new account in the database
func (*Store) NewBackupCodes ¶
Insert TOTP backup codes in the database
func (*Store) NewEmailVerificationCode ¶
Inserts a new email verification code
func (*Store) ResetLoginAttempts ¶
Resets an account login attempts
func (*Store) StartSessionCleanup ¶
Cleans up expired JWTs
func (*Store) ToggleAccount2FA ¶
Changes an account 2FA status
func (*Store) TrackLoginAttempts ¶
Changes an account login attempts
func (*Store) ValidateTOTP ¶
Validates a TOTP code using the database stored secret
func (*Store) VerifyAccount ¶
Changes an account verification status