Module libpasta::config [] [src]

Configuration module

Included here are methods to setup and configure libpasta. Currently, this refers to the choice of default hashing algorithm.

Configuration can be specified in two ways: through configuration files, or programmatically.

Configuration files are either found in the current path with the name .libpasta.yaml, or an alternative path can be specified using the environment variable LIBPASTA_CFG.

Alternatively, the set_primitive function, and others, can be used to configure the library. However, note that once the library is "in use", i.e. a function like hash_password has been called, then attempting to configure the library will cause a panic.

There are a number of ways panics can happen through using the configuration files. libpasta does not try to recover gracefully if

Structs

DEFAULT_ALG

Default algorithm to use for new hash computations.

DEFAULT_PRIM

Globally-set default Primitive. Guaranteed to be a static reference to some PrimitiveImpl. Note that accessing this variable finalises the configuration state and further changes cannot be made.

RANDOMNESS_SOURCE

Global source of randomness for generating salts

Functions

add_key

Add a new key into the list of configured keys

from_file

Adds the configuration specified in the supplied file to the global configuration

set_keyed_hash

Use an additional keyed hash function or encryption scheme.

set_primitive

Set the default hashing primitive to be used

to_string

Print the global configuration as a YAML-formatted string.