auth

package
v0.0.0-...-25a2d4a Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPassword

func CheckPassword(hashed, plain string) bool

func GenerateAccessToken

func GenerateAccessToken(userID int64, email string) (string, time.Time, error)

func HashPassword

func HashPassword(plain string) (string, error)

func HashRefreshToken

func HashRefreshToken(plain string) string

func NewAccessToken

func NewAccessToken(userID int64, email string, ttl time.Duration) (string, error)

func NewRefreshToken

func NewRefreshToken() (plain string, hash string, expiresAt time.Time, err error)

Types

type Claims

type Claims struct {
	UserID int64  `json:"uid"`
	Email  string `json:"email"`
	jwt.RegisteredClaims
}

func Parse

func Parse(tokenStr string) (*Claims, error)

Jump to

Keyboard shortcuts

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