Help us shape the future of Go! Take the 2026 Go Developer Survey

token

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package token generates, parses and hashes admin and client bearer tokens, and compares client token digests in constant time.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(s string) string

func Match added in v0.3.0

func Match(stored, presented Digest) bool

func NewAdmin

func NewAdmin() string

func NewClient added in v0.3.0

func NewClient() (id, full string)

func ParseClient added in v0.3.0

func ParseClient(s string) (id string, ok bool)

func StoredDigest added in v0.3.0

func StoredDigest(s string) []byte

func WellFormedClientID added in v0.3.0

func WellFormedClientID(id string) bool

Types

type Digest added in v0.3.0

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

func DigestOf added in v0.3.0

func DigestOf(s string) Digest

func ParseDigest added in v0.3.0

func ParseDigest(b []byte) (Digest, bool)

func RandomDigest added in v0.3.0

func RandomDigest() Digest

Jump to

Keyboard shortcuts

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