ujwt

package
v0.6.40 Latest Latest
Warning

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

Go to latest
Published: May 25, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessClaims

type AccessClaims[Account any, Session any] struct {
	Account Account `json:"account,omitempty"`
	Session Session `json:"session,omitempty"`
	jwt.RegisteredClaims
}

type Jwt

type Jwt[Account any, Session any] struct {
	// contains filtered or unexported fields
}

func New

func New[Account any, Session any](opts Options) *Jwt[Account, Session]

func (*Jwt[Account, Session]) New

func (o *Jwt[Account, Session]) New(account Account, session Session) (token string, refreshToken string, err error)

func (*Jwt[Account, Session]) NewAccess

func (o *Jwt[Account, Session]) NewAccess(account Account, session Session) (string, error)

func (*Jwt[Account, Session]) NewRefresh

func (o *Jwt[Account, Session]) NewRefresh(session Session) (string, error)

func (*Jwt[Account, Session]) Options

func (o *Jwt[Account, Session]) Options() Options

func (*Jwt[Account, Session]) ParseAccess

func (o *Jwt[Account, Session]) ParseAccess(token string) (claims AccessClaims[Account, Session], err error)

func (*Jwt[Account, Session]) ParseRefresh

func (o *Jwt[Account, Session]) ParseRefresh(token string) (claims RefreshClaims[Session], err error)

func (*Jwt[Account, Session]) ParseRefreshSession added in v0.5.3

func (o *Jwt[Account, Session]) ParseRefreshSession(token string) (Session, error)

type Options

type Options struct {
	Key                   string
	ExpirationTime        time.Duration
	RefreshExpirationTime time.Duration
}

func (Options) KeyBytes

func (o Options) KeyBytes() []byte

type RefreshClaims

type RefreshClaims[Session any] struct {
	Session Session `json:"session,omitempty"`
	jwt.RegisteredClaims
}

Jump to

Keyboard shortcuts

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