pub struct NodeKeypairs { /* private fields */ }Expand description
This is used at a network node for holding the obligatory Ed25519 keypair needed as Adult, and then a BLS keypair share when being promoted to Elder. (Also the corresponding public keys). The Ed25519 is kept as Elder, in case it is demoted.
Implementations§
Source§impl NodeKeypairs
impl NodeKeypairs
Sourcepub fn new<T: CryptoRng + Rng>(rng: &mut T) -> Self
pub fn new<T: CryptoRng + Rng>(rng: &mut T) -> Self
Constructs a NodeKeypairs with a random Ed25519 keypair and no BLS keys.
Sourcepub fn within_range<T: CryptoRng + Rng>(
start: &XorName,
end: &XorName,
rng: &mut T,
) -> Self
pub fn within_range<T: CryptoRng + Rng>( start: &XorName, end: &XorName, rng: &mut T, ) -> Self
Constructs a NodeKeypairs whose name is in the interval [start, end] (both endpoints inclusive).
Sourcepub fn public_key(&self) -> PublicKey
pub fn public_key(&self) -> PublicKey
Returns the BLS if any, else the Ed25519.
Sourcepub fn public_key_set(&self) -> Option<&PublicKeySet>
pub fn public_key_set(&self) -> Option<&PublicKeySet>
Returns the BLS public key set if any.
Sourcepub fn sign_using_ed25519<T: AsRef<[u8]>>(&self, data: T) -> Signature
pub fn sign_using_ed25519<T: AsRef<[u8]>>(&self, data: T) -> Signature
Creates a detached Ed25519 signature of data.
Sourcepub fn sign_using_bls<T: AsRef<[u8]>>(&self, data: T) -> Option<Signature>
pub fn sign_using_bls<T: AsRef<[u8]>>(&self, data: T) -> Option<Signature>
Creates a detached BLS signature share of data if the self holds a BLS keypair share.
Sourcepub fn set_bls_keys(
&mut self,
index: usize,
secret_share: BlsSecretKeyShare,
public_set: PublicKeySet,
)
pub fn set_bls_keys( &mut self, index: usize, secret_share: BlsSecretKeyShare, public_set: PublicKeySet, )
Sets the NodeKeypairs’s BLS keypair share using the provided BLS secret key share.
Sourcepub fn clear_bls_keys(&mut self)
pub fn clear_bls_keys(&mut self)
Clears the NodeKeypairs’s BLS keypair share, i.e. sets it to None.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for NodeKeypairs
impl<'de> Deserialize<'de> for NodeKeypairs
Source§fn 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>,
Auto Trait Implementations§
impl Freeze for NodeKeypairs
impl RefUnwindSafe for NodeKeypairs
impl Send for NodeKeypairs
impl Sync for NodeKeypairs
impl Unpin for NodeKeypairs
impl UnwindSafe for NodeKeypairs
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more