pub struct Voucher(/* private fields */);Expand description
A Voucher is a very weakly one-way-transformed value for an arbitrary u64.
CheckingParameters let us confirm whether the voucher came
from an expected u64 value after transformation by the
VouchingParameters associated with the CheckingParameters,
while making it hard to accidentally generate a valid Voucher
with only CheckingParameters (i.e., it’s hard to accidentally
back out the VouchingParameters from CheckingParameters).
The type wrapper exists to prevent confusion between what’s
a Voucher value what’s an expected u64 value.
Generate Vouchers with VouchingParameters::vouch or
VouchingParameters::vouch_many, by deserialising directly into
Voucher objects, or with std::mem::transmute. The latter is
unsafe, and that’s on purpose: code that takes arbitrary u64s
and stamps them as Voucher values should be scrutinised.
Confirm that a Voucher is valid for a given set of CheckingParameters
and initial u64 (i.e., was generated from the initial u64 using
the VouchingParameters associated with the CheckingParameters)
by calling CheckingParameters::check or CheckingParameters::check_many.