pub struct VoprfClient<CS: CipherSuite> { /* private fields */ }Expand description
A client which engages with a VoprfServer in verifiable mode, meaning that the OPRF outputs can be checked against a server public key.
Implementations§
Source§impl<CS: CipherSuite> VoprfClient<CS>
impl<CS: CipherSuite> VoprfClient<CS>
Sourcepub fn serialize(&self) -> Array<u8, VoprfClientLen<CS>>
pub fn serialize(&self) -> Array<u8, VoprfClientLen<CS>>
Serialization into bytes
Sourcepub fn deserialize(input: &[u8]) -> Result<Self>
pub fn deserialize(input: &[u8]) -> Result<Self>
Source§impl<CS: CipherSuite> VoprfClient<CS>
impl<CS: CipherSuite> VoprfClient<CS>
Sourcepub fn blind<R: TryRng + TryCryptoRng>(
input: &[u8],
blinding_factor_rng: &mut R,
) -> Result<VoprfClientBlindResult<CS>>
pub fn blind<R: TryRng + TryCryptoRng>( input: &[u8], blinding_factor_rng: &mut R, ) -> Result<VoprfClientBlindResult<CS>>
Computes the first step for the multiplicative blinding version of DH-OPRF.
§Errors
Error::Input if the input is empty or longer then u16::MAX.
Sourcepub fn deterministic_blind_unchecked(
input: &[u8],
blind: <CS::Group as Group>::Scalar,
) -> Result<VoprfClientBlindResult<CS>>
Available on crate features danger only.
pub fn deterministic_blind_unchecked( input: &[u8], blind: <CS::Group as Group>::Scalar, ) -> Result<VoprfClientBlindResult<CS>>
danger only.Computes the first step for the multiplicative blinding version of DH-OPRF, taking a blinding factor scalar as input instead of sampling from an RNG.
§Caution
This should be used with caution, since it does not perform any checks on the validity of the blinding factor!
§Errors
Error::Input if the input is empty or longer then u16::MAX.
Sourcepub fn finalize(
&self,
input: &[u8],
evaluation_element: &EvaluationElement<CS>,
proof: &Proof<CS>,
pk: <CS::Group as Group>::Elem,
) -> Result<Output<CS::Hash>>
pub fn finalize( &self, input: &[u8], evaluation_element: &EvaluationElement<CS>, proof: &Proof<CS>, pk: <CS::Group as Group>::Elem, ) -> Result<Output<CS::Hash>>
Computes the third step for the multiplicative blinding version of DH-OPRF, in which the client unblinds the server’s message.
§Errors
Error::Inputif theinputis empty or longer thenu16::MAX.Error::ProofVerificationif theprooffailed to verify.
Sourcepub fn batch_finalize<'a, I, II, IC, IM>(
inputs: &'a II,
clients: &'a IC,
messages: &'a IM,
proof: &Proof<CS>,
pk: <CS::Group as Group>::Elem,
) -> Result<VoprfClientBatchFinalizeResult<'a, CS, I, II, IC, IM>>where
CS: 'a,
I: 'a + AsRef<[u8]>,
&'a II: 'a + IntoIterator<Item = I>,
<&'a II as IntoIterator>::IntoIter: ExactSizeIterator,
&'a IC: 'a + IntoIterator<Item = &'a VoprfClient<CS>>,
<&'a IC as IntoIterator>::IntoIter: ExactSizeIterator,
&'a IM: 'a + IntoIterator<Item = &'a EvaluationElement<CS>>,
<&'a IM as IntoIterator>::IntoIter: ExactSizeIterator,
pub fn batch_finalize<'a, I, II, IC, IM>(
inputs: &'a II,
clients: &'a IC,
messages: &'a IM,
proof: &Proof<CS>,
pk: <CS::Group as Group>::Elem,
) -> Result<VoprfClientBatchFinalizeResult<'a, CS, I, II, IC, IM>>where
CS: 'a,
I: 'a + AsRef<[u8]>,
&'a II: 'a + IntoIterator<Item = I>,
<&'a II as IntoIterator>::IntoIter: ExactSizeIterator,
&'a IC: 'a + IntoIterator<Item = &'a VoprfClient<CS>>,
<&'a IC as IntoIterator>::IntoIter: ExactSizeIterator,
&'a IM: 'a + IntoIterator<Item = &'a EvaluationElement<CS>>,
<&'a IM as IntoIterator>::IntoIter: ExactSizeIterator,
Allows for batching of the finalization of multiple VoprfClient and EvaluationElement pairs
§Errors
Error::Batchif the number ofclientsandmessagesdon’t match or is longer thenu16::MAX.Error::ProofVerificationif theprooffailed to verify.
The resulting messages can each fail individually with Error::Input
if the input is empty or longer then u16::MAX.