Struct blsttc::SecretKeyShare
source · [−]pub struct SecretKeyShare(_);
Expand description
A secret key share.
Serde integration
SecretKeyShare
implements Deserialize
but not Serialize
to avoid accidental
serialization in insecure contexts. To enable both use the ::serde_impl::SerdeSecret
wrapper which implements both Deserialize
and Serialize
.
Implementations
sourceimpl SecretKeyShare
impl SecretKeyShare
sourcepub fn from_mut(fr: &mut Fr) -> Self
pub fn from_mut(fr: &mut Fr) -> Self
Creates a new SecretKeyShare
from a mutable reference to a field element. This
constructor takes a reference to avoid any unnecessary stack copying/moving of secrets
field elements. The field element will be copied bytewise onto the heap, the resulting
Box
is stored in the SecretKey
which is then wrapped in a SecretKeyShare
.
WARNING this constructor will overwrite the pointed to Fr
element with zeros once it
has been copied into a new SecretKeyShare
.
Returns the matching public key share.
sourcepub fn sign_g2<H: Into<G2Affine>>(&self, hash: H) -> SignatureShare
pub fn sign_g2<H: Into<G2Affine>>(&self, hash: H) -> SignatureShare
Signs the given element of G2
.
Returns a decryption share, or None
, if the ciphertext isn’t valid.
Returns a decryption share, without validating the ciphertext.
sourcepub fn reveal(&self) -> String
pub fn reveal(&self) -> String
Generates a non-redacted debug string. This method differs from
the Debug
implementation in that it does leak the secret prime
field element.
sourcepub fn derive_child(&self, index: &[u8]) -> Self
pub fn derive_child(&self, index: &[u8]) -> Self
Derives a child secret key share for a given index.
Trait Implementations
sourceimpl Clone for SecretKeyShare
impl Clone for SecretKeyShare
sourcefn clone(&self) -> SecretKeyShare
fn clone(&self) -> SecretKeyShare
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for SecretKeyShare
impl Debug for SecretKeyShare
sourceimpl Default for SecretKeyShare
impl Default for SecretKeyShare
sourcefn default() -> SecretKeyShare
fn default() -> SecretKeyShare
Returns the “default value” for a type. Read more
sourceimpl<'de> Deserialize<'de> for SecretKeyShare
impl<'de> Deserialize<'de> for SecretKeyShare
sourcefn 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>,
Deserialize this value from the given Serde deserializer. Read more
Can be used to create a new random instance of SecretKeyShare
. This is only useful for testing
purposes as such a key has not been derived from a SecretKeySet
.
sourcefn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> SecretKeyShare
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> SecretKeyShare
Generate a random value of T
, using rng
as the source of randomness.
sourcefn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T> where
R: Rng,
fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T> where
R: Rng,
Create an iterator that generates random values of T
, using rng
as
the source of randomness. Read more
sourcefn eq(&self, other: &SecretKeyShare) -> bool
fn eq(&self, other: &SecretKeyShare) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &SecretKeyShare) -> bool
fn ne(&self, other: &SecretKeyShare) -> bool
This method tests for !=
.
impl Eq for SecretKeyShare
impl StructuralEq for SecretKeyShare
impl StructuralPartialEq for SecretKeyShare
Auto Trait Implementations
impl RefUnwindSafe for SecretKeyShare
impl Send for SecretKeyShare
impl Sync for SecretKeyShare
impl Unpin for SecretKeyShare
impl UnwindSafe for SecretKeyShare
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more