pub struct PoprfClient<CS: CipherSuite> { /* private fields */ }Expand description
A client which engages with a PoprfServer in verifiable mode, meaning that the OPRF outputs can be checked against a server public key.
Implementations§
Source§impl<CS: CipherSuite> PoprfClient<CS>
impl<CS: CipherSuite> PoprfClient<CS>
Sourcepub fn blind<R: TryRng + TryCryptoRng>(
input: &[u8],
blinding_factor_rng: &mut R,
) -> Result<PoprfClientBlindResult<CS>>
pub fn blind<R: TryRng + TryCryptoRng>( input: &[u8], blinding_factor_rng: &mut R, ) -> Result<PoprfClientBlindResult<CS>>
Computes the first step for the multiplicative blinding version of DH-OPRF.
§Errors
Error::Inputif theinputis empty or longer thanu16::MAX.Error::Rngif the random number generator fails.
Sourcepub fn deterministic_blind_unchecked(
input: &[u8],
blind: <CS::Group as Group>::Scalar,
) -> Result<PoprfClientBlindResult<CS>>
Available on crate features danger only.
pub fn deterministic_blind_unchecked( input: &[u8], blind: <CS::Group as Group>::Scalar, ) -> Result<PoprfClientBlindResult<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! In particular, a zero blind
has no multiplicative inverse: a later finalize will
then panic on prime-order curves and produce a degenerate (identity)
output on Ristretto255. Only pass a blind known to be a non-zero
scalar.
§Errors
Error::Input if the input is empty or longer than u16::MAX.
Sourcepub fn finalize(
&self,
input: &[u8],
evaluation_element: &EvaluationElement<CS>,
proof: &Proof<CS>,
pk: <CS::Group as Group>::Elem,
info: Option<&[u8]>,
) -> Result<Output<CS::Hash>>
pub fn finalize( &self, input: &[u8], evaluation_element: &EvaluationElement<CS>, proof: &Proof<CS>, pk: <CS::Group as Group>::Elem, info: Option<&[u8]>, ) -> 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::Infoif theinfois longer thanu16::MAX.Error::Inputif theinputis empty or longer thanu16::MAX.Error::Protocolif the protocol fails and can’t be completed.Error::ProofVerificationif theprooffailed to verify.
Sourcepub fn batch_finalize<'a, II: 'a + Iterator<Item = &'a [u8]> + ExactSizeIterator, IC, IM>(
inputs: II,
clients: &'a IC,
messages: &'a IM,
proof: &Proof<CS>,
pk: <CS::Group as Group>::Elem,
info: Option<&'a [u8]>,
) -> Result<PoprfClientBatchFinalizeResult<'a, CS, II, IC, IM>>where
CS: 'a,
&'a IC: 'a + IntoIterator<Item = &'a PoprfClient<CS>>,
<&'a IC as IntoIterator>::IntoIter: ExactSizeIterator,
&'a IM: 'a + IntoIterator<Item = &'a EvaluationElement<CS>>,
<&'a IM as IntoIterator>::IntoIter: ExactSizeIterator,
<<CS as CipherSuite>::Hash as OutputSizeUser>::OutputSize: ArrayLength,
pub fn batch_finalize<'a, II: 'a + Iterator<Item = &'a [u8]> + ExactSizeIterator, IC, IM>(
inputs: II,
clients: &'a IC,
messages: &'a IM,
proof: &Proof<CS>,
pk: <CS::Group as Group>::Elem,
info: Option<&'a [u8]>,
) -> Result<PoprfClientBatchFinalizeResult<'a, CS, II, IC, IM>>where
CS: 'a,
&'a IC: 'a + IntoIterator<Item = &'a PoprfClient<CS>>,
<&'a IC as IntoIterator>::IntoIter: ExactSizeIterator,
&'a IM: 'a + IntoIterator<Item = &'a EvaluationElement<CS>>,
<&'a IM as IntoIterator>::IntoIter: ExactSizeIterator,
<<CS as CipherSuite>::Hash as OutputSizeUser>::OutputSize: ArrayLength,
Allows for batching of the finalization of multiple PoprfClient and EvaluationElement pairs
§Errors
Error::Infoif theinfois longer thanu16::MAX.Error::Protocolif the protocol fails and can’t be completed.Error::Batchif the number ofinputs,clientsandmessagesdon’t match or is longer thanu16::MAX.Error::ProofVerificationif theprooffailed to verify.
The resulting messages can each fail individually with Error::Input
if the input is empty or longer than u16::MAX.
Source§impl<CS: CipherSuite> PoprfClient<CS>
impl<CS: CipherSuite> PoprfClient<CS>
Sourcepub fn serialize(&self) -> GenericArray<u8, PoprfClientLen<CS>>
pub fn serialize(&self) -> GenericArray<u8, PoprfClientLen<CS>>
Serialization into bytes