integration-0.1.0
Safe HaskellNone
LanguageGHC2021

MLS.Util

Synopsis

Documentation

data InitMLSClient Source #

Instances

Instances details
Default InitMLSClient Source # 
Instance details

Defined in MLS.Util

createMLSClient :: (MakesValue u, HasCallStack) => InitMLSClient -> u -> App ClientIdentity Source #

Create new mls client and register with backend.

createNewGroup :: HasCallStack => Ciphersuite -> ClientIdentity -> App ConvId Source #

Create conversation and corresponding group.

createNewGroupWith :: HasCallStack => Ciphersuite -> ClientIdentity -> CreateConv -> App ConvId Source #

Create conversation and corresponding group.

createSelfGroup :: HasCallStack => Ciphersuite -> ClientIdentity -> App (String, Value) Source #

Retrieve self conversation and create the corresponding group.

resetOne2OneGroup :: (HasCallStack, MakesValue one2OneConv) => Ciphersuite -> ClientIdentity -> one2OneConv -> App () Source #

An MLS 1:1 group is not created by a client: the backend derives the group id and only materialises the conversation on the first commit. So in place of createGroup, resetOne2OneGroup points the test's MLS state at that group id (this client as the only member, epoch 0) and has mls-cli create the group with the backend's removal key from public_keys of the conversation, which is what makes the backend an accepted external sender.

resetOne2OneGroupGeneric :: (HasCallStack, MakesValue conv, MakesValue keys) => Ciphersuite -> ClientIdentity -> conv -> keys -> App () Source #

Useful when keys are to be taken from main conv and the conv here is the subconv

createAddCommit :: HasCallStack => ClientIdentity -> ConvId -> [Value] -> App MessagePackage Source #

Claim keypackages and create a commit/welcome pair on a given client. Note that this alters the state of the group immediately. If we want to test a scenario where the commit is rejected by the backend, we can restore the group to the previous state by using an older version of the group file.

consumeMessage :: HasCallStack => ConvId -> Ciphersuite -> ClientIdentity -> Maybe MessagePackage -> WebSocket -> App Value Source #

Get a single MLS message from a websocket and consume it. Return a JSON representation of the message.

consumeMessageNoExternal :: HasCallStack => Ciphersuite -> ClientIdentity -> MessagePackage -> WebSocket -> App Value Source #

like consumeMessage but will not consume a message where the sender is the backend

sendAndConsumeMessage :: HasCallStack => MessagePackage -> App Value Source #

Send an MLS message, wait for clients to receive it, then consume it on the client side. If the message is a commit, the sendAndConsumeCommitBundle function should be used instead.

returns response body of postMLSMessage

sendAndConsumeCommitBundleWithProtocol :: HasCallStack => MLSProtocol -> MessagePackage -> App Value Source #

Send an MLS commit bundle, wait for clients to receive it, consume it, and update the test state accordingly.

sendCommitBundle :: HasCallStack => MessagePackage -> App Value Source #

Send an MLS commit bundle, and update the test state accordingly.

createGroupForChannel :: Ciphersuite -> ClientIdentity -> ConvId -> [Value] -> App () Source #

Use this when the user creating the group has not yet joined the channel.

addMembersToChannel :: (HasCallStack, MakesValue user, MakesValue conv) => user -> conv -> AddMembers -> App Response Source #

Adds members to a channel where the user (must be team admin) it not a member of. The difference to the "normal" case is that the users are added to the conversation before they are added to the MLS group.