Configuration

Trait Configuration 

Source
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§

Source

fn hash(item: &[u8]) -> [u8; 32]

Hash a single byte array

Source

fn empty_root_value() -> AzksValue

The value stored in the root node upon initialization, with no children

Source

fn empty_node_hash() -> AzksValue

AZKS value corresponding to an empty node

Source

fn hash_leaf_with_value( value: &AkdValue, epoch: u64, nonce: &[u8], ) -> AzksValueWithEpoch

Hash a leaf epoch and nonce with a given AkdValue

Source

fn hash_leaf_with_commitment( commitment: AzksValue, epoch: u64, ) -> AzksValueWithEpoch

Hash a commit and epoch together to get the leaf’s hash value

Source

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.

Source

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

Source

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.
Source

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

Source

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

Source

fn stale_azks_value() -> AzksValue

Similar to commit_fresh_value, but used for stale values.

Source

fn compute_node_label_value(bytes: &[u8]) -> Vec<u8>

Computes the node label value from the bytes of the label

Source

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.

Implementors§