-
Notifications
You must be signed in to change notification settings - Fork 30
Crate features
The default features are always enabled unless specifically disabled. The default
feature enables the feature safe_api
.
Example:
[dependencies.orion]
version = "*" # Replace * with the most recent version
This feature enables the optional dependencies on getrandom
and ct-codecs
. getrandom
is the dependency that allows for secure generation of keys, nonces, and other types that require cryptographically strong randomness. ct-codecs
is used for the high-level API only, whereas getrandom
also enables hazardous-level functionality.
All functionality that is enabled through the two aforementioned dependencies must be enabled through safe_api
. In other words, you cannot specify the getrandom
feature (a different feature for each dependency is automatically generated) to make the T::generate()
APIs are available for newtypes.
The safe_api
feature requires access to std
.
Example: Same as default
.
This enables (de)serialization of select types by enabling the optional serde
dependency. The dependency itself uses Rust alloc
module, because it requires heap-allocations.
The serde
feature is expected to be enabled with either Orion's alloc
or safe_api
/default
features.
Example:
[dependencies.orion]
version = "*" # Replace * with the most recent version
features = ["serde"]
[dependencies.orion]
version = "*" # Replace * with the most recent version
default-features = false
features = ["alloc", "serde"]
The alloc
feature is defined for APIs that require heap-allocations but without the use of std
. The feature enables the use of Argon2i in hazardous
, where the user has access to a heap-allocator but not std
.
It is assumed that if alloc
is enabled, safe_api
is not.
Example:
[dependencies.orion]
version = "*" # Replace * with the most recent version
default-features = false
features = ["alloc"]
Orion is defined as no_std
as long as safe_api
is not enabled. When no additional features have been enabled and the default is disabled (as shown in the example below), Orion performs no heap allocations.
Example:
[dependencies.orion]
version = "*" # Replace * with the most recent version
default-features = false