token

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2026 License: GPL-3.0, LGPL-3.0 Imports: 5 Imported by: 0

README

Thanatos tokens

The Thanatos tokens are used to verify if a user was already succesfully challenged.

How it works

A thanatos token consists of the current time, a salt (random per token) and a key, given by the server. SHA2-256 is then used to compute a hash and return the hash. The hash + time and salt are then considered the token.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateKey32 added in v0.2.0

func GenerateKey32() (key [32]byte)

func GenerateSalt4 added in v0.2.0

func GenerateSalt4() (salt [4]byte)

func New51

func New51(key [32]byte, salt [4]byte, t time.Time) ([51]byte, error)

func NewAsString51 added in v0.3.0

func NewAsString51(key [32]byte, salt [4]byte, t time.Time) (string, error)

func Verify51

func Verify51(token [51]byte, key [32]byte, validFor time.Duration) (ok bool, err error)

func VerifyFromString51 added in v0.3.0

func VerifyFromString51(tokenAsString string, key [32]byte, validFor time.Duration) (ok bool, err error)

Types

This section is empty.