NodeIdentity

Trait NodeIdentity 

Source
pub trait NodeIdentity {
    type Error;

    // Required methods
    fn public_key(&self) -> &PublicKey;
    async fn sign(&self, message: &[u8]) -> Result<[u8; 64], Self::Error>;
    async fn agree(&self, peer: &PublicKey) -> Result<SharedSecret, Self::Error>;

    // Provided method
    fn hint(&self) -> NodeHint { ... }
}
Expand description

Node identity capable of signing and key agreement.

Required Associated Types§

Required Methods§

Source

fn public_key(&self) -> &PublicKey

Return the long-term Ed25519 public key for this identity.

Source

async fn sign(&self, message: &[u8]) -> Result<[u8; 64], Self::Error>

Sign an arbitrary message.

Source

async fn agree(&self, peer: &PublicKey) -> Result<SharedSecret, Self::Error>

Perform X25519-style key agreement with a peer public key.

Provided Methods§

Source

fn hint(&self) -> NodeHint

Return the three-byte node hint derived from public_key.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§