Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
pcapriotti committed Dec 8, 2022
1 parent a8faa13 commit 5ea1140
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions services/brig/src/Brig/API/MLS/KeyPackages.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ where
import Brig.API.Error
import Brig.API.Handler
import Brig.API.MLS.KeyPackages.Validation
import Brig.API.MLS.Util
import Brig.API.Types
import Brig.App
import qualified Brig.Data.Client as Data
Expand All @@ -48,6 +49,7 @@ import Wire.API.User.Client

uploadKeyPackages :: Local UserId -> ClientId -> KeyPackageUpload -> Handler r ()
uploadKeyPackages lusr cid (kpuKeyPackages -> kps) = do
assertMLSEnabled
let identity = mkClientIdentity (qUntagged lusr) cid
kps' <- traverse (validateKeyPackage identity) kps
lift . wrapClient $ Data.insertKeyPackages (tUnqualified lusr) cid kps'
Expand All @@ -57,7 +59,8 @@ claimKeyPackages ::
Qualified UserId ->
Maybe ClientId ->
Handler r KeyPackageBundle
claimKeyPackages lusr target skipOwn =
claimKeyPackages lusr target skipOwn = do
assertMLSEnabled
foldQualified
lusr
(withExceptT clientError . claimLocalKeyPackages (qUntagged lusr) skipOwn)
Expand Down Expand Up @@ -131,7 +134,8 @@ claimRemoteKeyPackages lusr target = do
handleFailure = maybe (throwE (ClientUserNotFound (tUnqualified target))) pure

countKeyPackages :: Local UserId -> ClientId -> Handler r KeyPackageCount
countKeyPackages lusr c =
countKeyPackages lusr c = do
assertMLSEnabled
lift $
KeyPackageCount . fromIntegral
<$> wrapClient (Data.countKeyPackages lusr c)

0 comments on commit 5ea1140

Please sign in to comment.