tokenrevocation

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package tokenrevocation rejects specific API tokens before their expiry.

Tokens are identified by the hex SHA-256 of the raw token string, so revoking a token does not require it to carry a jti claim and the configuration never holds a usable credential.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(token string) string

Hash returns the hex-encoded SHA-256 of a token string. For an issued token this equals the SHA-256 of the raw string.

The signature segment is canonicalized first. The JWT parser verifies the decoded signature bytes, not the segment text, and its non-strict base64 decoding accepts other spellings of the same signature (unused trailing bits, embedded CR/LF). Without canonicalization those spellings would verify but hash differently, bypassing revocation.

Types

type List

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

List is a set of revoked token hashes. A nil List revokes nothing.

func New

func New(hashes []string) (*List, error)

New builds a List from hex-encoded SHA-256 token hashes.

func (*List) IsRevoked

func (l *List) IsRevoked(token string) bool

IsRevoked reports whether the raw token string has been revoked.

func (*List) Len

func (l *List) Len() int

Len returns the number of revoked token hashes.

Jump to

Keyboard shortcuts

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