token

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package token contains opaque secret and token handling contracts for autent.

Most embedders can use OpaqueSecretManager directly, while custom runtimes can implement the same interfaces with their own secret strategy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OpaqueSecretManager

type OpaqueSecretManager struct{}

OpaqueSecretManager issues random opaque session secrets and verifies them by hash.

func (OpaqueSecretManager) HashSecret

func (OpaqueSecretManager) HashSecret(secret string) []byte

HashSecret hashes one plain secret for storage.

func (OpaqueSecretManager) Issue

func (manager OpaqueSecretManager) Issue() (string, []byte, error)

Issue issues one random opaque secret and its stored hash.

func (OpaqueSecretManager) NewSecret

func (OpaqueSecretManager) NewSecret() (string, []byte, error)

NewSecret issues one random opaque secret and its stored hash.

func (OpaqueSecretManager) Verify

func (manager OpaqueSecretManager) Verify(secret string, secretHash []byte) bool

Verify compares one plain secret to one stored hash in constant time.

func (OpaqueSecretManager) VerifySecret

func (OpaqueSecretManager) VerifySecret(secret string, secretHash []byte) bool

VerifySecret compares one plain secret to one stored hash in constant time.

type SecretManager

type SecretManager interface {
	NewSecret() (plain string, secretHash []byte, err error)
	HashSecret(secret string) []byte
	VerifySecret(secret string, secretHash []byte) bool
}

SecretManager issues and verifies opaque session secrets.

Jump to

Keyboard shortcuts

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