service

package
v1.21.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2023 License: Unlicense Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidKind for generation of tokens.
	ErrInvalidKind = errors.New("invalid kind")

	// ErrInvalidAlgorithm for service.
	ErrInvalidAlgorithm = errors.New("invalid algorithm")

	// ErrInvalidIssuer for service.
	ErrInvalidIssuer = errors.New("invalid issuer")

	// ErrInvalidAudience for service.
	ErrInvalidAudience = errors.New("invalid audience")

	// ErrInvalidTime for service.
	ErrInvalidTime = errors.New("invalid time")
)

Module for fx.

Functions

This section is empty.

Types

type JWT added in v1.10.3

type JWT struct {
	// contains filtered or unexported fields
}

JWT service.

func NewJWT added in v1.10.3

func NewJWT(publicKey ed25519.PublicKey, privateKey ed25519.PrivateKey) *JWT

NewJWT service.

func (*JWT) Generate added in v1.10.3

func (j *JWT) Generate(sub, aud, iss string, exp time.Duration) (string, error)

Generate JWT token.

func (*JWT) Verify added in v1.12.0

func (j *JWT) Verify(token, aud, iss string) (string, error)

Verify JWT token.

type Paseto added in v1.10.3

type Paseto struct {
	// contains filtered or unexported fields
}

Paseto service.

func NewPaseto added in v1.10.3

func NewPaseto(publicKey ed25519.PublicKey, privateKey ed25519.PrivateKey) *Paseto

NewPaseto service.

func (*Paseto) Generate added in v1.10.3

func (p *Paseto) Generate(sub, aud, iss string, exp time.Duration) (string, error)

Generate Paseto token.

func (*Paseto) Verify added in v1.12.0

func (p *Paseto) Verify(token, aud, iss string) (string, error)

Verify Paseto token.

type Service added in v1.9.0

type Service struct {
	// contains filtered or unexported fields
}

Service of tokens.

func NewService added in v1.12.0

func NewService(jwt *JWT, paseto *Paseto) *Service

NewService of tokens.

func (*Service) Generate added in v1.12.0

func (s *Service) Generate(kind, sub, aud, iss string, exp time.Duration) (string, error)

Generate token based on kind.

func (*Service) Verify added in v1.12.0

func (s *Service) Verify(token, kind, aud, iss string) (string, error)

Verify token based on kind.

Jump to

Keyboard shortcuts

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