Skip to main content

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 πŸ”’
Legacy encrypted file extension
JSON_EXT
LOCAL_CONFIG
Server locally configurable file
PLAINTEXT_PASSWORD
Legacy plain-text stored password
PRIVATE_CONFIG
Server private keys file
SALT_FILE πŸ”’
Legacy salt file for combining with the private key

FunctionsΒ§

encrypted_json_read πŸ”’
Reads an encrypted json file into a struct
parse_legacy_encrypted_backup πŸ”’
Parses the legacy encrypted guardian backup format from raw file contents, decrypting the private config with the provided password. The salt and private bytes come from the backup’s private.salt and private.encrypt entries.
parse_plaintext_backup πŸ”’
Parses the current plaintext guardian backup format from raw file contents.
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 config from plaintext JSON files. Falls back to reading the legacy encrypted format using the password.private file if the plaintext private config does not exist.
read_server_config_legacy_encrypted πŸ”’
Reads the server config with the legacy encrypted private config format, using the password from the password.private file.
read_server_config_plaintext πŸ”’
Reads the server config from plaintext JSON files
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 as plaintext JSON.