ujwt

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 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, SessionId any] struct {
	Account   Account   `json:"account"`
	SessionId SessionId `json:"sessionId"`
	jwt.RegisteredClaims
}

type Jwt

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

func New

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

func (*Jwt[Account, SessionId]) New

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

func (*Jwt[Account, SessionId]) NewAccess

func (o *Jwt[Account, SessionId]) NewAccess(account Account, sessionId SessionId) (string, error)

func (*Jwt[Account, SessionId]) NewRefresh

func (o *Jwt[Account, SessionId]) NewRefresh(sessionId SessionId) (string, error)

func (*Jwt[Account, SessionId]) Options

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

func (*Jwt[Account, SessionId]) ParseAccess

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

func (*Jwt[Account, SessionId]) ParseRefresh

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

func (*Jwt[Account, SessionId]) ParseRefreshSessionId

func (o *Jwt[Account, SessionId]) ParseRefreshSessionId(token string) (SessionId, 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[SessionId any] struct {
	SessionId SessionId `json:"sessionId"`
	jwt.RegisteredClaims
}

Jump to

Keyboard shortcuts

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