primitives/sharing/
mod.rs1pub mod authenticated;
3pub mod reconstructible;
4pub mod threat_model;
5pub mod unauthenticated;
6
7use std::{
8 fmt::Debug,
9 ops::{Add, Neg, Sub},
10};
11
12pub use authenticated::*;
13pub use reconstructible::Reconstructible;
14use serde::{de::DeserializeOwned, Serialize};
15pub use threat_model::*;
16pub use unauthenticated::*;
17
18pub trait SecretShare:
21 Reconstructible
22 + PlaintextOps<<Self as Reconstructible>::Value>
23 + Clone
24 + Debug
25 + Send
26 + Sync
27 + 'static
28 + PartialEq
29 + Serialize
30 + DeserializeOwned
31 + for<'a> Add<&'a Self, Output = Self>
32 + for<'s> Sub<&'s Self, Output = Self>
33 + Neg<Output = Self>
34{
35}
36
37impl<T> SecretShare for T where
38 T: Reconstructible
39 + PlaintextOps<<Self as Reconstructible>::Value>
40 + Clone
41 + Debug
42 + Send
43 + Sync
44 + 'static
45 + PartialEq
46 + Serialize
47 + DeserializeOwned
48 + for<'a> Add<&'a Self, Output = Self>
49 + for<'a> Sub<&'a Self, Output = Self>
50 + Neg<Output = Self>
51{
52}
53
54pub trait PlaintextOps<Plaintext = <Self as Reconstructible>::Value>: Reconstructible {
59 fn add_plaintext(self, ptx: &Plaintext, is_first_peer: bool) -> Self;
61
62 fn sub_plaintext(self, ptx: &Plaintext, is_first_peer: bool) -> Self;
64}