auth

package
v0.0.0-...-673c5a3 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyTime    = 1
	KeyMemory  = 64 * 1024
	KeyThreads = 4
	KeyLen     = 32
	SaltLen    = 32
)

Variables

This section is empty.

Functions

func Encode

func Encode(password []byte) (key, salt []byte, err error)

func Handle

func Handle(next http.Handler) http.Handler

func Key

func Key(password, salt []byte) []byte

func Salt

func Salt() ([]byte, error)

func Token

func Token(userId int, expiresIn time.Duration) (string, int, error)

Types

type UserAuth

type UserAuth struct {
	UserID int
}

func ForContext

func ForContext(ctx context.Context) *UserAuth

type UserClaims

type UserClaims struct {
	UserID int `json:"userId"`
	jwt.StandardClaims
}

Jump to

Keyboard shortcuts

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