pub struct MessageGroup<ID, OP, PKI, DGM, KMG, ORD> { /* private fields */ }
Expand description
API to manage groups using the “Message Encryption” scheme with strong security guarantees.
Implementations§
Source§impl<ID, OP, PKI, DGM, KMG, ORD> MessageGroup<ID, OP, PKI, DGM, KMG, ORD>where
ID: IdentityHandle,
OP: OperationId,
PKI: IdentityRegistry<ID, PKI::State> + PreKeyRegistry<ID, OneTimeKeyBundle>,
PKI::State: Clone,
DGM: AckedGroupMembership<ID, OP>,
KMG: IdentityManager<KMG::State> + PreKeyManager,
KMG::State: Clone,
ORD: ForwardSecureOrdering<ID, OP, DGM>,
impl<ID, OP, PKI, DGM, KMG, ORD> MessageGroup<ID, OP, PKI, DGM, KMG, ORD>where
ID: IdentityHandle,
OP: OperationId,
PKI: IdentityRegistry<ID, PKI::State> + PreKeyRegistry<ID, OneTimeKeyBundle>,
PKI::State: Clone,
DGM: AckedGroupMembership<ID, OP>,
KMG: IdentityManager<KMG::State> + PreKeyManager,
KMG::State: Clone,
ORD: ForwardSecureOrdering<ID, OP, DGM>,
Sourcepub fn init(
my_id: ID,
my_keys: KMG::State,
pki: PKI::State,
dgm: DGM::State,
orderer: ORD::State,
config: GroupConfig,
) -> GroupState<ID, OP, PKI, DGM, KMG, ORD>
pub fn init( my_id: ID, my_keys: KMG::State, pki: PKI::State, dgm: DGM::State, orderer: ORD::State, config: GroupConfig, ) -> GroupState<ID, OP, PKI, DGM, KMG, ORD>
Returns initial state for messaging group.
This needs to be called before creating or being added to a group.
Sourcepub fn create(
y: GroupState<ID, OP, PKI, DGM, KMG, ORD>,
initial_members: Vec<ID>,
rng: &Rng,
) -> GroupResult<ORD::Message, ID, OP, PKI, DGM, KMG, ORD>
pub fn create( y: GroupState<ID, OP, PKI, DGM, KMG, ORD>, initial_members: Vec<ID>, rng: &Rng, ) -> GroupResult<ORD::Message, ID, OP, PKI, DGM, KMG, ORD>
Creates new group with initial set of members.
Sourcepub fn add(
y: GroupState<ID, OP, PKI, DGM, KMG, ORD>,
added: ID,
rng: &Rng,
) -> GroupResult<ORD::Message, ID, OP, PKI, DGM, KMG, ORD>
pub fn add( y: GroupState<ID, OP, PKI, DGM, KMG, ORD>, added: ID, rng: &Rng, ) -> GroupResult<ORD::Message, ID, OP, PKI, DGM, KMG, ORD>
Adds new member to group.
Sourcepub fn remove(
y: GroupState<ID, OP, PKI, DGM, KMG, ORD>,
removed: ID,
rng: &Rng,
) -> GroupResult<ORD::Message, ID, OP, PKI, DGM, KMG, ORD>
pub fn remove( y: GroupState<ID, OP, PKI, DGM, KMG, ORD>, removed: ID, rng: &Rng, ) -> GroupResult<ORD::Message, ID, OP, PKI, DGM, KMG, ORD>
Removes member from group. It is possible to remove ourselves.
Sourcepub fn update(
y: GroupState<ID, OP, PKI, DGM, KMG, ORD>,
rng: &Rng,
) -> GroupResult<ORD::Message, ID, OP, PKI, DGM, KMG, ORD>
pub fn update( y: GroupState<ID, OP, PKI, DGM, KMG, ORD>, rng: &Rng, ) -> GroupResult<ORD::Message, ID, OP, PKI, DGM, KMG, ORD>
Updates group secret and provides all members with fresh entropy.
Sourcepub fn receive(
y: GroupState<ID, OP, PKI, DGM, KMG, ORD>,
message: &ORD::Message,
rng: &Rng,
) -> GroupResult<Option<GroupOutput<ID, OP, DGM, ORD>>, ID, OP, PKI, DGM, KMG, ORD>
pub fn receive( y: GroupState<ID, OP, PKI, DGM, KMG, ORD>, message: &ORD::Message, rng: &Rng, ) -> GroupResult<Option<GroupOutput<ID, OP, DGM, ORD>>, ID, OP, PKI, DGM, KMG, ORD>
Handler for incoming, remote messages.
This yields a list of “outputs” which can be either control messages which need to be broadcast to all members in the group or decrypted application message payloads.
If we got removed after processing a control message we will receive a “removed” output signal.
Sourcepub fn send(
y: GroupState<ID, OP, PKI, DGM, KMG, ORD>,
plaintext: &[u8],
) -> GroupResult<ORD::Message, ID, OP, PKI, DGM, KMG, ORD>
pub fn send( y: GroupState<ID, OP, PKI, DGM, KMG, ORD>, plaintext: &[u8], ) -> GroupResult<ORD::Message, ID, OP, PKI, DGM, KMG, ORD>
Encrypts application message towards the current group.
The returned message can then be broadcast to all members in the group. The underlying protocol makes sure that all members will be able to decrypt this message.
Sourcepub fn members(
y: &GroupState<ID, OP, PKI, DGM, KMG, ORD>,
) -> Result<HashSet<ID>, GroupError<ID, OP, PKI, DGM, KMG, ORD>>
pub fn members( y: &GroupState<ID, OP, PKI, DGM, KMG, ORD>, ) -> Result<HashSet<ID>, GroupError<ID, OP, PKI, DGM, KMG, ORD>>
Returns a list of all current members in this group from our perspective.