Documentation
¶
Index ¶
- func AddEntry(context echo.Context) error
- func AddLabel(context echo.Context) error
- func AuthMiddleware() echo.MiddlewareFunc
- func BuildJwtToken(user database.User, sessionDuration time.Duration, secret []byte) string
- func BuildRateLimiterConf() *limiter.Limiter
- func DeclareRoutes(app *echo.Echo)
- func DeleteAbstract(context echo.Context, m database.Model) error
- func DeleteEntry(context echo.Context) error
- func DeleteLabel(context echo.Context) error
- func EditEntry(context echo.Context) error
- func EditLabel(context echo.Context) error
- func GetEntries(c echo.Context) error
- func GetEntry(context echo.Context) error
- func GetLabels(context echo.Context) error
- func GetMe(c echo.Context) error
- func InternalError(context echo.Context, err error) error
- func Login(context echo.Context) error
- func PopulateLabelsUrls(labels []database.Label) []database.Label
- func RateLimiterMiddleware(limiter *limiter.Limiter) echo.MiddlewareFunc
- func RecoverMiddleware() echo.MiddlewareFunc
- func Register(context echo.Context) error
- func RequestGoogleAuthenticatorQRCode(context echo.Context) error
- func RequestTwoFactorsToken(context echo.Context) error
- func RequireBody(next echo.HandlerFunc) echo.HandlerFunc
- func RunHttpServer()
- func SendApiSpec(c echo.Context) error
- func TokenToRemainingDuration() time.Duration
- func ValidateJWTToken(token string, secret []byte) (jwt.MapClaims, error)
- func ValidateOTPCode(context echo.Context) error
- type AddEntryRequestBody
- type LoginBody
- type OTPCodeBody
- type TokenClaims
- type Url
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthMiddleware ¶
func AuthMiddleware() echo.MiddlewareFunc
func BuildJwtToken ¶
Add a user to claims without otp secret and password. Expects a duration in nanoseconds Could implement a key rotation system
func BuildRateLimiterConf ¶
func DeclareRoutes ¶
func DeleteAbstract ¶
Abstract implementation for an http call DELETE /resource/:id Expect the resource to be associated to the user with the foreign key user_id
func DeleteEntry ¶
func DeleteLabel ¶
func GetEntries ¶
func GetEntry ¶
Returns a specific entry and the next / prev ones.
We may want that the prev and next fit search criteria, in which case they should be sent here with the same format as in GetEntries
func InternalError ¶
Return HTTP 500 and log error to sentry
func Login ¶
2FA could check: Cookie, IP, device / fingerprint, link to element which validates the cookie
func RateLimiterMiddleware ¶
func RateLimiterMiddleware(limiter *limiter.Limiter) echo.MiddlewareFunc
Middleware to limit the number of request an IP can make during a time window
func RecoverMiddleware ¶
func RecoverMiddleware() echo.MiddlewareFunc
func RequestTwoFactorsToken ¶
func RequireBody ¶
func RequireBody(next echo.HandlerFunc) echo.HandlerFunc
func RunHttpServer ¶
func RunHttpServer()
func SendApiSpec ¶
func ValidateOTPCode ¶
Types ¶
type AddEntryRequestBody ¶
type AddEntryRequestBody struct {
database.PartialEntry
LabelsID []uint `json:"labels_id"`
}
type LoginBody ¶
type LoginBody struct {
Email string `json:"email"`
Password string `json:"password" validate:"min=9"`
SessionDurationMs time.Duration `json:"session_duration_ms"`
TwoFactorsCookie string `json:"two_factors_cookie"`
}
We use login body instead of user because user json blocks password
type OTPCodeBody ¶
type TokenClaims ¶
type TokenClaims struct {
User database.User `json:"user"`
jwt.StandardClaims
}
func (TokenClaims) Valid ¶
func (c TokenClaims) Valid() error
type Url ¶
type Url struct {
ovh.ObjectTempPublicUrl
// contains filtered or unexported fields
}