Trait akd::ecvrf::VRFKeyStorage

source ·
pub trait VRFKeyStorage: Clone + Sync + Send {
    fn retrieve<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8, Global>, VrfError>> + Send + 'async_trait, Global>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; fn get_vrf_private_key<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<VRFPrivateKey, VrfError>> + Send + 'async_trait, Global>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... } fn get_vrf_public_key<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<VRFPublicKey, VrfError>> + Send + 'async_trait, Global>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... } fn get_node_label<'life0, 'life1, 'async_trait>(
        &'life0 self,
        label: &'life1 AkdLabel,
        freshness: VersionFreshness,
        version: u64
    ) -> Pin<Box<dyn Future<Output = Result<NodeLabel, VrfError>> + Send + 'async_trait, Global>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
, { ... } fn get_node_label_with_expanded_key(
        expanded_private_key: &VRFExpandedPrivateKey,
        pk: &VRFPublicKey,
        label: &AkdLabel,
        freshness: VersionFreshness,
        version: u64
    ) -> NodeLabel { ... } fn get_node_label_from_vrf_proof<'life0, 'async_trait>(
        &'life0 self,
        proof: Proof
    ) -> Pin<Box<dyn Future<Output = NodeLabel> + Send + 'async_trait, Global>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... } fn get_label_proof<'life0, 'life1, 'async_trait>(
        &'life0 self,
        label: &'life1 AkdLabel,
        freshness: VersionFreshness,
        version: u64
    ) -> Pin<Box<dyn Future<Output = Result<Proof, VrfError>> + Send + 'async_trait, Global>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
, { ... } fn get_label_proof_with_key(
        key: &VRFPrivateKey,
        label: &AkdLabel,
        freshness: VersionFreshness,
        version: u64
    ) -> Proof { ... } fn get_label_with_key_helper(
        expanded_private_key: &VRFExpandedPrivateKey,
        pk: &VRFPublicKey,
        label: &AkdLabel,
        freshness: VersionFreshness,
        version: u64
    ) -> Output { ... } fn get_node_labels<'life0, 'life1, 'async_trait>(
        &'life0 self,
        labels: &'life1 [(AkdLabel, VersionFreshness, u64)]
    ) -> Pin<Box<dyn Future<Output = Result<Vec<((AkdLabel, VersionFreshness, u64), NodeLabel), Global>, VrfError>> + Send + 'async_trait, Global>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
, { ... } }
Expand description

Represents a secure storage of the VRF private key. Since the VRF private key should change never (if it does, the entire tree is no longer a consistent mapping of user -> node label), it is highly recommended to back this implementation with a static cache of the private key bytes which lives for the life of the process.

I.e. retrieve the byte vector 1 time, and simply keep serving it up without doing network access calls

Required Methods§

Retrieve the VRF Private key as a vector of bytes

Provided Methods§

Retrieve the properly constructed VRF Private key

Retrieve the VRF public key

Returns the NodeLabel that corresponds to a version of the label argument.

The stale boolean here is to indicate whether we are getting the NodeLabel for a fresh version, or a version that we are retiring.

Returns the NodeLabel that corresponds to a version of the label argument utilizing the provided private key.

The stale boolean here is to indicate whether we are getting the NodeLabel for a fresh version, or a version that we are retiring.

Returns the tree nodelabel that corresponds to a vrf proof.

Retrieve the proof for a specific label

Retrieve the proof for a specific label, with a supplied private key

Retrieve the output for a specific label, with a supplied private key

Returns the NodeLabels that corresponds to a collection of (label, freshness, version) arguments with only a single fetch to retrieve the VRF private key from storage.

Note: The freshness enum here is to indicate whether we are getting the NodeLabel for a fresh version, or a version that we are retiring.

Implementors§