pub fn sign_submit(
    content: HttpSubmitContent,
    sender: &Sender,
) -> Result<(HttpRequestEnvelope<HttpSubmitContent>, MessageId), Box<dyn Error>> {
    // Open question: should this also set the `sender` field of the `content`? The
    // two are linked, but it's a bit weird for a function that presents itself
    // as 'wrapping a content into an envelope' to mess up with the content.

    let message_id = match &content {
        HttpSubmitContent::Call { update } => update.id(),
    };

    let pub_key_der = sender.sender_pubkey_der().map(Blob);
    let sender_sig = sender.sign_message_id(&message_id)?.map(Blob);

    let envelope = HttpRequestEnvelope::<HttpSubmitContent> {
        content,
        sender_pubkey: pub_key_der,
        sender_sig,
        sender_delegation: None,
    };
    Ok((envelope, message_id))
}
/// Wraps the content into an envelope that contains the message signature.
///
/// Prerequisite: `content` contains a `sender` field that is compatible with
/// the `keypair` argument.
Wraps the content into an envelope that contains the message signature.
Wraps the content into an envelope that contains the message signature .
pub fn sign_submit(
    content: HttpSubmitContent,
    sender: &Sender,
) -> Result<(HttpRequestEnvelope<HttpSubmitContent>, MessageId), Box<dyn Error>> {
    // Open question: should this also set the `sender` field of the `content`? The
    // two are linked, but it's a bit weird for a function that presents itself
    // as 'wrapping a content into an envelope' to mess up with the content.
    let message_id = match &content {
        HttpSubmitContent::Call { update } => update.id(),
    };
    let pub_key_der = sender.sender_pubkey_der().map(Blob);
    let sender_sig = sender.sign_message_id(&message_id)?.map(Blob);
    let envelope = HttpRequestEnvelope::<HttpSubmitContent> {
        content,
        sender_pubkey: pub_key_der,
        sender_sig,
        sender_delegation: None,
    };
    Ok((envelope, message_id))
}
pub fn sign_submit ( content : HttpSubmitContent , sender : & Sender , ) -> Result < ( HttpRequestEnvelope < HttpSubmitContent > , MessageId ) , Box < dyn Error > > { // Open question: should this also set the `sender` field of the `content`? The // two are linked, but it's a bit weird for a function that presents itself // as 'wrapping a content into an envelope' to mess up with the content. let message_id = match & content { HttpSubmitContent :: Call { update } => update . id ( ) , } ; let pub_key_der = sender . sender_pubkey_der ( ) . map ( Blob ) ; let sender_sig = sender . sign_message_id ( & message_id ) ? . map ( Blob ) ; let envelope = HttpRequestEnvelope :: < HttpSubmitContent > { content , sender_pubkey : pub_key_der , sender_sig , sender_delegation : None , } ; Ok ( ( envelope , message_id ) ) }
Wraps the content into an envelope that contains the message signature.
Wraps the content into an envelope that contains the message signature .
content
HttpSubmitContent
sender
&Sender
content
HttpSubmitContent
sender
&Sender