token

package
v0.0.0-...-4d352a7 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package token implements methods to manage PASETO tokens. Tokens are assigned to daemons to uniquely identify them in the cluster.

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultExpiry is the default token expiration time if nothing is
	// provided.
	DefaultExpiry = time.Now().Add(time.Minute * 5)

	ErrInvalidNB        = errors.New("expiry cannot be shorter than NB")
	ErrMissingBody      = errors.New("missing body in params")
	ErrMissingSecretKey = errors.New("missing secret key in params")
)

Functions

func Decrypt

func Decrypt(enc, secret string, implicit []byte) (*token, error)

Decrypt decrypts the encrypted token

func New

func New(p Params) (*token, error)

New returns a new paseto token from the provided parameters.

Types

type Params

type Params struct {
	Expiry    time.Time
	NotBefore time.Time
	Issuer    string
	Audience  string
	Body      map[string]any
}

Params contains parameters to construct a paseto token.

Jump to

Keyboard shortcuts

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