Skip to content

Commit

Permalink
Fix: Z-Auth mistakingly added to endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
smatting committed Feb 22, 2021
1 parent 18fc922 commit 44fd44a
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions services/brig/src/Brig/API/Public.hs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,6 @@ type ListClientsBulk =

type GetUsersPrekeysClientUnqualified =
Summary "(deprecated) Get a prekey for a specific client of a user."
:> ZAuthServant
:> "users"
:> CaptureUserId "uid"
:> "prekeys"
Expand All @@ -318,7 +317,6 @@ type GetUsersPrekeysClientUnqualified =

type GetUsersPrekeysClientQualified =
Summary "Get a prekey for a specific client of a user."
:> ZAuthServant
:> "users"
:> Capture "domain" Domain
:> CaptureUserId "uid"
Expand All @@ -328,15 +326,13 @@ type GetUsersPrekeysClientQualified =

type GetUsersPrekeyBundleUnqualified =
Summary "(deprecated) Get a prekey for each client of a user."
:> ZAuthServant
:> "users"
:> CaptureUserId "uid"
:> "prekeys"
:> Get '[Servant.JSON] Public.PrekeyBundle

type GetUsersPrekeyBundleQualified =
Summary "Get a prekey for each client of a user."
:> ZAuthServant
:> "users"
:> Capture "domain" Domain
:> CaptureUserId "uid"
Expand All @@ -348,7 +344,6 @@ type GetMultiUserPrekeyBundleUnqualified =
"(deprecated) Given a map of user IDs to client IDs return a \
\prekey for each one. You can't request information for more users than \
\maximum conversation size."
:> ZAuthServant
:> "users"
:> "prekeys"
:> Servant.ReqBody '[Servant.JSON] Public.UserClients
Expand All @@ -359,7 +354,6 @@ type GetMultiUserPrekeyBundleQualified =
"Given a map of user IDs to client IDs return a \
\prekey for each one. You can't request information for more users than \
\maximum conversation size."
:> ZAuthServant
:> "list-prekeys"
:> Servant.ReqBody '[Servant.JSON] Public.QualifiedUserClients
:> Post '[Servant.JSON] (Public.QualifiedUserClientMap (Maybe Public.Prekey))
Expand Down Expand Up @@ -1070,33 +1064,33 @@ listPropertyKeysAndValuesH (u ::: _) = do
keysAndVals <- lift (API.lookupPropertyKeysAndValues u)
pure $ json (keysAndVals :: Public.PropertyKeysAndValues)

getPrekeyUnqualifiedH :: UserId -> UserId -> ClientId -> Handler Public.ClientPrekey
getPrekeyUnqualifiedH _zUser user client = do
getPrekeyUnqualifiedH :: UserId -> ClientId -> Handler Public.ClientPrekey
getPrekeyUnqualifiedH user client = do
domain <- viewFederationDomain
ifNothing (notFound "prekey not found") =<< lift (API.claimPrekey user domain client)

getPrekeyH :: UserId -> Domain -> UserId -> ClientId -> Handler Public.ClientPrekey
getPrekeyH _zUser domain user client = do
getPrekeyH :: Domain -> UserId -> ClientId -> Handler Public.ClientPrekey
getPrekeyH domain user client = do
ifNothing (notFound "prekey not found") =<< lift (API.claimPrekey user domain client)

getPrekeyBundleUnqualifiedH :: UserId -> UserId -> Handler Public.PrekeyBundle
getPrekeyBundleUnqualifiedH _zUser uid = do
getPrekeyBundleUnqualifiedH :: UserId -> Handler Public.PrekeyBundle
getPrekeyBundleUnqualifiedH uid = do
domain <- viewFederationDomain
API.claimPrekeyBundle domain uid !>> clientError

getPrekeyBundleH :: UserId -> Domain -> UserId -> Handler Public.PrekeyBundle
getPrekeyBundleH _zUser domain uid =
getPrekeyBundleH :: Domain -> UserId -> Handler Public.PrekeyBundle
getPrekeyBundleH domain uid =
API.claimPrekeyBundle domain uid !>> clientError

getMultiUserPrekeyBundleUnqualifiedH :: UserId -> Public.UserClients -> Handler (Public.UserClientMap (Maybe Public.Prekey))
getMultiUserPrekeyBundleUnqualifiedH _zUserId userClients = do
getMultiUserPrekeyBundleUnqualifiedH :: Public.UserClients -> Handler (Public.UserClientMap (Maybe Public.Prekey))
getMultiUserPrekeyBundleUnqualifiedH userClients = do
maxSize <- fromIntegral . setMaxConvSize <$> view settings
when (Map.size (Public.userClients userClients) > maxSize) $
throwStd tooManyClients
API.claimMultiPrekeyBundlesLocal userClients !>> clientError

getMultiUserPrekeyBundleH :: UserId -> Public.QualifiedUserClients -> Handler (Public.QualifiedUserClientMap (Maybe Public.Prekey))
getMultiUserPrekeyBundleH _zUserId qualUserClients = do
getMultiUserPrekeyBundleH :: Public.QualifiedUserClients -> Handler (Public.QualifiedUserClientMap (Maybe Public.Prekey))
getMultiUserPrekeyBundleH qualUserClients = do
maxSize <- fromIntegral . setMaxConvSize <$> view settings
let Sum (size :: Int) =
Map.foldMapWithKey
Expand Down

0 comments on commit 44fd44a

Please sign in to comment.