mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-06-03 08:47:32 +00:00
31 lines
1.1 KiB
Haskell
31 lines
1.1 KiB
Haskell
{-# LANGUAGE DataKinds #-}
|
|
{-# LANGUAGE KindSignatures #-}
|
|
{-# LANGUAGE MultiParamTypeClasses #-}
|
|
{-# LANGUAGE NamedFieldPuns #-}
|
|
|
|
module Simplex.Messaging.Server.QueueStore where
|
|
|
|
import Simplex.Messaging.Protocol
|
|
|
|
data QueueRec = QueueRec
|
|
{ recipientId :: RecipientId,
|
|
senderId :: SenderId,
|
|
recipientKey :: RcvPublicVerifyKey,
|
|
rcvSrvSignKey :: RcvPrivateSignKey,
|
|
rcvDhSecret :: RcvDHSecret,
|
|
senderKey :: Maybe SndPublicVerifyKey,
|
|
sndSrvSignKey :: SndPrivateSignKey,
|
|
notifier :: Maybe (NotifierId, NtfPublicVerifyKey),
|
|
status :: QueueStatus
|
|
}
|
|
|
|
data QueueStatus = QueueActive | QueueOff deriving (Eq)
|
|
|
|
class MonadQueueStore s m where
|
|
addQueue :: s -> QueueRec -> m (Either ErrorType ())
|
|
getQueue :: s -> SParty (a :: Party) -> QueueId -> m (Either ErrorType QueueRec)
|
|
secureQueue :: s -> RecipientId -> SndPublicVerifyKey -> m (Either ErrorType ())
|
|
addQueueNotifier :: s -> RecipientId -> NotifierId -> NtfPublicVerifyKey -> m (Either ErrorType ())
|
|
suspendQueue :: s -> RecipientId -> m (Either ErrorType ())
|
|
deleteQueue :: s -> RecipientId -> m (Either ErrorType ())
|