token

package
v0.0.0-...-54f60d9 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPassword

func CheckPassword(password string, hashedPassword string) error

func HashPassword

func HashPassword(password string) (string, error)

Types

type PasetoMaker

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

func NewPaseto

func NewPaseto() (*PasetoMaker, error)

func (*PasetoMaker) CreateToken

func (maker *PasetoMaker) CreateToken(payload *Payload) (string, error)

func (*PasetoMaker) VerifyToken

func (maker *PasetoMaker) VerifyToken(signed string) ([]byte, error)

type Payload

type Payload struct {
	ID        uuid.UUID `json:"payload_id"`
	UserId    int64     `json:"id"`
	Email     string    `json:"email"`
	Username  string    `json:"username"`
	Role      string    `json:"role"`
	CreatedAt time.Time `json:"created_at"`
	ExpiryAt  time.Time `json:"expiry_at"`
}

func NewPayload

func NewPayload(username, role, email string, userId int64, duration time.Duration) (*Payload, error)

Jump to

Keyboard shortcuts

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