module Wire.API.Routes.Public.Galley.MLS where
import Servant
import Servant.OpenApi.Internal.Orphans ()
import Wire.API.Error
import Wire.API.Error.Galley
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.Routes.MultiVerb
import Wire.API.Routes.Named
import Wire.API.Routes.Public
import Wire.API.Routes.Version
type MLSMessagingAPI =
Named
"mls-message"
( Summary "Post an MLS message"
:> From 'V5
:> CanThrow 'ConvAccessDenied
:> CanThrow 'ConvMemberNotFound
:> CanThrow 'ConvNotFound
:> CanThrow 'LegalHoldNotEnabled
:> CanThrow 'MissingLegalholdConsent
:> CanThrow 'MLSClientMismatch
:> CanThrow 'MLSClientSenderUserMismatch
:> CanThrow 'MLSCommitMissingReferences
:> CanThrow 'MLSGroupConversationMismatch
:> CanThrow 'MLSInvalidLeafNodeIndex
:> CanThrow 'MLSNotEnabled
:> CanThrow 'MLSProposalNotFound
:> CanThrow 'MLSProtocolErrorTag
:> CanThrow 'MLSSelfRemovalNotAllowed
:> CanThrow 'MLSStaleMessage
:> CanThrow 'MLSSubConvClientNotInParent
:> CanThrow 'MLSUnsupportedMessage
:> CanThrow 'MLSUnsupportedProposal
:> CanThrow MLSProposalFailure
:> CanThrow NonFederatingBackends
:> CanThrow UnreachableBackends
:> "messages"
:> ZLocalUser
:> ZClient
:> ZConn
:> ReqBody '[MLS] (RawMLS Message)
:> MultiVerb1 'POST '[JSON] (Respond 201 "Message sent" MLSMessageSendingStatus)
)
:<|> Named
"mls-commit-bundle"
( Summary "Post a MLS CommitBundle"
:> From V5
:> CanThrow ConvAccessDenied
:> CanThrow ConvMemberNotFound
:> CanThrow ConvNotFound
:> CanThrow LegalHoldNotEnabled
:> CanThrow MissingLegalholdConsent
:> CanThrow MLSClientMismatch
:> CanThrow MLSClientSenderUserMismatch
:> CanThrow MLSCommitMissingReferences
:> CanThrow MLSGroupConversationMismatch
:> CanThrow MLSInvalidLeafNodeIndex
:> CanThrow MLSNotEnabled
:> CanThrow MLSProposalNotFound
:> CanThrow MLSProtocolErrorTag
:> CanThrow MLSSelfRemovalNotAllowed
:> CanThrow MLSStaleMessage
:> CanThrow MLSSubConvClientNotInParent
:> CanThrow MLSUnsupportedMessage
:> CanThrow MLSUnsupportedProposal
:> CanThrow MLSWelcomeMismatch
:> CanThrow MLSLegalholdIncompatible
:> CanThrow MLSProposalFailure
:> CanThrow NonFederatingBackends
:> CanThrow UnreachableBackends
:> "commit-bundles"
:> ZLocalUser
:> ZClient
:> ZConn
:> ReqBody '[MLS] (RawMLS 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"
:> Description
"The format of the returned key is determined by the `format` query parameter:\n\
\ - raw (default): base64-encoded raw public keys\n\
\ - jwk: keys are nested objects in JWK format."
:> From 'V5
:> CanThrow 'MLSNotEnabled
:> "public-keys"
:> ZLocalUser
:> QueryParam "format" MLSPublicKeyFormat
:> MultiVerb1
'GET
'[JSON]
( Respond
200
"Public keys"
(MLSKeysByPurpose (MLSKeys SomeKey))
)
)
type MLSAPI = LiftNamed ("mls" :> MLSMessagingAPI)