SecretMana (secret_mana v0.0.2)

View Source

SecretMana is a module for managing encrypted secrets using age (https://github.com/FiloSottile/age).

This module provides functionality to:

  • Read encrypted secrets
  • Edit secrets with your preferred editor
  • Encrypt/decrypt files
  • Generate age keys
  • Install the age binary

SecretMana supports both JSON and YAML formats for secret files.

Summary

Functions

Opens the decrypted secrets in your editor for modification, then re-encrypts them when done.

Encrypts a file using the age public key.

Generates a new age key pair in the configured directory.

Downloads and installs the age binary for the current platform.

Reads and decrypts secrets from the configured secret file.

Functions

edit()

Opens the decrypted secrets in your editor for modification, then re-encrypts them when done.

Uses the EDITOR environment variable to determine which editor to use, falls back to vim if not set.

Examples

SecretMana.edit()

encrypt(file, check_file_type \\ true)

Encrypts a file using the age public key.

The file must be in the format specified by the configuration (JSON or YAML).

Parameters

  • file - Path to the file to encrypt

Examples

SecretMana.encrypt("secrets.json")

gen_key()

Generates a new age key pair in the configured directory.

Creates both a private key file and a public key file.

Examples

SecretMana.gen_key()

install()

Downloads and installs the age binary for the current platform.

Automatically detects the correct version based on the current system architecture.

Examples

SecretMana.install()

read(path \\ nil)

Reads and decrypts secrets from the configured secret file.

Parameters

  • path - Optional list of keys to traverse the secret structure, defaults to nil which returns the entire secret

Examples

# Read all secrets
SecretMana.read()

# Read a specific nested key
SecretMana.read(["database", "password"])