pub struct DonationPermit { /* private fields */ }Expand description
A single redeemable donation permit.
This is the value sent, over an unauthenticated connection, to a donation endpoint. It is a bearer token: it does not bind to any particular request, so it must be transmitted over a confidential channel (e.g. TLS).
Implementations§
Source§impl DonationPermit
impl DonationPermit
Sourcepub fn expiration(&self) -> Timestamp
pub fn expiration(&self) -> Timestamp
The expiration after which this permit can no longer be redeemed.
Sourcepub fn spend_id(&self) -> &[u8] ⓘ
pub fn spend_id(&self) -> &[u8] ⓘ
The key a redeeming server should use to detect double-spends: the permit’s nonce.
The nonce uniquely identifies the permit and cannot be altered without invalidating the
token (verification recomputes the attribute point from it), so a replayed permit produces
the same key. The redeeming server must record this (scoped to
expiration) and reject any permit whose key it has already seen.
Sourcepub fn verify(
&self,
now: Timestamp,
key_pair: &DonationPermitDerivedKeyPair,
) -> Result<(), ZkGroupVerificationFailure>
pub fn verify( &self, now: Timestamp, key_pair: &DonationPermitDerivedKeyPair, ) -> Result<(), ZkGroupVerificationFailure>
Verifies that this permit was honestly issued for the current day under key_pair.
This does not enforce single use. The caller must additionally check
spend_id against its spent set and record it on success.
Trait Implementations§
Source§impl Clone for DonationPermit
impl Clone for DonationPermit
Source§fn clone(&self) -> DonationPermit
fn clone(&self) -> DonationPermit
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DonationPermit
impl Debug for DonationPermit
Source§impl<'de> Deserialize<'de> for DonationPermit
impl<'de> Deserialize<'de> for DonationPermit
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 DonationPermit
impl PartialDefault for DonationPermit
Source§fn partial_default() -> Self
fn partial_default() -> Self
Auto Trait Implementations§
impl Freeze for DonationPermit
impl RefUnwindSafe for DonationPermit
impl Send for DonationPermit
impl Sync for DonationPermit
impl Unpin for DonationPermit
impl UnsafeUnpin for DonationPermit
impl UnwindSafe for DonationPermit
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