Skip to content
Draft
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
6 changes: 6 additions & 0 deletions libs/wire-subsystems/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
, aeson-pretty
, amazonka
, amazonka-core
, amazonka-dynamodb
, amazonka-ses
, amazonka-sqs
, amqp
Expand Down Expand Up @@ -68,6 +69,7 @@
, memory
, mime
, mime-mail
, MonadRandom
, network
, network-conduit-tls
, network-uri
Expand Down Expand Up @@ -135,6 +137,7 @@ mkDerivation {
aeson-pretty
amazonka
amazonka-core
amazonka-dynamodb
amazonka-ses
amazonka-sqs
amqp
Expand Down Expand Up @@ -193,6 +196,7 @@ mkDerivation {
memory
mime
mime-mail
MonadRandom
network
network-conduit-tls
network-uri
Expand Down Expand Up @@ -252,6 +256,7 @@ mkDerivation {
aeson-pretty
amazonka
amazonka-core
amazonka-dynamodb
amazonka-ses
amazonka-sqs
amqp
Expand Down Expand Up @@ -308,6 +313,7 @@ mkDerivation {
memory
mime
mime-mail
MonadRandom
network
network-conduit-tls
network-uri
Expand Down
39 changes: 39 additions & 0 deletions libs/wire-subsystems/src/Wire/ClientStore.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{-# LANGUAGE TemplateHaskell #-}

module Wire.ClientStore where

import Data.Id
import Data.Json.Util (UTCTimeMillis)
import Data.Time
import Imports
import Polysemy
import Wire.API.MLS.CipherSuite
import Wire.API.User.Client
import Wire.API.User.Client.Prekey
import Wire.API.UserMap

data DuplicateMLSPublicKey = DuplicateMLSPublicKey

data ClientStore m a where
-- Lifecycle
Upsert :: UserId -> ClientId -> UTCTimeMillis -> NewClient -> ClientStore m (Maybe DuplicateMLSPublicKey)
Delete :: UserId -> ClientId -> ClientStore m ()
UpdateLabel :: UserId -> ClientId -> Maybe Text -> ClientStore m ()
UpdateCapabilities :: UserId -> ClientId -> Maybe ClientCapabilityList -> ClientStore m ()
UpdateLastActive :: UserId -> ClientId -> UTCTime -> ClientStore m ()
-- Lookups
LookupClient :: UserId -> ClientId -> ClientStore m (Maybe Client)
LookupClients :: UserId -> ClientStore m [Client]
LookupClientIds :: UserId -> ClientStore m [ClientId]
LookupClientIdsBulk :: [UserId] -> ClientStore m UserClients
LookupClientsBulk :: [UserId] -> ClientStore m (UserMap (Set Client))
LookupPubClientsBulk :: [UserId] -> ClientStore m (UserMap (Set PubClient))
LookupPrekeyIds :: UserId -> ClientId -> ClientStore m [PrekeyId]
-- Proteus
UpdatePrekeys :: UserId -> ClientId -> [UncheckedPrekeyBundle] -> ClientStore m ()
ClaimPrekey :: UserId -> ClientId -> ClientStore m (Maybe ClientPrekey)
-- MLS
AddMLSPublicKeys :: UserId -> ClientId -> [(SignatureSchemeTag, ByteString)] -> ClientStore m (Maybe DuplicateMLSPublicKey)
LookupMLSPublicKey :: UserId -> ClientId -> SignatureSchemeTag -> ClientStore m (Maybe LByteString)

makeSem ''ClientStore
Loading