[][src]Struct challenge_bypass_ristretto::voprf::Token

#[repr(C)]
pub struct Token { pub(crate) t: TokenPreimage, r: Scalar, }

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

Methods

impl Token[src]

pub fn random<D, T>(rng: &mut T) -> Self where
    D: Digest<OutputSize = U64> + Default,
    T: Rng + CryptoRng
[src]

Generates a new random Token using the provided random number generator.

pub(crate) fn hash_from_bytes_with_blind<D>(
    bytes: &[u8],
    blinding_scalar: Scalar
) -> Self where
    D: Digest<OutputSize = U64> + Default
[src]

Creates a new Token, using hashing to derive a TokenPreimage and the specified blind

pub fn hash_from_bytes<D, T>(rng: &mut T, bytes: &[u8]) -> Self where
    D: Digest<OutputSize = U64> + Default,
    T: Rng + CryptoRng
[src]

Creates a new Token, using hashing to derive a TokenPreimage and a random blind

pub fn blind(&self) -> BlindedToken[src]

Blinds the Token, returning a BlindedToken to be sent to the server.

pub(crate) fn unblind(
    &self,
    Q: &SignedToken
) -> Result<UnblindedToken, TokenError>
[src]

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.

pub fn to_bytes(&self) -> [u8; 96][src]

Convert this Token to a byte array.

fn bytes_length_error() -> TokenError[src]

pub fn from_bytes(bytes: &[u8]) -> Result<Token, TokenError>[src]

Construct a Token from a slice of bytes.

Trait Implementations

impl Debug for Token[src]

impl Drop for Token[src]

Overwrite the token blinding factor with null when it goes out of scope.

Auto Trait Implementations

impl Send for Token

impl Sync for Token

Blanket Implementations

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same for T

type Output = T

Should always be Self