pub trait SignatureProtocol<A>: Copy {
// Provided methods
fn prepare_message<'b>(&self, bytes: &'b [u8]) -> Cow<'b, [u8]> { ... }
fn prepare_messages<'b>(&self, bytes: &'b [Vec<u8>]) -> Cow<'b, [Vec<u8>]> { ... }
fn encode_signature(
&self,
_algorithm: A,
signature: Vec<u8>,
) -> Result<Vec<u8>, MessageSignatureError> { ... }
fn decode_signature<'s>(
&self,
encoded_signature: &'s [u8],
) -> Result<Cow<'s, [u8]>, InvalidProtocolSignature> { ... }
}
Expand description
Signature protocol.
Specifies how the client and signer communicates together to produce a signature. This includes:
- how to encode the message sent to the signer,
- what transformation must be operated on the message by the signer,
- how to encode the signature to send back to the client.
For instance when using the EthereumPersonalSignature2021
cryptographic
suite the EthereumWallet
protocol applies where:
- the signer (the Ethereum Wallet) must prefix the message with
\x19Ethereum Signed Message:\n
, - send back the signature encoded in hexadecimal.
The simplest protocol is described by the unit ()
type, where the raw
message is transmitted to the signer, which must sign it and return the
raw bytes.
Provided Methods§
fn prepare_message<'b>(&self, bytes: &'b [u8]) -> Cow<'b, [u8]>
fn prepare_messages<'b>(&self, bytes: &'b [Vec<u8>]) -> Cow<'b, [Vec<u8>]>
fn encode_signature( &self, _algorithm: A, signature: Vec<u8>, ) -> Result<Vec<u8>, MessageSignatureError>
fn decode_signature<'s>( &self, encoded_signature: &'s [u8], ) -> Result<Cow<'s, [u8]>, InvalidProtocolSignature>
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.