Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/1-api-changes/finalise-v4
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove MLS endpoints from API v4 and finalise it
2 changes: 1 addition & 1 deletion docs/src/developer/developer/api-versioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ are several steps to make apart from deciding what endpoint changes are part of
the version:

- In `wire-api` extend the `Version` type with a new version by appending the
new version to the end, e.g., by adding `V4`.
new version to the end, e.g., by adding `V6`.
- In the same `Version` module update the `developmentVersions` value to list
only the new version,
- Consider updating the `backendApiVersion` value in Stern, which is
Expand Down
2 changes: 1 addition & 1 deletion integration/test/Testlib/Env.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ mkGlobalEnv cfgFile = do
gDomain1 = intConfig.backendOne.originDomain,
gDomain2 = intConfig.backendTwo.originDomain,
gDynamicDomains = (.domain) <$> Map.elems intConfig.dynamicBackends,
gDefaultAPIVersion = 4,
gDefaultAPIVersion = 5,
gManager = manager,
gServicesCwdBase = devEnvProjectRoot <&> (</> "services"),
gRemovalKeyPath = error "Uninitialised removal key path",
Expand Down
3 changes: 3 additions & 0 deletions libs/metrics-wai/src/Data/Metrics/Servant.hs
Original file line number Diff line number Diff line change
Expand Up @@ -154,5 +154,8 @@ instance
where
getRoutes = getRoutes @route <> getRoutes @routes

instance RoutesToPaths EmptyAPI where
getRoutes = mempty

instance RoutesToPaths Raw where
getRoutes = []
9 changes: 9 additions & 0 deletions libs/wire-api/src/Wire/API/Routes/Named.hs
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,12 @@ namedClient ::
(HasEndpoint api endpoint name, HasClient m endpoint) =>
Client m endpoint
namedClient = clientIn (Proxy @endpoint) (Proxy @m)

---------------------------------------------
-- Utility to add a combinator to a Named API

type family x ::> api

type instance
x ::> (Named name api) =
Named name (x :> api)
52 changes: 4 additions & 48 deletions libs/wire-api/src/Wire/API/Routes/Public/Brig.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ import Wire.API.Connection hiding (MissingLegalholdConsent)
import Wire.API.Error
import Wire.API.Error.Brig
import Wire.API.Error.Empty
import Wire.API.MLS.KeyPackage
import Wire.API.MLS.Servant
import Wire.API.MakesFederatedCall
import Wire.API.OAuth
import Wire.API.Properties
Expand Down Expand Up @@ -85,7 +83,6 @@ type BrigAPI =
:<|> UserClientAPI
:<|> ConnectionAPI
:<|> PropertiesAPI
:<|> MLSAPI
:<|> UserHandleAPI
:<|> SearchAPI
:<|> AuthAPI
Expand Down Expand Up @@ -276,6 +273,7 @@ type UserAPI =
:<|> Named
"get-supported-protocols"
( Summary "Get a user's supported protocols"
:> From 'V5
:> ZLocalUser
:> "users"
:> QualifiedCaptureUserId "uid"
Expand Down Expand Up @@ -418,6 +416,7 @@ type SelfAPI =
:<|> Named
"change-supported-protocols"
( Summary "Change your supported protocols"
:> From 'V5
:> ZLocalUser
:> ZConn
:> "self"
Expand Down Expand Up @@ -1100,6 +1099,8 @@ type ConnectionAPI =
:> Get '[Servant.JSON] (SearchResult Contact)
)

-- Properties API -----------------------------------------------------

type PropertiesAPI =
LiftNamed
( ZUser
Expand Down Expand Up @@ -1160,49 +1161,6 @@ type PropertiesAPI =
:> Get '[JSON] PropertyKeysAndValues
)

-- Properties API -----------------------------------------------------

type MLSKeyPackageAPI =
"key-packages"
:> ( Named
"mls-key-packages-upload"
( "self"
:> Summary "Upload a fresh batch of key packages"
:> Description "The request body should be a json object containing a list of base64-encoded key packages."
:> ZLocalUser
:> CanThrow 'MLSProtocolError
:> CanThrow 'MLSIdentityMismatch
:> CaptureClientId "client"
:> ReqBody '[JSON] KeyPackageUpload
:> MultiVerb 'POST '[JSON, MLS] '[RespondEmpty 201 "Key packages uploaded"] ()
)
:<|> Named
"mls-key-packages-claim"
( "claim"
:> Summary "Claim one key package for each client of the given user"
:> MakesFederatedCall 'Brig "claim-key-packages"
:> ZLocalUser
:> QualifiedCaptureUserId "user"
:> QueryParam'
[ Optional,
Strict,
Description "Do not claim a key package for the given own client"
]
"skip_own"
ClientId
:> MultiVerb1 'POST '[JSON] (Respond 200 "Claimed key packages" KeyPackageBundle)
)
:<|> Named
"mls-key-packages-count"
( "self"
:> ZLocalUser
:> CaptureClientId "client"
:> "count"
:> Summary "Return the number of unused key packages for the given client"
:> MultiVerb1 'GET '[JSON] (Respond 200 "Number of key packages" KeyPackageCount)
)
)

-- Search API -----------------------------------------------------

type SearchAPI =
Expand Down Expand Up @@ -1264,8 +1222,6 @@ type SearchAPI =
(SearchResult TeamContact)
)

type MLSAPI = LiftNamed ("mls" :> MLSKeyPackageAPI)

type AuthAPI =
Named
"access"
Expand Down
40 changes: 0 additions & 40 deletions libs/wire-api/src/Wire/API/Routes/Public/Galley/Conversation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ import Wire.API.Conversation.Typing
import Wire.API.Error
import Wire.API.Error.Galley
import Wire.API.Event.Conversation
import Wire.API.MLS.PublicGroupState
import Wire.API.MLS.Servant
import Wire.API.MakesFederatedCall
import Wire.API.OAuth
import Wire.API.Routes.MultiVerb
Expand Down Expand Up @@ -196,27 +194,6 @@ type ConversationAPI =
:> "roles"
:> Get '[Servant.JSON] ConversationRolesList
)
:<|> Named
"get-group-info"
( Summary "Get MLS group information"
:> From 'V4
:> MakesFederatedCall 'Galley "query-group-info"
:> CanThrow 'ConvNotFound
:> CanThrow 'MLSMissingGroupInfo
:> CanThrow 'MLSNotEnabled
:> ZLocalUser
:> "conversations"
:> QualifiedCapture "cnv" ConvId
:> "groupinfo"
:> MultiVerb1
'GET
'[MLS]
( Respond
200
"The group information"
OpaquePublicGroupState
)
)
:<|> Named
"list-conversation-ids-unqualified"
( Summary "[deprecated] Get all local conversation IDs."
Expand Down Expand Up @@ -460,23 +437,6 @@ type ConversationAPI =
:> "self"
:> ConversationVerb
)
:<|> Named
"get-mls-self-conversation"
( Summary "Get the user's MLS self-conversation"
:> From 'V4
:> ZLocalUser
:> "conversations"
:> "mls-self"
:> CanThrow 'MLSNotEnabled
:> MultiVerb1
'GET
'[JSON]
( Respond
200
"The MLS self-conversation"
Conversation
)
)
-- This endpoint can lead to the following events being sent:
-- - ConvCreate event to members
-- TODO: add note: "On 201, the conversation ID is the `Location` header"
Expand Down
8 changes: 4 additions & 4 deletions libs/wire-api/src/Wire/API/Routes/Public/Galley/Feature.hs
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,16 @@ type FeatureAPI =
:<|> FeatureStatusPut '[] '() GuestLinksConfig
:<|> FeatureStatusGet SndFactorPasswordChallengeConfig
:<|> FeatureStatusPut '[] '() SndFactorPasswordChallengeConfig
:<|> FeatureStatusGet MLSConfig
:<|> FeatureStatusPut '[] '() MLSConfig
:<|> From 'V5 ::> FeatureStatusGet MLSConfig
:<|> From 'V5 ::> FeatureStatusPut '[] '() MLSConfig
:<|> FeatureStatusGet ExposeInvitationURLsToTeamAdminConfig
:<|> FeatureStatusPut '[] '() ExposeInvitationURLsToTeamAdminConfig
:<|> FeatureStatusGet SearchVisibilityInboundConfig
:<|> FeatureStatusPut '[] '() SearchVisibilityInboundConfig
:<|> FeatureStatusGet OutlookCalIntegrationConfig
:<|> FeatureStatusPut '[] '() OutlookCalIntegrationConfig
:<|> FeatureStatusGet MlsE2EIdConfig
:<|> FeatureStatusPut '[] '() MlsE2EIdConfig
:<|> From 'V5 ::> FeatureStatusGet MlsE2EIdConfig
:<|> From 'V5 ::> FeatureStatusPut '[] '() MlsE2EIdConfig
:<|> AllFeatureConfigsUserGet
:<|> AllFeatureConfigsTeamGet
:<|> FeatureConfigDeprecatedGet "The usage of this endpoint was removed in iOS in version 3.101. It is not used by team management, or webapp, and is potentially used by the old Android client as of June 2022" LegalholdConfig
Expand Down
153 changes: 2 additions & 151 deletions libs/wire-api/src/Wire/API/Routes/Public/Galley/MLS.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,155 +17,6 @@

module Wire.API.Routes.Public.Galley.MLS where

import Servant hiding (WithStatus)
import Servant.Swagger.Internal.Orphans ()
import Wire.API.Error
import Wire.API.Error.Galley
import Wire.API.Event.Conversation
import Wire.API.MLS.CommitBundle
import Wire.API.MLS.Keys
import Wire.API.MLS.Message
import Wire.API.MLS.Serialisation
import Wire.API.MLS.Servant
import Wire.API.MLS.Welcome
import Wire.API.MakesFederatedCall
import Wire.API.Routes.MultiVerb
import Wire.API.Routes.Named
import Wire.API.Routes.Public
import Wire.API.Routes.Version
import Servant

type MLSMessagingAPI =
Named
"mls-welcome-message"
( Summary "Post an MLS welcome message"
:> Until 'V3
:> MakesFederatedCall 'Galley "mls-welcome"
:> CanThrow 'MLSKeyPackageRefNotFound
:> CanThrow 'MLSNotEnabled
:> "welcome"
:> ZLocalUser
:> ZConn
:> ReqBody '[MLS] (RawMLS Welcome)
:> MultiVerb1 'POST '[JSON] (RespondEmpty 201 "Welcome message sent")
)
:<|> Named
"mls-message-v1"
( Summary "Post an MLS message"
:> MakesFederatedCall 'Galley "on-mls-message-sent"
:> MakesFederatedCall 'Galley "send-mls-message"
:> MakesFederatedCall 'Galley "on-conversation-updated"
:> MakesFederatedCall 'Brig "get-mls-clients"
:> Until 'V2
:> CanThrow 'ConvAccessDenied
:> CanThrow 'ConvMemberNotFound
:> CanThrow 'ConvNotFound
:> CanThrow 'LegalHoldNotEnabled
:> CanThrow 'MLSClientMismatch
:> CanThrow 'MLSCommitMissingReferences
:> CanThrow 'MLSKeyPackageRefNotFound
:> CanThrow 'MLSNotEnabled
:> CanThrow 'MLSProposalNotFound
:> CanThrow 'MLSProtocolErrorTag
:> CanThrow 'MLSSelfRemovalNotAllowed
:> CanThrow 'MLSStaleMessage
:> CanThrow 'MLSUnsupportedMessage
:> CanThrow 'MLSUnsupportedProposal
:> CanThrow 'MLSClientSenderUserMismatch
:> CanThrow 'MLSGroupConversationMismatch
:> CanThrow 'MLSMissingSenderClient
:> CanThrow 'MissingLegalholdConsent
:> CanThrow MLSProposalFailure
:> CanThrow NonFederatingBackends
:> CanThrow UnreachableBackends
:> "messages"
:> ZLocalUser
:> ZOptClient
:> ZConn
:> ReqBody '[MLS] (RawMLS SomeMessage)
:> MultiVerb1 'POST '[JSON] (Respond 201 "Message sent" [Event])
)
:<|> Named
"mls-message"
( Summary "Post an MLS message"
:> MakesFederatedCall 'Galley "on-mls-message-sent"
:> MakesFederatedCall 'Galley "send-mls-message"
:> MakesFederatedCall 'Galley "on-conversation-updated"
:> MakesFederatedCall 'Brig "get-mls-clients"
:> From 'V2
:> CanThrow 'ConvAccessDenied
:> CanThrow 'ConvMemberNotFound
:> CanThrow 'ConvNotFound
:> CanThrow 'LegalHoldNotEnabled
:> CanThrow 'MLSClientMismatch
:> CanThrow 'MLSCommitMissingReferences
:> CanThrow 'MLSKeyPackageRefNotFound
:> CanThrow 'MLSNotEnabled
:> CanThrow 'MLSProposalNotFound
:> CanThrow 'MLSProtocolErrorTag
:> CanThrow 'MLSSelfRemovalNotAllowed
:> CanThrow 'MLSStaleMessage
:> CanThrow 'MLSUnsupportedMessage
:> CanThrow 'MLSUnsupportedProposal
:> CanThrow 'MLSClientSenderUserMismatch
:> CanThrow 'MLSGroupConversationMismatch
:> CanThrow 'MLSMissingSenderClient
:> CanThrow 'MissingLegalholdConsent
:> CanThrow MLSProposalFailure
:> CanThrow NonFederatingBackends
:> CanThrow UnreachableBackends
:> "messages"
:> ZLocalUser
:> ZOptClient
:> ZConn
:> ReqBody '[MLS] (RawMLS SomeMessage)
:> MultiVerb1 'POST '[JSON] (Respond 201 "Message sent" MLSMessageSendingStatus)
)
:<|> Named
"mls-commit-bundle"
( Summary "Post a MLS CommitBundle"
:> MakesFederatedCall 'Galley "on-mls-message-sent"
:> MakesFederatedCall 'Galley "mls-welcome"
:> MakesFederatedCall 'Galley "send-mls-commit-bundle"
:> MakesFederatedCall 'Galley "on-conversation-updated"
:> MakesFederatedCall 'Brig "get-mls-clients"
:> From 'V4
:> CanThrow 'ConvAccessDenied
:> CanThrow 'ConvMemberNotFound
:> CanThrow 'ConvNotFound
:> CanThrow 'LegalHoldNotEnabled
:> CanThrow 'MLSClientMismatch
:> CanThrow 'MLSCommitMissingReferences
:> CanThrow 'MLSKeyPackageRefNotFound
:> CanThrow 'MLSNotEnabled
:> CanThrow 'MLSProposalNotFound
:> CanThrow 'MLSProtocolErrorTag
:> CanThrow 'MLSSelfRemovalNotAllowed
:> CanThrow 'MLSStaleMessage
:> CanThrow 'MLSUnsupportedMessage
:> CanThrow 'MLSUnsupportedProposal
:> CanThrow 'MLSClientSenderUserMismatch
:> CanThrow 'MLSGroupConversationMismatch
:> CanThrow 'MLSMissingSenderClient
:> CanThrow 'MLSWelcomeMismatch
:> CanThrow 'MissingLegalholdConsent
:> CanThrow MLSProposalFailure
:> CanThrow NonFederatingBackends
:> CanThrow UnreachableBackends
:> "commit-bundles"
:> ZLocalUser
:> ZOptClient
:> ZConn
:> ReqBody '[CommitBundleMimeType] CommitBundle
:> MultiVerb1 'POST '[JSON] (Respond 201 "Commit accepted and forwarded" MLSMessageSendingStatus)
)
:<|> Named
"mls-public-keys"
( Summary "Get public keys used by the backend to sign external proposals"
:> From 'V4
:> CanThrow 'MLSNotEnabled
:> "public-keys"
:> ZLocalUser
:> MultiVerb1 'GET '[JSON] (Respond 200 "Public keys" MLSPublicKeys)
)

type MLSAPI = LiftNamed ("mls" :> MLSMessagingAPI)
type MLSAPI = EmptyAPI
1 change: 1 addition & 0 deletions libs/wire-api/src/Wire/API/Routes/Version.hs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ isDevelopmentVersion V0 = False
isDevelopmentVersion V1 = False
isDevelopmentVersion V2 = False
isDevelopmentVersion V3 = False
isDevelopmentVersion V4 = False
isDevelopmentVersion _ = True

developmentVersions :: [Version]
Expand Down
Loading