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§
sourcefn sign_with_local_identity(
&self,
msg: Vec<u8>,
) -> Result<Signature, SigningError>
fn sign_with_local_identity( &self, msg: Vec<u8>, ) -> Result<Signature, SigningError>
Signs the message with the KeyPair
that defines the local PeerId
.
sourcefn verify(
&self,
peer_id: PeerId,
public_key: &Vec<u8>,
signature: &Vec<u8>,
message: &Vec<u8>,
) -> Result<bool, String>
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.