user

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareHashAndPassword

func CompareHashAndPassword(hashedPwd, pwd []byte) error

func GenerateHashedSaltPassword

func GenerateHashedSaltPassword(pwd []byte) ([]byte, error)

Types

type Claims

type Claims struct {
	Username string `json:"username"`
	jwt.RegisteredClaims
}

Create a struct that will be encoded to a JWT. We add jwt.RegisteredClaims as an embedded type, to provide fields like expiry time

type JWTIssuer

type JWTIssuer struct {
	ExpirationTime time.Duration
	Key            string
}

func (*JWTIssuer) Issue

func (j *JWTIssuer) Issue(username string) (string, error)

func (*JWTIssuer) Validate

func (j *JWTIssuer) Validate(token string) (string, error)

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(querier query.Querier,
	secret string, expirationTimeDefault time.Duration) *Service

func (*Service) GetPubKey

func (u *Service) GetPubKey(loginName string) ([]byte, error)

func (*Service) Login

func (u *Service) Login(loginName string, pwd []byte) (bool, string, error)

func (*Service) Register

func (u *Service) Register(loginName string,
	pwd, PublicKey []byte) (string, error)

func (*Service) ValidateJWT

func (u *Service) ValidateJWT(token string) (string, error)

Jump to

Keyboard shortcuts

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