Struct challenge_bypass_ristretto::oprf::Token
source · #[repr(C)]pub struct Token {
pub(crate) t: TokenPreimage,
r: Scalar,
}
Expand description
A Token
consists of a randomly chosen preimage and blinding factor.
Since a token includes the blinding factor it should be treated as a client secret and NEVER revealed to the server.
Fields§
§t: TokenPreimage
t
is a TokenPreimage
r: Scalar
r
is a Scalar
which is the blinding factor
Implementations§
source§impl Token
impl Token
sourcepub fn random<D, T>(rng: &mut T) -> Self
pub fn random<D, T>(rng: &mut T) -> Self
Generates a new random Token
using the provided random number generator.
sourcepub(crate) fn hash_from_bytes_with_blind<D>(
bytes: &[u8],
blinding_scalar: Scalar
) -> Self
pub(crate) fn hash_from_bytes_with_blind<D>( bytes: &[u8], blinding_scalar: Scalar ) -> Self
Creates a new Token
, using hashing to derive a TokenPreimage
and the specified blind
sourcepub fn hash_from_bytes<D, T>(rng: &mut T, bytes: &[u8]) -> Self
pub fn hash_from_bytes<D, T>(rng: &mut T, bytes: &[u8]) -> Self
Creates a new Token
, using hashing to derive a TokenPreimage
and a random blind
sourcepub fn blind(&self) -> BlindedToken
pub fn blind(&self) -> BlindedToken
Blinds the Token
, returning a BlindedToken
to be sent to the server.
sourcepub(crate) fn unblind(
&self,
Q: &SignedToken
) -> Result<UnblindedToken, TokenError>
pub(crate) fn unblind( &self, Q: &SignedToken ) -> Result<UnblindedToken, TokenError>
Using the blinding factor of the original Token
, unblind a SignedToken
returned from the server.
Returns a TokenError
if the SignedToken
point is not valid.
fn bytes_length_error() -> TokenError
sourcepub fn from_bytes(bytes: &[u8]) -> Result<Token, TokenError>
pub fn from_bytes(bytes: &[u8]) -> Result<Token, TokenError>
Construct a Token
from a slice of bytes.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Token
impl Send for Token
impl Sync for Token
impl Unpin for Token
impl UnwindSafe for Token
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