Struct sc_cli::NodeKeyParams
source · pub struct NodeKeyParams {
pub node_key: Option<String>,
pub node_key_type: NodeKeyType,
pub node_key_file: Option<PathBuf>,
}
Expand description
Parameters used to create the NodeKeyConfig
, which determines the keypair
used for libp2p networking.
Fields§
§node_key: Option<String>
The secret key to use for libp2p networking.
The value is a string that is parsed according to the choice of
--node-key-type
as follows:
ed25519
:
The value is parsed as a hex-encoded Ed25519 32 byte secret key,
i.e. 64 hex characters.
The value of this option takes precedence over --node-key-file
.
WARNING: Secrets provided as command-line arguments are easily exposed.
Use of this option should be limited to development and testing. To use
an externally managed secret key, use --node-key-file
instead.
node_key_type: NodeKeyType
The type of secret key to use for libp2p networking. The secret key of the node is obtained as follows:
- If the
--node-key
option is given, the value is parsed as a secret key according to the type. See the documentation for--node-key
. - If the
--node-key-file
option is given, the secret key is read from the specified file. See the documentation for--node-key-file
. - Otherwise, the secret key is read from a file with a predetermined, type-specific name
from the chain-specific network config directory inside the base directory specified by
--base-dir
. If this file does not exist, it is created with a newly generated secret key of the chosen type. The node’s secret key determines the corresponding public key and hence the node’s peer ID in the context of libp2p.
node_key_file: Option<PathBuf>
The file from which to read the node’s secret key to use for libp2p networking.
The contents of the file are parsed according to the choice of --node-key-type
as follows:
ed25519
:
The file must contain an unencoded 32 byte or hex encoded Ed25519 secret key.
If the file does not exist, it is created with a newly generated secret key of
the chosen type.
Implementations§
source§impl NodeKeyParams
impl NodeKeyParams
sourcepub fn node_key(&self, net_config_dir: &PathBuf) -> Result<NodeKeyConfig>
pub fn node_key(&self, net_config_dir: &PathBuf) -> Result<NodeKeyConfig>
Create a NodeKeyConfig
from the given NodeKeyParams
in the context
of an optional network config storage directory.
Trait Implementations§
source§impl Args for NodeKeyParams
impl Args for NodeKeyParams
source§fn group_id() -> Option<Id>
fn group_id() -> Option<Id>
ArgGroup::id
][crate::ArgGroup::id] for this set of argumentssource§fn augment_args<'b>(__clap_app: Command) -> Command
fn augment_args<'b>(__clap_app: Command) -> Command
source§fn augment_args_for_update<'b>(__clap_app: Command) -> Command
fn augment_args_for_update<'b>(__clap_app: Command) -> Command
source§impl Clone for NodeKeyParams
impl Clone for NodeKeyParams
source§fn clone(&self) -> NodeKeyParams
fn clone(&self) -> NodeKeyParams
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for NodeKeyParams
impl Debug for NodeKeyParams
source§impl FromArgMatches for NodeKeyParams
impl FromArgMatches for NodeKeyParams
source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches ) -> Result<Self, Error>
source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches ) -> Result<(), Error>
ArgMatches
to self
.source§fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches
) -> Result<(), Error>
fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches ) -> Result<(), Error>
ArgMatches
to self
.Auto Trait Implementations§
impl RefUnwindSafe for NodeKeyParams
impl Send for NodeKeyParams
impl Sync for NodeKeyParams
impl Unpin for NodeKeyParams
impl UnwindSafe for NodeKeyParams
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> 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>,
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
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
T
.