pub struct DonationPermitRequestContext { /* private fields */ }Expand description
Client-retained state for an in-flight permit request.
This holds the per-permit secrets (nonces and blinding scalars) that the client needs to unblind
the eventual DonationPermitResponse. It must be persisted between sending the
request and calling receive.
Implementations§
Source§impl DonationPermitRequestContext
impl DonationPermitRequestContext
Sourcepub fn new(count: NonZeroUsize, randomness: RandomnessBytes) -> Self
pub fn new(count: NonZeroUsize, randomness: RandomnessBytes) -> Self
Samples count fresh permits’ worth of nonces and blinding scalars from randomness.
Each nonce gets an independent blinding scalar, so every eventual permit is information-theoretically independent of issuance and of its siblings.
Sourcepub fn request(&self) -> DonationPermitRequest
pub fn request(&self) -> DonationPermitRequest
The wire request to send to the issuing server.
Sourcepub fn receive(
self,
response: DonationPermitResponse,
root_public_key: impl AsRef<ServerRootPublicKey>,
now: Timestamp,
) -> Result<Vec<DonationPermit>, ZkGroupVerificationFailure>
pub fn receive( self, response: DonationPermitResponse, root_public_key: impl AsRef<ServerRootPublicKey>, now: Timestamp, ) -> Result<Vec<DonationPermit>, ZkGroupVerificationFailure>
Validates the issuer’s response and extracts the redeemable permits.
now is used to validate the response’s expiration window. root_public_key must be the
audited, client-pinned public key; verifying the issuance proof against it is what prevents
the issuing server from tagging this client with a per-client key.
The returned permits are in the same order as the nonces in this context.
Trait Implementations§
Source§impl Clone for DonationPermitRequestContext
impl Clone for DonationPermitRequestContext
Source§fn clone(&self) -> DonationPermitRequestContext
fn clone(&self) -> DonationPermitRequestContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'de> Deserialize<'de> for DonationPermitRequestContext
impl<'de> Deserialize<'de> for DonationPermitRequestContext
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialDefault for DonationPermitRequestContext
impl PartialDefault for DonationPermitRequestContext
Source§fn partial_default() -> Self
fn partial_default() -> Self
Auto Trait Implementations§
impl Freeze for DonationPermitRequestContext
impl RefUnwindSafe for DonationPermitRequestContext
impl Send for DonationPermitRequestContext
impl Sync for DonationPermitRequestContext
impl Unpin for DonationPermitRequestContext
impl UnsafeUnpin for DonationPermitRequestContext
impl UnwindSafe for DonationPermitRequestContext
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more