1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/// Protocol execution ID
///
/// Each protocol execution must have unique execution ID. All signers taking part in the protocol
/// (keygen/signing/etc.) must share the same execution ID, otherwise protocol will abort with
/// unverbose error.
#[derive(Clone, Copy, udigest::Digestable)]
pub struct ExecutionId<'id> {
    #[udigest(as_bytes)]
    id: &'id [u8],
}

impl<'id> ExecutionId<'id> {
    /// Constructs an execution ID from bytes
    pub fn new(eid: &'id [u8]) -> Self {
        Self { id: eid }
    }

    /// Returns bytes that represent an execution ID
    pub fn as_bytes(&self) -> &'id [u8] {
        self.id
    }
}