models

package
v0.0.0-...-fef38e7 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const AccessTokenExpireTime = 360

Variables

This section is empty.

Functions

func GenerateAccessToken

func GenerateAccessToken(refreshToken *jwt.Token, privateKey string) (string, error)

func GenerateRefreshToken

func GenerateRefreshToken(claims jwt.MapClaims, secret string) (*jwt.Token, string, error)

func ParseAccessToken

func ParseAccessToken(tokenString string, publicKey string) (*jwt.Token, error)

func ParseRefreshToken

func ParseRefreshToken(tokenString string, secretGenerator func(string) (string, error)) (*jwt.Token, error)

Types

type RedisUserModel

type RedisUserModel struct {
	Redis  *redis.Client
	Prefix string
	Expiry time.Duration
}

UserModel is the model for user

func NewUserModel

func NewUserModel(redis *redis.Client, prefix string, expiry time.Duration) *RedisUserModel

func (*RedisUserModel) GetVersion

func (u *RedisUserModel) GetVersion(ctx context.Context, userId string) (string, error)

GetVersion returns the version of the user and updates the expiry of the version

func (*RedisUserModel) UpdateVersion

func (u *RedisUserModel) UpdateVersion(ctx context.Context, userId string) (string, error)

type UserModel

type UserModel interface {
	GetVersion(ctx context.Context, userID string) (string, error)
	UpdateVersion(ctx context.Context, userID string) (string, error)
}

Jump to

Keyboard shortcuts

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