Documentation
¶
Index ¶
- Variables
- type API
- func (a *API) ChangeEmail(id, newEmail string) error
- func (a *API) ConfirmEmail(token string) error
- func (a *API) ConfirmEmailChange(token string) error
- func (a *API) ConfirmRecovery(token, password string) error
- func (a *API) DelSessionVal(r *http.Request, w http.ResponseWriter, key string) error
- func (a *API) DeleteMetaDataKeys(id string, keys []string) error
- func (a *API) DeleteUser(r *http.Request) error
- func (a *API) GetSessionVal(r *http.Request, key string) (interface{}, error)
- func (a *API) HandleGothCallback(w http.ResponseWriter, r *http.Request) error
- func (a *API) HandleGothLogin(w http.ResponseWriter, r *http.Request) error
- func (a *API) HandleGothLogout(w http.ResponseWriter, r *http.Request) error
- func (a *API) IsAuthenticated(next http.Handler) http.Handler
- func (a *API) LoggedInUser(r *http.Request) (*User, error)
- func (a *API) Login(w http.ResponseWriter, r *http.Request, email, password string) error
- func (a *API) LoginWithOTP(w http.ResponseWriter, r *http.Request, otp string) error
- func (a *API) Logout(w http.ResponseWriter, r *http.Request)
- func (a *API) OTP(email string) error
- func (a *API) Recovery(email string) error
- func (a *API) ResetAPIToken(r *http.Request) (string, error)
- func (a *API) SetSessionVal(r *http.Request, w http.ResponseWriter, key string, val interface{}) error
- func (a *API) Signup(email, password string, metadata map[string]interface{}) error
- func (a *API) UpdateBillingID(r *http.Request, billingID string) error
- func (a *API) UpdateMetaData(id string, metaData map[string]interface{}) error
- type Config
- type MailType
- type SendMailFunc
- type SessionsStore
- type User
- type UserStore
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidPassword = errors.New("password is invalid") ErrWrongPassword = errors.New("password is wrong") ErrInvalidEmail = errors.New("email is invalid") ErrUserNotFound = errors.New("user not found") ErrUserNotLoggedIn = errors.New("user is not logged in") ErrEmailNotConfirmed = errors.New("email has not been confirmed") ErrLoginSessionNotFound = errors.New("a valid login session wasn't found") ErrSessionValNotFound = errors.New("session val not found") ErrInternal = errors.New("internal server error") ErrUserExists = errors.New("email is already linked to a user") ErrSendingEmail = errors.New("problem sending the email") )
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
func NewAPI ¶
func NewAPI(ctx context.Context, apiMasterSecret string, userStore UserStore, sessionStore SessionsStore, sendMail SendMailFunc) *API
func (*API) ChangeEmail ¶
func (*API) ConfirmEmail ¶
func (*API) ConfirmEmailChange ¶
func (*API) ConfirmRecovery ¶
func (*API) DelSessionVal ¶
func (*API) GetSessionVal ¶
func (*API) HandleGothCallback ¶
func (*API) HandleGothLogin ¶
func (*API) HandleGothLogout ¶
func (*API) LoginWithOTP ¶
func (*API) SetSessionVal ¶
func (*API) UpdateBillingID ¶ added in v0.1.2
type SendMailFunc ¶
type SessionsStore ¶
func NewDefaultSessionStore ¶
type UserStore ¶
type UserStore interface { // Create, Delete New(email, password, provider string, meta map[string]interface{}) (string, error) UserData(id string) (string, string, string, map[string]interface{}, error) UserIDByEmail(email string) (string, error) UserIDByConfirmationToken(token string) (string, error) UserIDByRecoveryToken(token string) (string, error) UserIDByEmailChangeToken(token string) (string, error) UserIDByOTP(token string) (string, error) UserIDByAPIKey(apiKey string) (string, error) DeleteUser(id string) error GetPassword(id string) (string, error) GetAPIKey(id string) (string, error) GetEmailChange(id string) (string, error) IsEmailConfirmed(id string) (bool, error) // Update Password UpdatePassword(id, password string) error // Update API Key UpdateAPIKey(id, apiKey string) error // Update Email UpdateEmail(id, email string) error UpdateBillingID(id, billingID string) error UpdateProvider(id, provider string) error // Confirm Email SaveConfirmationToken(id, token string) error SaveConfirmationTokenSentAt(id string, tokenSentAt time.Time) error MarkConfirmed(id string, confirmed bool) error DeleteConfirmToken(id string) error // One time password SaveOTP(id, otp string) error SaveOTPSentAt(id string, otpSentAt time.Time) error DeleteOTP(id string) error // Recover Password SaveRecoveryToken(id, token string) error SaveRecoveryTokenSentAt(id string, tokenSentAt time.Time) error DeleteRecoveryToken(id string) error // Change Email SaveEmailChangeToken(id, email, token string) error SaveEmailChangeTokenSentAt(id string, tokenSentAt time.Time) error DeleteEmailChangeToken(id string) error // Metadata UpsertMetaData(id string, metaData map[string]interface{}) error DeleteKeysMetaData(id string, keys []string) error DeleteAllMetadata(id string) error // Timestamps SetUpdatedAt(id string, time time.Time) error SetLastSignInAt(id string, time time.Time) error Close() error }
UserStore represents the data store for the User model
Click to show internal directories.
Click to hide internal directories.