Function sign_message

Source
pub fn sign_message<F, T>(
    f: F,
    message: &T,
    pubkey: PublicKey,
) -> Result<Signature, SignError>
where F: SignFn<T>, T: AsRef<TaggedHash>,
Expand description

Signs a TaggedHash computed over the merkle root of message’s TLV stream, checking if it can be verified with the supplied pubkey.

Since message is any type that implements AsRef<TaggedHash>, sign may be a closure that takes a message such as Bolt12Invoice or InvoiceRequest. This allows further message verification before signing its TaggedHash.