#[repr(C)]pub struct SigningKey {
pub public_key: PublicKey,
pub(crate) k: Scalar,
}Expand description
A SigningKey is used to sign a BlindedToken and verify an UnblindedToken.
This is a server secret and should NEVER be revealed to the client.
Fields§
§public_key: PublicKeyA PublicKey showing a committment to this particular key
k: Scalark is the actual key
Implementations§
Source§impl SigningKey
impl SigningKey
Sourcepub fn random<T: Rng + CryptoRng>(rng: &mut T) -> Self
pub fn random<T: Rng + CryptoRng>(rng: &mut T) -> Self
Generates a new random SigningKey using the provided random number generator.
Sourcepub fn from_random_bytes(bytes: &[u8]) -> Result<SigningKey, TokenError>
pub fn from_random_bytes(bytes: &[u8]) -> Result<SigningKey, TokenError>
Construct a SigningKey from 64 random bytes.
The random bytes MUST be cryptographically strong, uniform random bytes such as those output from a CSPRNG or appropriately seeded KDF.
Sourcepub fn sign(&self, P: &BlindedToken) -> Result<SignedToken, TokenError>
pub fn sign(&self, P: &BlindedToken) -> Result<SignedToken, TokenError>
Signs the provided BlindedToken
Returns None if the BlindedToken point is not valid.
Sourcepub fn rederive_unblinded_token(&self, t: &TokenPreimage) -> UnblindedToken
pub fn rederive_unblinded_token(&self, t: &TokenPreimage) -> UnblindedToken
Rederives an UnblindedToken via the token preimage of the provided UnblindedToken
W’ = T^k = H_1(t)^k
fn bytes_length_error() -> TokenError
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<SigningKey, TokenError>
pub fn from_bytes(bytes: &[u8]) -> Result<SigningKey, TokenError>
Construct a SigningKey from a slice of bytes.
Trait Implementations§
Source§impl Clone for SigningKey
impl Clone for SigningKey
Source§fn clone(&self) -> SigningKey
fn clone(&self) -> SigningKey
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SigningKey
impl Debug for SigningKey
Auto Trait Implementations§
impl Freeze for SigningKey
impl RefUnwindSafe for SigningKey
impl Send for SigningKey
impl Sync for SigningKey
impl Unpin for SigningKey
impl UnwindSafe for SigningKey
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