Module io

Module io 

Source

ConstantsΒ§

CLIENT_CONFIG
Client configuration file
CLIENT_INVITE_CODE_FILE
Client connection string file
CONSENSUS_CONFIG
Server consensus-only configurable file
DB_FILE
Database file name
ENCRYPTED_EXT
JSON_EXT
LOCAL_CONFIG
Server locally configurable file
NEW_VERSION_FILE_EXT
PLAINTEXT_PASSWORD
Plain-text stored password, used to restart the server without having to send a password in via the API
PRIVATE_CONFIG
Server encrypted private keys file
SALT_FILE
Salt backup for combining with the private key

FunctionsΒ§

backup_copy_path
create_backup_copy
encrypted_json_read πŸ”’
Reads an encrypted json file into a struct
encrypted_json_write
Writes struct into an encrypted json file
finalize_password_change
Clean up private config and password file backups after the config has been read successfully for the first time after a password change.
plaintext_display_write πŸ”’
plaintext_json_read πŸ”’
Reads a plaintext json file into a struct
plaintext_json_write πŸ”’
Writes struct into a plaintext json file
read_server_config
Reads the server from the local, private, and consensus cfg files
recover_interrupted_password_change
If reencrypt_private_config was interrupted, this function ensures that the system is in a consistent state, either pre-password change or post-password change.
reencrypt_private_config
Re-encrypts the private config with a new password.
trim_password
We definitely don’t want leading/trailing newlines in passwords, and a user editing the file manually will probably get a free newline added by the text editor.
write_server_config
Writes the server into configuration files (private keys encrypted)