pub struct ServerKey { /* private fields */ }Expand description
A server’s key for one mode.
Implementations§
Source§impl ServerKey
impl ServerKey
Sourcepub fn generate<R: RandomSource + ?Sized>(
mode: Mode,
rng: &mut R,
) -> Result<Self>
pub fn generate<R: RandomSource + ?Sized>( mode: Mode, rng: &mut R, ) -> Result<Self>
A fresh key from rng. Pass ic_drbg::Rng.
Sourcepub fn derive(mode: Mode, seed: &[u8; 32], info: &[u8]) -> Result<Self>
pub fn derive(mode: Mode, seed: &[u8; 32], info: &[u8]) -> Result<Self>
RFC 9497 section 3.2.1’s DeriveKeyPair: a key from a 32-byte secret
seed and a public info.
Sourcepub fn from_bytes(mode: Mode, secret: &[u8]) -> Result<Self>
pub fn from_bytes(mode: Mode, secret: &[u8]) -> Result<Self>
A key from its 32-byte scalar.
Sourcepub fn public_key(&self) -> [u8; 33]
pub fn public_key(&self) -> [u8; 33]
The public key, which a VOPRF or POPRF client needs.
Sourcepub fn blind_evaluate<R: RandomSource + ?Sized>(
&self,
blinded: &[u8; 33],
info: &[u8],
rng: &mut R,
) -> Result<([u8; 33], Option<[u8; 64]>)>
pub fn blind_evaluate<R: RandomSource + ?Sized>( &self, blinded: &[u8; 33], info: &[u8], rng: &mut R, ) -> Result<([u8; 33], Option<[u8; 64]>)>
Evaluate one blinded element; see ServerKey::blind_evaluate_batch.
Sourcepub fn blind_evaluate_batch<R: RandomSource + ?Sized>(
&self,
blinded: &[[u8; 33]],
info: &[u8],
rng: &mut R,
evaluated: &mut [[u8; 33]],
) -> Result<Option<[u8; 64]>>
pub fn blind_evaluate_batch<R: RandomSource + ?Sized>( &self, blinded: &[[u8; 33]], info: &[u8], rng: &mut R, evaluated: &mut [[u8; 33]], ) -> Result<Option<[u8; 64]>>
Evaluate blinded elements, writing one evaluated element for each, and return the batched proof in the verifiable modes.
info is the POPRF’s public input and must be empty in the other two
modes. A POPRF info that hashes to the negated key – which only
someone who knows the key can find – is refused, as RFC 9497 says,
and is a sign the key is known.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ServerKey
impl RefUnwindSafe for ServerKey
impl Send for ServerKey
impl Sync for ServerKey
impl Unpin for ServerKey
impl UnsafeUnpin for ServerKey
impl UnwindSafe for ServerKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more