-
Notifications
You must be signed in to change notification settings - Fork 324
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GET endpoint for subconversations (#2869)
* Add tge GET subconverstion endpoint * Add golden tests for subconversations * Test injectivity of `initialGroupId` Co-authored-by: Marko Dimjašević <marko.dimjasevic@wire.com> Co-authored-by: Stefan Matting <smatting@users.noreply.github.com>
- Loading branch information
1 parent
64b8d60
commit 72baa93
Showing
40 changed files
with
1,050 additions
and
308 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Introduce a subconversation GET endpoint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Introduce a Galley DB table for subconversations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Support mapping MLS group IDs to subconversations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Introduce an effect for subconversations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
libs/wire-api/test/golden/Test/Wire/API/Golden/Manual/SubConversation.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
-- This file is part of the Wire Server implementation. | ||
-- | ||
-- Copyright (C) 2022 Wire Swiss GmbH <opensource@wire.com> | ||
-- | ||
-- This program is free software: you can redistribute it and/or modify it under | ||
-- the terms of the GNU Affero General Public License as published by the Free | ||
-- Software Foundation, either version 3 of the License, or (at your option) any | ||
-- later version. | ||
-- | ||
-- This program is distributed in the hope that it will be useful, but WITHOUT | ||
-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
-- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more | ||
-- details. | ||
-- | ||
-- You should have received a copy of the GNU Affero General Public License along | ||
-- with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
module Test.Wire.API.Golden.Manual.SubConversation | ||
( testObject_PublicSubConversation_1, | ||
testObject_PublicSubConversation_2, | ||
) | ||
where | ||
|
||
import Data.Domain | ||
import Data.Id | ||
import Data.Qualified | ||
import qualified Data.UUID as UUID | ||
import Imports | ||
import Wire.API.MLS.CipherSuite | ||
import Wire.API.MLS.Credential | ||
import Wire.API.MLS.Epoch | ||
import Wire.API.MLS.Group | ||
import Wire.API.MLS.SubConversation | ||
|
||
subConvId1 :: SubConvId | ||
subConvId1 = SubConvId "test_group" | ||
|
||
subConvId2 :: SubConvId | ||
subConvId2 = SubConvId "call" | ||
|
||
domain :: Domain | ||
domain = Domain "golden.example.com" | ||
|
||
convId :: Qualified ConvId | ||
convId = | ||
Qualified | ||
( Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000100000001")) | ||
) | ||
domain | ||
|
||
testObject_PublicSubConversation_1 :: PublicSubConversation | ||
testObject_PublicSubConversation_1 = | ||
PublicSubConversation | ||
convId | ||
subConvId1 | ||
(GroupId "test_group") | ||
(Epoch 5) | ||
MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519 | ||
[] | ||
|
||
testObject_PublicSubConversation_2 :: PublicSubConversation | ||
testObject_PublicSubConversation_2 = | ||
PublicSubConversation | ||
convId | ||
subConvId2 | ||
(GroupId "test_group_2") | ||
(Epoch 0) | ||
MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519 | ||
[mkClientIdentity user cid] | ||
where | ||
user :: Qualified UserId | ||
user = | ||
Qualified | ||
( Id (fromJust (UUID.fromString "00000000-0000-0007-0000-000a00000002")) | ||
) | ||
domain | ||
cid = ClientId "deadbeef" |
11 changes: 11 additions & 0 deletions
11
libs/wire-api/test/golden/testObject_PublicSubConversation_1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"cipher_suite": 1, | ||
"epoch": 5, | ||
"group_id": "dGVzdF9ncm91cA==", | ||
"members": [], | ||
"parent_qualified_id": { | ||
"domain": "golden.example.com", | ||
"id": "00000000-0000-0001-0000-000100000001" | ||
}, | ||
"subconv_id": "test_group" | ||
} |
17 changes: 17 additions & 0 deletions
17
libs/wire-api/test/golden/testObject_PublicSubConversation_2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"cipher_suite": 1, | ||
"epoch": 0, | ||
"group_id": "dGVzdF9ncm91cF8y", | ||
"members": [ | ||
{ | ||
"client_id": "deadbeef", | ||
"domain": "golden.example.com", | ||
"user_id": "00000000-0000-0007-0000-000a00000002" | ||
} | ||
], | ||
"parent_qualified_id": { | ||
"domain": "golden.example.com", | ||
"id": "00000000-0000-0001-0000-000100000001" | ||
}, | ||
"subconv_id": "call" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
libs/wire-api/test/unit/Test/Wire/API/MLS/SubConversation.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
-- This file is part of the Wire Server implementation. | ||
-- | ||
-- Copyright (C) 2022 Wire Swiss GmbH <opensource@wire.com> | ||
-- | ||
-- This program is free software: you can redistribute it and/or modify it under | ||
-- the terms of the GNU Affero General Public License as published by the Free | ||
-- Software Foundation, either version 3 of the License, or (at your option) any | ||
-- later version. | ||
-- | ||
-- This program is distributed in the hope that it will be useful, but WITHOUT | ||
-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
-- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more | ||
-- details. | ||
-- | ||
-- You should have received a copy of the GNU Affero General Public License along | ||
-- with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
module Test.Wire.API.MLS.SubConversation where | ||
|
||
import Data.Domain | ||
import Data.Id | ||
import Data.Qualified | ||
import Imports | ||
import Test.QuickCheck | ||
import Test.Tasty | ||
import Test.Tasty.QuickCheck | ||
import Wire.API.MLS.SubConversation | ||
|
||
tests :: TestTree | ||
tests = | ||
testGroup | ||
"Subconversation" | ||
[ testProperty "injectivity of the initial group ID mapping" $ | ||
forAll genIds injectiveInitialGroupId | ||
] | ||
where | ||
genIds :: Gen (ConvId, SubConvId, SubConvId) | ||
genIds = do | ||
s1 <- arbitrary | ||
(,,) <$> arbitrary <*> pure s1 <*> arbitrary `suchThat` (/= s1) | ||
|
||
injectiveInitialGroupId :: (ConvId, SubConvId, SubConvId) -> Property | ||
injectiveInitialGroupId (cnv, scnv1, scnv2) = do | ||
let domain = Domain "group.example.com" | ||
lcnv = toLocalUnsafe domain cnv | ||
initialGroupId lcnv scnv1 =/= initialGroupId lcnv scnv2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.