| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
MLS.Util
Synopsis
- mkClientIdentity :: (MakesValue u, MakesValue c) => u -> c -> App ClientIdentity
- cid2Str :: ClientIdentity -> String
- hid2Str :: String -> String
- mem2Str :: GroupMember -> String
- data MessagePackage = MessagePackage {}
- toRandomFile :: ByteString -> App FilePath
- randomFileName :: App FilePath
- mlscli :: HasCallStack => Maybe ConvId -> Ciphersuite -> ClientIdentity -> [String] -> Maybe ByteString -> App ByteString
- mlscliGroupMem :: HasCallStack => Maybe ConvId -> Ciphersuite -> GroupMember -> [String] -> Maybe ByteString -> App ByteString
- runCli :: HasCallStack => FilePath -> [String] -> Maybe ByteString -> App ByteString
- argSubst :: String -> String -> String -> String
- createWireClient :: (MakesValue u, HasCallStack) => u -> AddClient -> App ClientIdentity
- data InitMLSClient = InitMLSClient {}
- initMLSClient :: InitMLSClient -> ClientIdentity -> App Value
- createMLSClient :: (MakesValue u, HasCallStack) => InitMLSClient -> u -> App ClientIdentity
- uploadNewKeyPackage :: HasCallStack => Ciphersuite -> ClientIdentity -> App String
- generateKeyPackage :: HasCallStack => ClientIdentity -> Ciphersuite -> App (ByteString, String)
- generateHistoryClient :: HasCallStack => ConvId -> Ciphersuite -> App (ByteString, String, String)
- createNewGroup :: HasCallStack => Ciphersuite -> ClientIdentity -> App ConvId
- createNewGroupWith :: HasCallStack => Ciphersuite -> ClientIdentity -> CreateConv -> App ConvId
- createSelfGroup :: HasCallStack => Ciphersuite -> ClientIdentity -> App (String, Value)
- createGroup :: Ciphersuite -> ClientIdentity -> ConvId -> App ()
- deleteGroup :: ConvId -> App MLSConv
- resetGroup :: ClientIdentity -> ConvId -> String -> App ConvId
- createSubConv :: HasCallStack => Ciphersuite -> ConvId -> ClientIdentity -> String -> App ()
- createOne2OneSubConv :: (HasCallStack, MakesValue keys) => Ciphersuite -> ConvId -> ClientIdentity -> String -> keys -> App ()
- resetOne2OneGroup :: (HasCallStack, MakesValue one2OneConv) => Ciphersuite -> ClientIdentity -> one2OneConv -> App ()
- resetOne2OneGroupGeneric :: (HasCallStack, MakesValue conv, MakesValue keys) => Ciphersuite -> ClientIdentity -> conv -> keys -> App ()
- resetClientGroup :: (HasCallStack, MakesValue keys) => Ciphersuite -> ClientIdentity -> String -> ConvId -> keys -> App ()
- keyPackageFile :: HasCallStack => String -> String -> App FilePath
- unbundleKeyPackages :: HasCallStack => Value -> App [(ClientIdentity, ByteString)]
- createAddCommit :: HasCallStack => ClientIdentity -> ConvId -> [Value] -> App MessagePackage
- withTempKeyPackageFile :: ByteString -> ContT a App FilePath
- createAddCommitWithHistoryClient :: HasCallStack => ClientIdentity -> ConvId -> [Value] -> App (MessagePackage, String)
- createAddCommitWithKeyPackages :: HasCallStack => ClientIdentity -> ConvId -> [(ClientIdentity, ByteString)] -> Maybe ByteString -> App MessagePackage
- createRemoveCommit :: HasCallStack => ClientIdentity -> ConvId -> [ClientIdentity] -> App MessagePackage
- createRemoveCommitGroupMember :: HasCallStack => ClientIdentity -> ConvId -> [GroupMember] -> App MessagePackage
- createAddProposals :: HasCallStack => ConvId -> ClientIdentity -> [Value] -> App [MessagePackage]
- createReInitProposal :: HasCallStack => ConvId -> ClientIdentity -> App MessagePackage
- createAddProposalWithKeyPackage :: ConvId -> ClientIdentity -> (ClientIdentity, ByteString) -> App MessagePackage
- createPendingProposalCommit :: HasCallStack => ConvId -> ClientIdentity -> App MessagePackage
- createExternalCommit :: HasCallStack => ConvId -> ClientIdentity -> Maybe ByteString -> App MessagePackage
- data MLSNotificationTag
- consumingMessages :: HasCallStack => MLSProtocol -> MessagePackage -> Codensity App ()
- consumeMessageWithPredicate :: HasCallStack => (Value -> App Bool) -> ConvId -> Ciphersuite -> ClientIdentity -> Maybe MessagePackage -> WebSocket -> App Value
- consumeMessage :: HasCallStack => ConvId -> Ciphersuite -> ClientIdentity -> Maybe MessagePackage -> WebSocket -> App Value
- consumeMessageNoExternal :: HasCallStack => Ciphersuite -> ClientIdentity -> MessagePackage -> WebSocket -> App Value
- mlsCliConsume :: HasCallStack => ConvId -> Ciphersuite -> ClientIdentity -> ByteString -> App ByteString
- sendAndConsumeMessage :: HasCallStack => MessagePackage -> App Value
- sendAndConsumeCommitBundle :: HasCallStack => MessagePackage -> App Value
- sendAndConsumeCommitBundleWithProtocol :: HasCallStack => MLSProtocol -> MessagePackage -> App Value
- sendCommitBundle :: HasCallStack => MessagePackage -> App Value
- consumeWelcome :: HasCallStack => ClientIdentity -> MessagePackage -> WebSocket -> App ()
- fromWelcome :: ConvId -> Ciphersuite -> ClientIdentity -> ByteString -> App ()
- readWelcome :: FilePath -> IO (Maybe ByteString)
- mkBundle :: MessagePackage -> ByteString
- mkGroupInfoMessage :: ByteString -> ByteString
- spawn :: HasCallStack => CreateProcess -> Maybe ByteString -> App ByteString
- getClientGroupState :: HasCallStack => ClientIdentity -> App ClientGroupState
- setClientGroupState :: HasCallStack => ClientIdentity -> ClientGroupState -> App ()
- showMessage :: HasCallStack => Ciphersuite -> ClientIdentity -> ByteString -> App Value
- readGroupState :: HasCallStack => ByteString -> App [(GroupMember, Word32)]
- createApplicationMessage :: HasCallStack => ConvId -> ClientIdentity -> String -> App MessagePackage
- createTransientMessage :: HasCallStack => ConvId -> ClientIdentity -> String -> App MessagePackage
- createTargetedMessage :: HasCallStack => ConvId -> ClientIdentity -> ClientIdentity -> String -> App MessagePackage
- createTransientTargetedMessage :: HasCallStack => ConvId -> ClientIdentity -> ClientIdentity -> String -> App MessagePackage
- leaveConv :: HasCallStack => ConvId -> ClientIdentity -> App ()
- getConv :: HasCallStack => ConvId -> ClientIdentity -> App Value
- getSubConvId :: (MakesValue user, HasCallStack) => user -> ConvId -> String -> App ConvId
- createGroupForChannel :: Ciphersuite -> ClientIdentity -> ConvId -> [Value] -> App ()
- addMembersToChannel :: (HasCallStack, MakesValue user, MakesValue conv) => user -> conv -> AddMembers -> App Response
- removeMemberFromChannel :: HasCallStack => Value -> Value -> Value -> App ()
- resetMLSConversation :: (HasCallStack, MakesValue conv) => ClientIdentity -> conv -> App Value
- withMLSStateReset :: App a -> App a
Documentation
mkClientIdentity :: (MakesValue u, MakesValue c) => u -> c -> App ClientIdentity Source #
cid2Str :: ClientIdentity -> String Source #
mem2Str :: GroupMember -> String Source #
data MessagePackage Source #
Constructors
| MessagePackage | |
Fields
| |
Instances
| Show MessagePackage Source # | |
Defined in MLS.Util Methods showsPrec :: Int -> MessagePackage -> ShowS # show :: MessagePackage -> String # showList :: [MessagePackage] -> ShowS # | |
| Eq MessagePackage Source # | |
Defined in MLS.Util Methods (==) :: MessagePackage -> MessagePackage -> Bool # (/=) :: MessagePackage -> MessagePackage -> Bool # | |
toRandomFile :: ByteString -> App FilePath Source #
mlscli :: HasCallStack => Maybe ConvId -> Ciphersuite -> ClientIdentity -> [String] -> Maybe ByteString -> App ByteString Source #
mlscliGroupMem :: HasCallStack => Maybe ConvId -> Ciphersuite -> GroupMember -> [String] -> Maybe ByteString -> App ByteString Source #
runCli :: HasCallStack => FilePath -> [String] -> Maybe ByteString -> App ByteString Source #
createWireClient :: (MakesValue u, HasCallStack) => u -> AddClient -> App ClientIdentity Source #
data InitMLSClient Source #
Constructors
| InitMLSClient | |
Fields
| |
Instances
| Default InitMLSClient Source # | |
Defined in MLS.Util Methods def :: InitMLSClient Source # | |
initMLSClient :: InitMLSClient -> ClientIdentity -> App Value Source #
createMLSClient :: (MakesValue u, HasCallStack) => InitMLSClient -> u -> App ClientIdentity Source #
Create new mls client and register with backend.
uploadNewKeyPackage :: HasCallStack => Ciphersuite -> ClientIdentity -> App String Source #
create and upload to backend
generateKeyPackage :: HasCallStack => ClientIdentity -> Ciphersuite -> App (ByteString, String) Source #
generateHistoryClient :: HasCallStack => ConvId -> Ciphersuite -> App (ByteString, String, String) Source #
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.
createGroup :: Ciphersuite -> ClientIdentity -> ConvId -> App () Source #
resetGroup :: ClientIdentity -> ConvId -> String -> App ConvId Source #
createSubConv :: HasCallStack => Ciphersuite -> ConvId -> ClientIdentity -> String -> App () Source #
createOne2OneSubConv :: (HasCallStack, MakesValue keys) => Ciphersuite -> ConvId -> ClientIdentity -> String -> keys -> App () Source #
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
resetClientGroup :: (HasCallStack, MakesValue keys) => Ciphersuite -> ClientIdentity -> String -> ConvId -> keys -> App () Source #
keyPackageFile :: HasCallStack => String -> String -> App FilePath Source #
unbundleKeyPackages :: HasCallStack => Value -> App [(ClientIdentity, ByteString)] Source #
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.
withTempKeyPackageFile :: ByteString -> ContT a App FilePath Source #
createAddCommitWithHistoryClient :: HasCallStack => ClientIdentity -> ConvId -> [Value] -> App (MessagePackage, String) Source #
createAddCommitWithKeyPackages :: HasCallStack => ClientIdentity -> ConvId -> [(ClientIdentity, ByteString)] -> Maybe ByteString -> App MessagePackage Source #
createRemoveCommit :: HasCallStack => ClientIdentity -> ConvId -> [ClientIdentity] -> App MessagePackage Source #
createRemoveCommitGroupMember :: HasCallStack => ClientIdentity -> ConvId -> [GroupMember] -> App MessagePackage Source #
createAddProposals :: HasCallStack => ConvId -> ClientIdentity -> [Value] -> App [MessagePackage] Source #
createReInitProposal :: HasCallStack => ConvId -> ClientIdentity -> App MessagePackage Source #
createAddProposalWithKeyPackage :: ConvId -> ClientIdentity -> (ClientIdentity, ByteString) -> App MessagePackage Source #
createPendingProposalCommit :: HasCallStack => ConvId -> ClientIdentity -> App MessagePackage Source #
createExternalCommit :: HasCallStack => ConvId -> ClientIdentity -> Maybe ByteString -> App MessagePackage Source #
data MLSNotificationTag Source #
Constructors
| MLSNotificationMessageTag | |
| MLSNotificationWelcomeTag |
Instances
| Show MLSNotificationTag Source # | |
Defined in MLS.Util Methods showsPrec :: Int -> MLSNotificationTag -> ShowS # show :: MLSNotificationTag -> String # showList :: [MLSNotificationTag] -> ShowS # | |
| Eq MLSNotificationTag Source # | |
Defined in MLS.Util Methods (==) :: MLSNotificationTag -> MLSNotificationTag -> Bool # (/=) :: MLSNotificationTag -> MLSNotificationTag -> Bool # | |
| Ord MLSNotificationTag Source # | |
Defined in MLS.Util Methods compare :: MLSNotificationTag -> MLSNotificationTag -> Ordering # (<) :: MLSNotificationTag -> MLSNotificationTag -> Bool # (<=) :: MLSNotificationTag -> MLSNotificationTag -> Bool # (>) :: MLSNotificationTag -> MLSNotificationTag -> Bool # (>=) :: MLSNotificationTag -> MLSNotificationTag -> Bool # max :: MLSNotificationTag -> MLSNotificationTag -> MLSNotificationTag # min :: MLSNotificationTag -> MLSNotificationTag -> MLSNotificationTag # | |
consumingMessages :: HasCallStack => MLSProtocol -> MessagePackage -> Codensity App () Source #
consumeMessageWithPredicate :: HasCallStack => (Value -> App Bool) -> ConvId -> Ciphersuite -> ClientIdentity -> Maybe MessagePackage -> WebSocket -> App Value Source #
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
mlsCliConsume :: HasCallStack => ConvId -> Ciphersuite -> ClientIdentity -> ByteString -> App ByteString Source #
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.
consumeWelcome :: HasCallStack => ClientIdentity -> MessagePackage -> WebSocket -> App () Source #
fromWelcome :: ConvId -> Ciphersuite -> ClientIdentity -> ByteString -> App () Source #
readWelcome :: FilePath -> IO (Maybe ByteString) Source #
mkBundle :: MessagePackage -> ByteString Source #
spawn :: HasCallStack => CreateProcess -> Maybe ByteString -> App ByteString Source #
setClientGroupState :: HasCallStack => ClientIdentity -> ClientGroupState -> App () Source #
showMessage :: HasCallStack => Ciphersuite -> ClientIdentity -> ByteString -> App Value Source #
readGroupState :: HasCallStack => ByteString -> App [(GroupMember, Word32)] Source #
createApplicationMessage :: HasCallStack => ConvId -> ClientIdentity -> String -> App MessagePackage Source #
createTransientMessage :: HasCallStack => ConvId -> ClientIdentity -> String -> App MessagePackage Source #
createTargetedMessage :: HasCallStack => ConvId -> ClientIdentity -> ClientIdentity -> String -> App MessagePackage Source #
createTransientTargetedMessage :: HasCallStack => ConvId -> ClientIdentity -> ClientIdentity -> String -> App MessagePackage Source #
leaveConv :: HasCallStack => ConvId -> ClientIdentity -> App () Source #
getConv :: HasCallStack => ConvId -> ClientIdentity -> App Value Source #
getSubConvId :: (MakesValue user, HasCallStack) => user -> ConvId -> String -> App ConvId Source #
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.
removeMemberFromChannel :: HasCallStack => Value -> Value -> Value -> App () Source #
resetMLSConversation :: (HasCallStack, MakesValue conv) => ClientIdentity -> conv -> App Value Source #
withMLSStateReset :: App a -> App a Source #