pub struct EncryptionGroup<ID, OP, PKI, DGM, KMG, ORD> { /* private fields */ }
Expand description
API to manage groups using the “Data Encryption” scheme and process remote control messages.
Implementations§
Source§impl<ID, OP, PKI, DGM, KMG, ORD> EncryptionGroup<ID, OP, PKI, DGM, KMG, ORD>where
ID: IdentityHandle,
OP: OperationId,
PKI: IdentityRegistry<ID, PKI::State> + PreKeyRegistry<ID, LongTermKeyBundle>,
PKI::State: Clone,
DGM: GroupMembership<ID, OP>,
KMG: IdentityManager<KMG::State> + PreKeyManager,
KMG::State: Clone,
ORD: Ordering<ID, OP, DGM>,
impl<ID, OP, PKI, DGM, KMG, ORD> EncryptionGroup<ID, OP, PKI, DGM, KMG, ORD>where
ID: IdentityHandle,
OP: OperationId,
PKI: IdentityRegistry<ID, PKI::State> + PreKeyRegistry<ID, LongTermKeyBundle>,
PKI::State: Clone,
DGM: GroupMembership<ID, OP>,
KMG: IdentityManager<KMG::State> + PreKeyManager,
KMG::State: Clone,
ORD: Ordering<ID, OP, DGM>,
Sourcepub fn init(
my_id: ID,
my_keys: KMG::State,
pki: PKI::State,
dgm: DGM::State,
orderer: ORD::State,
) -> 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, ) -> GroupState<ID, OP, PKI, DGM, KMG, ORD>
Returns initial state for 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 by providing all current members with new group secret.
Sourcepub fn receive(
y: GroupState<ID, OP, PKI, DGM, KMG, ORD>,
message: &ORD::Message,
) -> GroupResult<Vec<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, ) -> GroupResult<Vec<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 payloads.
If we got removed after processing a control message we will receive an “removed” output signal.
Sourcepub fn send(
y: GroupState<ID, OP, PKI, DGM, KMG, ORD>,
plaintext: &[u8],
rng: &Rng,
) -> GroupResult<ORD::Message, ID, OP, PKI, DGM, KMG, ORD>
pub fn send( y: GroupState<ID, OP, PKI, DGM, KMG, ORD>, plaintext: &[u8], rng: &Rng, ) -> GroupResult<ORD::Message, ID, OP, PKI, DGM, KMG, ORD>
Encrypts application payload 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.
Sourcepub fn update_secrets<F>(
y: GroupState<ID, OP, PKI, DGM, KMG, ORD>,
update_fn: F,
) -> GroupState<ID, OP, PKI, DGM, KMG, ORD>
pub fn update_secrets<F>( y: GroupState<ID, OP, PKI, DGM, KMG, ORD>, update_fn: F, ) -> GroupState<ID, OP, PKI, DGM, KMG, ORD>
Applications can remove group secrets for forward secrecy based on their own logic.
Make sure that the ordering implementation and higher-level application logic accounts for error cases where past secrets might not exist anymore.