/// Computes the NodeId associated to the given (Protobuf-serialized) public key
///
/// # Errors
/// * `InvalidNodePublicKey::MalformedRawBytes` if the provided key is not a
///   proper Ed25519 public key
///
/// # Returns
/// * The NodeId associated to the key
Computes the NodeId associated to the given (Protobuf-serialized) public key
Computes the NodeId associated to the given ( Protobuf - serialized ) public key
pub fn derive_node_id(node_signing_pk: &PublicKeyProto) -> Result<NodeId, InvalidNodePublicKey> {
    let raw_key = &node_signing_pk.key_value;
    let pk_bytes = internal_types::PublicKey::try_from(&raw_key[..]).map_err(|e| {
        InvalidNodePublicKey::MalformedRawBytes {
            internal_error: format!("{:?}", e),
        }
    })?;
    let der_pk = pk_bytes.to_der();
    Ok(NodeId::from(PrincipalId::new_self_authenticating(&der_pk)))
}
pub fn derive_node_id ( node_signing_pk : & PublicKeyProto ) -> Result < NodeId , InvalidNodePublicKey > { let raw_key = & node_signing_pk . key_value ; let pk_bytes = internal_types :: PublicKey :: try_from ( & raw_key [ .. ] ) . map_err ( | e | { InvalidNodePublicKey :: MalformedRawBytes { internal_error : format ! ( " " e ) , } } ) ? ; let der_pk = pk_bytes . to_der ( ) ; Ok ( NodeId :: from ( PrincipalId :: new_self_authenticating ( & der_pk ) ) ) }
Computes the NodeId associated to the given (Protobuf-serialized) public key
Computes the NodeId associated to the given ( Protobuf - serialized ) public key
The NodeId associated to the key
The NodeId associated to the key
node_signing_pk
&PublicKeyProto
errors
`InvalidNodePublicKey::MalformedRawBytes` if the provided key is not a
proper Ed25519 public key
` InvalidNodePublicKey :: MalformedRawBytes ` if the provided key is not a proper Ed25519 public key