secret

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: Apache-2.0 Imports: 11 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

func SocialAvailable added in v0.4.0

func SocialAvailable() bool

SocialAvailable reports whether a SocialKey can be loaded right now without generating. It does not fail the process.

func SocialGenerateKey added in v0.4.0

func SocialGenerateKey() ([]byte, error)

SocialGenerateKey creates a new 32-byte master key, writes it to the managed env file with 0600 permissions, and returns the raw key for one-time display. If the file already exists and contains a valid key, it is returned without regeneration.

func SocialKeyPath added in v0.4.0

func SocialKeyPath() string

SocialKeyPath returns the managed env file path.

func SocialReset added in v0.4.0

func SocialReset()

SocialReset clears the cached key so the next call re-reads from disk/env. Used after onboarding generates a new key.

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.

type SocialKey added in v0.4.0

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

SocialKey is the master encryption key for Social Media credentials. It is loaded from a managed env file (~/.antares/secrets.env) or the ANTARES_MASTER_KEY environment variable. The key never lives in the database, config YAML, API responses, logs, prompts, RAG, or browser profiles.

func SocialDefault added in v0.4.0

func SocialDefault() (*SocialKey, error)

SocialDefault loads the social master key from the managed env file or the ANTARES_MASTER_KEY environment variable. It does NOT generate one automatically — Social Media encryption is opt-in, not silent.

func (*SocialKey) Box added in v0.4.0

func (k *SocialKey) Box() (*Box, error)

Box returns a Box backed by the social master key.

Jump to

Keyboard shortcuts

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