secret

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2026 License: Apache-2.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

Overview

Package secret encrypts small at-rest values (VPS passwords and SSH keys) with a machine-local key, so a leaked database does not hand over the credentials it stores.

The key lives in ~/.antares/.secretkey (0600), generated on first use. This protects against a database read alone; someone with the key file and the DB can still decrypt, which is the right trade-off for a single-machine tool — the key never leaves the box and is not in the DB.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Box

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

Box encrypts and decrypts with a single AES-256-GCM key.

func Default

func Default() (*Box, error)

Default returns the process-wide Box keyed from ~/.antares/.secretkey, creating the key on first use. Subsequent calls return the same Box.

func NewBox

func NewBox(key []byte) (*Box, error)

NewBox builds a Box from a raw 32-byte key (used in tests).

func Open

func Open(keyPath string) (*Box, error)

Open loads (or creates) the key at keyPath and returns a Box.

func (*Box) Decrypt

func (b *Box) Decrypt(enc string) (string, error)

Decrypt reverses Encrypt. An empty input returns an empty string.

func (*Box) Encrypt

func (b *Box) Encrypt(plain string) (string, error)

Encrypt returns a base64 string of nonce||ciphertext. An empty input encrypts to an empty string so blank fields stay blank.

Jump to

Keyboard shortcuts

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