Skip to content

Commit a5e246b

Browse files
mdimjasevicelland
authored andcommitted
[FS-919] Support Basic Processing of External Commits (#2765)
* Check external commit criteria - Extract the key package from the update path - Validate key package before replacing the old one * Fix the serialiseMLS instance for `Sender 'MLSPlainText` * Update the mls-test-cli reference * Integration tests for external commits
1 parent 52c4ef2 commit a5e246b

File tree

1 file changed

+58
-0
lines changed
  • services/galley/test/integration/API

1 file changed

+58
-0
lines changed

services/galley/test/integration/API/MLS.hs

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,6 +1050,64 @@ testExternalCommitNewClient = do
10501050

10511051
-- the list of members should be [alice1, bob1]
10521052

1053+
testExternalCommitNotMember :: TestM ()
1054+
testExternalCommitNotMember = do
1055+
[alice, bob] <- createAndConnectUsers (replicate 2 Nothing)
1056+
1057+
runMLSTest $ do
1058+
[alice1, alice2, bob1] <- traverse createMLSClient [alice, alice, bob]
1059+
traverse_ uploadNewKeyPackage [bob1, alice2]
1060+
(_, qcnv) <- setupMLSGroup alice1
1061+
1062+
-- so that we have the public group state
1063+
void $ createAddCommit alice1 [alice] >>= sendAndConsumeCommitBundle
1064+
1065+
pgs <-
1066+
LBS.toStrict . fromJust . responseBody
1067+
<$> getGroupInfo (ciUser alice1) qcnv
1068+
mp <- createExternalCommit bob1 (Just pgs) qcnv
1069+
bundle <- createBundle mp
1070+
postCommitBundle (ciUser (mpSender mp)) bundle
1071+
!!! const 404 === statusCode
1072+
1073+
testExternalCommitSameClient :: TestM ()
1074+
testExternalCommitSameClient = do
1075+
[alice, bob] <- createAndConnectUsers (replicate 2 Nothing)
1076+
1077+
runMLSTest $ do
1078+
[alice1, bob1] <- traverse createMLSClient [alice, bob]
1079+
void $ uploadNewKeyPackage bob1
1080+
(_, qcnv) <- setupMLSGroup alice1
1081+
void $ createAddCommit alice1 [bob] >>= sendAndConsumeCommitBundle
1082+
1083+
let rejoiner = alice1
1084+
ecEvents <- createExternalCommit rejoiner Nothing qcnv >>= sendAndConsumeCommitBundle
1085+
liftIO $
1086+
assertBool "No events after external commit expected" (null ecEvents)
1087+
1088+
message <- createApplicationMessage bob1 "hello"
1089+
void $ sendAndConsumeMessage message
1090+
1091+
testExternalCommitNewClient :: TestM ()
1092+
testExternalCommitNewClient = do
1093+
[alice, bob] <- createAndConnectUsers (replicate 2 Nothing)
1094+
1095+
runMLSTest $ do
1096+
[alice1, bob1] <- traverse createMLSClient [alice, bob]
1097+
void $ uploadNewKeyPackage bob1
1098+
(_, qcnv) <- setupMLSGroup alice1
1099+
void $ createAddCommit alice1 [bob] >>= sendAndConsumeCommitBundle
1100+
1101+
nc <- createMLSClient bob
1102+
ecEvents <- createExternalCommit nc Nothing qcnv >>= sendAndConsumeCommitBundle
1103+
liftIO $
1104+
assertBool "No events after external commit expected" (null ecEvents)
1105+
1106+
message <- createApplicationMessage nc "hello"
1107+
void $ sendAndConsumeMessage message
1108+
1109+
-- the list of members should be [alice1, bob1]
1110+
10531111
testAppMessage :: TestM ()
10541112
testAppMessage = do
10551113
users@(alice : _) <- createAndConnectUsers (replicate 4 Nothing)

0 commit comments

Comments
 (0)