jwtxt

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultTimeout is the default timeout for DNS queries.
	DefaultTimeout = time.Second * 15
)

Variables

View Source
var (
	ErrInvalidConfig = errors.New("invalid configuration")
	ErrInvalidJWT    = errors.New("invalid jwt txt record")
	ErrInvalidPath   = errors.New("invalid path")
	ErrUnspportedID  = errors.New("unsupported device id")
	ErrUnspportedAlg = errors.New("unsupported jwt algorithm")
	ErrNoKeys        = errors.New("no keys provided")
	ErrNoKeysMatch   = errors.New("no keys match jwt")
	ErrInvalidInput  = errors.New("invalid input")
)

Functions

This section is empty.

Types

type Instructions

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

func New

func New(opts ...Option) (*Instructions, error)

New creates a new secure Instruction object.

func (*Instructions) Endpoint

func (ins *Instructions) Endpoint(ctx context.Context) (string, error)

Endpoint returns the valid endpoint based on the instructions, or an error if there is no valid set of instructions.

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option is a functional option for the Instructions constructor.

func Algorithms

func Algorithms(algs ...string) Option

Algorithms sets the algorithms to use for verification. Valid algorithms are "EdDSA", "ES256", "ES384", "ES512", "PS256", "PS384", "PS512", "RS256", "RS384", and "RS512".

func BaseURL

func BaseURL(url string) Option

BaseURL sets the base URL to use for the endpoint.

func DeviceID

func DeviceID(id string) Option

DeviceID sets the ID to use for the endpoint.

func Timeout

func Timeout(timeout time.Duration) Option

Timeout sets the timeout for DNS queries. 0 means use the default timeout. A negative timeout is invalid.

func UseNowFunc

func UseNowFunc(nowFunc func() time.Time) Option

UseNowFunc sets the function to use for getting the current time.

func UseResolver

func UseResolver(resolver Resolver) Option

UseResolver sets the resolver to use for DNS queries.

func WithFetchListener

func WithFetchListener(listener event.FetchListener) Option

WithFetchListener adds a listener for fetch events.

func WithPEMs

func WithPEMs(pems ...[]byte) Option

WithPEMs adds PEM-encoded keys to the list of keys to use for verification.

type Resolver

type Resolver interface {
	LookupTXT(context.Context, string) ([]string, error)
}

The Resolver interface allows users to provide their own resolver for resolving DNS TXT records.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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