sc_network::service::traits

Trait NetworkSigner

Source
pub trait NetworkSigner {
    // Required methods
    fn sign_with_local_identity(
        &self,
        msg: Vec<u8>,
    ) -> Result<Signature, SigningError>;
    fn verify(
        &self,
        peer_id: PeerId,
        public_key: &Vec<u8>,
        signature: &Vec<u8>,
        message: &Vec<u8>,
    ) -> Result<bool, String>;
}
Expand description

Signer with network identity

Required Methods§

Source

fn sign_with_local_identity( &self, msg: Vec<u8>, ) -> Result<Signature, SigningError>

Signs the message with the KeyPair that defines the local PeerId.

Source

fn verify( &self, peer_id: PeerId, public_key: &Vec<u8>, signature: &Vec<u8>, message: &Vec<u8>, ) -> Result<bool, String>

Verify signature using peer’s public key.

public_key must be Protobuf-encoded ed25519 public key.

Returns Err(()) if public cannot be parsed into a valid ed25519 public key.

Implementations on Foreign Types§

Source§

impl<T> NetworkSigner for Arc<T>
where T: ?Sized + NetworkSigner,

Source§

fn sign_with_local_identity( &self, msg: Vec<u8>, ) -> Result<Signature, SigningError>

Source§

fn verify( &self, peer_id: PeerId, public_key: &Vec<u8>, signature: &Vec<u8>, message: &Vec<u8>, ) -> Result<bool, String>

Implementors§

Source§

impl<B, H> NetworkSigner for NetworkService<B, H>
where B: Block, H: ExHashT,