secret

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	KeyPrefix = "mtk_"
)

Variables

This section is empty.

Functions

func BurnPasswordCheck

func BurnPasswordCheck(pw string)

func CheckPassword

func CheckPassword(hash, pw string) bool

func Hash

func Hash(s string) []byte

func HashPassword

func HashPassword(pw string) (string, error)

func NewAPIKey

func NewAPIKey() (key, prefix string, hash []byte)

NewAPIKey returns a full key, the short prefix safe to display, and its hash for storage.

func Token

func Token() string

Token returns a random URL-safe string with 256 bits of entropy.

func ValidatePassword

func ValidatePassword(pw string) error

Types

type Sealer

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

Sealer encrypts values at rest with AES-256-GCM using a key file kept next to the database.

func LoadOrCreateSealer

func LoadOrCreateSealer(path string) (*Sealer, error)

LoadOrCreateSealer reads the key file at path, creating it (mode 0600) on first use.

func (*Sealer) Open

func (s *Sealer) Open(sealed []byte) (string, error)

func (*Sealer) Seal

func (s *Sealer) Seal(plain string) []byte

Jump to

Keyboard shortcuts

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