1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use std::collections::HashSet;

use crate::{
    distribution::{AskForSignatures, DistributionMessagesNew, SignaturesReceived},
    identifier::{DigestIdentifier, KeyIdentifier},
    signature::Signature,
};

use super::approval::TapleMessages;

pub fn create_distribution_request(
    subject_id: DigestIdentifier,
    sn: u64,
    signatures_requested: HashSet<KeyIdentifier>,
    sender_id: KeyIdentifier,
) -> TapleMessages {
    TapleMessages::DistributionMessage(DistributionMessagesNew::ProvideSignatures(
        AskForSignatures {
            subject_id,
            sn,
            signatures_requested,
            sender_id,
        },
    ))
}

pub fn create_distribution_response(
    subject_id: DigestIdentifier,
    sn: u64,
    signatures: HashSet<Signature>,
) -> TapleMessages {
    TapleMessages::DistributionMessage(DistributionMessagesNew::SignaturesReceived(
        SignaturesReceived {
            subject_id,
            sn,
            signatures,
        },
    ))
}