service

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2022 License: Unlicense Imports: 9 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")

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

Module for fx.

Functions

This section is empty.

Types

type Branca added in v1.10.3

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

Branca service to generate tokens.

func NewBranca added in v1.10.3

func NewBranca(branca *branca.Branca) *Branca

NewBranca service to generate tokens.

func (*Branca) Generate added in v1.10.3

func (b *Branca) Generate(sub, aud, iss string, exp time.Duration) (string, error)

Generate Branca token.

func (*Branca) Verify added in v1.12.0

func (b *Branca) Verify(token, iss string) (string, string, error)

Verify Branca token.

type BrancaToken added in v1.11.0

type BrancaToken struct {
	Subject  string `json:"sub"`
	Audience string `json:"aud"`
	Issuer   string `json:"iss"`
}

BrancaToken for service.

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, iss string) (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, iss string) (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(branca *Branca, 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(kind, token, iss string) (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