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