Skip to main content

Module secrets

Module secrets 

Source
Expand description

This file includes everything for server configuration setup and hashing.

It includes functions for encrypting and decrypting the server configuration using AES-256-GCM, as well as functions for saving and loading the encrypted configuration from a file. It also provides a setup process that prompts the user for necessary configurations and generates secure defaults.

Constantsยง

SECRETS_BACKUP_PATH
SECRETS_CHECKSUM_PATH
SECRETS_PATH

Functionsยง

decrypt ๐Ÿ”’
Decrypts the given encrypted data using AES-256-GCM with a key derived from the provided passphrase.
derive_key ๐Ÿ”’
Derives a key from the given passphrase and salt using Argon2id.
encrypt ๐Ÿ”’
Encrypts the given data using AES-256-GCM with a key derived from the provided passphrase.
generate_random_bytes ๐Ÿ”’
load_encrypted_config
Loads and decrypts the configuration from the encrypted file using the provided passphrase.
map_dialoguer_error ๐Ÿ”’
Helper function that maps a dialoguer::Error to a String for easier error handling.
prompt_passphrase
Prompts the user for a passphrase to encrypt/decrypt the server configuration.
prompt_passphrase_new
run_setup
Runs setup process
save_encrypted_config
Saves the given configuration to an encrypted file using the provided passphrase.
secrets_exist
Checks if the encrypted secrets file exists.
validate_passphrase
verify_admin_credentials