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>, 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,
{ ... }
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, H>(
&'life0 self,
uname: &'life1 AkdLabel,
stale: bool,
version: u64
) -> Pin<Box<dyn Future<Output = Result<NodeLabel, VrfError>> + Send + 'async_trait>>
where
H: 'async_trait + Hasher,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
{ ... }
fn get_node_label_from_vrf_pf<'life0, 'async_trait, H>(
&'life0 self,
proof: Proof
) -> Pin<Box<dyn Future<Output = Result<NodeLabel, VrfError>> + Send + 'async_trait>>
where
H: 'async_trait + Hasher,
'life0: 'async_trait,
Self: 'async_trait,
{ ... }
fn get_label_proof<'life0, 'life1, 'async_trait, H>(
&'life0 self,
uname: &'life1 AkdLabel,
stale: bool,
version: u64
) -> Pin<Box<dyn Future<Output = Result<Proof, VrfError>> + Send + 'async_trait>>
where
H: 'async_trait + Hasher,
'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
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, H>(
&'life0 self,
uname: &'life1 AkdLabel,
stale: bool,
version: u64
) -> Pin<Box<dyn Future<Output = Result<NodeLabel, VrfError>> + Send + 'async_trait>>where
H: 'async_trait + Hasher,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get_node_label<'life0, 'life1, 'async_trait, H>(
&'life0 self,
uname: &'life1 AkdLabel,
stale: bool,
version: u64
) -> Pin<Box<dyn Future<Output = Result<NodeLabel, VrfError>> + Send + 'async_trait>>where
H: 'async_trait + Hasher,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Returns the tree nodelabel that corresponds to a version of the uname 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.
sourcefn get_node_label_from_vrf_pf<'life0, 'async_trait, H>(
&'life0 self,
proof: Proof
) -> Pin<Box<dyn Future<Output = Result<NodeLabel, VrfError>> + Send + 'async_trait>>where
H: 'async_trait + Hasher,
'life0: 'async_trait,
Self: 'async_trait,
fn get_node_label_from_vrf_pf<'life0, 'async_trait, H>(
&'life0 self,
proof: Proof
) -> Pin<Box<dyn Future<Output = Result<NodeLabel, VrfError>> + Send + 'async_trait>>where
H: 'async_trait + Hasher,
'life0: 'async_trait,
Self: 'async_trait,
Returns the tree nodelabel that corresponds to a vrf proof.
sourcefn get_label_proof<'life0, 'life1, 'async_trait, H>(
&'life0 self,
uname: &'life1 AkdLabel,
stale: bool,
version: u64
) -> Pin<Box<dyn Future<Output = Result<Proof, VrfError>> + Send + 'async_trait>>where
H: 'async_trait + Hasher,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get_label_proof<'life0, 'life1, 'async_trait, H>(
&'life0 self,
uname: &'life1 AkdLabel,
stale: bool,
version: u64
) -> Pin<Box<dyn Future<Output = Result<Proof, VrfError>> + Send + 'async_trait>>where
H: 'async_trait + Hasher,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Retrieve the proof for a specific label