bf

package
v0.0.0-...-cbbd1a2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMsgDuplicateArticleSlug       = "duplicate article slug \"%v\""
	ErrMsgDuplicateArticleUuid       = "duplicate article uuid %v"
	ErrMsgArticleSlugNotFound        = "article slug \"%v\" not found"
	ErrMsgArticleNotFound            = "article not found for Id %v"
	ErrMsgArticleCreateMissingFields = "article has missing fields for Create operation"
	ErrMsgArticleAlreadyFavorited    = "article with ID \"%v\" has already been favoriated"
	ErrMsgArticleWasNotFavorited     = "article with ID \"%v\" was not favorited"
	ErrMsgCommentNotFound            = "comment not found because comment ID not valid or user did not author the article"
	ErrMsgProfileNotFound            = "profile not found"
	ErrMsgTagNameAlreadyExists       = "tag name %v already exists"
	ErrMsgTagOnArticleAlreadyExists  = "tag with name %v already exists on article with slug %v"
	ErrMsgUserEmailNotFound          = "user not found for email %v"
	ErrMsgUsernameOrEmailDuplicate   = "user with name \"%v\" or email \"%v\" already exists"
	ErrMsgUsernameDuplicate          = "user with name \"%v\" already exists"
	ErrMsgUsernameNotFound           = "user not found for username \"%v\""
	ErrMsgUserAlreadyFollowed        = "user with username \"%v\" was already followed"
	ErrMsgUserWasNotFollowed         = "user with username \"%v\" was not followed"
	ErrMsgUnauthorizedUser           = "user \"%v\" not authorized to take this action"
	ErrMsgAuthenticationFailed       = "user authentication failed with name \"%v\" and password \"%v\""
	ErrMsgNotAuthenticated           = "user not authenticated"
	ErrMsgDuplicateUserEmail         = "user with email %v already exists"
)
View Source
var (
	ErrAuthenticationFailed = errx.NewKind("ErrAuthenticationFailed")
	ErrUnauthorizedUser     = errx.NewKind("ErrUnauthorizedUser")
	ErrValidationFailed     = errx.NewKind("ErrValidationFailed")
)

Functions

This section is empty.

Types

type ArticleCheckOwnerBfT

type ArticleCheckOwnerBfT = func(article model.ArticlePlus, username string) error
var ArticleCheckOwnerBf ArticleCheckOwnerBfT = func(article model.ArticlePlus, username string) error {
	if article.Author.Username != username {
		return ErrUnauthorizedUser.Make(nil, ErrMsgUnauthorizedUser, username)
	}
	return nil
}

type UserAuthenticateBfT

type UserAuthenticateBfT = func(user model.User, password string) bool
var UserAuthenticateBf UserAuthenticateBfT = func(
	user model.User,
	password string,
) bool {
	return crypto.ArgonPasswordCheck(password, user.PasswordHash)
}

type UserGenTokenBfT

type UserGenTokenBfT = func(user model.User) (string, error)

func UserGenTokenEcdsaBfC

func UserGenTokenEcdsaBfC(
	cfgSrc UserGenTokenEcdsaBfCfgSrc,
) UserGenTokenBfT

func UserGenTokenHmacBfC

func UserGenTokenHmacBfC(
	cfgSrc UserGenTokenHmacBfCfgSrc,
) UserGenTokenBfT

type UserGenTokenEcdsaBfCfgSrc

type UserGenTokenEcdsaBfCfgSrc = func() (
	privateKey ecdsa.PrivateKey,
	tokenTimeToLive time.Duration,
)

type UserGenTokenHmacBfCfgInfo

type UserGenTokenHmacBfCfgInfo struct {
	Key             []byte
	TokenTimeToLive time.Duration
}

type UserGenTokenHmacBfCfgSrc

type UserGenTokenHmacBfCfgSrc = func() UserGenTokenHmacBfCfgInfo

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL