pub trait Signer:
Send
+ Sync
+ Clone
+ 'static {
type Signature: Signature;
type PublicKey: PublicKey<Signature = Self::Signature>;
// Required methods
fn public_key(&self) -> Self::PublicKey;
fn sign(&self, namespace: Option<&[u8]>, msg: &[u8]) -> Self::Signature;
}
Expand description
Required Associated Types§
Required Methods§
Sourcefn public_key(&self) -> Self::PublicKey
fn public_key(&self) -> Self::PublicKey
Sourcefn sign(&self, namespace: Option<&[u8]>, msg: &[u8]) -> Self::Signature
fn sign(&self, namespace: Option<&[u8]>, msg: &[u8]) -> Self::Signature
Sign a message with the given namespace.
The message should not be hashed prior to calling this function. If a particular scheme requires a payload to be hashed before it is signed, it will be done internally.
A namespace should be used to prevent cross-domain attacks (where a signature can be reused in a different context). It must be prepended to the message so that a signature meant for one context cannot be used unexpectedly in another (i.e. signing a message on the network layer can’t accidentally spend funds on the execution layer). See union_unique for details.
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.