auth

package
v0.0.0-...-86240e4 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2023 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateJWT

func CreateJWT(payload JWTPayload, privateKey *rsa.PrivateKey) (string, error)

func GenerateHash

func GenerateHash(password []byte) ([]byte, error)

func Login

func Login(username, password string, privateKey *rsa.PrivateKey, u *model.UserModel) (string, error)

func ParsePrivateKey

func ParsePrivateKey(keypair string) (*rsa.PrivateKey, error)

Must be pem encoded

func Register

func Register(username, email, password string, u *model.UserModel, privateKey *rsa.PrivateKey, foreignUser bool,
	foreignUserID, foreignWebsite string) (string, error)

func RegisterRevolt

func RegisterRevolt(email string) error

func ValidateJWT

func ValidateJWT(jwt string, privateKey rsa.PrivateKey) (int64, error)

Types

type JWTPayload

type JWTPayload struct {
	UID int64 `json:"uid"`
}

Jump to

Keyboard shortcuts

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