pub trait Configuration:
Clone
+ Send
+ Sync
+ 'static {
Show 13 methods
// Required methods
fn hash(item: &[u8]) -> [u8; 32];
fn empty_root_value() -> AzksValue;
fn empty_node_hash() -> AzksValue;
fn hash_leaf_with_value(
value: &AkdValue,
epoch: u64,
nonce: &[u8],
) -> AzksValueWithEpoch;
fn hash_leaf_with_commitment(
commitment: AzksValue,
epoch: u64,
) -> AzksValueWithEpoch;
fn get_commitment_nonce(
commitment_key: &[u8],
label: &NodeLabel,
version: u64,
value: &AkdValue,
) -> [u8; 32];
fn compute_fresh_azks_value(
commitment_key: &[u8],
label: &NodeLabel,
version: u64,
value: &AkdValue,
) -> AzksValue;
fn get_hash_from_label_input(
label: &AkdLabel,
freshness: VersionFreshness,
version: u64,
) -> Vec<u8> ⓘ;
fn compute_parent_hash_from_children(
left_val: &AzksValue,
left_label: &[u8],
right_val: &AzksValue,
right_label: &[u8],
) -> AzksValue;
fn compute_root_hash_from_val(root_val: &AzksValue) -> [u8; 32];
fn stale_azks_value() -> AzksValue;
fn compute_node_label_value(bytes: &[u8]) -> Vec<u8> ⓘ;
fn empty_label() -> NodeLabel;
}Expand description
Trait for customizing the directory’s cryptographic operations
Required Methods§
Sourcefn empty_root_value() -> AzksValue
fn empty_root_value() -> AzksValue
The value stored in the root node upon initialization, with no children
Sourcefn empty_node_hash() -> AzksValue
fn empty_node_hash() -> AzksValue
AZKS value corresponding to an empty node
Sourcefn hash_leaf_with_value(
value: &AkdValue,
epoch: u64,
nonce: &[u8],
) -> AzksValueWithEpoch
fn hash_leaf_with_value( value: &AkdValue, epoch: u64, nonce: &[u8], ) -> AzksValueWithEpoch
Hash a leaf epoch and nonce with a given AkdValue
Sourcefn hash_leaf_with_commitment(
commitment: AzksValue,
epoch: u64,
) -> AzksValueWithEpoch
fn hash_leaf_with_commitment( commitment: AzksValue, epoch: u64, ) -> AzksValueWithEpoch
Hash a commit and epoch together to get the leaf’s hash value
Sourcefn get_commitment_nonce(
commitment_key: &[u8],
label: &NodeLabel,
version: u64,
value: &AkdValue,
) -> [u8; 32]
fn get_commitment_nonce( commitment_key: &[u8], label: &NodeLabel, version: u64, value: &AkdValue, ) -> [u8; 32]
Used by the server to produce a commitment nonce for an AkdLabel, version, and AkdValue.
Sourcefn compute_fresh_azks_value(
commitment_key: &[u8],
label: &NodeLabel,
version: u64,
value: &AkdValue,
) -> AzksValue
fn compute_fresh_azks_value( commitment_key: &[u8], label: &NodeLabel, version: u64, value: &AkdValue, ) -> AzksValue
Used by the server to produce a commitment for an AkdLabel, version, and AkdValue
Sourcefn get_hash_from_label_input(
label: &AkdLabel,
freshness: VersionFreshness,
version: u64,
) -> Vec<u8> ⓘ
fn get_hash_from_label_input( label: &AkdLabel, freshness: VersionFreshness, version: u64, ) -> Vec<u8> ⓘ
To convert a regular label (arbitrary string of bytes) into a NodeLabel, we compute the output as: H(label || freshness || version)
Specifically, we concatenate the following together:
- I2OSP(len(label) as u64, label)
- A single byte encoded as 0u8 if “stale”, 1u8 if “fresh”
- A u64 representing the version These are all interpreted as a single byte array and hashed together, with the output of the hash returned.
Sourcefn compute_parent_hash_from_children(
left_val: &AzksValue,
left_label: &[u8],
right_val: &AzksValue,
right_label: &[u8],
) -> AzksValue
fn compute_parent_hash_from_children( left_val: &AzksValue, left_label: &[u8], right_val: &AzksValue, right_label: &[u8], ) -> AzksValue
Computes the parent hash from the children hashes and labels
Sourcefn compute_root_hash_from_val(root_val: &AzksValue) -> [u8; 32]
fn compute_root_hash_from_val(root_val: &AzksValue) -> [u8; 32]
Given the top-level hash, compute the “actual” root hash that is published by the directory maintainer
Sourcefn stale_azks_value() -> AzksValue
fn stale_azks_value() -> AzksValue
Similar to commit_fresh_value, but used for stale values.
Sourcefn compute_node_label_value(bytes: &[u8]) -> Vec<u8> ⓘ
fn compute_node_label_value(bytes: &[u8]) -> Vec<u8> ⓘ
Computes the node label value from the bytes of the label
Sourcefn empty_label() -> NodeLabel
fn empty_label() -> NodeLabel
Returns the representation of the empty label
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.