Trait akd::ecvrf::VRFKeyStorage
source · pub trait VRFKeyStorage: Clone + Sync + Send {
// Required method
fn retrieve<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, VrfError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
// Provided methods
fn get_vrf_private_key<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<VRFPrivateKey, VrfError>> + Send + 'async_trait>>
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>>
where 'life0: 'async_trait,
Self: 'async_trait { ... }
fn get_node_label<'life0, 'life1, 'async_trait, TC>(
&'life0 self,
label: &'life1 AkdLabel,
freshness: VersionFreshness,
version: u64
) -> Pin<Box<dyn Future<Output = Result<NodeLabel, VrfError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
TC: 'async_trait + Configuration,
Self: 'async_trait { ... }
fn get_node_label_with_expanded_key<TC>(
expanded_private_key: &VRFExpandedPrivateKey,
pk: &VRFPublicKey,
label: &AkdLabel,
freshness: VersionFreshness,
version: u64
) -> NodeLabel
where TC: Configuration { ... }
fn get_node_label_from_vrf_proof<'life0, 'async_trait>(
&'life0 self,
proof: Proof
) -> Pin<Box<dyn Future<Output = NodeLabel> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait { ... }
fn get_label_proof<'life0, 'life1, 'async_trait, TC>(
&'life0 self,
label: &'life1 AkdLabel,
freshness: VersionFreshness,
version: u64
) -> Pin<Box<dyn Future<Output = Result<Proof, VrfError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
TC: 'async_trait + Configuration,
Self: 'async_trait { ... }
fn get_label_proof_with_key<TC>(
key: &VRFPrivateKey,
label: &AkdLabel,
freshness: VersionFreshness,
version: u64
) -> Proof
where TC: Configuration { ... }
fn get_label_with_key_helper<TC>(
expanded_private_key: &VRFExpandedPrivateKey,
pk: &VRFPublicKey,
label: &AkdLabel,
freshness: VersionFreshness,
version: u64
) -> Output
where TC: Configuration { ... }
fn get_node_labels<'life0, 'life1, 'async_trait, TC>(
&'life0 self,
labels: &'life1 [(AkdLabel, VersionFreshness, u64, AkdValue)]
) -> Pin<Box<dyn Future<Output = Result<Vec<((AkdLabel, VersionFreshness, u64, AkdValue), NodeLabel)>, VrfError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
TC: 'async_trait + Configuration,
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§
Provided Methods§
sourcefn get_vrf_private_key<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<VRFPrivateKey, VrfError>> + Send + 'async_trait>>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>>where 'life0: 'async_trait, Self: 'async_trait,
Retrieve the properly constructed VRF Private key
sourcefn get_vrf_public_key<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<VRFPublicKey, VrfError>> + Send + 'async_trait>>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>>where 'life0: 'async_trait, Self: 'async_trait,
Retrieve the VRF public key
sourcefn get_node_label<'life0, 'life1, 'async_trait, TC>(
&'life0 self,
label: &'life1 AkdLabel,
freshness: VersionFreshness,
version: u64
) -> Pin<Box<dyn Future<Output = Result<NodeLabel, VrfError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
TC: 'async_trait + Configuration,
Self: 'async_trait,
fn get_node_label<'life0, 'life1, 'async_trait, TC>( &'life0 self, label: &'life1 AkdLabel, freshness: VersionFreshness, version: u64 ) -> Pin<Box<dyn Future<Output = Result<NodeLabel, VrfError>> + Send + 'async_trait>>where 'life0: 'async_trait, 'life1: 'async_trait, TC: 'async_trait + Configuration, Self: 'async_trait,
sourcefn get_node_label_with_expanded_key<TC>(
expanded_private_key: &VRFExpandedPrivateKey,
pk: &VRFPublicKey,
label: &AkdLabel,
freshness: VersionFreshness,
version: u64
) -> NodeLabelwhere
TC: Configuration,
fn get_node_label_with_expanded_key<TC>( expanded_private_key: &VRFExpandedPrivateKey, pk: &VRFPublicKey, label: &AkdLabel, freshness: VersionFreshness, version: u64 ) -> NodeLabelwhere TC: Configuration,
sourcefn get_node_label_from_vrf_proof<'life0, 'async_trait>(
&'life0 self,
proof: Proof
) -> Pin<Box<dyn Future<Output = NodeLabel> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn get_node_label_from_vrf_proof<'life0, 'async_trait>( &'life0 self, proof: Proof ) -> Pin<Box<dyn Future<Output = NodeLabel> + Send + 'async_trait>>where 'life0: 'async_trait, Self: 'async_trait,
Returns the tree nodelabel that corresponds to a vrf proof.
sourcefn get_label_proof<'life0, 'life1, 'async_trait, TC>(
&'life0 self,
label: &'life1 AkdLabel,
freshness: VersionFreshness,
version: u64
) -> Pin<Box<dyn Future<Output = Result<Proof, VrfError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
TC: 'async_trait + Configuration,
Self: 'async_trait,
fn get_label_proof<'life0, 'life1, 'async_trait, TC>( &'life0 self, label: &'life1 AkdLabel, freshness: VersionFreshness, version: u64 ) -> Pin<Box<dyn Future<Output = Result<Proof, VrfError>> + Send + 'async_trait>>where 'life0: 'async_trait, 'life1: 'async_trait, TC: 'async_trait + Configuration, Self: 'async_trait,
Retrieve the proof for a specific label
sourcefn get_label_proof_with_key<TC>(
key: &VRFPrivateKey,
label: &AkdLabel,
freshness: VersionFreshness,
version: u64
) -> Proofwhere
TC: Configuration,
fn get_label_proof_with_key<TC>( key: &VRFPrivateKey, label: &AkdLabel, freshness: VersionFreshness, version: u64 ) -> Proofwhere TC: Configuration,
Retrieve the proof for a specific label, with a supplied private key
sourcefn get_label_with_key_helper<TC>(
expanded_private_key: &VRFExpandedPrivateKey,
pk: &VRFPublicKey,
label: &AkdLabel,
freshness: VersionFreshness,
version: u64
) -> Outputwhere
TC: Configuration,
fn get_label_with_key_helper<TC>( expanded_private_key: &VRFExpandedPrivateKey, pk: &VRFPublicKey, label: &AkdLabel, freshness: VersionFreshness, version: u64 ) -> Outputwhere TC: Configuration,
Retrieve the output for a specific label, with a supplied private key
sourcefn get_node_labels<'life0, 'life1, 'async_trait, TC>(
&'life0 self,
labels: &'life1 [(AkdLabel, VersionFreshness, u64, AkdValue)]
) -> Pin<Box<dyn Future<Output = Result<Vec<((AkdLabel, VersionFreshness, u64, AkdValue), NodeLabel)>, VrfError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
TC: 'async_trait + Configuration,
Self: 'async_trait,
fn get_node_labels<'life0, 'life1, 'async_trait, TC>( &'life0 self, labels: &'life1 [(AkdLabel, VersionFreshness, u64, AkdValue)] ) -> Pin<Box<dyn Future<Output = Result<Vec<((AkdLabel, VersionFreshness, u64, AkdValue), NodeLabel)>, VrfError>> + Send + 'async_trait>>where 'life0: 'async_trait, 'life1: 'async_trait, TC: 'async_trait + Configuration, Self: 'async_trait,
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.