core

package
v0.0.0-...-4b76107 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAuth

func CreateAuth(user []byte, td *TokenDetails) error

func VerifyPassword

func VerifyPassword(password string, passwordHash string, salt string) error

Types

type AccessDetails

type AccessDetails struct {
	AccessUuid string
	User       User
}

type TokenDetails

type TokenDetails struct {
	AccessToken  string
	RefreshToken string
	AccessUuid   string
	RefreshUuid  string
	AtExpires    int64
	RtExpires    int64
}

func CreateToken

func CreateToken(userId string) (*TokenDetails, error)

type User

type User struct {
	ID        primitive.ObjectID `bson:"_id" json:"id"`
	Name      string             `bson:"name" json:"name" validate:"required"`
	Email     string             `bson:"email" json:"email" validate:"email,required"`
	Password  string             `bson:"password" json:"password" validate:"required,min=6"`
	Salt      string             `bson:"salt" json:"salt"`
	Roles     []string           `bson:"roles" json:"roles"`
	Active    bool               `bson:"active" json:"active"`
	CreatedAt time.Time          `bson:"created_at"`
	UpdatedAt time.Time          `bson:"updated_at"`
}

Jump to

Keyboard shortcuts

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