Trait sc_network::service::traits::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,