Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidatePassword ¶
func ValidatePassword() fiber.Handler
Types ¶
type LoginInput ¶
type LoginInput struct { Email string `json:"email,omitempty"` MemberName string `json:"membername,omitempty"` Password string `json:"password"` }
LoginInput is the input for the login request
type RegLoginInput ¶
type RegLoginInput interface { RegisterInput | LoginInput }
RegLoginInput is an union (feature introduced in Go 1.18) of RegisterInput and LoginInput
type RegisterInput ¶
type RegisterInput struct { Email string `json:"email"` MemberName string `json:"membername"` // Password is first temporarily encrypted using RSA and then hashed using argon2id // For more details see the internal/crypt package Password string `json:"password"` PasswordConfirm string `json:"passwordConfirm"` Roles []string `json:"roles"` }
RegisterInput is the input for the registration request
type Service ¶ added in v0.6.2
type Service struct {
// contains filtered or unexported fields
}
Service allows dependency injection for the controller methods, so that the db connection needn't be created in the controller methods
func NewService ¶ added in v0.6.2
func NewService( conf *cfg.Config, ms member.MemberStorer, log *zerolog.Logger, secStorage *sql.DB, ) *Service
NewService creates an instance of the Service struct and returns a pointer to it It should be used within the routes package where the db connection and config are passed from the main package
func (*Service) GetPrivateKey ¶
func (a *Service) GetPrivateKey(identifier uuid.UUID) (key *age.X25519Identity, err error)
Verify verifies the received data against the private key Obviously this must not be exposed by an API. It's for internal use.
func (*Service) GetPubKey ¶
GetPubKey returns a public key and uuid for the client to encrypt their password In the context of X25519 it returns the recipient's public key @Summary Get public key @Description Get public key for client to encrypt their password @Tags Auth @Produce json @Success 200 {object} PublicKeyResponse @Router /auth/pubkey [get] @Security ApiKeyAuth @Security OAuth2Application[write]
func (*Service) GetSessionTimeoutPrefs ¶ added in v0.7.0
GetSessionTimeoutPrefs returns the session timeout preferences This setting is not synced across devices. The way it works is: 1. Send a request to the database, where a JOIN is performed on the current device's identifier and the member's ID 2. If the device is found, return the timeout preference