token

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatToken

func FormatToken(tunnelID, secret string) string

FormatToken combines a tunnel ID and plaintext secret into a tunnel token string.

func GenerateSecret

func GenerateSecret() (string, string, error)

GenerateSecret creates a new random secret and its bcrypt hash. Returns (plaintext, hash, error). The plaintext should be shown to the user once.

func HashSecret

func HashSecret(plaintext string) (string, error)

HashSecret creates a bcrypt hash from a plaintext secret.

func Validate

func Validate(tok string, lookupHash func(id string) string) (tunnelID string, valid bool)

Validate checks a tunnel token (format: tunnel_id:secret) against stored hashes. lookupHash should return the bcrypt hash for the given tunnel ID, or "" if not found.

Types

This section is empty.

Jump to

Keyboard shortcuts

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