Type Alias jormungandr_lib::interfaces::config::node::NodeId
source · pub type NodeId = Identifier<Ed25519>;
Expand description
Identifier of a peer node.
Aliased Type§
struct NodeId(PublicKey<Ed25519>);
Fields§
§0: PublicKey<Ed25519>
Implementations§
source§impl<A: AsymmetricPublicKey> Identifier<A>
impl<A: AsymmetricPublicKey> Identifier<A>
pub fn into_public_key(self) -> PublicKey<A>
sourcepub fn to_bech32_str(&self) -> String
pub fn to_bech32_str(&self) -> String
encode the Identifier
into a bech32 string.
This is a human readable encoding that allows to check input validation. When displaying this identifier to the user it is preferable to provide the output of this function.
Serde implementation of Identifier
provides the bech32 string support.
Example
let key : SigningKey<Ed25519> = SigningKey::generate(thread_rng());
let key = key.identifier();
println!("key: {}", key.to_bech32_str());
sourcepub fn from_bech32_str(s: &str) -> Result<Self, Error>
pub fn from_bech32_str(s: &str) -> Result<Self, Error>
try to decode the given bech32 string into a valid Identifier
sourcepub fn to_hex(&self) -> String
pub fn to_hex(&self) -> String
encode the Identifier
into an hexadecimal string
While this is still a human readable format. it is lesser than
the output of Self::to_bech32_str
as it does not provide user input
verification.
Display
implementation of Identifier
provides the hexadecimal string support.
as well as the FromStr
implementation.
This format is, for example, used in the REST API.
Example
let key : SigningKey<Ed25519> = SigningKey::generate(thread_rng());
let key = key.identifier();
println!("key: {}", key.to_hex());
source§impl Identifier<Ed25519>
impl Identifier<Ed25519>
sourcepub fn to_single_address(&self, discrimination: Discrimination) -> Address
pub fn to_single_address(&self, discrimination: Discrimination) -> Address
construct a single address
sourcepub fn to_group_address(
&self,
discrimination: Discrimination,
group: PublicKey<Ed25519>
) -> Address
pub fn to_group_address( &self, discrimination: Discrimination, group: PublicKey<Ed25519> ) -> Address
create a group address.
sourcepub fn to_account_address(&self, discrimination: Discrimination) -> Address
pub fn to_account_address(&self, discrimination: Discrimination) -> Address
create an account address.
Trait Implementations§
source§impl<A: AsymmetricPublicKey> AsRef<PublicKey<A>> for Identifier<A>
impl<A: AsymmetricPublicKey> AsRef<PublicKey<A>> for Identifier<A>
source§impl<A: AsymmetricPublicKey> Clone for Identifier<A>
impl<A: AsymmetricPublicKey> Clone for Identifier<A>
source§impl<A: AsymmetricPublicKey> Debug for Identifier<A>
impl<A: AsymmetricPublicKey> Debug for Identifier<A>
source§impl<'de, A: AsymmetricPublicKey> Deserialize<'de> for Identifier<A>
impl<'de, A: AsymmetricPublicKey> Deserialize<'de> for Identifier<A>
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>,
source§impl<A: AsymmetricPublicKey> Display for Identifier<A>
impl<A: AsymmetricPublicKey> Display for Identifier<A>
source§impl<A: AsymmetricPublicKey> From<PublicKey<A>> for Identifier<A>
impl<A: AsymmetricPublicKey> From<PublicKey<A>> for Identifier<A>
source§impl<A: AsymmetricPublicKey> FromStr for Identifier<A>
impl<A: AsymmetricPublicKey> FromStr for Identifier<A>
source§impl<A: AsymmetricPublicKey> Hash for Identifier<A>
impl<A: AsymmetricPublicKey> Hash for Identifier<A>
source§impl<A: AsymmetricPublicKey> Ord for Identifier<A>
impl<A: AsymmetricPublicKey> Ord for Identifier<A>
source§impl<A: AsymmetricPublicKey> PartialEq<Identifier<A>> for Identifier<A>
impl<A: AsymmetricPublicKey> PartialEq<Identifier<A>> for Identifier<A>
source§impl<A: AsymmetricPublicKey> PartialOrd<Identifier<A>> for Identifier<A>
impl<A: AsymmetricPublicKey> PartialOrd<Identifier<A>> for Identifier<A>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more