Enum sc_network::config::Keypair
pub enum Keypair {
Ed25519(Keypair),
}
Expand description
Identity keypair of a node.
Example: Generating RSA keys with OpenSSL
openssl genrsa -out private.pem 2048
openssl pkcs8 -in private.pem -inform PEM -topk8 -out private.pk8 -outform DER -nocrypt
rm private.pem # optional
Loading the keys:
let mut bytes = std::fs::read("private.pk8").unwrap();
let keypair = Keypair::rsa_from_pkcs8(&mut bytes);
Variants§
Ed25519(Keypair)
👎Deprecated since 0.1.0: This enum will be made opaque in the future, use
Keypair::try_into_ed25519
instead.An Ed25519 keypair.
Implementations§
§impl Keypair
impl Keypair
pub fn generate_ed25519() -> Keypair
pub fn generate_ed25519() -> Keypair
Generate a new Ed25519 keypair.
pub fn into_ed25519(self) -> Option<Keypair>
👎Deprecated: This method name does not follow Rust naming conventions, use
Keypair::try_into_ed25519
instead.pub fn try_into_ed25519(self) -> Result<Keypair, OtherVariantError>
pub fn ed25519_from_bytes( bytes: impl AsMut<[u8]> ) -> Result<Keypair, DecodingError>
pub fn sign(&self, msg: &[u8]) -> Result<Vec<u8, Global>, SigningError>
pub fn sign(&self, msg: &[u8]) -> Result<Vec<u8, Global>, SigningError>
Sign a message using the private key of this keypair, producing a signature that can be verified using the corresponding public key.
pub fn to_protobuf_encoding(&self) -> Result<Vec<u8, Global>, DecodingError>
pub fn to_protobuf_encoding(&self) -> Result<Vec<u8, Global>, DecodingError>
Encode a private key as protobuf structure.
pub fn from_protobuf_encoding(bytes: &[u8]) -> Result<Keypair, DecodingError>
pub fn from_protobuf_encoding(bytes: &[u8]) -> Result<Keypair, DecodingError>
Decode a private key from a protobuf structure and parse it as a Keypair
.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Keypair
impl Send for Keypair
impl Sync for Keypair
impl Unpin for Keypair
impl UnwindSafe for Keypair
Blanket Implementations§
source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T, Outer> IsWrappedBy<Outer> for Twhere
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for Twhere Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere Self: UniqueSaturatedFrom<T>,
source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere Self: UniqueSaturatedInto<T>,
Consume self to return an equivalent value of
T
. Read moresource§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere T: UncheckedFrom<S>,
source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
The counterpart to
unchecked_from
.source§impl<T, S> UniqueSaturatedInto<T> for Swhere
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for Swhere T: Bounded, S: TryInto<T>,
source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of
T
.