jwt

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2024 License: BSD-2-Clause Imports: 14 Imported by: 0

Documentation

Overview

Package jwt implements a Hook that fails on Announce or Scrape if the client's request is missing a valid JSON Web Token.

JWTs are validated against the standard claims in RFC7519 along with an extra "infohash(es)" claim that verifies the client has access to the Swarm.

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrMissingJWT is returned when a JWT is missing from a request.
	ErrMissingJWT = bittorrent.ClientError("request not allowed by mochi: missing jwt")

	// ErrInvalidJWT is returned when a JWT fails to verify.
	ErrInvalidJWT = bittorrent.ClientError("request not allowed by mochi: invalid jwt")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Header            string
	Issuer            string
	Audience          string
	JWKSetURL         string        `cfg:"jwk_set_url"`
	JWKUpdateInterval time.Duration `cfg:"jwk_set_update_interval"`
	HandleAnnounce    bool          `cfg:"handle_announce"`
	HandleScrape      bool          `cfg:"handle_scrape"`
}

Config represents all the values required by this middleware to fetch JWKs and verify JWTs.

Jump to

Keyboard shortcuts

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