pub trait Signer:
Random
+ 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: &[u8], msg: &[u8]) -> Self::Signature;
// Provided method
fn from_seed(seed: u64) -> Self { ... }
}Expand description
Required Associated Types§
Required Methods§
Sourcefn public_key(&self) -> Self::PublicKey
fn public_key(&self) -> Self::PublicKey
Sourcefn sign(&self, namespace: &[u8], msg: &[u8]) -> Self::Signature
fn sign(&self, namespace: &[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 must 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 commonware_utils::union_unique for details.
Provided Methods§
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.