[][src]Module safe_app::utils

Utility functions.

Modules

logging

Logging utilities. These functions can initialise logging for output to stdout only, or to a file and stdout. For more fine-grained control, create a file called log.toml in the root directory of the project, or in the same directory where the executable is. See log4rs docs for details about the format and structure of this file.

test_utils

Common utility functions for writing test cases.

Constants

SYM_ENC_KEY_LEN

Length of the symmetric encryption key.

SYM_ENC_NONCE_LEN

Length of the nonce used for symmetric encryption.

Traits

FutureExt

Additional future combinators.

Functions

bin_data_format

Convert binary data to a diplay-able format

derive_secrets

Derive Password, Keyword and PIN (in order).

generate_nonce

Generates a nonce for symmetric encryption

generate_random_string

Generates a String from length random UTF-8 chars. Note that the NULL character will be excluded to allow conversion to a CString if required, and that the actual len() of the returned String will likely be around 4 * length as most of the randomly-generated chars will consume 4 elements of the String.

generate_random_string_rng

Generates a random String using provided length and rng.

generate_random_vector

Generate a random vector of given length.

generate_random_vector_rng

Generates a random vector using provided length and rng.

generate_readable_string

Generates a readable String using only ASCII characters.

generate_readable_string_rng

Generates a readable String using provided length and `rng.

generate_sym_enc_key

Generates a symmetric encryption key

symmetric_decrypt

Symmetric decryption.

symmetric_encrypt

Symmetric encryption. If nonce is None, then it will be generated randomly.

Type Definitions

SymEncKey

Symmetric encryption key

SymEncNonce

Symmetric encryption nonce