secrets

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package secrets provides password-encrypted storage for sensitive data (e.g. Chrome cookies, API tokens). Data is encrypted at rest with AES-256-GCM using an Argon2id-derived key. The plaintext never touches disk or shell history — passwords are read via raw terminal I/O.

Storage layout: ~/.revoco/secrets.json

{
  "salt":  "<base64>",   // 16-byte Argon2id salt
  "nonce": "<base64>",   // 12-byte GCM nonce
  "data":  "<base64>"    // AES-256-GCM ciphertext (JSON payload)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultPath

func DefaultPath() (string, error)

DefaultPath returns ~/.revoco/secrets.json.

func Delete

func Delete(path, password, key string) error

Delete removes a key from the secrets file and re-encrypts.

func Encrypt

func Encrypt(path string, password string, payload Payload) error

Encrypt serialises payload as JSON, encrypts it with AES-256-GCM keyed by password, and writes the envelope to path.

func Exists

func Exists(path string) bool

Exists reports whether the secrets file exists at path.

func Get

func Get(path, password, key string) (string, error)

Get is a convenience wrapper that decrypts and returns a single key.

func PromptPassword

func PromptPassword(prompt string) (string, error)

PromptPassword reads a password from the terminal without echo. It uses raw terminal mode so the password never appears in shell history or process listings.

func Store

func Store(path, password, key, value string) error

Store is a convenience wrapper that opens or creates the secrets file, sets one key, and re-encrypts. The password is prompted interactively if not supplied.

Types

type Payload

type Payload map[string]string

Payload is the decrypted in-memory container for all secrets. Keys are arbitrary labels (e.g. "google_cookies"), values are the sensitive strings.

func Decrypt

func Decrypt(path string, password string) (Payload, error)

Decrypt reads the envelope from path, decrypts it with password, and returns the payload. Returns an error if the password is wrong or the file is corrupt.

Jump to

Keyboard shortcuts

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