jwt

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(claims core.JwtClaims, privatekey string) (string, error)

Create creates server signed JWT

func Validate

func Validate(jwt string) (*core.JwtHeader, *core.JwtClaims, error)

Validate checks is jwt signature valid and not expired

Types

type Repository

type Repository interface {
	CheckJTI(ctx context.Context, jti string) (bool, error)
	InvalidateJTI(ctx context.Context, jti string, exp time.Time) error
}

func NewRepository

func NewRepository(rdb *redis.Client) Repository

type Service

type Service interface {
	CheckJTI(ctx context.Context, jti string) (bool, error)
	InvalidateJTI(ctx context.Context, jti string, exp time.Time) error
}

Service is the interface for auth service

func NewService

func NewService(repository Repository) Service

NewService creates a new auth service

Directories

Path Synopsis
Package mock_jwt is a generated GoMock package.
Package mock_jwt is a generated GoMock package.

Jump to

Keyboard shortcuts

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