mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-03-31 22:46:27 +00:00
36 lines
1.0 KiB
Haskell
36 lines
1.0 KiB
Haskell
{-# LANGUAGE DataKinds #-}
|
|
{-# LANGUAGE KindSignatures #-}
|
|
{-# LANGUAGE MultiParamTypeClasses #-}
|
|
{-# LANGUAGE NamedFieldPuns #-}
|
|
|
|
module Simplex.Messaging.Server.QueueStore where
|
|
|
|
import Simplex.Messaging.Encoding.String
|
|
import Simplex.Messaging.Protocol
|
|
|
|
data QueueRec = QueueRec
|
|
{ recipientId :: !RecipientId,
|
|
recipientKey :: !RcvPublicVerifyKey,
|
|
rcvDhSecret :: !RcvDhSecret,
|
|
senderId :: !SenderId,
|
|
senderKey :: !(Maybe SndPublicVerifyKey),
|
|
notifier :: !(Maybe NtfCreds),
|
|
status :: !ServerQueueStatus
|
|
}
|
|
deriving (Eq, Show)
|
|
|
|
data NtfCreds = NtfCreds
|
|
{ notifierId :: !NotifierId,
|
|
notifierKey :: !NtfPublicVerifyKey,
|
|
rcvNtfDhSecret :: !RcvNtfDhSecret
|
|
}
|
|
deriving (Eq, Show)
|
|
|
|
instance StrEncoding NtfCreds where
|
|
strEncode NtfCreds {notifierId, notifierKey, rcvNtfDhSecret} = strEncode (notifierId, notifierKey, rcvNtfDhSecret)
|
|
strP = do
|
|
(notifierId, notifierKey, rcvNtfDhSecret) <- strP
|
|
pure NtfCreds {notifierId, notifierKey, rcvNtfDhSecret}
|
|
|
|
data ServerQueueStatus = QueueActive | QueueOff deriving (Eq, Show)
|