token

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2025 License: AGPL-3.0-or-later Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTokenNotFound = errors.New("token not found")

ErrTokenNotFound is returned when the token file does not exist.

Functions

func Compare

func Compare(rawToken RawToken, hashedToken string) (bool, error)

Compare checks if the provided raw token matches the stored token.

func Read

func Read(dataDir string) (string, error)

Read reads the stored token from the specified path and returns it.

Types

type RawToken

type RawToken string

RawToken is a type that represents a raw token in hexadecimal format.

It must not be persisted by the server.

func Generate

func Generate() (RawToken, string, error)

Generate creates a new random token and returns its raw hexadecimal representation and a hashed version suitable for storage.

func Write

func Write(dataDir string) (RawToken, string, error)

Write generates a new token, writes it to the specified path, and returns the raw and stored representations.

Jump to

Keyboard shortcuts

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