-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | SimpleXMQ message broker
--   
--   This package includes <a>server</a>, <a>client</a> and <a>agent</a>
--   for SMP protocols:
--   
--   <ul>
--   <li><a>SMP protocol</a></li>
--   <li><a>SMP agent protocol</a></li>
--   </ul>
--   
--   See <a>terminal chat prototype</a> built with SimpleXMQ broker.
@package simplexmq
@version 6.5.0.16

module Simplex.FileTransfer.Chunks
serverChunkSizes :: [Word32]
chunkSize0 :: Word32
chunkSize1 :: Word32
chunkSize2 :: Word32
chunkSize3 :: Word32
kb :: Integral a => a -> a
toKB :: Integral a => a -> a
mb :: Integral a => a -> a
gb :: Integral a => a -> a

module Simplex.Messaging.Agent.Lock
type Lock = TMVar Text
createLock :: STM Lock
createLockIO :: IO Lock
withLock :: MonadUnliftIO m => Lock -> Text -> ExceptT e m a -> ExceptT e m a
withLock' :: MonadUnliftIO m => Lock -> Text -> m a -> m a
withGetLock :: MonadUnliftIO m => (k -> STM Lock) -> k -> Text -> m a -> m a
withGetLocks :: MonadUnliftIO m => (k -> STM Lock) -> Set k -> Text -> m a -> m a
getPutLock :: (k -> STM Lock) -> k -> Text -> STM Lock

module Simplex.Messaging.Agent.Store.Postgres.Options
data DBOpts
DBOpts :: ByteString -> ByteString -> Natural -> Bool -> DBOpts
[connstr] :: DBOpts -> ByteString
[schema] :: DBOpts -> ByteString
[poolSize] :: DBOpts -> Natural
[createSchema] :: DBOpts -> Bool
instance GHC.Show.Show Simplex.Messaging.Agent.Store.Postgres.Options.DBOpts

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20220101_initial
m20220101_initial :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20220301_snd_queue_keys
m20220301_snd_queue_keys :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20220322_notifications
m20220322_notifications :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20220608_v2
m20220608_v2 :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20220625_v2_ntf_mode
m20220625_v2_ntf_mode :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20220811_onion_hosts
m20220811_onion_hosts :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20220817_connection_ntfs
m20220817_connection_ntfs :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20220905_commands
m20220905_commands :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20220915_connection_queues
m20220915_connection_queues :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20230110_users
m20230110_users :: Query
new_m20230110_users :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20230117_fkey_indexes
m20230117_fkey_indexes :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20230120_delete_errors
m20230120_delete_errors :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20230217_server_key_hash
m20230217_server_key_hash :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20230223_files
m20230223_files :: Query
down_m20230223_files :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20230320_retry_state
m20230320_retry_state :: Query
down_m20230320_retry_state :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20230401_snd_files
m20230401_snd_files :: Query
down_m20230401_snd_files :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20230510_files_pending_replicas_indexes
m20230510_files_pending_replicas_indexes :: Query
down_m20230510_files_pending_replicas_indexes :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20230516_encrypted_rcv_message_hashes
m20230516_encrypted_rcv_message_hashes :: Query
down_m20230516_encrypted_rcv_message_hashes :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20230531_switch_status
m20230531_switch_status :: Query
down_m20230531_switch_status :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20230615_ratchet_sync
m20230615_ratchet_sync :: Query
down_m20230615_ratchet_sync :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20230701_delivery_receipts
m20230701_delivery_receipts :: Query
down_m20230701_delivery_receipts :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20230720_delete_expired_messages
m20230720_delete_expired_messages :: Query
down_m20230720_delete_expired_messages :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20230722_indexes
m20230722_indexes :: Query
down_m20230722_indexes :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20230814_indexes
m20230814_indexes :: Query
down_m20230814_indexes :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20230829_crypto_files
m20230829_crypto_files :: Query
down_m20230829_crypto_files :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20231222_command_created_at
m20231222_command_created_at :: Query
down_m20231222_command_created_at :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20231225_failed_work_items
m20231225_failed_work_items :: Query
down_m20231225_failed_work_items :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20240121_message_delivery_indexes
m20240121_message_delivery_indexes :: Query
down_m20240121_message_delivery_indexes :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20240124_file_redirect
m20240124_file_redirect :: Query
down_m20240124_file_redirect :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20240223_connections_wait_delivery
m20240223_connections_wait_delivery :: Query
down_m20240223_connections_wait_delivery :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20240225_ratchet_kem
m20240225_ratchet_kem :: Query
down_m20240225_ratchet_kem :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20240417_rcv_files_approved_relays
m20240417_rcv_files_approved_relays :: Query
down_m20240417_rcv_files_approved_relays :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20240624_snd_secure
m20240624_snd_secure :: Query
down_m20240624_snd_secure :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20240702_servers_stats
m20240702_servers_stats :: Query
down_m20240702_servers_stats :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20240930_ntf_tokens_to_delete
m20240930_ntf_tokens_to_delete :: Query
down_m20240930_ntf_tokens_to_delete :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20241007_rcv_queues_last_broker_ts
m20241007_rcv_queues_last_broker_ts :: Query
down_m20241007_rcv_queues_last_broker_ts :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20241224_ratchet_e2e_snd_params
m20241224_ratchet_e2e_snd_params :: Query
down_m20241224_ratchet_e2e_snd_params :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20250203_msg_bodies
m20250203_msg_bodies :: Query
down_m20250203_msg_bodies :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20250322_short_links
m20250322_short_links :: Query
down_m20250322_short_links :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20250702_conn_invitations_remove_cascade_delete
m20250702_conn_invitations_remove_cascade_delete :: Query
down_m20250702_conn_invitations_remove_cascade_delete :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20251009_queue_to_subscribe
m20251009_queue_to_subscribe :: Query
down_m20251009_queue_to_subscribe :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20251010_client_notices
m20251010_client_notices :: Query
down_m20251010_client_notices :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20251230_strict_tables
m20251230_strict_tables :: Query
down_m20251230_strict_tables :: Query

module Simplex.Messaging.Agent.Store.SQLite.Migrations.M20260410_receive_attempts
m20260410_receive_attempts :: Query
down_m20260410_receive_attempts :: Query

module Simplex.Messaging.Agent.Store.SQLite.Util
type SQLiteFunc = Ptr CContext -> CArgCount -> Ptr (Ptr CValue) -> IO ()
type SQLiteFuncFinal = Ptr CContext -> IO ()
mkSQLiteFunc :: (FuncContext -> FuncArgs -> IO ()) -> SQLiteFunc
mkSQLiteAggStep :: a -> (FuncContext -> FuncArgs -> a -> IO a) -> SQLiteFunc
mkSQLiteAggFinal :: a -> (FuncContext -> a -> IO ()) -> SQLiteFuncFinal
createStaticFunction :: Database -> ByteString -> CArgCount -> Bool -> FunPtr SQLiteFunc -> IO (Either Error ())
createStaticAggregate :: Database -> ByteString -> CArgCount -> FunPtr SQLiteFunc -> FunPtr SQLiteFuncFinal -> IO (Either Error ())

module Simplex.Messaging.Crypto.SNTRUP761.Bindings.Defines
c_SNTRUP761_SECRETKEY_SIZE :: Int
c_SNTRUP761_PUBLICKEY_SIZE :: Int
c_SNTRUP761_CIPHERTEXT_SIZE :: Int
c_SNTRUP761_SIZE :: Int

module Simplex.Messaging.Server.Expiration
data ExpirationConfig
ExpirationConfig :: Int64 -> Int64 -> ExpirationConfig
[ttl] :: ExpirationConfig -> Int64
[checkInterval] :: ExpirationConfig -> Int64
expireBeforeEpoch :: ExpirationConfig -> IO Int64
showTTL :: Int64 -> String

module Simplex.Messaging.Server.Main.GitCommit
gitCommit :: Q Exp

module Simplex.Messaging.Server.StoreLog.Types

-- | opaque container for file handle with a type-safe IOMode constructors
--   are not exported, openWriteStoreLog and openReadStoreLog should be
--   used instead
data StoreLog (a :: IOMode)
[ReadStoreLog] :: FilePath -> Handle -> StoreLog 'ReadMode
[WriteStoreLog] :: FilePath -> Handle -> StoreLog 'WriteMode

module Simplex.Messaging.TMap
type TMap k a = TVar (Map k a)
emptyIO :: IO (TMap k a)
singleton :: k -> a -> STM (TMap k a)
clear :: TMap k a -> STM ()
null :: TMap k a -> STM Bool
lookup :: Ord k => k -> TMap k a -> STM (Maybe a)
lookupIO :: Ord k => k -> TMap k a -> IO (Maybe a)
member :: Ord k => k -> TMap k a -> STM Bool
memberIO :: Ord k => k -> TMap k a -> IO Bool
insert :: Ord k => k -> a -> TMap k a -> STM ()
insertM :: Ord k => k -> STM a -> TMap k a -> STM ()
delete :: Ord k => k -> TMap k a -> STM ()
lookupInsert :: Ord k => k -> a -> TMap k a -> STM (Maybe a)
lookupDelete :: Ord k => k -> TMap k a -> STM (Maybe a)
adjust :: Ord k => (a -> a) -> k -> TMap k a -> STM ()
update :: Ord k => (a -> Maybe a) -> k -> TMap k a -> STM ()
alter :: Ord k => (Maybe a -> Maybe a) -> k -> TMap k a -> STM ()
alterF :: Ord k => (Maybe a -> STM (Maybe a)) -> k -> TMap k a -> STM ()
union :: Ord k => Map k a -> TMap k a -> STM ()

module Simplex.Messaging.Transport.Buffer
data TBuffer
TBuffer :: TVar ByteString -> TMVar () -> TBuffer
[buffer] :: TBuffer -> TVar ByteString
[getLock] :: TBuffer -> TMVar ()
newTBuffer :: IO TBuffer

-- | Attempt to read some bytes, appending it to the existing buffer
peekBuffered :: TBuffer -> Int -> IO ByteString -> IO (ByteString, Maybe ByteString)
getBuffered :: TBuffer -> Int -> Maybe Int -> IO ByteString -> IO ByteString
withTimedErr :: Maybe Int -> IO a -> IO a
getLnBuffered :: TBuffer -> IO ByteString -> IO ByteString

-- | Trim trailing CR from ByteString.
trimCR :: ByteString -> ByteString

module Simplex.Messaging.Transport.HTTP2.File
fileBlockSize :: Int
hReceiveFile :: (Int -> IO ByteString) -> Handle -> Word32 -> IO Int64
hSendFile :: Handle -> (Builder -> IO ()) -> Word32 -> IO ()
getFileChunk :: Handle -> Word32 -> IO ByteString

module Simplex.Messaging.Transport.Shared
data ChainCertificates
CCEmpty :: ChainCertificates
CCSelf :: SignedCertificate -> ChainCertificates
CCValid :: SignedCertificate -> SignedCertificate -> SignedCertificate -> ChainCertificates
[leafCert] :: ChainCertificates -> SignedCertificate
[idCert] :: ChainCertificates -> SignedCertificate
[caCert] :: ChainCertificates -> SignedCertificate
CCLong :: ChainCertificates
chainIdCaCerts :: CertificateChain -> ChainCertificates
x509validate :: SignedCertificate -> (HostName, ByteString) -> CertificateChain -> IO [FailedReason]
takePeerCertChain :: TMVar (Maybe CertificateChain) -> IO CertificateChain

module Simplex.Messaging.Util
class Show e => AnyError e
fromSomeException :: AnyError e => SomeException -> e
(<$?>) :: MonadFail m => (a -> Either String b) -> m a -> m b
infixl 4 <$?>
($>>) :: (Monad m, Monad f, Traversable f) => m (f a) -> m (f b) -> m (f b)
infixl 1 $>>
(<$$) :: (Functor f, Functor g) => b -> f (g a) -> f (g b)
infixl 4 <$$
(<$$>) :: (Functor f, Functor g) => (a -> b) -> f (g a) -> f (g b)
infixl 4 <$$>
raceAny_ :: MonadUnliftIO m => [m a] -> m ()
bshow :: Show a => a -> ByteString
tshow :: Show a => a -> Text
maybeWord :: (a -> ByteString) -> Maybe a -> ByteString
liftError :: MonadIO m => (e -> e') -> ExceptT e IO a -> ExceptT e' m a
liftError' :: MonadIO m => (e -> e') -> IO (Either e a) -> ExceptT e' m a
liftEitherWith :: MonadIO m => (e -> e') -> Either e a -> ExceptT e' m a
ifM :: Monad m => m Bool -> m a -> m a -> m a
whenM :: Monad m => m Bool -> m () -> m ()
unlessM :: Monad m => m Bool -> m () -> m ()
anyM :: Monad m => [m Bool] -> m Bool
($>>=) :: (Monad m, Monad f, Traversable f) => m (f a) -> (a -> m (f b)) -> m (f b)
infixl 1 $>>=
mapME :: (Monad m, Traversable t) => (a -> m (Either e b)) -> t (Either e a) -> m (t (Either e b))
bindRight :: Monad m => (a -> m (Either e b)) -> Either e a -> m (Either e b)
forME :: (Monad m, Traversable t) => t (Either e a) -> (a -> m (Either e b)) -> m (t (Either e b))

-- | Monadic version of mapAccumL Copied from ghc-9.6.3 package:
--   <a>https://hackage.haskell.org/package/ghc-9.12.1/docs/GHC-Utils-Monad.html#v:mapAccumLM</a>
--   for backward compatibility with 8.10.7.
mapAccumLM :: (Monad m, Traversable t) => (acc -> x -> m (acc, y)) -> acc -> t x -> m (acc, t y)
mapAccumLM_List :: Monad m => (acc -> x -> m (acc, y)) -> acc -> [x] -> m (acc, [y])
mapAccumLM_NonEmpty :: Monad m => (acc -> x -> m (acc, y)) -> acc -> NonEmpty x -> m (acc, NonEmpty y)
tryWriteTBQueue :: TBQueue a -> a -> STM Bool
catchAll :: IO a -> (SomeException -> IO a) -> IO a
catchAll_ :: IO a -> IO a -> IO a
tryAllErrors :: (AnyError e, MonadUnliftIO m) => ExceptT e m a -> ExceptT e m (Either e a)
tryAllErrors' :: (AnyError e, MonadUnliftIO m) => ExceptT e m a -> m (Either e a)
catchAllErrors :: (AnyError e, MonadUnliftIO m) => ExceptT e m a -> (e -> ExceptT e m a) -> ExceptT e m a
catchAllErrors' :: (AnyError e, MonadUnliftIO m) => ExceptT e m a -> (e -> m a) -> m a
catchThrow :: MonadUnliftIO m => ExceptT e m a -> (SomeException -> e) -> ExceptT e m a
allFinally :: (AnyError e, MonadUnliftIO m) => ExceptT e m a -> ExceptT e m b -> ExceptT e m a
isOwnException :: SomeException -> Bool
isAsyncCancellation :: SomeException -> Bool
catchOwn' :: IO a -> (SomeException -> IO a) -> IO a
catchOwn :: MonadUnliftIO m => m a -> (SomeException -> m a) -> m a
tryAllOwnErrors :: (AnyError e, MonadUnliftIO m) => ExceptT e m a -> ExceptT e m (Either e a)
tryAllOwnErrors' :: (AnyError e, MonadUnliftIO m) => ExceptT e m a -> m (Either e a)
catchAllOwnErrors :: (AnyError e, MonadUnliftIO m) => ExceptT e m a -> (e -> ExceptT e m a) -> ExceptT e m a
catchAllOwnErrors' :: (AnyError e, MonadUnliftIO m) => ExceptT e m a -> (e -> m a) -> m a
eitherToMaybe :: Either a b -> Maybe b
listToEither :: e -> [a] -> Either e a
firstRow :: (a -> b) -> e -> IO [a] -> IO (Either e b)
maybeFirstRow :: Functor f => (a -> b) -> f [a] -> f (Maybe b)
maybeFirstRow' :: Functor f => b -> (a -> b) -> f [a] -> f b
firstRow' :: (a -> Either e b) -> e -> IO [a] -> IO (Either e b)
groupOn :: Eq k => (a -> k) -> [a] -> [[a]]
groupOn' :: Eq k => (a -> k) -> [a] -> [NonEmpty a]
eqOn :: Eq k => (a -> k) -> a -> a -> Bool
groupAllOn :: Ord k => (a -> k) -> [a] -> [[a]]
toChunks :: Int -> [a] -> [NonEmpty a]
safeDecodeUtf8 :: ByteString -> Text
timeoutThrow :: MonadUnliftIO m => e -> Int -> ExceptT e m a -> ExceptT e m a
threadDelay' :: Int64 -> IO ()
diffToMicroseconds :: NominalDiffTime -> Int64
diffToMilliseconds :: NominalDiffTime -> Int64
labelMyThread :: MonadIO m => String -> m ()
atomicModifyIORef'_ :: IORef a -> (a -> a) -> IO ()
encodeJSON :: ToJSON a => a -> Text
decodeJSON :: FromJSON a => Text -> Maybe a
traverseWithKey_ :: Monad m => (k -> v -> m ()) -> Map k v -> m ()

module Simplex.Messaging.Session
data SessionVar a
SessionVar :: TMVar a -> Int -> UTCTime -> SessionVar a
[sessionVar] :: SessionVar a -> TMVar a
[sessionVarId] :: SessionVar a -> Int
[sessionVarTs] :: SessionVar a -> UTCTime
getSessVar :: forall k a. Ord k => TVar Int -> k -> TMap k (SessionVar a) -> UTCTime -> STM (Either (SessionVar a) (SessionVar a))
removeSessVar :: Ord k => SessionVar a -> k -> TMap k (SessionVar a) -> STM ()
tryReadSessVar :: Ord k => k -> TMap k (SessionVar a) -> STM (Maybe a)

module Simplex.Messaging.Parsers
base64P :: Parser ByteString
parse :: Parser a -> e -> ByteString -> Either e a
parseAll :: Parser a -> ByteString -> Either String a
parseE :: (String -> e) -> Parser a -> ByteString -> ExceptT e IO a
parseE' :: (String -> e) -> Parser a -> ByteString -> ExceptT e IO a
parseRead1 :: Read a => Parser a
parseString :: (ByteString -> Either String a) -> String -> a
fstToLower :: String -> String
dropPrefix :: String -> String -> String
enumJSON :: (String -> String) -> Options
sumTypeJSON :: (String -> String) -> Options
taggedObjectJSON :: (String -> String) -> Options
singleFieldJSON :: (String -> String) -> Options
singleFieldJSON_ :: Maybe String -> (String -> String) -> Options
defaultJSON :: Options
textP :: Parser String
pattern SingleFieldJSONTag :: (Eq a, IsString a) => a
pattern TaggedObjectJSONTag :: (Eq a, IsString a) => a
pattern TaggedObjectJSONData :: (Eq a, IsString a) => a

module Simplex.Messaging.Transport.KeepAlive
data KeepAliveOpts
KeepAliveOpts :: Int -> Int -> Int -> KeepAliveOpts
[keepIdle] :: KeepAliveOpts -> Int
[keepIntvl] :: KeepAliveOpts -> Int
[keepCnt] :: KeepAliveOpts -> Int
defaultKeepAliveOpts :: KeepAliveOpts
setSocketKeepAlive :: Socket -> KeepAliveOpts -> IO ()
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Transport.KeepAlive.KeepAliveOpts
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Transport.KeepAlive.KeepAliveOpts
instance GHC.Show.Show Simplex.Messaging.Transport.KeepAlive.KeepAliveOpts
instance GHC.Classes.Eq Simplex.Messaging.Transport.KeepAlive.KeepAliveOpts

module Simplex.Messaging.Protocol.Types
data ClientNotice
ClientNotice :: Maybe Int64 -> ClientNotice
[ttl] :: ClientNotice -> Maybe Int64
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Protocol.Types.ClientNotice
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Protocol.Types.ClientNotice
instance GHC.Show.Show Simplex.Messaging.Protocol.Types.ClientNotice
instance GHC.Classes.Eq Simplex.Messaging.Protocol.Types.ClientNotice

module Simplex.Messaging.Encoding

-- | SMP protocol encoding
class Encoding a

-- | protocol encoding of type (default implementation uses protocol
--   ByteString encoding)
smpEncode :: Encoding a => a -> ByteString

-- | decoding of type (default implementation uses parser)
smpDecode :: Encoding a => ByteString -> Either String a

-- | protocol parser of type (default implementation parses protocol
--   ByteString encoding)
smpP :: Encoding a => Parser a
newtype Tail
Tail :: ByteString -> Tail
[unTail] :: Tail -> ByteString
newtype Large
Large :: ByteString -> Large
[unLarge] :: Large -> ByteString
_smpP :: Encoding a => Parser a
smpEncodeList :: Encoding a => [a] -> ByteString
smpListP :: Encoding a => Parser [a]
lenEncode :: Int -> Char
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Encoding.Large
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Encoding.Tail
instance Simplex.Messaging.Encoding.Encoding GHC.Types.Char
instance Simplex.Messaging.Encoding.Encoding GHC.Types.Bool
instance Simplex.Messaging.Encoding.Encoding GHC.Word.Word16
instance Simplex.Messaging.Encoding.Encoding GHC.Word.Word32
instance Simplex.Messaging.Encoding.Encoding GHC.Int.Int64
instance Simplex.Messaging.Encoding.Encoding Data.ByteString.Internal.Type.ByteString
instance Simplex.Messaging.Encoding.Encoding a => Simplex.Messaging.Encoding.Encoding (GHC.Maybe.Maybe a)
instance Simplex.Messaging.Encoding.Encoding Data.Time.Clock.Internal.SystemTime.SystemTime
instance Simplex.Messaging.Encoding.Encoding Data.Text.Internal.Text
instance Simplex.Messaging.Encoding.Encoding GHC.Base.String
instance Simplex.Messaging.Encoding.Encoding a => Simplex.Messaging.Encoding.Encoding (GHC.Base.NonEmpty a)
instance (Simplex.Messaging.Encoding.Encoding a, Simplex.Messaging.Encoding.Encoding b) => Simplex.Messaging.Encoding.Encoding (a, b)
instance (Simplex.Messaging.Encoding.Encoding a, Simplex.Messaging.Encoding.Encoding b, Simplex.Messaging.Encoding.Encoding c) => Simplex.Messaging.Encoding.Encoding (a, b, c)
instance (Simplex.Messaging.Encoding.Encoding a, Simplex.Messaging.Encoding.Encoding b, Simplex.Messaging.Encoding.Encoding c, Simplex.Messaging.Encoding.Encoding d) => Simplex.Messaging.Encoding.Encoding (a, b, c, d)
instance (Simplex.Messaging.Encoding.Encoding a, Simplex.Messaging.Encoding.Encoding b, Simplex.Messaging.Encoding.Encoding c, Simplex.Messaging.Encoding.Encoding d, Simplex.Messaging.Encoding.Encoding e) => Simplex.Messaging.Encoding.Encoding (a, b, c, d, e)
instance (Simplex.Messaging.Encoding.Encoding a, Simplex.Messaging.Encoding.Encoding b, Simplex.Messaging.Encoding.Encoding c, Simplex.Messaging.Encoding.Encoding d, Simplex.Messaging.Encoding.Encoding e, Simplex.Messaging.Encoding.Encoding f) => Simplex.Messaging.Encoding.Encoding (a, b, c, d, e, f)
instance (Simplex.Messaging.Encoding.Encoding a, Simplex.Messaging.Encoding.Encoding b, Simplex.Messaging.Encoding.Encoding c, Simplex.Messaging.Encoding.Encoding d, Simplex.Messaging.Encoding.Encoding e, Simplex.Messaging.Encoding.Encoding f, Simplex.Messaging.Encoding.Encoding g) => Simplex.Messaging.Encoding.Encoding (a, b, c, d, e, f, g)
instance (Simplex.Messaging.Encoding.Encoding a, Simplex.Messaging.Encoding.Encoding b, Simplex.Messaging.Encoding.Encoding c, Simplex.Messaging.Encoding.Encoding d, Simplex.Messaging.Encoding.Encoding e, Simplex.Messaging.Encoding.Encoding f, Simplex.Messaging.Encoding.Encoding g, Simplex.Messaging.Encoding.Encoding h) => Simplex.Messaging.Encoding.Encoding (a, b, c, d, e, f, g, h)

module Simplex.Messaging.Encoding.String
class TextEncoding a
textEncode :: TextEncoding a => a -> Text
textDecode :: TextEncoding a => Text -> Maybe a

-- | Serializing human-readable and (where possible) URI-friendly strings
--   for SMP and SMP agent protocols
class StrEncoding a
strEncode :: StrEncoding a => a -> ByteString
strDecode :: StrEncoding a => ByteString -> Either String a
strP :: StrEncoding a => Parser a
newtype Str
Str :: ByteString -> Str
[unStr] :: Str -> ByteString
strP_ :: StrEncoding a => Parser a
_strP :: StrEncoding a => Parser a
strToJSON :: StrEncoding a => a -> Value
strToJEncoding :: StrEncoding a => a -> Encoding
strParseJSON :: StrEncoding a => String -> Value -> Parser a
textToJSON :: TextEncoding a => a -> Value
textToEncoding :: TextEncoding a => a -> Encoding
textParseJSON :: TextEncoding a => String -> Value -> Parser a
base64urlP :: Parser ByteString
strEncodeList :: StrEncoding a => [a] -> ByteString
strListP :: StrEncoding a => Parser [a]
instance GHC.Show.Show Simplex.Messaging.Encoding.String.Str
instance GHC.Classes.Eq Simplex.Messaging.Encoding.String.Str
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Encoding.String.Str
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Encoding.String.Str
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Encoding.String.Str
instance Simplex.Messaging.Encoding.String.StrEncoding Data.ByteString.Internal.Type.ByteString
instance Simplex.Messaging.Encoding.String.StrEncoding GHC.Base.String
instance Simplex.Messaging.Encoding.String.StrEncoding Data.Text.Internal.Text
instance Simplex.Messaging.Encoding.String.StrEncoding a => Simplex.Messaging.Encoding.String.StrEncoding (GHC.Maybe.Maybe a)
instance Simplex.Messaging.Encoding.String.StrEncoding GHC.Word.Word16
instance Simplex.Messaging.Encoding.String.StrEncoding GHC.Word.Word32
instance Simplex.Messaging.Encoding.String.StrEncoding GHC.Types.Char
instance Simplex.Messaging.Encoding.String.StrEncoding GHC.Types.Bool
instance Simplex.Messaging.Encoding.String.StrEncoding GHC.Types.Int
instance Simplex.Messaging.Encoding.String.StrEncoding GHC.Int.Int64
instance Simplex.Messaging.Encoding.String.StrEncoding Data.Time.Clock.Internal.SystemTime.SystemTime
instance Simplex.Messaging.Encoding.String.StrEncoding Data.Time.Clock.Internal.UTCTime.UTCTime
instance Simplex.Messaging.Encoding.String.StrEncoding Data.X509.CertificateChain.CertificateChain
instance Simplex.Messaging.Encoding.String.StrEncoding Data.X509.Validation.Fingerprint.Fingerprint
instance Simplex.Messaging.Encoding.String.StrEncoding a => Simplex.Messaging.Encoding.String.StrEncoding (GHC.Base.NonEmpty a)
instance (Simplex.Messaging.Encoding.String.StrEncoding a, GHC.Classes.Ord a) => Simplex.Messaging.Encoding.String.StrEncoding (Data.Set.Internal.Set a)
instance Simplex.Messaging.Encoding.String.StrEncoding Data.IntSet.Internal.IntSet
instance (Simplex.Messaging.Encoding.String.StrEncoding a, Simplex.Messaging.Encoding.String.StrEncoding b) => Simplex.Messaging.Encoding.String.StrEncoding (a, b)
instance (Simplex.Messaging.Encoding.String.StrEncoding a, Simplex.Messaging.Encoding.String.StrEncoding b, Simplex.Messaging.Encoding.String.StrEncoding c) => Simplex.Messaging.Encoding.String.StrEncoding (a, b, c)
instance (Simplex.Messaging.Encoding.String.StrEncoding a, Simplex.Messaging.Encoding.String.StrEncoding b, Simplex.Messaging.Encoding.String.StrEncoding c, Simplex.Messaging.Encoding.String.StrEncoding d) => Simplex.Messaging.Encoding.String.StrEncoding (a, b, c, d)
instance (Simplex.Messaging.Encoding.String.StrEncoding a, Simplex.Messaging.Encoding.String.StrEncoding b, Simplex.Messaging.Encoding.String.StrEncoding c, Simplex.Messaging.Encoding.String.StrEncoding d, Simplex.Messaging.Encoding.String.StrEncoding e) => Simplex.Messaging.Encoding.String.StrEncoding (a, b, c, d, e)
instance (Simplex.Messaging.Encoding.String.StrEncoding a, Simplex.Messaging.Encoding.String.StrEncoding b, Simplex.Messaging.Encoding.String.StrEncoding c, Simplex.Messaging.Encoding.String.StrEncoding d, Simplex.Messaging.Encoding.String.StrEncoding e, Simplex.Messaging.Encoding.String.StrEncoding f) => Simplex.Messaging.Encoding.String.StrEncoding (a, b, c, d, e, f)

module Simplex.Messaging.ServiceScheme
data ServiceScheme
SSSimplex :: ServiceScheme
SSAppServer :: SrvLoc -> ServiceScheme
data SrvLoc
SrvLoc :: HostName -> ServiceName -> SrvLoc
simplexChat :: ServiceScheme
instance GHC.Show.Show Simplex.Messaging.ServiceScheme.SrvLoc
instance GHC.Classes.Ord Simplex.Messaging.ServiceScheme.SrvLoc
instance GHC.Classes.Eq Simplex.Messaging.ServiceScheme.SrvLoc
instance GHC.Show.Show Simplex.Messaging.ServiceScheme.ServiceScheme
instance GHC.Classes.Eq Simplex.Messaging.ServiceScheme.ServiceScheme
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.ServiceScheme.ServiceScheme
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.ServiceScheme.SrvLoc

module Simplex.Messaging.Agent.Store.Shared
data Migration
Migration :: String -> Text -> Maybe Text -> Migration
[name] :: Migration -> String
[up] :: Migration -> Text
[down] :: Migration -> Maybe Text
data MigrationsToRun
MTRUp :: [Migration] -> MigrationsToRun
MTRDown :: [DownMigration] -> MigrationsToRun
MTRNone :: MigrationsToRun
data DownMigration
DownMigration :: String -> Text -> DownMigration
[downName] :: DownMigration -> String
[downQuery] :: DownMigration -> Text
data MTRError
MTRENoDown :: [String] -> MTRError
[dbMigrations] :: MTRError -> [String]
MTREDifferent :: String -> String -> MTRError
[appMigration] :: MTRError -> String
[dbMigration] :: MTRError -> String
mtrErrorDescription :: MTRError -> String
data MigrationConfig
MigrationConfig :: MigrationConfirmation -> Maybe FilePath -> MigrationConfig
[confirm] :: MigrationConfig -> MigrationConfirmation
[backupPath] :: MigrationConfig -> Maybe FilePath
data MigrationConfirmation
MCYesUp :: MigrationConfirmation
MCYesUpDown :: MigrationConfirmation
MCConsole :: MigrationConfirmation
MCError :: MigrationConfirmation
data MigrationError
MEUpgrade :: [UpMigration] -> MigrationError
[upMigrations] :: MigrationError -> [UpMigration]
MEDowngrade :: [String] -> MigrationError
[downMigrations] :: MigrationError -> [String]
MigrationError :: MTRError -> MigrationError
[mtrError] :: MigrationError -> MTRError
data UpMigration
UpMigration :: String -> Bool -> UpMigration
[upName] :: UpMigration -> String
[withDown] :: UpMigration -> Bool
migrationErrorDescription :: Bool -> MigrationError -> String
toDownMigration :: Migration -> Maybe DownMigration
upMigration :: Migration -> UpMigration
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Store.Shared.MigrationError
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Store.Shared.UpMigration
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Store.Shared.UpMigration
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Store.Shared.MTRError
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Store.Shared.MTRError
instance GHC.Show.Show Simplex.Messaging.Agent.Store.Shared.Migration
instance GHC.Classes.Eq Simplex.Messaging.Agent.Store.Shared.Migration
instance GHC.Show.Show Simplex.Messaging.Agent.Store.Shared.DownMigration
instance GHC.Classes.Eq Simplex.Messaging.Agent.Store.Shared.DownMigration
instance GHC.Show.Show Simplex.Messaging.Agent.Store.Shared.MigrationsToRun
instance GHC.Classes.Eq Simplex.Messaging.Agent.Store.Shared.MigrationsToRun
instance GHC.Show.Show Simplex.Messaging.Agent.Store.Shared.MTRError
instance GHC.Classes.Eq Simplex.Messaging.Agent.Store.Shared.MTRError
instance GHC.Show.Show Simplex.Messaging.Agent.Store.Shared.UpMigration
instance GHC.Classes.Eq Simplex.Messaging.Agent.Store.Shared.UpMigration
instance GHC.Show.Show Simplex.Messaging.Agent.Store.Shared.MigrationError
instance GHC.Classes.Eq Simplex.Messaging.Agent.Store.Shared.MigrationError
instance GHC.Show.Show Simplex.Messaging.Agent.Store.Shared.MigrationConfirmation
instance GHC.Classes.Eq Simplex.Messaging.Agent.Store.Shared.MigrationConfirmation
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Agent.Store.Shared.MigrationConfirmation

module Simplex.Messaging.Server.QueueStore.Postgres.Config
data PostgresStoreCfg
PostgresStoreCfg :: DBOpts -> Maybe FilePath -> MigrationConfirmation -> Int64 -> PostgresStoreCfg
[dbOpts] :: PostgresStoreCfg -> DBOpts
[dbStoreLogPath] :: PostgresStoreCfg -> Maybe FilePath
[confirmMigrations] :: PostgresStoreCfg -> MigrationConfirmation
[deletedTTL] :: PostgresStoreCfg -> Int64

module Simplex.Messaging.Agent.Store.SQLite.Migrations.App

-- | The list of migrations in ascending order by date
appMigrations :: [Migration]

module Simplex.Messaging.Agent.Store.Migrations.App

module Simplex.Messaging.Agent.Store.Migrations
data Migration
Migration :: String -> Text -> Maybe Text -> Migration
[name] :: Migration -> String
[up] :: Migration -> Text
[down] :: Migration -> Maybe Text
data MigrationsToRun
MTRUp :: [Migration] -> MigrationsToRun
MTRDown :: [DownMigration] -> MigrationsToRun
MTRNone :: MigrationsToRun
data DownMigration
DownMigration :: String -> Text -> DownMigration
[downName] :: DownMigration -> String
[downQuery] :: DownMigration -> Text
data DBMigrate
DBMigrate :: IO () -> IO [Migration] -> (MigrationsToRun -> IO ()) -> Maybe (IO ()) -> DBMigrate
[initialize] :: DBMigrate -> IO ()
[getCurrent] :: DBMigrate -> IO [Migration]
[run] :: DBMigrate -> MigrationsToRun -> IO ()
[backup] :: DBMigrate -> Maybe (IO ())
sharedMigrateSchema :: DBMigrate -> Bool -> [Migration] -> MigrationConfirmation -> IO (Either MigrationError ())
migrationsToRun :: [Migration] -> [Migration] -> Either MTRError MigrationsToRun
toDownMigration :: Migration -> Maybe DownMigration

module Simplex.Messaging.Agent.QueryString
data QueryStringParams
QSP :: QSPEscaping -> SimpleQuery -> QueryStringParams
data QSPEscaping
QEscape :: QSPEscaping
QNoEscaping :: QSPEscaping
queryParam :: StrEncoding a => ByteString -> QueryStringParams -> Parser a
queryParamParser :: Parser a -> ByteString -> QueryStringParams -> Parser a
queryParam_ :: StrEncoding a => ByteString -> QueryStringParams -> Parser (Maybe a)
queryParamStr :: ByteString -> QueryStringParams -> Maybe ByteString
instance GHC.Show.Show Simplex.Messaging.Agent.QueryString.QSPEscaping
instance GHC.Show.Show Simplex.Messaging.Agent.QueryString.QueryStringParams
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Agent.QueryString.QueryStringParams

module Simplex.Messaging.Compression
data Compressed

-- | Messages below this length are not encoded to avoid compression
--   overhead.
maxLengthPassthrough :: Int
compressionLevel :: Num a => a
compress1 :: ByteString -> Compressed
decompress1 :: Compressed -> Either String ByteString
limitDecompress1 :: Int -> Compressed -> Either String ByteString
decompressedSize :: Compressed -> Maybe Int
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Compression.Compressed

module Simplex.Messaging.Agent.Store.SQLite.DB
newtype BoolInt
BI :: Bool -> BoolInt
[unBI] :: BoolInt -> Bool
newtype Binary a
Binary :: a -> Binary a
[fromBinary] :: Binary a -> a
data Connection
Connection :: Connection -> TrackQueries -> TMap Query SlowQueryStats -> Connection
[conn] :: Connection -> Connection
[track] :: Connection -> TrackQueries
[slow] :: Connection -> TMap Query SlowQueryStats
data SlowQueryStats
SlowQueryStats :: Int64 -> Int64 -> Int64 -> Map Text Int -> SlowQueryStats
[count] :: SlowQueryStats -> Int64
[timeMax] :: SlowQueryStats -> Int64
[timeAvg] :: SlowQueryStats -> Int64
[errs] :: SlowQueryStats -> Map Text Int
data TrackQueries
TQAll :: TrackQueries
TQSlow :: Int64 -> TrackQueries
TQOff :: TrackQueries
class () => FromField a
fromField :: FromField a => FieldParser a
class () => ToField a
toField :: ToField a => a -> SQLData
data () => SQLError
open :: String -> TrackQueries -> IO Connection
close :: Connection -> IO ()
execute :: ToRow q => Connection -> Query -> q -> IO ()
execute_ :: Connection -> Query -> IO ()
executeMany :: ToRow q => Connection -> Query -> [q] -> IO ()
query :: (ToRow q, FromRow r) => Connection -> Query -> q -> IO [r]
query_ :: FromRow r => Connection -> Query -> IO [r]
blobFieldDecoder :: Typeable k => (ByteString -> Either String k) -> FieldParser k
fromTextField_ :: Typeable a => (Text -> Maybe a) -> Field -> Ok a
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Store.SQLite.DB.SlowQueryStats
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Store.SQLite.DB.SlowQueryStats
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Agent.Store.SQLite.DB.BoolInt
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Agent.Store.SQLite.DB.BoolInt
instance Database.SQLite.Simple.ToField.ToField a => Database.SQLite.Simple.ToField.ToField (Simplex.Messaging.Agent.Store.SQLite.DB.Binary a)
instance Database.SQLite.Simple.FromField.FromField a => Database.SQLite.Simple.FromField.FromField (Simplex.Messaging.Agent.Store.SQLite.DB.Binary a)
instance GHC.Classes.Eq Simplex.Messaging.Agent.Store.SQLite.DB.TrackQueries
instance GHC.Show.Show Simplex.Messaging.Agent.Store.SQLite.DB.SlowQueryStats

module Simplex.Messaging.Agent.Store.DB
class () => FromField a
fromField :: FromField a => FieldParser a
class () => ToField a
toField :: ToField a => a -> SQLData

module Simplex.Messaging.SystemTime
newtype RoundedSystemTime (t :: Nat)
RoundedSystemTime :: Int64 -> RoundedSystemTime (t :: Nat)
[roundedSeconds] :: RoundedSystemTime (t :: Nat) -> Int64
type SystemDate = RoundedSystemTime 86400
type SystemSeconds = RoundedSystemTime 1
getRoundedSystemTime :: forall t. KnownNat t => IO (RoundedSystemTime t)
getSystemDate :: IO SystemDate
getSystemSeconds :: IO SystemSeconds
roundedToUTCTime :: RoundedSystemTime t -> UTCTime
instance Database.SQLite.Simple.ToField.ToField (Simplex.Messaging.SystemTime.RoundedSystemTime t)
instance Database.SQLite.Simple.FromField.FromField (Simplex.Messaging.SystemTime.RoundedSystemTime t)
instance Data.Aeson.Types.ToJSON.ToJSON (Simplex.Messaging.SystemTime.RoundedSystemTime t)
instance Data.Aeson.Types.FromJSON.FromJSON (Simplex.Messaging.SystemTime.RoundedSystemTime t)
instance GHC.Show.Show (Simplex.Messaging.SystemTime.RoundedSystemTime t)
instance GHC.Classes.Ord (Simplex.Messaging.SystemTime.RoundedSystemTime t)
instance GHC.Classes.Eq (Simplex.Messaging.SystemTime.RoundedSystemTime t)
instance Simplex.Messaging.Encoding.String.StrEncoding (Simplex.Messaging.SystemTime.RoundedSystemTime t)

module Simplex.Messaging.Server.QueueStore.QueueInfo
data QueueInfo
QueueInfo :: Bool -> Bool -> Maybe QSub -> Int -> Maybe MsgInfo -> QueueInfo
[qiSnd] :: QueueInfo -> Bool
[qiNtf] :: QueueInfo -> Bool
[qiSub] :: QueueInfo -> Maybe QSub
[qiSize] :: QueueInfo -> Int
[qiMsg] :: QueueInfo -> Maybe MsgInfo
data QSub
QSub :: QSubThread -> Maybe Text -> QSub
[qSubThread] :: QSub -> QSubThread
[qDelivered] :: QSub -> Maybe Text
data QSubThread
QNoSub :: QSubThread
QSubPending :: QSubThread
QSubThread :: QSubThread
QProhibitSub :: QSubThread
data MsgInfo
MsgInfo :: Text -> UTCTime -> MsgType -> MsgInfo
[msgId] :: MsgInfo -> Text
[msgTs] :: MsgInfo -> UTCTime
[msgType] :: MsgInfo -> MsgType
data MsgType
MTMessage :: MsgType
MTQuota :: MsgType
data QueueMode
QMMessaging :: QueueMode
QMContact :: QueueMode
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Server.QueueStore.QueueInfo.QueueInfo
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Server.QueueStore.QueueInfo.QueueInfo
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Server.QueueStore.QueueInfo.QueueInfo
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Server.QueueStore.QueueInfo.MsgInfo
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Server.QueueStore.QueueInfo.MsgInfo
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Server.QueueStore.QueueInfo.MsgType
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Server.QueueStore.QueueInfo.MsgType
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Server.QueueStore.QueueInfo.QSub
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Server.QueueStore.QueueInfo.QSub
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Server.QueueStore.QueueInfo.QSubThread
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Server.QueueStore.QueueInfo.QSubThread
instance GHC.Show.Show Simplex.Messaging.Server.QueueStore.QueueInfo.QSubThread
instance GHC.Classes.Eq Simplex.Messaging.Server.QueueStore.QueueInfo.QSubThread
instance GHC.Show.Show Simplex.Messaging.Server.QueueStore.QueueInfo.QSub
instance GHC.Classes.Eq Simplex.Messaging.Server.QueueStore.QueueInfo.QSub
instance GHC.Show.Show Simplex.Messaging.Server.QueueStore.QueueInfo.MsgType
instance GHC.Classes.Eq Simplex.Messaging.Server.QueueStore.QueueInfo.MsgType
instance GHC.Show.Show Simplex.Messaging.Server.QueueStore.QueueInfo.MsgInfo
instance GHC.Classes.Eq Simplex.Messaging.Server.QueueStore.QueueInfo.MsgInfo
instance GHC.Show.Show Simplex.Messaging.Server.QueueStore.QueueInfo.QueueInfo
instance GHC.Classes.Eq Simplex.Messaging.Server.QueueStore.QueueInfo.QueueInfo
instance GHC.Show.Show Simplex.Messaging.Server.QueueStore.QueueInfo.QueueMode
instance GHC.Classes.Eq Simplex.Messaging.Server.QueueStore.QueueInfo.QueueMode
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Server.QueueStore.QueueInfo.QueueMode
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Server.QueueStore.QueueInfo.QueueMode
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Server.QueueStore.QueueInfo.QueueMode


-- | This module provides cryptography implementation for SMP protocols
--   based on <a>cryptonite package</a>.
module Simplex.Messaging.Crypto

-- | Cryptographic algorithms.
data Algorithm
Ed25519 :: Algorithm
Ed448 :: Algorithm
X25519 :: Algorithm
X448 :: Algorithm

-- | Singleton types for <a>Algorithm</a>.
data SAlgorithm :: Algorithm -> Type
[SEd25519] :: SAlgorithm Ed25519
[SEd448] :: SAlgorithm Ed448
[SX25519] :: SAlgorithm X25519
[SX448] :: SAlgorithm X448
data Alg
Alg :: SAlgorithm a -> Alg
data AuthAlg
AuthAlg :: SAlgorithm a -> AuthAlg
data DhAlg
DhAlg :: SAlgorithm a -> DhAlg
type family DhAlgorithm (a :: Algorithm) :: Constraint

-- | GADT for private keys.
data PrivateKey (a :: Algorithm)
[PrivateKeyEd25519] :: SecretKey -> PrivateKey Ed25519
[PrivateKeyEd448] :: SecretKey -> PrivateKey Ed448
[PrivateKeyX25519] :: SecretKey -> PrivateKey X25519
[PrivateKeyX448] :: SecretKey -> PrivateKey X448

-- | GADT for public keys.
data PublicKey (a :: Algorithm)
[PublicKeyEd25519] :: PublicKey -> PublicKey Ed25519
[PublicKeyEd448] :: PublicKey -> PublicKey Ed448
[PublicKeyX25519] :: PublicKey -> PublicKey X25519
[PublicKeyX448] :: PublicKey -> PublicKey X448
type PrivateKeyEd25519 = PrivateKey Ed25519
type PublicKeyEd25519 = PublicKey Ed25519
type PrivateKeyX25519 = PrivateKey X25519
type PublicKeyX25519 = PublicKey X25519
type PrivateKeyX448 = PrivateKey X448
type PublicKeyX448 = PublicKey X448
data APrivateKey
APrivateKey :: SAlgorithm a -> PrivateKey a -> APrivateKey
data APublicKey
APublicKey :: SAlgorithm a -> PublicKey a -> APublicKey
data APrivateSignKey
APrivateSignKey :: SAlgorithm a -> PrivateKey a -> APrivateSignKey
data APublicVerifyKey
APublicVerifyKey :: SAlgorithm a -> PublicKey a -> APublicVerifyKey
data APrivateDhKey
APrivateDhKey :: SAlgorithm a -> PrivateKey a -> APrivateDhKey
data APublicDhKey
APublicDhKey :: SAlgorithm a -> PublicKey a -> APublicDhKey
data APrivateAuthKey
APrivateAuthKey :: SAlgorithm a -> PrivateKey a -> APrivateAuthKey
data APublicAuthKey
APublicAuthKey :: SAlgorithm a -> PublicKey a -> APublicAuthKey

-- | Class for public key types
class CryptoPublicKey k
toPubKey :: CryptoPublicKey k => (forall a. AlgorithmI a => PublicKey a -> b) -> k -> b
pubKey :: CryptoPublicKey k => APublicKey -> Either String k
class CryptoPrivateKey pk where {
    type PublicKeyType pk;
}
toPrivKey :: CryptoPrivateKey pk => (forall a. AlgorithmI a => PrivateKey a -> b) -> pk -> b
privKey :: CryptoPrivateKey pk => APrivateKey -> Either String pk
toPublic :: CryptoPrivateKey pk => pk -> PublicKeyType pk
type AAuthKeyPair = KeyPairType APrivateAuthKey
type KeyPair a = KeyPairType (PrivateKey a)
type KeyPairX25519 = KeyPair X25519
type KeyPairEd25519 = KeyPair Ed25519
type ASignatureKeyPair = KeyPairType APrivateSignKey
data DhSecret (a :: Algorithm)
[DhSecretX25519] :: DhSecret -> DhSecret X25519
[DhSecretX448] :: DhSecret -> DhSecret X448
type DhSecretX25519 = DhSecret X25519
data ADhSecret
ADhSecret :: SAlgorithm a -> DhSecret a -> ADhSecret

-- | Certificate fingerpint newtype.
--   
--   Previously was used for server's public key hash in ad-hoc transport
--   scheme, kept as is for compatibility.
newtype KeyHash
KeyHash :: ByteString -> KeyHash
[$sel:unKeyHash:KeyHash] :: KeyHash -> ByteString
newRandom :: IO (TVar ChaChaDRG)
newRandomDRG :: TVar ChaChaDRG -> STM (TVar ChaChaDRG)
generateAKeyPair :: AlgorithmI a => SAlgorithm a -> TVar ChaChaDRG -> STM AKeyPair
generateKeyPair :: forall a. AlgorithmI a => TVar ChaChaDRG -> STM (KeyPair a)
generateSignatureKeyPair :: (AlgorithmI a, SignatureAlgorithm a) => SAlgorithm a -> TVar ChaChaDRG -> STM ASignatureKeyPair
generateAuthKeyPair :: (AlgorithmI a, AuthAlgorithm a) => SAlgorithm a -> TVar ChaChaDRG -> STM AAuthKeyPair
generatePrivateAuthKey :: (AlgorithmI a, AuthAlgorithm a) => SAlgorithm a -> TVar ChaChaDRG -> STM APrivateAuthKey
generateDhKeyPair :: (AlgorithmI a, DhAlgorithm a) => SAlgorithm a -> TVar ChaChaDRG -> STM ADhKeyPair
privateToX509 :: PrivateKey a -> PrivKey
x509ToPublic :: (PubKey, [ASN1]) -> Either String APublicKey
x509ToPublic' :: CryptoPublicKey k => PubKey -> Either String k
x509ToPrivate :: (PrivKey, [ASN1]) -> Either String APrivateKey
x509ToPrivate' :: CryptoPrivateKey k => PrivKey -> Either String k
publicKey :: PrivateKey a -> PublicKey a

-- | Expand signature private key to a key pair.
signatureKeyPair :: APrivateSignKey -> ASignatureKeyPair
publicToX509 :: PublicKey a -> PubKey
encodeASNObj :: ASN1Object a => a -> ByteString
encodePubKey :: CryptoPublicKey k => k -> ByteString
decodePubKey :: CryptoPublicKey k => ByteString -> Either String k
encodePrivKey :: CryptoPrivateKey pk => pk -> ByteString
decodePrivKey :: CryptoPrivateKey k => ByteString -> Either String k
pubKeyBytes :: PublicKey a -> ByteString
data Signature (a :: Algorithm)
[SignatureEd25519] :: Signature -> Signature Ed25519
[SignatureEd448] :: Signature -> Signature Ed448
data ASignature
ASignature :: SAlgorithm a -> Signature a -> ASignature
class CryptoSignature s
signatureBytes :: CryptoSignature s => s -> ByteString
decodeSignature :: CryptoSignature s => ByteString -> Either String s
class SignatureSize s
signatureSize :: SignatureSize s => s -> Int
type family SignatureAlgorithm (a :: Algorithm) :: Constraint
type family AuthAlgorithm (a :: Algorithm) :: Constraint
class AlgorithmI (a :: Algorithm)
sAlgorithm :: AlgorithmI a => SAlgorithm a
sign :: APrivateSignKey -> ByteString -> ASignature

-- | Message signing.
--   
--   Used by SMP clients to sign SMP commands and by SMP agents to sign
--   messages.
sign' :: SignatureAlgorithm a => PrivateKey a -> ByteString -> Signature a
verify :: APublicVerifyKey -> ASignature -> ByteString -> Bool

-- | Signature verification.
--   
--   Used by SMP servers to authorize SMP commands and by SMP agents to
--   verify messages.
verify' :: SignatureAlgorithm a => PublicKey a -> Signature a -> ByteString -> Bool
validSignatureSize :: Int -> Bool
checkAlgorithm :: forall t a a'. (AlgorithmI a, AlgorithmI a') => t a' -> Either String (t a)
newtype CbAuthenticator
CbAuthenticator :: ByteString -> CbAuthenticator
cbAuthenticatorSize :: Int
cbAuthenticate :: PublicKeyX25519 -> PrivateKeyX25519 -> CbNonce -> ByteString -> CbAuthenticator
cbVerify :: PublicKeyX25519 -> PrivateKeyX25519 -> CbNonce -> CbAuthenticator -> ByteString -> Bool
dh' :: DhAlgorithm a => PublicKey a -> PrivateKey a -> DhSecret a
dhBytes' :: DhSecret a -> ByteString

-- | AES key newtype.
newtype Key
Key :: ByteString -> Key
[$sel:unKey:Key] :: Key -> ByteString

-- | IV bytes newtype.
newtype IV
IV :: ByteString -> IV
[$sel:unIV:IV] :: IV -> ByteString

-- | GCMIV bytes newtype.
data GCMIV
newtype AuthTag
AuthTag :: AuthTag -> AuthTag
[$sel:unAuthTag:AuthTag] :: AuthTag -> AuthTag

-- | AEAD-GCM encryption with associated data.
--   
--   Used as part of double ratchet encryption. This function requires 16
--   bytes IV, it transforms IV in cryptonite_aes_gcm_init here:
--   <a>https://github.com/haskell-crypto/cryptonite/blob/master/cbits/cryptonite_aes.c</a>
encryptAEAD :: Key -> IV -> Int -> ByteString -> ByteString -> ExceptT CryptoError IO (AuthTag, ByteString)

-- | AEAD-GCM decryption with associated data.
--   
--   Used as part of double ratchet encryption. This function requires 16
--   bytes IV, it transforms IV in cryptonite_aes_gcm_init here:
--   <a>https://github.com/haskell-crypto/cryptonite/blob/master/cbits/cryptonite_aes.c</a>
--   To make it compatible with WebCrypto we will need to start using
--   initAEADGCM.
decryptAEAD :: Key -> IV -> ByteString -> ByteString -> AuthTag -> ExceptT CryptoError IO ByteString
encryptAESNoPad :: Key -> GCMIV -> ByteString -> ExceptT CryptoError IO (AuthTag, ByteString)
decryptAESNoPad :: Key -> GCMIV -> ByteString -> AuthTag -> ExceptT CryptoError IO ByteString
authTagSize :: Int

-- | Random AES256 key.
randomAesKey :: TVar ChaChaDRG -> STM Key
randomGCMIV :: TVar ChaChaDRG -> STM GCMIV
ivSize :: forall c. BlockCipher c => Int
gcmIVSize :: Int
gcmIV :: ByteString -> Either CryptoError GCMIV
data CbNonce
pattern CbNonce :: ByteString -> CbNonce

-- | NaCl <tt>crypto_box</tt> encrypt with padding with a shared DH secret
--   and 192-bit nonce.
cbEncrypt :: DhSecret X25519 -> CbNonce -> ByteString -> Int -> Either CryptoError ByteString

-- | NaCl <tt>crypto_box</tt> encrypt with a shared DH secret and 192-bit
--   nonce (without padding).
cbEncryptNoPad :: DhSecret X25519 -> CbNonce -> ByteString -> ByteString

-- | NaCl <tt>crypto_box</tt> encrypt with a shared DH secret and 192-bit
--   nonce.
cbEncryptMaxLenBS :: KnownNat i => DhSecret X25519 -> CbNonce -> MaxLenBS i -> ByteString

-- | NaCl <tt>crypto_box</tt> decrypt with a shared DH secret and 192-bit
--   nonce.
cbDecrypt :: DhSecret X25519 -> CbNonce -> ByteString -> Either CryptoError ByteString

-- | NaCl <tt>crypto_box</tt> decrypt with a shared DH secret and 192-bit
--   nonce (without unpadding).
cbDecryptNoPad :: DhSecret X25519 -> CbNonce -> ByteString -> Either CryptoError ByteString

-- | NaCl <tt>crypto_box</tt> decrypt with a shared DH secret and 192-bit
--   nonce.
sbDecrypt_ :: ByteArrayAccess key => key -> CbNonce -> ByteString -> Either CryptoError ByteString
sbEncrypt_ :: ByteArrayAccess key => key -> CbNonce -> ByteString -> Int -> Either CryptoError ByteString
sbEncryptNoPad :: SbKey -> CbNonce -> ByteString -> ByteString
sbDecryptNoPad :: SbKey -> CbNonce -> ByteString -> Either CryptoError ByteString
cbNonce :: ByteString -> CbNonce
randomCbNonce :: TVar ChaChaDRG -> STM CbNonce
reverseNonce :: CbNonce -> CbNonce
data SbKey
pattern SbKey :: ByteString -> SbKey

-- | NaCl <tt>secret_box</tt> encrypt with a symmetric 256-bit key and
--   192-bit nonce.
sbEncrypt :: SbKey -> CbNonce -> ByteString -> Int -> Either CryptoError ByteString

-- | NaCl <tt>secret_box</tt> decrypt with a symmetric 256-bit key and
--   192-bit nonce.
sbDecrypt :: SbKey -> CbNonce -> ByteString -> Either CryptoError ByteString
sbKey :: ByteString -> Either String SbKey
unsafeSbKey :: ByteString -> SbKey
randomSbKey :: TVar ChaChaDRG -> STM SbKey
data SbChainKey
type SbKeyNonce = (SbKey, CbNonce)
sbcInit :: ByteArrayAccess secret => ByteString -> secret -> (SbChainKey, SbChainKey)
sbcHkdf :: SbChainKey -> (SbKeyNonce, SbChainKey)
hkdf :: ByteArrayAccess secret => ByteString -> secret -> ByteString -> Int -> ByteString
randomBytes :: Int -> TVar ChaChaDRG -> STM ByteString

-- | SHA256 digest.
sha256Hash :: ByteString -> ByteString

-- | SHA512 digest.
sha512Hash :: ByteString -> ByteString

-- | SHA3-256 digest.
sha3_256 :: ByteString -> ByteString

-- | SHA3-384 digest.
sha3_384 :: ByteString -> ByteString
canPad :: Int -> Int -> Bool
pad :: ByteString -> Int -> Either CryptoError ByteString
unPad :: ByteString -> Either CryptoError ByteString
signCertificate :: APrivateSignKey -> Certificate -> SignedCertificate
signX509 :: (ASN1Object o, Eq o, Show o) => APrivateSignKey -> o -> SignedExact o
verifyX509 :: (ASN1Object o, Eq o, Show o) => APublicVerifyKey -> SignedExact o -> Either String o
certificateFingerprint :: SignedCertificate -> KeyHash
signedFingerprint :: (ASN1Object o, Eq o, Show o) => SignedExact o -> KeyHash
class SignatureAlgorithmX509 a
signatureAlgorithmX509 :: SignatureAlgorithmX509 a => a -> SignatureALG

-- | A wrapper to marshall signed ASN1 objects, like certificates.
newtype SignedObject a
SignedObject :: SignedExact a -> SignedObject a
[$sel:getSignedExact:SignedObject] :: SignedObject a -> SignedExact a
encodeCertChain :: CertificateChain -> NonEmpty Large
certChainP :: Parser CertificateChain

-- | Various cryptographic or related errors.
data CryptoError

-- | AES initialization error
AESCipherError :: CryptoError -> CryptoError

-- | IV generation error
CryptoIVError :: CryptoError

-- | AES decryption error
AESDecryptError :: CryptoError
CBDecryptError :: CryptoError
CryptoPoly1305Error :: CryptoError -> CryptoError

-- | message is larger that allowed padded length minus 2 (to prepend
--   message length) (or required un-padded length is larger than the
--   message length)
CryptoLargeMsgError :: CryptoError

-- | padded message is shorter than 2 bytes
CryptoInvalidMsgError :: CryptoError

-- | failure parsing message header
CryptoHeaderError :: String -> CryptoError

-- | no sending chain key in ratchet state
CERatchetState :: CryptoError

-- | no decapsulation key in ratchet state
CERatchetKEMState :: CryptoError

-- | header decryption error (could indicate that another key should be
--   tried)
CERatchetHeader :: CryptoError

-- | too many skipped messages
CERatchetTooManySkipped :: Word32 -> CryptoError

-- | earlier message number (or, possibly, skipped message that failed to
--   decrypt?)
CERatchetEarlierMessage :: Word32 -> CryptoError

-- | duplicate message number
CERatchetDuplicateMessage :: CryptoError
data MaxLenBS (i :: Nat)
pattern MaxLenBS :: ByteString -> MaxLenBS i
maxLenBS :: forall i. KnownNat i => ByteString -> Either CryptoError (MaxLenBS i)
unsafeMaxLenBS :: forall i. KnownNat i => ByteString -> MaxLenBS i
appendMaxLenBS :: (KnownNat i, KnownNat j) => MaxLenBS i -> MaxLenBS j -> MaxLenBS (i + j)
instance GHC.Exception.Type.Exception Simplex.Messaging.Crypto.CryptoError
instance GHC.Show.Show Simplex.Messaging.Crypto.CryptoError
instance GHC.Classes.Eq Simplex.Messaging.Crypto.CryptoError
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Crypto.Key
instance GHC.Show.Show Simplex.Messaging.Crypto.Key
instance GHC.Classes.Ord Simplex.Messaging.Crypto.Key
instance GHC.Classes.Eq Simplex.Messaging.Crypto.Key
instance GHC.Show.Show Simplex.Messaging.Crypto.IV
instance GHC.Classes.Eq Simplex.Messaging.Crypto.IV
instance GHC.Show.Show Simplex.Messaging.Crypto.KeyHash
instance GHC.Classes.Ord Simplex.Messaging.Crypto.KeyHash
instance GHC.Classes.Eq Simplex.Messaging.Crypto.KeyHash
instance GHC.Show.Show Simplex.Messaging.Crypto.CbAuthenticator
instance GHC.Classes.Eq Simplex.Messaging.Crypto.CbAuthenticator
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Crypto.CbNonce
instance GHC.Show.Show Simplex.Messaging.Crypto.CbNonce
instance GHC.Classes.Eq Simplex.Messaging.Crypto.CbNonce
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Crypto.SbKey
instance GHC.Show.Show Simplex.Messaging.Crypto.SbKey
instance GHC.Classes.Eq Simplex.Messaging.Crypto.SbKey
instance GHC.Show.Show Simplex.Messaging.Crypto.SbChainKey
instance GHC.Classes.Eq Simplex.Messaging.Crypto.SbChainKey
instance GHC.Show.Show (Simplex.Messaging.Crypto.SAlgorithm a)
instance GHC.Classes.Eq (Simplex.Messaging.Crypto.PublicKey a)
instance GHC.Show.Show (Simplex.Messaging.Crypto.PublicKey a)
instance GHC.Show.Show Simplex.Messaging.Crypto.APublicKey
instance GHC.Classes.Eq (Simplex.Messaging.Crypto.PrivateKey a)
instance GHC.Show.Show (Simplex.Messaging.Crypto.PrivateKey a)
instance GHC.Show.Show Simplex.Messaging.Crypto.APrivateKey
instance GHC.Show.Show Simplex.Messaging.Crypto.APrivateSignKey
instance GHC.Show.Show Simplex.Messaging.Crypto.APublicVerifyKey
instance GHC.Show.Show Simplex.Messaging.Crypto.APrivateDhKey
instance GHC.Show.Show Simplex.Messaging.Crypto.APublicDhKey
instance GHC.Classes.Eq (Simplex.Messaging.Crypto.DhSecret a)
instance GHC.Show.Show (Simplex.Messaging.Crypto.DhSecret a)
instance GHC.Show.Show Simplex.Messaging.Crypto.APrivateAuthKey
instance GHC.Show.Show Simplex.Messaging.Crypto.APublicAuthKey
instance GHC.Classes.Eq (Simplex.Messaging.Crypto.Signature a)
instance GHC.Show.Show (Simplex.Messaging.Crypto.Signature a)
instance GHC.Show.Show Simplex.Messaging.Crypto.ASignature
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Crypto.SbKey
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Crypto.SbKey
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Crypto.SbKey
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Crypto.SbKey
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Crypto.CbNonce
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Crypto.CbNonce
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Crypto.CbNonce
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Crypto.CbNonce
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Crypto.CbNonce
instance (Data.Typeable.Internal.Typeable a, GHC.Classes.Eq a, GHC.Show.Show a, Data.ASN1.Types.ASN1Object a) => Database.SQLite.Simple.FromField.FromField (Simplex.Messaging.Crypto.SignedObject a)
instance (GHC.Classes.Eq a, GHC.Show.Show a, Data.ASN1.Types.ASN1Object a) => Database.SQLite.Simple.ToField.ToField (Simplex.Messaging.Crypto.SignedObject a)
instance (GHC.Classes.Eq a, GHC.Show.Show a, Data.ASN1.Types.ASN1Object a) => Simplex.Messaging.Encoding.Encoding (Simplex.Messaging.Crypto.SignedObject a)
instance Simplex.Messaging.Crypto.SignatureAlgorithm a => Simplex.Messaging.Crypto.SignatureAlgorithmX509 (Simplex.Messaging.Crypto.SAlgorithm a)
instance Simplex.Messaging.Crypto.SignatureAlgorithmX509 Simplex.Messaging.Crypto.APrivateSignKey
instance Simplex.Messaging.Crypto.SignatureAlgorithmX509 Simplex.Messaging.Crypto.APublicVerifyKey
instance Simplex.Messaging.Crypto.SignatureAlgorithmX509 pk => Simplex.Messaging.Crypto.SignatureAlgorithmX509 (a, pk)
instance GHC.TypeNats.KnownNat i => Simplex.Messaging.Encoding.Encoding (Simplex.Messaging.Crypto.MaxLenBS i)
instance GHC.TypeNats.KnownNat i => Simplex.Messaging.Encoding.String.StrEncoding (Simplex.Messaging.Crypto.MaxLenBS i)
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Crypto.KeyHash
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Crypto.KeyHash
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Crypto.KeyHash
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Crypto.KeyHash
instance Data.String.IsString Simplex.Messaging.Crypto.KeyHash
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Crypto.KeyHash
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Crypto.KeyHash
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Crypto.AuthTag
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Crypto.IV
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Crypto.IV
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Crypto.IV
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Crypto.Key
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Crypto.Key
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Crypto.Key
instance Simplex.Messaging.Crypto.SignatureSize (Simplex.Messaging.Crypto.Signature a)
instance Simplex.Messaging.Crypto.SignatureSize Simplex.Messaging.Crypto.ASignature
instance Simplex.Messaging.Crypto.SignatureSize Simplex.Messaging.Crypto.APrivateSignKey
instance Simplex.Messaging.Crypto.SignatureSize Simplex.Messaging.Crypto.APublicVerifyKey
instance Simplex.Messaging.Crypto.SignatureAlgorithm a => Simplex.Messaging.Crypto.SignatureSize (Simplex.Messaging.Crypto.PrivateKey a)
instance Simplex.Messaging.Crypto.SignatureAlgorithm a => Simplex.Messaging.Crypto.SignatureSize (Simplex.Messaging.Crypto.PublicKey a)
instance Data.String.IsString Simplex.Messaging.Crypto.ASignature
instance Simplex.Messaging.Crypto.CryptoSignature (Simplex.Messaging.Crypto.Signature s) => Simplex.Messaging.Encoding.String.StrEncoding (Simplex.Messaging.Crypto.Signature s)
instance Simplex.Messaging.Crypto.CryptoSignature (Simplex.Messaging.Crypto.Signature s) => Data.Aeson.Types.ToJSON.ToJSON (Simplex.Messaging.Crypto.Signature s)
instance Simplex.Messaging.Crypto.CryptoSignature (Simplex.Messaging.Crypto.Signature s) => Data.Aeson.Types.FromJSON.FromJSON (Simplex.Messaging.Crypto.Signature s)
instance Simplex.Messaging.Crypto.CryptoSignature (Simplex.Messaging.Crypto.Signature s) => Simplex.Messaging.Encoding.Encoding (Simplex.Messaging.Crypto.Signature s)
instance Simplex.Messaging.Crypto.CryptoSignature Simplex.Messaging.Crypto.ASignature
instance Simplex.Messaging.Crypto.CryptoSignature (GHC.Maybe.Maybe Simplex.Messaging.Crypto.ASignature)
instance Simplex.Messaging.Crypto.AlgorithmI a => Simplex.Messaging.Crypto.CryptoSignature (Simplex.Messaging.Crypto.Signature a)
instance Simplex.Messaging.Crypto.CryptoPrivateKey Simplex.Messaging.Crypto.APrivateKey
instance Simplex.Messaging.Crypto.CryptoPrivateKey Simplex.Messaging.Crypto.APrivateSignKey
instance Simplex.Messaging.Crypto.CryptoPrivateKey Simplex.Messaging.Crypto.APrivateAuthKey
instance Simplex.Messaging.Crypto.CryptoPrivateKey Simplex.Messaging.Crypto.APrivateDhKey
instance Simplex.Messaging.Crypto.AlgorithmI a => Simplex.Messaging.Crypto.CryptoPrivateKey (Simplex.Messaging.Crypto.PrivateKey a)
instance Simplex.Messaging.Crypto.CryptoPublicKey Simplex.Messaging.Crypto.APublicKey
instance Simplex.Messaging.Crypto.CryptoPublicKey Simplex.Messaging.Crypto.APublicVerifyKey
instance Simplex.Messaging.Crypto.CryptoPublicKey Simplex.Messaging.Crypto.APublicAuthKey
instance Simplex.Messaging.Crypto.CryptoPublicKey Simplex.Messaging.Crypto.APublicDhKey
instance Simplex.Messaging.Crypto.AlgorithmI a => Simplex.Messaging.Crypto.CryptoPublicKey (Simplex.Messaging.Crypto.PublicKey a)
instance GHC.Classes.Eq Simplex.Messaging.Crypto.APrivateAuthKey
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Crypto.APrivateAuthKey
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Crypto.APrivateAuthKey
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Crypto.APrivateAuthKey
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Crypto.APrivateAuthKey
instance GHC.Classes.Eq Simplex.Messaging.Crypto.APublicAuthKey
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Crypto.APublicAuthKey
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Crypto.APublicAuthKey
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Crypto.APublicAuthKey
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Crypto.APublicAuthKey
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Crypto.APrivateDhKey
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Crypto.APrivateDhKey
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Crypto.APublicDhKey
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Crypto.APublicDhKey
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Crypto.APublicDhKey
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Crypto.APublicDhKey
instance Simplex.Messaging.Crypto.AlgorithmI a => Simplex.Messaging.Encoding.String.StrEncoding (Simplex.Messaging.Crypto.DhSecret a)
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Crypto.ADhSecret
instance Simplex.Messaging.Crypto.AlgorithmI a => Data.String.IsString (Simplex.Messaging.Crypto.DhSecret a)
instance Database.SQLite.Simple.ToField.ToField (Simplex.Messaging.Crypto.DhSecret a)
instance (Data.Typeable.Internal.Typeable a, Simplex.Messaging.Crypto.AlgorithmI a) => Database.SQLite.Simple.FromField.FromField (Simplex.Messaging.Crypto.DhSecret a)
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Crypto.APublicVerifyKey
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Crypto.APublicVerifyKey
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Crypto.APublicVerifyKey
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Crypto.APublicVerifyKey
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Crypto.APrivateSignKey
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Crypto.APrivateSignKey
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Crypto.APrivateSignKey
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Crypto.APrivateSignKey
instance Simplex.Messaging.Encoding.String.StrEncoding (Simplex.Messaging.Crypto.PrivateKey 'Simplex.Messaging.Crypto.X25519)
instance Simplex.Messaging.Crypto.AlgorithmI a => Data.String.IsString (Simplex.Messaging.Crypto.PrivateKey a)
instance Simplex.Messaging.Crypto.AlgorithmI a => Data.Aeson.Types.ToJSON.ToJSON (Simplex.Messaging.Crypto.PrivateKey a)
instance Simplex.Messaging.Crypto.AlgorithmI a => Data.Aeson.Types.FromJSON.FromJSON (Simplex.Messaging.Crypto.PrivateKey a)
instance Simplex.Messaging.Crypto.AlgorithmI a => Database.SQLite.Simple.ToField.ToField (Simplex.Messaging.Crypto.PrivateKey a)
instance (Data.Typeable.Internal.Typeable a, Simplex.Messaging.Crypto.AlgorithmI a) => Database.SQLite.Simple.FromField.FromField (Simplex.Messaging.Crypto.PrivateKey a)
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Crypto.APublicKey
instance Simplex.Messaging.Crypto.AlgorithmI a => Simplex.Messaging.Encoding.Encoding (Simplex.Messaging.Crypto.PublicKey a)
instance Simplex.Messaging.Crypto.AlgorithmI a => Simplex.Messaging.Encoding.String.StrEncoding (Simplex.Messaging.Crypto.PublicKey a)
instance Simplex.Messaging.Crypto.AlgorithmI a => Data.Aeson.Types.ToJSON.ToJSON (Simplex.Messaging.Crypto.PublicKey a)
instance Simplex.Messaging.Crypto.AlgorithmI a => Data.Aeson.Types.FromJSON.FromJSON (Simplex.Messaging.Crypto.PublicKey a)
instance Simplex.Messaging.Crypto.AlgorithmI a => Data.String.IsString (Simplex.Messaging.Crypto.PublicKey a)
instance Simplex.Messaging.Crypto.AlgorithmI a => Database.SQLite.Simple.ToField.ToField (Simplex.Messaging.Crypto.PublicKey a)
instance (Data.Typeable.Internal.Typeable a, Simplex.Messaging.Crypto.AlgorithmI a) => Database.SQLite.Simple.FromField.FromField (Simplex.Messaging.Crypto.PublicKey a)
instance Simplex.Messaging.Crypto.AlgorithmI 'Simplex.Messaging.Crypto.Ed25519
instance Simplex.Messaging.Crypto.AlgorithmI 'Simplex.Messaging.Crypto.Ed448
instance Simplex.Messaging.Crypto.AlgorithmI 'Simplex.Messaging.Crypto.X25519
instance Simplex.Messaging.Crypto.AlgorithmI 'Simplex.Messaging.Crypto.X448
instance Data.Type.Equality.TestEquality Simplex.Messaging.Crypto.SAlgorithm

module Simplex.Messaging.Transport.Credentials
tlsCredentials :: NonEmpty Credentials -> (KeyHash, Credential)
type Credentials = (ASignatureKeyPair, SignedCertificate)
genCredentials :: TVar ChaChaDRG -> Maybe Credentials -> (Hours, Hours) -> Text -> IO Credentials
signCertificate :: APrivateSignKey -> Certificate -> SignedCertificate

module Simplex.Messaging.Crypto.SNTRUP761.Bindings.RNG
withDRG :: TVar ChaChaDRG -> (Ptr RNGContext -> IO a) -> IO a
rngFuncPtr :: FunPtr RNGFunc
type RNGContext = ()
type RNGFunc = Ptr RNGContext -> CSize -> Ptr Word8 -> IO ()

module Simplex.Messaging.Crypto.SNTRUP761.Bindings.FFI
c_sntrup761_keypair :: Ptr Word8 -> Ptr Word8 -> Ptr RNGContext -> FunPtr RNGFunc -> IO ()
c_sntrup761_enc :: Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> Ptr RNGContext -> FunPtr RNGFunc -> IO ()
c_sntrup761_dec :: Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> IO ()

module Simplex.Messaging.Crypto.SNTRUP761.Bindings
newtype KEMPublicKey
KEMPublicKey :: ByteString -> KEMPublicKey
data KEMSecretKey
newtype KEMCiphertext
KEMCiphertext :: ByteString -> KEMCiphertext
newtype KEMSharedKey
KEMSharedKey :: ScrubbedBytes -> KEMSharedKey
type KEMKeyPair = (KEMPublicKey, KEMSecretKey)
sntrup761Keypair :: TVar ChaChaDRG -> IO KEMKeyPair
sntrup761Enc :: TVar ChaChaDRG -> KEMPublicKey -> IO (KEMCiphertext, KEMSharedKey)
sntrup761Dec :: KEMCiphertext -> KEMSecretKey -> IO KEMSharedKey
instance GHC.Show.Show Simplex.Messaging.Crypto.SNTRUP761.Bindings.KEMPublicKey
instance GHC.Classes.Eq Simplex.Messaging.Crypto.SNTRUP761.Bindings.KEMPublicKey
instance GHC.Show.Show Simplex.Messaging.Crypto.SNTRUP761.Bindings.KEMSecretKey
instance GHC.Classes.Eq Simplex.Messaging.Crypto.SNTRUP761.Bindings.KEMSecretKey
instance GHC.Show.Show Simplex.Messaging.Crypto.SNTRUP761.Bindings.KEMCiphertext
instance GHC.Classes.Eq Simplex.Messaging.Crypto.SNTRUP761.Bindings.KEMCiphertext
instance GHC.Show.Show Simplex.Messaging.Crypto.SNTRUP761.Bindings.KEMSharedKey
instance GHC.Classes.Eq Simplex.Messaging.Crypto.SNTRUP761.Bindings.KEMSharedKey
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Crypto.SNTRUP761.Bindings.KEMSharedKey
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Crypto.SNTRUP761.Bindings.KEMSharedKey
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Crypto.SNTRUP761.Bindings.KEMSharedKey
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Crypto.SNTRUP761.Bindings.KEMSharedKey
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Crypto.SNTRUP761.Bindings.KEMSharedKey
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Crypto.SNTRUP761.Bindings.KEMSharedKey
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Crypto.SNTRUP761.Bindings.KEMCiphertext
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Crypto.SNTRUP761.Bindings.KEMCiphertext
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Crypto.SNTRUP761.Bindings.KEMCiphertext
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Crypto.SNTRUP761.Bindings.KEMCiphertext
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Crypto.SNTRUP761.Bindings.KEMSecretKey
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Crypto.SNTRUP761.Bindings.KEMSecretKey
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Crypto.SNTRUP761.Bindings.KEMSecretKey
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Crypto.SNTRUP761.Bindings.KEMSecretKey
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Crypto.SNTRUP761.Bindings.KEMPublicKey
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Crypto.SNTRUP761.Bindings.KEMPublicKey
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Crypto.SNTRUP761.Bindings.KEMPublicKey
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Crypto.SNTRUP761.Bindings.KEMPublicKey

module Simplex.Messaging.Crypto.SNTRUP761
newtype KEMHybridSecret
KEMHybridSecret :: ScrubbedBytes -> KEMHybridSecret

-- | NaCl <tt>crypto_box</tt> decrypt with a shared hybrid DH + KEM secret
--   and 192-bit nonce.
kcbDecrypt :: KEMHybridSecret -> CbNonce -> ByteString -> Either CryptoError ByteString

-- | NaCl <tt>crypto_box</tt> encrypt with a shared hybrid DH + KEM secret
--   and 192-bit nonce.
kcbEncrypt :: KEMHybridSecret -> CbNonce -> ByteString -> Int -> Either CryptoError ByteString
kemHybridSecret :: PublicKeyX25519 -> PrivateKeyX25519 -> KEMSharedKey -> KEMHybridSecret

module Simplex.Messaging.Crypto.Lazy

-- | SHA512 digest of a lazy bytestring.
sha256Hash :: LazyByteString -> ByteString

-- | SHA512 digest of a lazy bytestring.
sha512Hash :: LazyByteString -> ByteString
pad :: LazyByteString -> Int64 -> Int64 -> Either CryptoError LazyByteString
unPad :: LazyByteString -> Either CryptoError LazyByteString
splitLen :: LazyByteString -> Either CryptoError (Int64, LazyByteString)

-- | NaCl <tt>secret_box</tt> lazy encrypt with a symmetric 256-bit key and
--   192-bit nonce. The resulting string will be bigger than paddedLen by
--   the size of the auth tag (16 bytes).
sbEncrypt :: SbKey -> CbNonce -> LazyByteString -> Int64 -> Int64 -> Either CryptoError LazyByteString

-- | NaCl <tt>secret_box</tt> decrypt with a symmetric 256-bit key and
--   192-bit nonce. The resulting string will be smaller than packet size
--   by the size of the auth tag (16 bytes).
sbDecrypt :: SbKey -> CbNonce -> LazyByteString -> Either CryptoError LazyByteString

-- | NaCl <tt>secret_box</tt> lazy encrypt with a symmetric 256-bit key and
--   192-bit nonce with appended auth tag (more efficient with large
--   files).
sbEncryptTailTag :: SbKey -> CbNonce -> LazyByteString -> Int64 -> Int64 -> Either CryptoError LazyByteString

-- | NaCl <tt>crypto_box</tt> lazy encrypt with with a shared hybrid KEM+DH
--   256-bit secret and 192-bit nonce with appended auth tag (more
--   efficient with large strings/files).
kcbEncryptTailTag :: KEMHybridSecret -> CbNonce -> LazyByteString -> Int64 -> Int64 -> Either CryptoError LazyByteString

-- | NaCl <tt>secret_box</tt> decrypt with a symmetric 256-bit key and
--   192-bit nonce with appended auth tag (more efficient with large
--   files). paddedLen should NOT include the tag length, it should be the
--   same number that is passed to sbEncrypt / sbEncryptTailTag.
sbDecryptTailTag :: SbKey -> CbNonce -> Int64 -> LazyByteString -> Either CryptoError (Bool, LazyByteString)

-- | NaCl <tt>crypto_box</tt> lazy decrypt with a shared hybrid KEM+DH
--   256-bit secret and 192-bit nonce with appended auth tag (more
--   efficient with large strings/files). paddedLen should NOT include the
--   tag length, it should be the same number that is passed to sbEncrypt /
--   sbEncryptTailTag.
kcbDecryptTailTag :: KEMHybridSecret -> CbNonce -> Int64 -> LazyByteString -> Either CryptoError (Bool, LazyByteString)
sbEncryptTailTagNoPad :: SbKeyNonce -> LazyByteString -> Either CryptoError LazyByteString
sbDecryptTailTagNoPad :: SbKeyNonce -> Int64 -> LazyByteString -> Either CryptoError (Bool, LazyByteString)
fastReplicate :: Int64 -> Char -> LazyByteString
secretBox :: ByteArrayAccess key => (SbState -> ByteString -> (ByteString, SbState)) -> key -> ByteString -> LazyByteString -> Either CryptoError (NonEmpty ByteString)
secretBoxTailTag :: ByteArrayAccess key => (SbState -> ByteString -> (ByteString, SbState)) -> key -> ByteString -> LazyByteString -> Either CryptoError [ByteString]
type SbState = (State, State)
cbInit :: DhSecretX25519 -> CbNonce -> Either CryptoError SbState
sbInit :: SbKey -> CbNonce -> Either CryptoError SbState
kcbInit :: KEMHybridSecret -> CbNonce -> Either CryptoError SbState
sbEncryptChunk :: SbState -> ByteString -> (ByteString, SbState)
sbDecryptChunk :: SbState -> ByteString -> (ByteString, SbState)
sbEncryptChunkLazy :: SbState -> LazyByteString -> (LazyByteString, SbState)
sbDecryptChunkLazy :: SbState -> LazyByteString -> (LazyByteString, SbState)
sbAuth :: SbState -> Auth
type LazyByteString = ByteString

module Simplex.Messaging.Crypto.File
data CryptoFile
CryptoFile :: FilePath -> Maybe CryptoFileArgs -> CryptoFile
[filePath] :: CryptoFile -> FilePath
[cryptoArgs] :: CryptoFile -> Maybe CryptoFileArgs
data CryptoFileArgs
CFArgs :: SbKey -> CbNonce -> CryptoFileArgs
[fileKey] :: CryptoFileArgs -> SbKey
[fileNonce] :: CryptoFileArgs -> CbNonce
data CryptoFileHandle
CFHandle :: Handle -> Maybe (TVar SbState) -> CryptoFileHandle
data FTCryptoError
FTCECryptoError :: CryptoError -> FTCryptoError
FTCEInvalidHeader :: String -> FTCryptoError
FTCEInvalidFileSize :: FTCryptoError
FTCEInvalidAuthTag :: FTCryptoError
FTCEFileIOError :: String -> FTCryptoError
readFile :: CryptoFile -> ExceptT FTCryptoError IO LazyByteString
writeFile :: CryptoFile -> LazyByteString -> ExceptT FTCryptoError IO ()
withFile :: CryptoFile -> IOMode -> (CryptoFileHandle -> ExceptT FTCryptoError IO a) -> ExceptT FTCryptoError IO a
hPut :: CryptoFileHandle -> LazyByteString -> IO ()
hPutTag :: CryptoFileHandle -> IO ()
hGet :: CryptoFileHandle -> Int -> IO ByteString

-- | Read and validate the auth tag. This function should be called after
--   reading the whole file, it assumes you know the file size and read
--   only the needed bytes.
hGetTag :: CryptoFileHandle -> ExceptT FTCryptoError IO ()
plain :: FilePath -> CryptoFile
randomArgs :: TVar ChaChaDRG -> STM CryptoFileArgs
getFileContentsSize :: CryptoFile -> IO Integer
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Crypto.File.CryptoFile
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Crypto.File.CryptoFile
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Crypto.File.CryptoFileArgs
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Crypto.File.CryptoFileArgs
instance GHC.Show.Show Simplex.Messaging.Crypto.File.CryptoFileArgs
instance GHC.Classes.Eq Simplex.Messaging.Crypto.File.CryptoFileArgs
instance GHC.Show.Show Simplex.Messaging.Crypto.File.CryptoFile
instance GHC.Classes.Eq Simplex.Messaging.Crypto.File.CryptoFile
instance GHC.Exception.Type.Exception Simplex.Messaging.Crypto.File.FTCryptoError
instance GHC.Classes.Eq Simplex.Messaging.Crypto.File.FTCryptoError
instance GHC.Show.Show Simplex.Messaging.Crypto.File.FTCryptoError

module Simplex.Messaging.Agent.Store.Entity
data DBStored
DBStored :: DBStored
DBNew :: DBStored
data SDBStored (s :: DBStored)
[SDBStored] :: SDBStored 'DBStored
[SDBNew] :: SDBStored 'DBNew
class DBStoredI s
sdbStored :: DBStoredI s => SDBStored s
type DBEntityId = DBEntityId' 'DBStored
data DBEntityId' (s :: DBStored)
[DBEntityId] :: Int64 -> DBEntityId' 'DBStored
[DBNewEntity] :: DBEntityId' 'DBNew
instance GHC.Show.Show (Simplex.Messaging.Agent.Store.Entity.SDBStored s)
instance GHC.Show.Show (Simplex.Messaging.Agent.Store.Entity.DBEntityId' s)
instance GHC.Classes.Eq (Simplex.Messaging.Agent.Store.Entity.DBEntityId' s)
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Agent.Store.Entity.DBEntityId
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Agent.Store.Entity.DBEntityId
instance Data.Aeson.Types.ToJSON.ToJSON (Simplex.Messaging.Agent.Store.Entity.DBEntityId' s)
instance Simplex.Messaging.Agent.Store.Entity.DBStoredI s => Data.Aeson.Types.FromJSON.FromJSON (Simplex.Messaging.Agent.Store.Entity.DBEntityId' s)
instance Simplex.Messaging.Agent.Store.Entity.DBStoredI 'Simplex.Messaging.Agent.Store.Entity.DBStored
instance Simplex.Messaging.Agent.Store.Entity.DBStoredI 'Simplex.Messaging.Agent.Store.Entity.DBNew

module Simplex.Messaging.Agent.Store.SQLite.Common
data DBStore
DBStore :: FilePath -> [SQLiteFuncDef] -> TVar (Maybe ScrubbedBytes) -> TVar Int -> MVar Connection -> TVar Bool -> Bool -> DBStore
[$sel:dbFilePath:DBStore] :: DBStore -> FilePath
[$sel:dbFunctions:DBStore] :: DBStore -> [SQLiteFuncDef]
[$sel:dbKey:DBStore] :: DBStore -> TVar (Maybe ScrubbedBytes)
[$sel:dbSem:DBStore] :: DBStore -> TVar Int
[$sel:dbConnection:DBStore] :: DBStore -> MVar Connection
[$sel:dbClosed:DBStore] :: DBStore -> TVar Bool
[$sel:dbNew:DBStore] :: DBStore -> Bool
data DBOpts
DBOpts :: FilePath -> [SQLiteFuncDef] -> ScrubbedBytes -> Bool -> Bool -> TrackQueries -> DBOpts
[$sel:dbFilePath:DBOpts] :: DBOpts -> FilePath
[$sel:dbFunctions:DBOpts] :: DBOpts -> [SQLiteFuncDef]
[$sel:dbKey:DBOpts] :: DBOpts -> ScrubbedBytes
[$sel:keepKey:DBOpts] :: DBOpts -> Bool
[$sel:vacuum:DBOpts] :: DBOpts -> Bool
[$sel:track:DBOpts] :: DBOpts -> TrackQueries
data SQLiteFuncDef
SQLiteFuncDef :: ByteString -> CArgCount -> SQLiteFuncPtrs -> SQLiteFuncDef
[$sel:funcName:SQLiteFuncDef] :: SQLiteFuncDef -> ByteString
[$sel:argCount:SQLiteFuncDef] :: SQLiteFuncDef -> CArgCount
[$sel:funcPtrs:SQLiteFuncDef] :: SQLiteFuncDef -> SQLiteFuncPtrs
data SQLiteFuncPtrs
SQLiteFuncPtr :: Bool -> FunPtr SQLiteFunc -> SQLiteFuncPtrs
[$sel:deterministic:SQLiteFuncPtr] :: SQLiteFuncPtrs -> Bool
[$sel:funcPtr:SQLiteFuncPtr] :: SQLiteFuncPtrs -> FunPtr SQLiteFunc
SQLiteAggrPtrs :: FunPtr SQLiteFunc -> FunPtr SQLiteFuncFinal -> SQLiteFuncPtrs
[$sel:stepPtr:SQLiteFuncPtr] :: SQLiteFuncPtrs -> FunPtr SQLiteFunc
[$sel:finalPtr:SQLiteFuncPtr] :: SQLiteFuncPtrs -> FunPtr SQLiteFuncFinal
withConnection :: DBStore -> (Connection -> IO a) -> IO a
withConnection' :: DBStore -> (Connection -> IO a) -> IO a
withTransaction :: DBStore -> (Connection -> IO a) -> IO a
withTransaction' :: DBStore -> (Connection -> IO a) -> IO a
withTransactionPriority :: DBStore -> Bool -> (Connection -> IO a) -> IO a
withSavepoint :: Connection -> Query -> IO a -> IO (Either SQLError a)
dbBusyLoop :: forall a. IO a -> IO a
storeKey :: ScrubbedBytes -> Bool -> Maybe ScrubbedBytes

module Simplex.Messaging.Agent.Store.Common

module Simplex.Messaging.Agent.RetryInterval
data RetryInterval
RetryInterval :: Int64 -> Int64 -> Int64 -> RetryInterval
[initialInterval] :: RetryInterval -> Int64
[increaseAfter] :: RetryInterval -> Int64
[maxInterval] :: RetryInterval -> Int64
data RetryInterval2
RetryInterval2 :: RetryInterval -> RetryInterval -> RetryInterval2
[riSlow] :: RetryInterval2 -> RetryInterval
[riFast] :: RetryInterval2 -> RetryInterval
data RetryIntervalMode
RISlow :: RetryIntervalMode
RIFast :: RetryIntervalMode
data RI2State
RI2State :: Int64 -> Int64 -> RI2State
[slowInterval] :: RI2State -> Int64
[fastInterval] :: RI2State -> Int64
withRetryInterval :: forall m a. MonadIO m => RetryInterval -> (Int64 -> m a -> m a) -> m a
withRetryIntervalCount :: forall m a. MonadIO m => RetryInterval -> (Int -> Int64 -> m a -> m a) -> m a
withRetryForeground :: forall m a. MonadIO m => RetryInterval -> STM Bool -> STM Bool -> (Int64 -> m a -> m a) -> m a
withRetryLock2 :: forall m. MonadIO m => RetryInterval2 -> TMVar () -> (RI2State -> (RetryIntervalMode -> m ()) -> m ()) -> m ()
updateRetryInterval2 :: RI2State -> RetryInterval2 -> RetryInterval2
nextRetryDelay :: Int64 -> Int64 -> RetryInterval -> Int64
instance GHC.Show.Show Simplex.Messaging.Agent.RetryInterval.RI2State
instance GHC.Show.Show Simplex.Messaging.Agent.RetryInterval.RetryIntervalMode
instance GHC.Classes.Eq Simplex.Messaging.Agent.RetryInterval.RetryIntervalMode

module Simplex.FileTransfer.Util
uniqueCombine :: MonadIO m => FilePath -> String -> m FilePath
removePath :: MonadIO m => FilePath -> m ()

module Simplex.Messaging.Version.Internal
newtype Version v
Version :: Word16 -> Version v
instance GHC.Show.Show (Simplex.Messaging.Version.Internal.Version v)
instance GHC.Classes.Ord (Simplex.Messaging.Version.Internal.Version v)
instance GHC.Classes.Eq (Simplex.Messaging.Version.Internal.Version v)
instance Simplex.Messaging.Encoding.Encoding (Simplex.Messaging.Version.Internal.Version v)
instance Simplex.Messaging.Encoding.String.StrEncoding (Simplex.Messaging.Version.Internal.Version v)
instance Data.Aeson.Types.ToJSON.ToJSON (Simplex.Messaging.Version.Internal.Version v)
instance Data.Aeson.Types.FromJSON.FromJSON (Simplex.Messaging.Version.Internal.Version v)

module Simplex.Messaging.Version
data Version v
data VersionRange v
class VersionScope v
pattern VersionRange :: Version v -> Version v -> VersionRange v
class VersionScope v => VersionI v a | a -> v where {
    type VersionRangeT v a;
}
version :: VersionI v a => a -> Version v
toVersionRangeT :: VersionI v a => a -> VersionRange v -> VersionRangeT v a
class VersionScope v => VersionRangeI v a | a -> v where {
    type VersionT v a;
}
versionRange :: VersionRangeI v a => a -> VersionRange v
toVersionRange :: VersionRangeI v a => a -> VersionRange v -> a
toVersionT :: VersionRangeI v a => a -> Version v -> VersionT v a
data Compatible a
pattern Compatible :: a -> Compatible a

-- | construct valid version range, to be used in constants
mkVersionRange :: Version v -> Version v -> VersionRange v
safeVersionRange :: Version v -> Version v -> Maybe (VersionRange v)
versionToRange :: Version v -> VersionRange v
isCompatible :: VersionI v a => a -> VersionRange v -> Bool
isCompatibleRange :: VersionRangeI v a => a -> VersionRange v -> Bool
proveCompatible :: VersionI v a => a -> VersionRange v -> Maybe (Compatible a)
compatibleVersion :: VersionRangeI v a => a -> VersionRange v -> Maybe (Compatible (VersionT v a))

-- | intersection of version ranges
compatibleVRange :: VersionRangeI v a => a -> VersionRange v -> Maybe (Compatible a)

-- | version range capped by compatible version
compatibleVRange' :: VersionRangeI v a => a -> Version v -> Maybe (Compatible a)
instance GHC.Show.Show (Simplex.Messaging.Version.VersionRange v)
instance GHC.Classes.Eq (Simplex.Messaging.Version.VersionRange v)
instance Simplex.Messaging.Version.VersionScope v => Simplex.Messaging.Version.VersionRangeI v (Simplex.Messaging.Version.VersionRange v)
instance Simplex.Messaging.Version.VersionScope v => Simplex.Messaging.Version.VersionI v (Simplex.Messaging.Version.Internal.Version v)
instance Simplex.Messaging.Version.VersionScope v => Simplex.Messaging.Encoding.Encoding (Simplex.Messaging.Version.VersionRange v)
instance Simplex.Messaging.Version.VersionScope v => Simplex.Messaging.Encoding.String.StrEncoding (Simplex.Messaging.Version.VersionRange v)
instance Data.Aeson.Types.FromJSON.FromJSON (Simplex.Messaging.Version.VersionRange v)
instance Data.Aeson.Types.ToJSON.ToJSON (Simplex.Messaging.Version.VersionRange v)


-- | This module defines basic TCP server and client and SMP protocol
--   encrypted transport over TCP.
--   
--   See
--   <a>https://github.com/simplex-chat/simplexmq/blob/master/protocol/simplex-messaging.md#appendix-a</a>
module Simplex.Messaging.Transport
data SMPVersion
type VersionSMP = Version SMPVersion
type VersionRangeSMP = VersionRange SMPVersion
type THandleSMP c p = THandle SMPVersion c p
alpnSupportedSMPHandshakes :: [ALPN]
supportedClientSMPRelayVRange :: VersionRangeSMP
supportedServerSMPRelayVRange :: VersionRangeSMP
supportedProxyClientSMPRelayVRange :: VersionRangeSMP
proxiedSMPRelayVRange :: VersionRangeSMP
minClientSMPRelayVersion :: VersionSMP
minServerSMPRelayVersion :: VersionSMP
currentClientSMPRelayVersion :: VersionSMP
currentServerSMPRelayVersion :: VersionSMP
authCmdsSMPVersion :: VersionSMP
sendingProxySMPVersion :: VersionSMP
sndAuthKeySMPVersion :: VersionSMP
deletedEventSMPVersion :: VersionSMP
encryptedBlockSMPVersion :: VersionSMP
blockedEntitySMPVersion :: VersionSMP
shortLinksSMPVersion :: VersionSMP
serviceCertsSMPVersion :: VersionSMP
newNtfCredsSMPVersion :: VersionSMP
clientNoticesSMPVersion :: VersionSMP
simplexMQVersion :: String
smpBlockSize :: Int
data TransportConfig
TransportConfig :: Bool -> Maybe Int -> TransportConfig
[$sel:logTLSErrors:TransportConfig] :: TransportConfig -> Bool
[$sel:transportTimeout:TransportConfig] :: TransportConfig -> Maybe Int
class Typeable c => Transport (c :: TransportPeer -> Type)
transport :: forall p. Transport c => ATransport p
transportName :: Transport c => TProxy c p -> String
transportConfig :: Transport c => c p -> TransportConfig

-- | Upgrade TLS context to connection
getTransportConnection :: (Transport c, TransportPeerI p) => TransportConfig -> Bool -> CertificateChain -> Context -> IO (c p)

-- | Whether TLS certificate chain was provided to peer It is always True
--   for the server. It is True for the client when server requested it AND
--   non-empty chain is sent.
certificateSent :: Transport c => c p -> Bool

-- | TLS certificate chain, server's in the client, client's in the server
--   (empty chain for non-service clients)
getPeerCertChain :: Transport c => c p -> CertificateChain

-- | tls-unique channel binding per RFC5929
tlsUnique :: Transport c => c p -> SessionId

-- | ALPN value negotiated for the session
getSessionALPN :: Transport c => c p -> Maybe ALPN

-- | Close connection
closeConnection :: Transport c => c p -> IO ()

-- | Read fixed number of bytes from connection
cGet :: Transport c => c p -> Int -> IO ByteString

-- | Write bytes to connection
cPut :: Transport c => c p -> ByteString -> IO ()

-- | Receive ByteString from connection, allowing LF or CRLF termination.
getLn :: Transport c => c p -> IO ByteString

-- | Send ByteString to connection terminating it with CRLF.
putLn :: Transport c => c p -> ByteString -> IO ()
data TProxy (c :: TransportPeer -> Type) (p :: TransportPeer)
TProxy :: TProxy (c :: TransportPeer -> Type) (p :: TransportPeer)
data ATransport p
ATransport :: TProxy c p -> ATransport p
type ASrvTransport = ATransport 'TServer
data TransportPeer
TClient :: TransportPeer
TServer :: TransportPeer
data STransportPeer (p :: TransportPeer)
[STClient] :: STransportPeer 'TClient
[STServer] :: STransportPeer 'TServer
class TransportPeerI p
sTransportPeer :: TransportPeerI p => STransportPeer p
getServerVerifyKey :: Transport c => c 'TClient -> Either String APublicVerifyKey
data TLS (p :: TransportPeer)
TLS :: Context -> ByteString -> TBuffer -> Maybe ALPN -> Bool -> CertificateChain -> TransportConfig -> TLS (p :: TransportPeer)
[$sel:tlsContext:TLS] :: TLS (p :: TransportPeer) -> Context
[$sel:tlsUniq:TLS] :: TLS (p :: TransportPeer) -> ByteString
[$sel:tlsBuffer:TLS] :: TLS (p :: TransportPeer) -> TBuffer
[$sel:tlsALPN:TLS] :: TLS (p :: TransportPeer) -> Maybe ALPN
[$sel:tlsCertSent:TLS] :: TLS (p :: TransportPeer) -> Bool
[$sel:tlsPeerCert:TLS] :: TLS (p :: TransportPeer) -> CertificateChain
[$sel:tlsTransportConfig:TLS] :: TLS (p :: TransportPeer) -> TransportConfig

-- | TLS-unique channel binding
type SessionId = ByteString
type ServiceId = EntityId
newtype EntityId
EntityId :: ByteString -> EntityId
[$sel:unEntityId:EntityId] :: EntityId -> ByteString
pattern NoEntity :: EntityId
type ALPN = ByteString
connectTLS :: TLSParams p => Maybe HostName -> TransportConfig -> p -> Socket -> IO Context
closeTLS :: Context -> IO ()
defaultSupportedParams :: Supported

-- | A selection of extra parameters to accomodate browser chains
defaultSupportedParamsHTTPS :: Supported
withTlsUnique :: forall c p. TransportPeerI p => Context -> (ByteString -> IO (c p)) -> IO (c p)

-- | The handle for SMP encrypted transport connection over Transport.
data THandle v c p
THandle :: c p -> THandleParams v p -> THandle v c p
[$sel:connection:THandle] :: THandle v c p -> c p
[$sel:params:THandle] :: THandle v c p -> THandleParams v p
data THandleParams v p
THandleParams :: SessionId -> Int -> VersionRange v -> Version v -> Maybe (THandleAuth p) -> Bool -> Maybe TSbChainKeys -> Bool -> Bool -> THandleParams v p
[$sel:sessionId:THandleParams] :: THandleParams v p -> SessionId
[$sel:blockSize:THandleParams] :: THandleParams v p -> Int

-- | server protocol version range
[$sel:thServerVRange:THandleParams] :: THandleParams v p -> VersionRange v

-- | agreed server protocol version
[$sel:thVersion:THandleParams] :: THandleParams v p -> Version v

-- | peer public key for command authorization and shared secrets for
--   entity ID encryption
[$sel:thAuth:THandleParams] :: THandleParams v p -> Maybe (THandleAuth p)

-- | do NOT send session ID in transmission, but include it into signed
--   message based on protocol version
[$sel:implySessId:THandleParams] :: THandleParams v p -> Bool

-- | keys for additional transport encryption
[$sel:encryptBlock:THandleParams] :: THandleParams v p -> Maybe TSbChainKeys

-- | send multiple transmissions in a single block based on protocol
--   version
[$sel:batch:THandleParams] :: THandleParams v p -> Bool

-- | include service signature (or '0' if it is absent), based on protocol
--   version
[$sel:serviceAuth:THandleParams] :: THandleParams v p -> Bool
data THandleAuth (p :: TransportPeer)
[THAuthClient] :: PublicKeyX25519 -> CertChainPubKey -> Maybe THClientService -> Maybe DhSecretX25519 -> THandleAuth 'TClient
[THAuthServer] :: PrivateKeyX25519 -> Maybe THPeerClientService -> Maybe DhSecretX25519 -> THandleAuth 'TServer
data CertChainPubKey
CertChainPubKey :: CertificateChain -> SignedExact PubKey -> CertChainPubKey
[$sel:certChain:CertChainPubKey] :: CertChainPubKey -> CertificateChain
[$sel:signedPubKey:CertChainPubKey] :: CertChainPubKey -> SignedExact PubKey
data ServiceCredentials
ServiceCredentials :: SMPServiceRole -> Credential -> Fingerprint -> APrivateSignKey -> ServiceCredentials
[$sel:serviceRole:ServiceCredentials] :: ServiceCredentials -> SMPServiceRole
[$sel:serviceCreds:ServiceCredentials] :: ServiceCredentials -> Credential
[$sel:serviceCertHash:ServiceCredentials] :: ServiceCredentials -> Fingerprint
[$sel:serviceSignKey:ServiceCredentials] :: ServiceCredentials -> APrivateSignKey
data THClientService' k
THClientService :: ServiceId -> SMPServiceRole -> Fingerprint -> k -> THClientService' k
[$sel:serviceId:THClientService] :: THClientService' k -> ServiceId
[$sel:serviceRole:THClientService] :: THClientService' k -> SMPServiceRole
[$sel:serviceCertHash:THClientService] :: THClientService' k -> Fingerprint
[$sel:serviceKey:THClientService] :: THClientService' k -> k
type THClientService = THClientService' PrivateKeyEd25519
type THPeerClientService = THClientService' PublicKeyEd25519
data SMPServiceRole
SRMessaging :: SMPServiceRole
SRNotifier :: SMPServiceRole
SRProxy :: SMPServiceRole
data TSbChainKeys
TSbChainKeys :: TVar SbChainKey -> TVar SbChainKey -> TSbChainKeys
[$sel:sndKey:TSbChainKeys] :: TSbChainKeys -> TVar SbChainKey
[$sel:rcvKey:TSbChainKeys] :: TSbChainKeys -> TVar SbChainKey

-- | Error of SMP encrypted transport over TCP.
data TransportError

-- | error parsing transport block
TEBadBlock :: TransportError

-- | incompatible client or server version
TEVersion :: TransportError

-- | message does not fit in transport block
TELargeMsg :: TransportError

-- | incorrect session ID
TEBadSession :: TransportError

-- | absent server key for v7 entity This error happens when the server did
--   not provide a DH key to authorize commands for the queue that should
--   be authorized with a DH key.
TENoServerAuth :: TransportError

-- | transport handshake error
TEHandshake :: HandshakeError -> TransportError
[$sel:handshakeErr:TEBadBlock] :: TransportError -> HandshakeError

-- | Transport handshake error.
data HandshakeError

-- | parsing error
PARSE :: HandshakeError

-- | incorrect server identity
IDENTITY :: HandshakeError

-- | v7 authentication failed
BAD_AUTH :: HandshakeError

-- | error reading/creating service record
BAD_SERVICE :: HandshakeError

-- | Server SMP transport handshake.
--   
--   See
--   <a>https://github.com/simplex-chat/simplexmq/blob/master/protocol/simplex-messaging.md#appendix-a</a>
smpServerHandshake :: forall c. Transport c => CertificateChain -> APrivateSignKey -> c 'TServer -> KeyPairX25519 -> KeyHash -> VersionRangeSMP -> (SMPServiceRole -> CertificateChain -> Fingerprint -> ExceptT TransportError IO ServiceId) -> ExceptT TransportError IO (THandleSMP c 'TServer)

-- | Client SMP transport handshake.
--   
--   See
--   <a>https://github.com/simplex-chat/simplexmq/blob/master/protocol/simplex-messaging.md#appendix-a</a>
smpClientHandshake :: forall c. Transport c => c 'TClient -> Maybe KeyPairX25519 -> KeyHash -> VersionRangeSMP -> Bool -> Maybe (ServiceCredentials, KeyPairEd25519) -> ExceptT TransportError IO (THandleSMP c 'TClient)

-- | Pad and send block to SMP transport.
tPutBlock :: Transport c => THandle v c p -> ByteString -> IO (Either TransportError ())

-- | Receive block from SMP transport.
tGetBlock :: Transport c => THandle v c p -> IO (Either TransportError ByteString)
sendHandshake :: (Transport c, Encoding smp) => THandle v c p -> smp -> ExceptT TransportError IO ()
getHandshake :: (Transport c, Encoding smp) => THandle v c p -> ExceptT TransportError IO smp
smpTHParamsSetVersion :: VersionSMP -> THandleParams SMPVersion p -> THandleParams SMPVersion p
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Transport.TransportError
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Transport.TransportError
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Transport.HandshakeError
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Transport.HandshakeError
instance GHC.Show.Show Simplex.Messaging.Transport.TransportPeer
instance GHC.Classes.Eq Simplex.Messaging.Transport.TransportPeer
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Transport.EntityId
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Transport.EntityId
instance GHC.Show.Show Simplex.Messaging.Transport.EntityId
instance GHC.Classes.Ord Simplex.Messaging.Transport.EntityId
instance GHC.Classes.Eq Simplex.Messaging.Transport.EntityId
instance GHC.Show.Show Simplex.Messaging.Transport.SMPServiceRole
instance GHC.Classes.Eq Simplex.Messaging.Transport.SMPServiceRole
instance GHC.Show.Show Simplex.Messaging.Transport.CertChainPubKey
instance GHC.Classes.Eq Simplex.Messaging.Transport.CertChainPubKey
instance GHC.Exception.Type.Exception Simplex.Messaging.Transport.HandshakeError
instance GHC.Show.Show Simplex.Messaging.Transport.HandshakeError
instance GHC.Read.Read Simplex.Messaging.Transport.HandshakeError
instance GHC.Classes.Eq Simplex.Messaging.Transport.HandshakeError
instance GHC.Exception.Type.Exception Simplex.Messaging.Transport.TransportError
instance GHC.Show.Show Simplex.Messaging.Transport.TransportError
instance GHC.Read.Read Simplex.Messaging.Transport.TransportError
instance GHC.Classes.Eq Simplex.Messaging.Transport.TransportError
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Transport.SMPServerHandshakeResponse
instance Simplex.Messaging.Transport.Transport Simplex.Messaging.Transport.TLS
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Transport.TransportError
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Transport.SMPServerHandshake
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Transport.SMPClientHandshake
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Transport.SMPClientHandshakeService
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Transport.CertChainPubKey
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Transport.SMPServiceRole
instance Simplex.Messaging.Transport.TransportPeerI 'Simplex.Messaging.Transport.TClient
instance Simplex.Messaging.Transport.TransportPeerI 'Simplex.Messaging.Transport.TServer
instance Simplex.Messaging.Version.VersionScope Simplex.Messaging.Transport.SMPVersion

module Simplex.Messaging.Transport.WebSockets
data WS (p :: TransportPeer)
WS :: ByteString -> Maybe ALPN -> Stream -> Connection -> TransportConfig -> Bool -> CertificateChain -> WS (p :: TransportPeer)
[tlsUniq] :: WS (p :: TransportPeer) -> ByteString
[wsALPN] :: WS (p :: TransportPeer) -> Maybe ALPN
[wsStream] :: WS (p :: TransportPeer) -> Stream
[wsConnection] :: WS (p :: TransportPeer) -> Connection
[wsTransportConfig] :: WS (p :: TransportPeer) -> TransportConfig
[wsCertSent] :: WS (p :: TransportPeer) -> Bool
[wsPeerCert] :: WS (p :: TransportPeer) -> CertificateChain
instance Simplex.Messaging.Transport.Transport Simplex.Messaging.Transport.WebSockets.WS

module Simplex.Messaging.Transport.Server
data TransportServerConfig
TransportServerConfig :: Bool -> Maybe [ALPN] -> Bool -> Bool -> Int -> Int -> TransportServerConfig
[$sel:logTLSErrors:TransportServerConfig] :: TransportServerConfig -> Bool
[$sel:serverALPN:TransportServerConfig] :: TransportServerConfig -> Maybe [ALPN]
[$sel:askClientCert:TransportServerConfig] :: TransportServerConfig -> Bool
[$sel:addCORSHeaders:TransportServerConfig] :: TransportServerConfig -> Bool
[$sel:tlsSetupTimeout:TransportServerConfig] :: TransportServerConfig -> Int
[$sel:transportTimeout:TransportServerConfig] :: TransportServerConfig -> Int
data ServerCredentials
ServerCredentials :: Maybe FilePath -> FilePath -> FilePath -> ServerCredentials
[$sel:caCertificateFile:ServerCredentials] :: ServerCredentials -> Maybe FilePath
[$sel:privateKeyFile:ServerCredentials] :: ServerCredentials -> FilePath
[$sel:certificateFile:ServerCredentials] :: ServerCredentials -> FilePath
data TLSServerCredential
TLSServerCredential :: Credential -> Maybe Credential -> TLSServerCredential
[$sel:credential:TLSServerCredential] :: TLSServerCredential -> Credential
[$sel:sniCredential:TLSServerCredential] :: TLSServerCredential -> Maybe Credential
type SNICredentialUsed = Bool
type AddHTTP = Bool
mkTransportServerConfig :: Bool -> Maybe [ALPN] -> Bool -> TransportServerConfig
runTransportServerState :: Transport c => SocketState -> TMVar Bool -> ServiceName -> Supported -> Credential -> TransportServerConfig -> (c 'TServer -> IO ()) -> IO ()
runTransportServerState_ :: forall c. Transport c => SocketState -> TMVar Bool -> ServiceName -> Supported -> TLSServerCredential -> TransportServerConfig -> (Socket -> (SNICredentialUsed, c 'TServer) -> IO ()) -> IO ()
type SocketState = (TVar Int, TVar Int, TVar (IntMap (Weak ThreadId)))
data SocketStats
SocketStats :: Int -> Int -> Int -> Int -> SocketStats
[$sel:socketsAccepted:SocketStats] :: SocketStats -> Int
[$sel:socketsClosed:SocketStats] :: SocketStats -> Int
[$sel:socketsActive:SocketStats] :: SocketStats -> Int
[$sel:socketsLeaked:SocketStats] :: SocketStats -> Int
newSocketState :: IO SocketState
getSocketStats :: SocketState -> IO SocketStats

-- | Run transport server (plain TCP or WebSockets) on passed TCP port and
--   signal when server started and stopped via passed TMVar.
--   
--   All accepted connections are passed to the passed function.
runTransportServer :: Transport c => TMVar Bool -> ServiceName -> Supported -> Credential -> TransportServerConfig -> (c 'TServer -> IO ()) -> IO ()

-- | Run a transport server with provided connection setup and handler.
runTransportServerSocket :: Transport c => TMVar Bool -> IO Socket -> String -> ServerParams -> TransportServerConfig -> (c 'TServer -> IO ()) -> IO ()

-- | Run TCP server without TLS
runLocalTCPServer :: TMVar Bool -> ServiceName -> (Socket -> IO ()) -> IO ()
startTCPServer :: TMVar Bool -> Maybe HostName -> ServiceName -> IO Socket
loadServerCredential :: ServerCredentials -> IO Credential
loadFingerprint :: ServerCredentials -> IO Fingerprint
loadFileFingerprint :: FilePath -> IO Fingerprint

-- | Server SMP transport handshake.
--   
--   See
--   <a>https://github.com/simplex-chat/simplexmq/blob/master/protocol/simplex-messaging.md#appendix-a</a>
smpServerHandshake :: forall c. Transport c => CertificateChain -> APrivateSignKey -> c 'TServer -> KeyPairX25519 -> KeyHash -> VersionRangeSMP -> (SMPServiceRole -> CertificateChain -> Fingerprint -> ExceptT TransportError IO ServiceId) -> ExceptT TransportError IO (THandleSMP c 'TServer)
instance GHC.Show.Show Simplex.Messaging.Transport.Server.TransportServerConfig
instance GHC.Classes.Eq Simplex.Messaging.Transport.Server.TransportServerConfig
instance GHC.Show.Show Simplex.Messaging.Transport.Server.ServerCredentials

module Simplex.Messaging.Transport.HTTP2
data HTTP2Body
HTTP2Body :: ByteString -> Int -> Maybe (Int -> IO ByteString) -> TBuffer -> HTTP2Body
[bodyHead] :: HTTP2Body -> ByteString
[bodySize] :: HTTP2Body -> Int
[bodyPart] :: HTTP2Body -> Maybe (Int -> IO ByteString)
[bodyBuffer] :: HTTP2Body -> TBuffer
class HTTP2BodyChunk a
getBodyChunk :: HTTP2BodyChunk a => a -> IO ByteString
getBodySize :: HTTP2BodyChunk a => a -> Maybe Int
defaultHTTP2BufferSize :: BufferSize
withHTTP2 :: BufferSize -> (Config -> IO a) -> IO () -> TLS p -> IO a
http2TLSParams :: Supported
getHTTP2Body :: HTTP2BodyChunk a => a -> Int -> IO HTTP2Body
httpALPN :: [ALPN]
httpALPN11 :: ALPN
instance Simplex.Messaging.Transport.HTTP2.HTTP2BodyChunk Network.HTTP2.Client.Types.Response
instance Simplex.Messaging.Transport.HTTP2.HTTP2BodyChunk Network.HTTP2.Server.Types.Request

module Simplex.Messaging.Transport.HTTP2.Server
type HTTP2ServerFunc = SessionId -> Maybe ALPN -> Request -> (Response -> IO ()) -> IO ()
data HTTP2ServerConfig
HTTP2ServerConfig :: Natural -> ServiceName -> BufferSize -> Int -> Supported -> ServerCredentials -> TransportServerConfig -> HTTP2ServerConfig
[qSize] :: HTTP2ServerConfig -> Natural
[http2Port] :: HTTP2ServerConfig -> ServiceName
[bufferSize] :: HTTP2ServerConfig -> BufferSize
[bodyHeadSize] :: HTTP2ServerConfig -> Int
[serverSupported] :: HTTP2ServerConfig -> Supported
[https2Credentials] :: HTTP2ServerConfig -> ServerCredentials
[transportConfig] :: HTTP2ServerConfig -> TransportServerConfig
data HTTP2Request
HTTP2Request :: SessionId -> Maybe ALPN -> Request -> HTTP2Body -> (Response -> IO ()) -> HTTP2Request
[sessionId] :: HTTP2Request -> SessionId
[sessionALPN] :: HTTP2Request -> Maybe ALPN
[request] :: HTTP2Request -> Request
[reqBody] :: HTTP2Request -> HTTP2Body
[sendResponse] :: HTTP2Request -> Response -> IO ()
data HTTP2Server
HTTP2Server :: Async () -> TBQueue HTTP2Request -> HTTP2Server
[action] :: HTTP2Server -> Async ()
[reqQ] :: HTTP2Server -> TBQueue HTTP2Request
getHTTP2Server :: HTTP2ServerConfig -> IO HTTP2Server
closeHTTP2Server :: HTTP2Server -> IO ()
runHTTP2Server :: TMVar Bool -> ServiceName -> BufferSize -> Supported -> Credential -> Maybe Credential -> TransportServerConfig -> Maybe ExpirationConfig -> (SessionId -> IO ()) -> (SNICredentialUsed -> HTTP2ServerFunc) -> IO ()
runHTTP2ServerWith :: BufferSize -> ((TLS p -> IO ()) -> a) -> HTTP2ServerFunc -> a
runHTTP2ServerWith_ :: Maybe ExpirationConfig -> (SessionId -> IO ()) -> BufferSize -> (((SNICredentialUsed, TLS p) -> IO ()) -> a) -> (SNICredentialUsed -> HTTP2ServerFunc) -> a
instance GHC.Show.Show Simplex.Messaging.Transport.HTTP2.Server.HTTP2ServerConfig

module Simplex.Messaging.Transport.Client

-- | Connect to passed TCP host:port and pass handle to the client.
runTransportClient :: Transport c => TransportClientConfig -> Maybe SocksCredentials -> TransportHost -> ServiceName -> Maybe KeyHash -> (c 'TClient -> IO a) -> IO a
runTLSTransportClient :: Transport c => Supported -> Maybe CertificateStore -> TransportClientConfig -> Maybe SocksCredentials -> TransportHost -> ServiceName -> Maybe KeyHash -> (c 'TClient -> IO a) -> IO a

-- | Client SMP transport handshake.
--   
--   See
--   <a>https://github.com/simplex-chat/simplexmq/blob/master/protocol/simplex-messaging.md#appendix-a</a>
smpClientHandshake :: forall c. Transport c => c 'TClient -> Maybe KeyPairX25519 -> KeyHash -> VersionRangeSMP -> Bool -> Maybe (ServiceCredentials, KeyPairEd25519) -> ExceptT TransportError IO (THandleSMP c 'TClient)
defaultSMPPort :: PortNumber
defaultTcpConnectTimeout :: Int
defaultTransportClientConfig :: TransportClientConfig
defaultSocksProxyWithAuth :: SocksProxyWithAuth
defaultSocksProxy :: SocksProxy
defaultSocksHost :: (Word8, Word8, Word8, Word8)
data TransportClientConfig
TransportClientConfig :: Maybe SocksProxy -> Int -> Maybe KeepAliveOpts -> Bool -> Maybe Credential -> Maybe [ALPN] -> Bool -> TransportClientConfig
[$sel:socksProxy:TransportClientConfig] :: TransportClientConfig -> Maybe SocksProxy
[$sel:tcpConnectTimeout:TransportClientConfig] :: TransportClientConfig -> Int
[$sel:tcpKeepAlive:TransportClientConfig] :: TransportClientConfig -> Maybe KeepAliveOpts
[$sel:logTLSErrors:TransportClientConfig] :: TransportClientConfig -> Bool
[$sel:clientCredentials:TransportClientConfig] :: TransportClientConfig -> Maybe Credential
[$sel:clientALPN:TransportClientConfig] :: TransportClientConfig -> Maybe [ALPN]
[$sel:useSNI:TransportClientConfig] :: TransportClientConfig -> Bool
newtype SocksProxy
SocksProxy :: SockAddr -> SocksProxy
data SocksProxyWithAuth
SocksProxyWithAuth :: SocksAuth -> SocksProxy -> SocksProxyWithAuth
data SocksAuth
SocksAuthUsername :: ByteString -> ByteString -> SocksAuth
[$sel:username:SocksAuthUsername] :: SocksAuth -> ByteString
[$sel:password:SocksAuthUsername] :: SocksAuth -> ByteString
SocksAuthNull :: SocksAuth
SocksIsolateByAuth :: SocksAuth
data TransportHost
THIPv4 :: (Word8, Word8, Word8, Word8) -> TransportHost
THIPv6 :: (Word32, Word32, Word32, Word32) -> TransportHost
THOnionHost :: ByteString -> TransportHost
THDomainName :: HostName -> TransportHost
newtype TransportHosts
TransportHosts :: NonEmpty TransportHost -> TransportHosts
[$sel:thList:TransportHosts] :: TransportHosts -> NonEmpty TransportHost
newtype TransportHosts_
TransportHosts_ :: [TransportHost] -> TransportHosts_
[$sel:thList_:TransportHosts_] :: TransportHosts_ -> [TransportHost]
validateCertificateChain :: KeyHash -> HostName -> ByteString -> CertificateChain -> IO [FailedReason]
instance GHC.Show.Show Simplex.Messaging.Transport.Client.TransportHost
instance GHC.Classes.Ord Simplex.Messaging.Transport.Client.TransportHost
instance GHC.Classes.Eq Simplex.Messaging.Transport.Client.TransportHost
instance GHC.Classes.Eq Simplex.Messaging.Transport.Client.SocksProxy
instance GHC.Show.Show Simplex.Messaging.Transport.Client.TransportClientConfig
instance GHC.Classes.Eq Simplex.Messaging.Transport.Client.TransportClientConfig
instance GHC.Show.Show Simplex.Messaging.Transport.Client.SocksAuth
instance GHC.Classes.Eq Simplex.Messaging.Transport.Client.SocksAuth
instance GHC.Show.Show Simplex.Messaging.Transport.Client.SocksProxyWithAuth
instance GHC.Classes.Eq Simplex.Messaging.Transport.Client.SocksProxyWithAuth
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Transport.Client.SocksProxyWithAuth
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Transport.Client.SocksProxyWithAuth
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Transport.Client.SocksProxyWithAuth
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Transport.Client.SocksAuth
instance GHC.Show.Show Simplex.Messaging.Transport.Client.SocksProxy
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Transport.Client.SocksProxy
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Transport.Client.TransportHosts_
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Transport.Client.TransportHosts
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Transport.Client.TransportHost
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Transport.Client.TransportHost
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Transport.Client.TransportHost
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Transport.Client.TransportHost
instance Data.String.IsString Simplex.Messaging.Transport.Client.TransportHost
instance Data.String.IsString (GHC.Base.NonEmpty Simplex.Messaging.Transport.Client.TransportHost)


-- | Types, parsers, serializers and functions to send and receive SMP
--   protocol commands and responses.
--   
--   See
--   <a>https://github.com/simplex-chat/simplexmq/blob/master/protocol/simplex-messaging.md</a>
module Simplex.Messaging.Protocol
supportedSMPClientVRange :: VersionRangeSMPC
maxMessageLength :: VersionSMP -> Int
paddedProxiedTLength :: Int
e2eEncConfirmationLength :: Int
e2eEncMessageLength :: Int
data SMPClientVersion
type VersionSMPC = Version SMPClientVersion
type VersionRangeSMPC = VersionRange SMPClientVersion
pattern VersionSMPC :: Word16 -> VersionSMPC
class ProtocolMsgTag (Tag msg) => ProtocolEncoding v err msg | msg -> err, msg -> v where {
    type Tag msg;
}
encodeProtocol :: ProtocolEncoding v err msg => Version v -> msg -> ByteString
protocolP :: ProtocolEncoding v err msg => Version v -> Tag msg -> Parser msg
fromProtocolError :: ProtocolEncoding v err msg => ProtocolErrorType -> err
checkCredentials :: ProtocolEncoding v err msg => Maybe TAuthorizations -> EntityId -> msg -> Either err msg

-- | Parameterized type for SMP protocol commands from all clients.
data Command (p :: Party)
[NEW] :: NewQueueReq -> Command Creator
[SUB] :: Command Recipient

-- | subscribe all associated queues. Service ID must be used as entity ID,
--   and service session key must sign the command.
[SUBS] :: Command RecipientService
[KEY] :: SndPublicAuthKey -> Command Recipient
[RKEY] :: NonEmpty RcvPublicAuthKey -> Command Recipient
[LSET] :: LinkId -> QueueLinkData -> Command Recipient
[LDEL] :: Command Recipient
[NKEY] :: NtfPublicAuthKey -> RcvNtfPublicDhKey -> Command Recipient
[NDEL] :: Command Recipient
[GET] :: Command Recipient
[ACK] :: MsgId -> Command Recipient
[OFF] :: Command Recipient
[DEL] :: Command Recipient
[QUE] :: Command Recipient
[SKEY] :: SndPublicAuthKey -> Command Sender
[SEND] :: MsgFlags -> MsgBody -> Command Sender
[PING] :: Command IdleClient
[LKEY] :: SndPublicAuthKey -> Command LinkClient
[LGET] :: Command LinkClient
[NSUB] :: Command Notifier

-- | subscribe all associated queues. Service ID must be used as entity ID,
--   and service session key must sign the command.
[NSUBS] :: Command NotifierService
[PRXY] :: SMPServer -> Maybe BasicAuth -> Command ProxiedClient
[PFWD] :: VersionSMP -> PublicKeyX25519 -> EncTransmission -> Command ProxiedClient
[RFWD] :: EncFwdTransmission -> Command ProxyService
data SubscriptionMode
SMSubscribe :: SubscriptionMode
SMOnlyCreate :: SubscriptionMode
data NewQueueReq
NewQueueReq :: RcvPublicAuthKey -> RcvPublicDhKey -> Maybe BasicAuth -> SubscriptionMode -> Maybe QueueReqData -> Maybe NewNtfCreds -> NewQueueReq
[$sel:rcvAuthKey:NewQueueReq] :: NewQueueReq -> RcvPublicAuthKey
[$sel:rcvDhKey:NewQueueReq] :: NewQueueReq -> RcvPublicDhKey
[$sel:auth_:NewQueueReq] :: NewQueueReq -> Maybe BasicAuth
[$sel:subMode:NewQueueReq] :: NewQueueReq -> SubscriptionMode
[$sel:queueReqData:NewQueueReq] :: NewQueueReq -> Maybe QueueReqData
[$sel:ntfCreds:NewQueueReq] :: NewQueueReq -> Maybe NewNtfCreds
data QueueReqData
QRMessaging :: Maybe (SenderId, QueueLinkData) -> QueueReqData
QRContact :: Maybe (LinkId, (SenderId, QueueLinkData)) -> QueueReqData
data QueueMode
QMMessaging :: QueueMode
QMContact :: QueueMode
type QueueLinkData = (EncFixedDataBytes, EncUserDataBytes)
type EncFixedDataBytes = EncDataBytes
type EncUserDataBytes = EncDataBytes
newtype EncDataBytes
EncDataBytes :: ByteString -> EncDataBytes
data NewNtfCreds
NewNtfCreds :: NtfPublicAuthKey -> RcvNtfPublicDhKey -> NewNtfCreds
data ServerNtfCreds
ServerNtfCreds :: NotifierId -> RcvNtfPublicDhKey -> ServerNtfCreds

-- | SMP protocol clients
data Party
Creator :: Party
Recipient :: Party
RecipientService :: Party
Sender :: Party
IdleClient :: Party
Notifier :: Party
NotifierService :: Party
LinkClient :: Party
ProxiedClient :: Party
ProxyService :: Party

-- | Type for client command of any participant.
data Cmd
Cmd :: SParty p -> Command p -> Cmd
type family QueueParty (p :: Party) :: Constraint
type family BatchParty (p :: Party) :: Constraint
type family ServiceParty (p :: Party) :: Constraint
data ASubscriberParty
ASP :: SParty p -> ASubscriberParty
data BrokerMsg
[IDS] :: QueueIdsKeys -> BrokerMsg
[LNK] :: SenderId -> QueueLinkData -> BrokerMsg

-- | Service subscription success - confirms when queue was associated with
--   the service
[SOK] :: Maybe ServiceId -> BrokerMsg

-- | The number of queues subscribed with SUBS command
[SOKS] :: Int64 -> BrokerMsg
[MSG] :: RcvMessage -> BrokerMsg
[NID] :: NotifierId -> RcvNtfPublicDhKey -> BrokerMsg
[NMSG] :: CbNonce -> EncNMsgMeta -> BrokerMsg
[PKEY] :: SessionId -> VersionRangeSMP -> CertChainPubKey -> BrokerMsg
[RRES] :: EncFwdResponse -> BrokerMsg
[PRES] :: EncResponse -> BrokerMsg
[END] :: BrokerMsg
[ENDS] :: Int64 -> BrokerMsg
[DELD] :: BrokerMsg
[INFO] :: QueueInfo -> BrokerMsg
[OK] :: BrokerMsg
[ERR] :: ErrorType -> BrokerMsg
[PONG] :: BrokerMsg

-- | Singleton types for SMP protocol clients
data SParty :: Party -> Type
[SCreator] :: SParty Creator
[SRecipient] :: SParty Recipient
[SRecipientService] :: SParty RecipientService
[SSender] :: SParty Sender
[SIdleClient] :: SParty IdleClient
[SNotifier] :: SParty Notifier
[SNotifierService] :: SParty NotifierService
[SSenderLink] :: SParty LinkClient
[SProxiedClient] :: SParty ProxiedClient
[SProxyService] :: SParty ProxyService
class PartyI (p :: Party)
sParty :: PartyI p => SParty p

-- | Queue IDs and keys
data QueueIdsKeys
QIK :: RecipientId -> SenderId -> RcvPublicDhKey -> Maybe QueueMode -> Maybe LinkId -> Maybe ServiceId -> Maybe ServerNtfCreds -> QueueIdsKeys
[$sel:rcvId:QIK] :: QueueIdsKeys -> RecipientId
[$sel:sndId:QIK] :: QueueIdsKeys -> SenderId
[$sel:rcvPublicDhKey:QIK] :: QueueIdsKeys -> RcvPublicDhKey
[$sel:queueMode:QIK] :: QueueIdsKeys -> Maybe QueueMode
[$sel:linkId:QIK] :: QueueIdsKeys -> Maybe LinkId
[$sel:serviceId:QIK] :: QueueIdsKeys -> Maybe ServiceId
[$sel:serverNtfCreds:QIK] :: QueueIdsKeys -> Maybe ServerNtfCreds
data ProtocolErrorType
PECmdSyntax :: ProtocolErrorType
PECmdUnknown :: ProtocolErrorType
PESession :: ProtocolErrorType
PEBlock :: ProtocolErrorType

-- | Type for protocol errors.
data ErrorType

-- | incorrect block format, encoding or signature size
BLOCK :: ErrorType

-- | incorrect SMP session ID (TLS Finished message / tls-unique binding
--   RFC5929)
SESSION :: ErrorType

-- | SMP command is unknown or has invalid syntax
CMD :: CommandError -> ErrorType
[$sel:cmdErr:BLOCK] :: ErrorType -> CommandError

-- | error from proxied relay
PROXY :: ProxyError -> ErrorType
[$sel:proxyErr:BLOCK] :: ErrorType -> ProxyError

-- | command authorization error - bad signature or non-existing SMP queue
AUTH :: ErrorType

-- | command with the entity that was blocked
BLOCKED :: BlockingInfo -> ErrorType
[$sel:blockInfo:BLOCK] :: ErrorType -> BlockingInfo

-- | service signature is not allowed for command or session; service
--   command is sent not in service session
SERVICE :: ErrorType

-- | encryption/decryption error in proxy protocol
CRYPTO :: ErrorType

-- | SMP queue capacity is exceeded on the server
QUOTA :: ErrorType

-- | SMP server storage error
STORE :: Text -> ErrorType
[$sel:storeErr:BLOCK] :: ErrorType -> Text

-- | ACK command is sent without message to be acknowledged
NO_MSG :: ErrorType

-- | sent message is too large (&gt; maxMessageLength = 16088 bytes)
LARGE_MSG :: ErrorType

-- | relay public key is expired
EXPIRED :: ErrorType

-- | internal server error
INTERNAL :: ErrorType

-- | used internally, never returned by the server (to be removed)
DUPLICATE_ :: ErrorType

-- | SMP command error type.
data CommandError

-- | unknown command
UNKNOWN :: CommandError

-- | error parsing command
SYNTAX :: CommandError

-- | command is not allowed (bad service role, or SUB/GET used with the
--   same queue in the same TCP session)
PROHIBITED :: CommandError

-- | transmission has no required credentials (signature or queue ID)
NO_AUTH :: CommandError

-- | transmission has credentials that are not allowed for this command
HAS_AUTH :: CommandError

-- | transmission has no required entity ID (e.g. SMP queue)
NO_ENTITY :: CommandError
data ProxyError

-- | Correctly parsed SMP server ERR response. This error is forwarded to
--   the agent client as AgentErrorType `ERR PROXY PROTOCOL err`.
PROTOCOL :: ErrorType -> ProxyError
[$sel:protocolErr:PROTOCOL] :: ProxyError -> ErrorType

-- | destination server error
BROKER :: BrokerErrorType -> ProxyError
[$sel:brokerErr:PROTOCOL] :: ProxyError -> BrokerErrorType

-- | basic auth provided to proxy is invalid
BASIC_AUTH :: ProxyError
NO_SESSION :: ProxyError

-- | SMP server errors.
data BrokerErrorType

-- | invalid server response (failed to parse)
RESPONSE :: String -> BrokerErrorType
[$sel:respErr:RESPONSE] :: BrokerErrorType -> String

-- | unexpected response
UNEXPECTED :: String -> BrokerErrorType
[$sel:respErr:RESPONSE] :: BrokerErrorType -> String

-- | network error
NETWORK :: NetworkError -> BrokerErrorType
[$sel:networkError:RESPONSE] :: BrokerErrorType -> NetworkError

-- | no compatible server host (e.g. onion when public is required, or vice
--   versa)
HOST :: BrokerErrorType

-- | service unavailable client-side - used in agent errors
NO_SERVICE :: BrokerErrorType

-- | handshake or other transport error
TRANSPORT :: TransportError -> BrokerErrorType
[$sel:transportErr:RESPONSE] :: BrokerErrorType -> TransportError

-- | command response timeout
TIMEOUT :: BrokerErrorType
data NetworkError
NEConnectError :: String -> NetworkError
[$sel:connectError:NEConnectError] :: NetworkError -> String
NETLSError :: String -> NetworkError
[$sel:tlsError:NEConnectError] :: NetworkError -> String
NEUnknownCAError :: NetworkError
NEFailedError :: NetworkError
NETimeoutError :: NetworkError
NESubscribeError :: String -> NetworkError
[$sel:subscribeError:NEConnectError] :: NetworkError -> String
data BlockingInfo
BlockingInfo :: BlockingReason -> Maybe ClientNotice -> BlockingInfo
[$sel:reason:BlockingInfo] :: BlockingInfo -> BlockingReason
[$sel:notice:BlockingInfo] :: BlockingInfo -> Maybe ClientNotice
data BlockingReason
BRSpam :: BlockingReason
BRContent :: BlockingReason

-- | unparsed SMP transmission with signature.
data RawTransmission

-- | Parsed SMP transmission without signature, size and session ID.
type Transmission c = (CorrId, EntityId, c)
type TAuthorizations = (TransmissionAuth, Maybe (Signature 'Ed25519))
data TransmissionAuth
TASignature :: ASignature -> TransmissionAuth
TAAuthenticator :: CbAuthenticator -> TransmissionAuth

-- | signed parsed transmission, with original raw bytes and parsing error.
type SignedTransmission c = (Maybe TAuthorizations, Signed, Transmission c)
type SignedTransmissionOrError e c = Either (Transmission e) (SignedTransmission c)

-- | unparsed sent SMP transmission with signature.
type SentRawTransmission = (Maybe TAuthorizations, ByteString)

-- | SMP message body format
data ClientMsgEnvelope
ClientMsgEnvelope :: PubHeader -> CbNonce -> ByteString -> ClientMsgEnvelope
[$sel:cmHeader:ClientMsgEnvelope] :: ClientMsgEnvelope -> PubHeader
[$sel:cmNonce:ClientMsgEnvelope] :: ClientMsgEnvelope -> CbNonce
[$sel:cmEncBody:ClientMsgEnvelope] :: ClientMsgEnvelope -> ByteString
data PubHeader
PubHeader :: VersionSMPC -> Maybe PublicKeyX25519 -> PubHeader
[$sel:phVersion:PubHeader] :: PubHeader -> VersionSMPC
[$sel:phE2ePubDhKey:PubHeader] :: PubHeader -> Maybe PublicKeyX25519
data ClientMessage
ClientMessage :: PrivHeader -> ByteString -> ClientMessage
data PrivHeader
PHConfirmation :: APublicAuthKey -> PrivHeader
PHEmpty :: PrivHeader
class (ProtocolTypeI (ProtoType msg), ProtocolEncoding v err msg, ProtocolEncoding v err (ProtoCommand msg), Show err, Show msg) => Protocol v err msg | msg -> v, msg -> err where {
    type ProtoCommand msg = cmd | cmd -> msg;
    type ProtoType msg = (sch :: ProtocolType) | sch -> msg;
}
protocolClientHandshake :: (Protocol v err msg, Transport c) => c 'TClient -> Maybe KeyPairX25519 -> KeyHash -> VersionRange v -> Bool -> Maybe (ServiceCredentials, KeyPairEd25519) -> ExceptT TransportError IO (THandle v c 'TClient)
useServiceAuth :: Protocol v err msg => ProtoCommand msg -> Bool
protocolPing :: Protocol v err msg => ProtoCommand msg
protocolError :: Protocol v err msg => msg -> Maybe err
data ProtocolType
PSMP :: ProtocolType
PNTF :: ProtocolType
PXFTP :: ProtocolType
data SProtocolType (p :: ProtocolType)
[SPSMP] :: SProtocolType 'PSMP
[SPNTF] :: SProtocolType 'PNTF
[SPXFTP] :: SProtocolType 'PXFTP
data AProtocolType
AProtocolType :: SProtocolType p -> AProtocolType
class ProtocolTypeI (p :: ProtocolType)
protocolTypeI :: ProtocolTypeI p => SProtocolType p
type family UserProtocol (p :: ProtocolType) :: Constraint

-- | server location and transport key digest (hash).
data ProtocolServer p
ProtocolServer :: SProtocolType p -> NonEmpty TransportHost -> ServiceName -> KeyHash -> ProtocolServer p
[$sel:scheme:ProtocolServer] :: ProtocolServer p -> SProtocolType p
[$sel:host:ProtocolServer] :: ProtocolServer p -> NonEmpty TransportHost
[$sel:port:ProtocolServer] :: ProtocolServer p -> ServiceName
[$sel:keyHash:ProtocolServer] :: ProtocolServer p -> KeyHash
type ProtoServer msg = ProtocolServer (ProtoType msg)
type SMPServer = ProtocolServer 'PSMP
pattern SMPServer :: NonEmpty TransportHost -> ServiceName -> KeyHash -> ProtocolServer 'PSMP
type SMPServerWithAuth = ProtoServerWithAuth 'PSMP
type NtfServer = ProtocolServer 'PNTF
pattern NtfServer :: NonEmpty TransportHost -> ServiceName -> KeyHash -> ProtocolServer 'PNTF
type NtfServerWithAuth = ProtoServerWithAuth 'PNTF
type XFTPServer = ProtocolServer 'PXFTP
pattern XFTPServer :: NonEmpty TransportHost -> ServiceName -> KeyHash -> ProtocolServer 'PXFTP
type XFTPServerWithAuth = ProtoServerWithAuth 'PXFTP
data ProtoServerWithAuth p
ProtoServerWithAuth :: ProtocolServer p -> Maybe BasicAuth -> ProtoServerWithAuth p
[$sel:protoServer:ProtoServerWithAuth] :: ProtoServerWithAuth p -> ProtocolServer p
[$sel:serverBasicAuth:ProtoServerWithAuth] :: ProtoServerWithAuth p -> Maybe BasicAuth
data AProtoServerWithAuth
AProtoServerWithAuth :: SProtocolType p -> ProtoServerWithAuth p -> AProtoServerWithAuth
newtype BasicAuth
BasicAuth :: ByteString -> BasicAuth
[$sel:unBasicAuth:BasicAuth] :: BasicAuth -> ByteString
data SrvLoc
SrvLoc :: HostName -> ServiceName -> SrvLoc

-- | Transmission correlation ID.
newtype CorrId
CorrId :: ByteString -> CorrId
[$sel:bs:CorrId] :: CorrId -> ByteString
pattern NoCorrId :: CorrId
newtype EntityId
EntityId :: ByteString -> EntityId
[$sel:unEntityId:EntityId] :: EntityId -> ByteString
pattern NoEntity :: EntityId

-- | SMP queue ID on the server.
type QueueId = EntityId

-- | SMP queue ID for the recipient.
type RecipientId = QueueId

-- | SMP queue ID for the sender.
type SenderId = QueueId
type LinkId = QueueId

-- | SMP queue ID for notifications.
type NotifierId = QueueId
type ServiceId = EntityId

-- | Recipient's private key used by the recipient to authorize (v6: sign,
--   v7: encrypt hash) SMP commands.
--   
--   Only used by SMP agent, kept here so its definition is close to
--   respective public key.
type RcvPrivateAuthKey = APrivateAuthKey

-- | Recipient's public key used by SMP server to verify authorization of
--   SMP commands.
type RcvPublicAuthKey = APublicAuthKey

-- | Public key used for DH exchange to encrypt message bodies from server
--   to recipient
type RcvPublicDhKey = PublicKeyX25519

-- | DH Secret used to encrypt message bodies from server to recipient
type RcvDhSecret = DhSecretX25519

-- | Sender's private key used by the recipient to authorize (v6: sign, v7:
--   encrypt hash) SMP commands.
--   
--   Only used by SMP agent, kept here so its definition is close to
--   respective public key.
type SndPrivateAuthKey = APrivateAuthKey

-- | Sender's public key used by SMP server to verify authorization of SMP
--   commands.
type SndPublicAuthKey = APublicAuthKey

-- | Private key used by push notifications server to authorize (sign or
--   encrypt hash) NSUB command.
type NtfPrivateAuthKey = APrivateAuthKey

-- | Public key used by SMP server to verify authorization of NSUB command
--   sent by push notifications server.
type NtfPublicAuthKey = APublicAuthKey

-- | Public key used for DH exchange to encrypt notification metadata from
--   server to recipient
type RcvNtfPublicDhKey = PublicKeyX25519

-- | DH Secret used to encrypt notification metadata from server to
--   recipient
type RcvNtfDhSecret = DhSecretX25519

-- | received message without server/recipient encryption
data Message
Message :: MsgId -> SystemTime -> MsgFlags -> MaxLenBS MaxMessageLen -> Message
[$sel:msgId:Message] :: Message -> MsgId
[$sel:msgTs:Message] :: Message -> SystemTime
[$sel:msgFlags:Message] :: Message -> MsgFlags
[$sel:msgBody:Message] :: Message -> MaxLenBS MaxMessageLen
MessageQuota :: MsgId -> SystemTime -> Message
[$sel:msgId:Message] :: Message -> MsgId
[$sel:msgTs:Message] :: Message -> SystemTime
data RcvMessage
RcvMessage :: MsgId -> EncRcvMsgBody -> RcvMessage
[$sel:msgId:RcvMessage] :: RcvMessage -> MsgId
[$sel:msgBody:RcvMessage] :: RcvMessage -> EncRcvMsgBody

-- | SMP message server ID.
type MsgId = ByteString

-- | SMP message body.
type MsgBody = ByteString
type MaxMessageLen = 16088
type MaxRcvMessageLen = MaxMessageLen + 16
newtype EncRcvMsgBody
EncRcvMsgBody :: ByteString -> EncRcvMsgBody
data RcvMsgBody
RcvMsgBody :: SystemTime -> MsgFlags -> MaxLenBS MaxMessageLen -> RcvMsgBody
[$sel:msgTs:RcvMsgBody] :: RcvMsgBody -> SystemTime
[$sel:msgFlags:RcvMsgBody] :: RcvMsgBody -> MsgFlags
[$sel:msgBody:RcvMsgBody] :: RcvMsgBody -> MaxLenBS MaxMessageLen
RcvMsgQuota :: SystemTime -> RcvMsgBody
[$sel:msgTs:RcvMsgBody] :: RcvMsgBody -> SystemTime
data ClientRcvMsgBody
ClientRcvMsgBody :: SystemTime -> MsgFlags -> ByteString -> ClientRcvMsgBody
[$sel:msgTs:ClientRcvMsgBody] :: ClientRcvMsgBody -> SystemTime
[$sel:msgFlags:ClientRcvMsgBody] :: ClientRcvMsgBody -> MsgFlags
[$sel:msgBody:ClientRcvMsgBody] :: ClientRcvMsgBody -> ByteString
ClientRcvMsgQuota :: SystemTime -> ClientRcvMsgBody
[$sel:msgTs:ClientRcvMsgBody] :: ClientRcvMsgBody -> SystemTime
type EncNMsgMeta = ByteString
data SMPMsgMeta
SMPMsgMeta :: MsgId -> SystemTime -> MsgFlags -> SMPMsgMeta
[$sel:msgId:SMPMsgMeta] :: SMPMsgMeta -> MsgId
[$sel:msgTs:SMPMsgMeta] :: SMPMsgMeta -> SystemTime
[$sel:msgFlags:SMPMsgMeta] :: SMPMsgMeta -> MsgFlags
data NMsgMeta
NMsgMeta :: MsgId -> SystemTime -> NMsgMeta
[$sel:msgId:NMsgMeta] :: NMsgMeta -> MsgId
[$sel:msgTs:NMsgMeta] :: NMsgMeta -> SystemTime
newtype EncFwdResponse
EncFwdResponse :: ByteString -> EncFwdResponse
newtype EncFwdTransmission
EncFwdTransmission :: ByteString -> EncFwdTransmission
newtype EncResponse
EncResponse :: ByteString -> EncResponse
newtype EncTransmission
EncTransmission :: ByteString -> EncTransmission
data FwdResponse
FwdResponse :: CorrId -> EncResponse -> FwdResponse
[$sel:fwdCorrId:FwdResponse] :: FwdResponse -> CorrId
[$sel:fwdResponse:FwdResponse] :: FwdResponse -> EncResponse
data FwdTransmission
FwdTransmission :: CorrId -> VersionSMP -> PublicKeyX25519 -> EncTransmission -> FwdTransmission
[$sel:fwdCorrId:FwdTransmission] :: FwdTransmission -> CorrId
[$sel:fwdVersion:FwdTransmission] :: FwdTransmission -> VersionSMP
[$sel:fwdKey:FwdTransmission] :: FwdTransmission -> PublicKeyX25519
[$sel:fwdTransmission:FwdTransmission] :: FwdTransmission -> EncTransmission
data MsgFlags
MsgFlags :: Bool -> MsgFlags
[$sel:notification:MsgFlags] :: MsgFlags -> Bool
initialSMPClientVersion :: VersionSMPC
currentSMPClientVersion :: VersionSMPC
senderCanSecure :: Maybe QueueMode -> Bool
queueReqMode :: QueueReqData -> QueueMode
queueParty :: SParty p -> Maybe (Dict (PartyI p, QueueParty p))
batchParty :: SParty p -> Maybe (Dict (PartyI p, BatchParty p))
serviceParty :: SParty p -> Maybe (Dict (PartyI p, ServiceParty p))
partyClientRole :: SParty p -> Maybe SMPServiceRole
partyServiceRole :: ServiceParty p => SParty p -> SMPServiceRole
userProtocol :: SProtocolType p -> Maybe (Dict (UserProtocol p))
rcvMessageMeta :: MsgId -> ClientRcvMsgBody -> SMPMsgMeta
noMsgFlags :: MsgFlags
messageId :: Message -> MsgId
messageTs :: Message -> SystemTime
toNetworkError :: SomeException -> NetworkError
class ProtocolMsgTag t
decodeTag :: ProtocolMsgTag t => ByteString -> Maybe t
messageTagP :: ProtocolMsgTag t => Parser t
data TransmissionForAuth
TransmissionForAuth :: ~ByteString -> ByteString -> TransmissionForAuth
[$sel:tForAuth:TransmissionForAuth] :: TransmissionForAuth -> ~ByteString
[$sel:tToSend:TransmissionForAuth] :: TransmissionForAuth -> ByteString
encodeTransmissionForAuth :: ProtocolEncoding v e c => THandleParams v p -> Transmission c -> TransmissionForAuth
encodeTransmission :: ProtocolEncoding v e c => THandleParams v p -> Transmission c -> ByteString

-- | SMP transmission parser.
transmissionP :: THandleParams v p -> Parser RawTransmission
_smpP :: Encoding a => Parser a
encodeRcvMsgBody :: RcvMsgBody -> MaxLenBS MaxRcvMessageLen
clientRcvMsgBodyP :: Parser ClientRcvMsgBody
legacyEncodeServer :: ProtocolServer p -> ByteString
legacyServerP :: forall p. ProtocolTypeI p => Parser (ProtocolServer p)
legacyStrEncodeServer :: ProtocolTypeI p => ProtocolServer p -> ByteString
srvHostnamesSMPClientVersion :: VersionSMPC
sndAuthKeySMPClientVersion :: VersionSMPC
shortLinksSMPClientVersion :: VersionSMPC
sameSrvAddr :: ProtocolServer p -> ProtocolServer p -> Bool
sameSrvAddr' :: ProtoServerWithAuth p -> ProtoServerWithAuth p -> Bool
noAuthSrv :: ProtocolServer p -> ProtoServerWithAuth p
toMsgInfo :: Message -> MsgInfo
data TransportBatch r
TBTransmissions :: ByteString -> Int -> [r] -> TransportBatch r
TBTransmission :: ByteString -> r -> TransportBatch r
TBError :: TransportError -> r -> TransportBatch r

-- | Send signed SMP transmission to TCP transport.
tPut :: Transport c => THandle v c p -> NonEmpty (Either TransportError SentRawTransmission) -> IO [Either TransportError ()]
tPutLog :: Transport c => THandle v c p -> ByteString -> IO (Either TransportError ())

-- | Receive server transmissions
tGetServer :: (ProtocolEncoding v err cmd, Transport c) => THandle v c 'TServer -> IO (NonEmpty (SignedTransmissionOrError err cmd))

-- | Receive client transmissions
tGetClient :: (ProtocolEncoding v err cmd, Transport c) => THandle v c 'TClient -> IO (NonEmpty (Transmission (Either err cmd)))
tParse :: THandleParams v p -> ByteString -> NonEmpty (Either TransportError RawTransmission)
tDecodeServer :: forall v err cmd. ProtocolEncoding v err cmd => THandleParams v 'TServer -> Either TransportError RawTransmission -> SignedTransmissionOrError err cmd
tDecodeClient :: forall v err cmd. ProtocolEncoding v err cmd => THandleParams v 'TClient -> Either TransportError RawTransmission -> Transmission (Either err cmd)
tEncode :: Bool -> SentRawTransmission -> ByteString
tEncodeBatch1 :: Bool -> SentRawTransmission -> ByteString
batchTransmissions :: THandleParams v p -> NonEmpty (Either TransportError SentRawTransmission) -> [TransportBatch ()]

-- | encodes and batches transmissions into blocks
batchTransmissions' :: forall v p r. THandleParams v p -> NonEmpty (Either TransportError SentRawTransmission, r) -> [TransportBatch r]

-- | Pack encoded transmissions into batches
batchTransmissions_ :: Int -> NonEmpty (Either TransportError ByteString, r) -> [TransportBatch r]
data CommandTag (p :: Party)
[NEW_] :: CommandTag Creator
[SUB_] :: CommandTag Recipient
[SUBS_] :: CommandTag RecipientService
[KEY_] :: CommandTag Recipient
[RKEY_] :: CommandTag Recipient
[LSET_] :: CommandTag Recipient
[LDEL_] :: CommandTag Recipient
[NKEY_] :: CommandTag Recipient
[NDEL_] :: CommandTag Recipient
[GET_] :: CommandTag Recipient
[ACK_] :: CommandTag Recipient
[OFF_] :: CommandTag Recipient
[DEL_] :: CommandTag Recipient
[QUE_] :: CommandTag Recipient
[SKEY_] :: CommandTag Sender
[SEND_] :: CommandTag Sender
[PING_] :: CommandTag IdleClient
[LKEY_] :: CommandTag LinkClient
[LGET_] :: CommandTag LinkClient
[PRXY_] :: CommandTag ProxiedClient
[PFWD_] :: CommandTag ProxiedClient
[RFWD_] :: CommandTag ProxyService
[NSUB_] :: CommandTag Notifier
[NSUBS_] :: CommandTag NotifierService
data BrokerMsgTag
IDS_ :: BrokerMsgTag
LNK_ :: BrokerMsgTag
SOK_ :: BrokerMsgTag
SOKS_ :: BrokerMsgTag
MSG_ :: BrokerMsgTag
NID_ :: BrokerMsgTag
NMSG_ :: BrokerMsgTag
PKEY_ :: BrokerMsgTag
RRES_ :: BrokerMsgTag
PRES_ :: BrokerMsgTag
END_ :: BrokerMsgTag
ENDS_ :: BrokerMsgTag
DELD_ :: BrokerMsgTag
INFO_ :: BrokerMsgTag
OK_ :: BrokerMsgTag
ERR_ :: BrokerMsgTag
PONG_ :: BrokerMsgTag
checkParty :: forall t p p'. (PartyI p, PartyI p') => t p' -> Either String (t p)
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Protocol.ProxyError
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Protocol.ProxyError
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Protocol.ErrorType
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Protocol.ErrorType
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Protocol.BlockingInfo
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Protocol.BlockingInfo
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Protocol.BrokerErrorType
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Protocol.BrokerErrorType
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Protocol.NetworkError
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Protocol.NetworkError
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Protocol.CommandError
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Protocol.CommandError
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Protocol.MsgFlags
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Protocol.MsgFlags
instance GHC.Show.Show Simplex.Messaging.Protocol.Party
instance GHC.Show.Show Simplex.Messaging.Protocol.TransmissionAuth
instance GHC.Show.Show Simplex.Messaging.Protocol.SubscriptionMode
instance GHC.Classes.Eq Simplex.Messaging.Protocol.SubscriptionMode
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Protocol.EncDataBytes
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Protocol.EncDataBytes
instance GHC.Show.Show Simplex.Messaging.Protocol.EncDataBytes
instance GHC.Classes.Eq Simplex.Messaging.Protocol.EncDataBytes
instance GHC.Show.Show Simplex.Messaging.Protocol.QueueReqData
instance GHC.Show.Show Simplex.Messaging.Protocol.EncTransmission
instance GHC.Show.Show Simplex.Messaging.Protocol.EncFwdTransmission
instance GHC.Show.Show Simplex.Messaging.Protocol.EncFwdResponse
instance GHC.Classes.Eq Simplex.Messaging.Protocol.EncFwdResponse
instance GHC.Show.Show Simplex.Messaging.Protocol.EncResponse
instance GHC.Classes.Eq Simplex.Messaging.Protocol.EncResponse
instance GHC.Show.Show Simplex.Messaging.Protocol.EncRcvMsgBody
instance GHC.Classes.Eq Simplex.Messaging.Protocol.EncRcvMsgBody
instance GHC.Show.Show Simplex.Messaging.Protocol.MsgFlags
instance GHC.Classes.Eq Simplex.Messaging.Protocol.MsgFlags
instance GHC.Show.Show Simplex.Messaging.Protocol.BrokerMsgTag
instance GHC.Show.Show Simplex.Messaging.Protocol.PubHeader
instance GHC.Show.Show Simplex.Messaging.Protocol.ClientMsgEnvelope
instance GHC.Show.Show Simplex.Messaging.Protocol.PrivHeader
instance GHC.Show.Show Simplex.Messaging.Protocol.ProtocolType
instance GHC.Classes.Ord Simplex.Messaging.Protocol.ProtocolType
instance GHC.Classes.Eq Simplex.Messaging.Protocol.ProtocolType
instance GHC.Show.Show (Simplex.Messaging.Protocol.ProtocolServer p)
instance GHC.Classes.Ord (Simplex.Messaging.Protocol.ProtocolServer p)
instance GHC.Classes.Eq (Simplex.Messaging.Protocol.ProtocolServer p)
instance GHC.Show.Show Simplex.Messaging.Protocol.BasicAuth
instance GHC.Classes.Ord Simplex.Messaging.Protocol.BasicAuth
instance GHC.Classes.Eq Simplex.Messaging.Protocol.BasicAuth
instance GHC.Show.Show (Simplex.Messaging.Protocol.ProtoServerWithAuth p)
instance GHC.Classes.Ord (Simplex.Messaging.Protocol.ProtoServerWithAuth p)
instance GHC.Classes.Eq (Simplex.Messaging.Protocol.ProtoServerWithAuth p)
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Protocol.CorrId
instance GHC.Show.Show Simplex.Messaging.Protocol.CorrId
instance GHC.Classes.Ord Simplex.Messaging.Protocol.CorrId
instance GHC.Classes.Eq Simplex.Messaging.Protocol.CorrId
instance GHC.Show.Show Simplex.Messaging.Protocol.RawTransmission
instance GHC.Show.Show Simplex.Messaging.Protocol.ServerNtfCreds
instance GHC.Classes.Eq Simplex.Messaging.Protocol.ServerNtfCreds
instance GHC.Show.Show Simplex.Messaging.Protocol.QueueIdsKeys
instance GHC.Classes.Eq Simplex.Messaging.Protocol.QueueIdsKeys
instance GHC.Show.Show Simplex.Messaging.Protocol.NewNtfCreds
instance GHC.Show.Show Simplex.Messaging.Protocol.NewQueueReq
instance GHC.Show.Show Simplex.Messaging.Protocol.NMsgMeta
instance GHC.Show.Show Simplex.Messaging.Protocol.SMPMsgMeta
instance GHC.Classes.Eq Simplex.Messaging.Protocol.SMPMsgMeta
instance GHC.Show.Show Simplex.Messaging.Protocol.RcvMessage
instance GHC.Classes.Eq Simplex.Messaging.Protocol.RcvMessage
instance GHC.Show.Show Simplex.Messaging.Protocol.CommandError
instance GHC.Read.Read Simplex.Messaging.Protocol.CommandError
instance GHC.Classes.Eq Simplex.Messaging.Protocol.CommandError
instance GHC.Show.Show Simplex.Messaging.Protocol.NetworkError
instance GHC.Read.Read Simplex.Messaging.Protocol.NetworkError
instance GHC.Classes.Eq Simplex.Messaging.Protocol.NetworkError
instance GHC.Exception.Type.Exception Simplex.Messaging.Protocol.BrokerErrorType
instance GHC.Show.Show Simplex.Messaging.Protocol.BrokerErrorType
instance GHC.Read.Read Simplex.Messaging.Protocol.BrokerErrorType
instance GHC.Classes.Eq Simplex.Messaging.Protocol.BrokerErrorType
instance GHC.Show.Show Simplex.Messaging.Protocol.BlockingReason
instance GHC.Classes.Eq Simplex.Messaging.Protocol.BlockingReason
instance GHC.Show.Show Simplex.Messaging.Protocol.BlockingInfo
instance GHC.Classes.Eq Simplex.Messaging.Protocol.BlockingInfo
instance GHC.Show.Show Simplex.Messaging.Protocol.ProxyError
instance GHC.Classes.Eq Simplex.Messaging.Protocol.ProxyError
instance GHC.Show.Show Simplex.Messaging.Protocol.ErrorType
instance GHC.Classes.Eq Simplex.Messaging.Protocol.ErrorType
instance GHC.Show.Show Simplex.Messaging.Protocol.BrokerMsg
instance GHC.Classes.Eq Simplex.Messaging.Protocol.BrokerMsg
instance GHC.Show.Show (Simplex.Messaging.Protocol.SParty p)
instance GHC.Show.Show Simplex.Messaging.Protocol.ASubscriberParty
instance GHC.Show.Show Simplex.Messaging.Protocol.Cmd
instance GHC.Show.Show (Simplex.Messaging.Protocol.Command p)
instance GHC.Show.Show (Simplex.Messaging.Protocol.CommandTag p)
instance GHC.Show.Show Simplex.Messaging.Protocol.CmdTag
instance GHC.Classes.Eq (Simplex.Messaging.Protocol.SProtocolType p)
instance GHC.Classes.Ord (Simplex.Messaging.Protocol.SProtocolType p)
instance GHC.Show.Show (Simplex.Messaging.Protocol.SProtocolType p)
instance GHC.Show.Show Simplex.Messaging.Protocol.AProtocolType
instance GHC.Show.Show Simplex.Messaging.Protocol.AProtoServerWithAuth
instance Simplex.Messaging.Protocol.Protocol Simplex.Messaging.Transport.SMPVersion Simplex.Messaging.Protocol.ErrorType Simplex.Messaging.Protocol.BrokerMsg
instance Simplex.Messaging.Protocol.PartyI p => Simplex.Messaging.Protocol.ProtocolEncoding Simplex.Messaging.Transport.SMPVersion Simplex.Messaging.Protocol.ErrorType (Simplex.Messaging.Protocol.Command p)
instance Simplex.Messaging.Protocol.ProtocolEncoding Simplex.Messaging.Transport.SMPVersion Simplex.Messaging.Protocol.ErrorType Simplex.Messaging.Protocol.Cmd
instance Simplex.Messaging.Protocol.ProtocolEncoding Simplex.Messaging.Transport.SMPVersion Simplex.Messaging.Protocol.ErrorType Simplex.Messaging.Protocol.BrokerMsg
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Protocol.ErrorType
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Protocol.ErrorType
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Protocol.ProxyError
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Protocol.ProxyError
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Protocol.BlockingInfo
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Protocol.BlockingInfo
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Protocol.BlockingReason
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Protocol.BlockingReason
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Protocol.BlockingReason
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Protocol.BrokerErrorType
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Protocol.BrokerErrorType
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Protocol.NetworkError
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Protocol.NetworkError
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Protocol.CommandError
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Protocol.Message
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Protocol.SMPMsgMeta
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Protocol.NMsgMeta
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Protocol.NewNtfCreds
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Protocol.ServerNtfCreds
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Protocol.FwdTransmission
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Protocol.FwdResponse
instance Data.String.IsString Simplex.Messaging.Protocol.CorrId
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Protocol.CorrId
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Protocol.CorrId
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Protocol.CorrId
instance Simplex.Messaging.Protocol.ProtocolTypeI p => Simplex.Messaging.Encoding.String.StrEncoding (Simplex.Messaging.Protocol.ProtoServerWithAuth p)
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Protocol.AProtoServerWithAuth
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Protocol.AProtoServerWithAuth
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Protocol.AProtoServerWithAuth
instance Simplex.Messaging.Protocol.ProtocolTypeI p => Data.String.IsString (Simplex.Messaging.Protocol.ProtoServerWithAuth p)
instance Simplex.Messaging.Protocol.ProtocolTypeI p => Data.Aeson.Types.ToJSON.ToJSON (Simplex.Messaging.Protocol.ProtoServerWithAuth p)
instance Simplex.Messaging.Protocol.ProtocolTypeI p => Data.Aeson.Types.FromJSON.FromJSON (Simplex.Messaging.Protocol.ProtoServerWithAuth p)
instance Data.String.IsString Simplex.Messaging.Protocol.BasicAuth
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Protocol.BasicAuth
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Protocol.BasicAuth
instance Simplex.Messaging.Protocol.ProtocolTypeI p => Simplex.Messaging.Encoding.String.StrEncoding (Simplex.Messaging.Protocol.ProtocolServer p)
instance Simplex.Messaging.Protocol.ProtocolTypeI p => Data.String.IsString (Simplex.Messaging.Protocol.ProtocolServer p)
instance Simplex.Messaging.Protocol.ProtocolTypeI p => Simplex.Messaging.Encoding.Encoding (Simplex.Messaging.Protocol.ProtocolServer p)
instance Simplex.Messaging.Protocol.ProtocolTypeI p => Data.Aeson.Types.ToJSON.ToJSON (Simplex.Messaging.Protocol.ProtocolServer p)
instance Simplex.Messaging.Protocol.ProtocolTypeI p => Data.Aeson.Types.FromJSON.FromJSON (Simplex.Messaging.Protocol.ProtocolServer p)
instance GHC.Classes.Eq Simplex.Messaging.Protocol.AProtocolType
instance Simplex.Messaging.Protocol.ProtocolTypeI p => Simplex.Messaging.Encoding.String.StrEncoding (Simplex.Messaging.Protocol.SProtocolType p)
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Protocol.AProtocolType
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Protocol.AProtocolType
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Protocol.AProtocolType
instance Simplex.Messaging.Protocol.ProtocolTypeI p => Data.Aeson.Types.ToJSON.ToJSON (Simplex.Messaging.Protocol.SProtocolType p)
instance Simplex.Messaging.Protocol.ProtocolTypeI p => Data.Aeson.Types.FromJSON.FromJSON (Simplex.Messaging.Protocol.SProtocolType p)
instance Simplex.Messaging.Protocol.ProtocolTypeI 'Simplex.Messaging.Protocol.PSMP
instance Simplex.Messaging.Protocol.ProtocolTypeI 'Simplex.Messaging.Protocol.PNTF
instance Simplex.Messaging.Protocol.ProtocolTypeI 'Simplex.Messaging.Protocol.PXFTP
instance Data.Type.Equality.TestEquality Simplex.Messaging.Protocol.SProtocolType
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Protocol.ProtocolType
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Protocol.ClientMessage
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Protocol.PrivHeader
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Protocol.ClientMsgEnvelope
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Protocol.PubHeader
instance Simplex.Messaging.Protocol.ProtocolMsgTag Simplex.Messaging.Protocol.CmdTag
instance Simplex.Messaging.Protocol.PartyI p => Simplex.Messaging.Protocol.ProtocolMsgTag (Simplex.Messaging.Protocol.CommandTag p)
instance Simplex.Messaging.Protocol.ProtocolMsgTag Simplex.Messaging.Protocol.BrokerMsgTag
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Protocol.BrokerMsgTag
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Protocol.CmdTag
instance Simplex.Messaging.Protocol.PartyI p => Simplex.Messaging.Encoding.Encoding (Simplex.Messaging.Protocol.CommandTag p)
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Protocol.MsgFlags
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Protocol.MsgFlags
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Protocol.QueueReqData
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Protocol.EncDataBytes
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Protocol.EncDataBytes
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Protocol.SubscriptionMode
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Protocol.SubscriptionMode
instance GHC.Classes.Eq Simplex.Messaging.Protocol.ASubscriberParty
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Protocol.ASubscriberParty
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Protocol.ASubscriberParty
instance Simplex.Messaging.Protocol.PartyI 'Simplex.Messaging.Protocol.Creator
instance Simplex.Messaging.Protocol.PartyI 'Simplex.Messaging.Protocol.Recipient
instance Simplex.Messaging.Protocol.PartyI 'Simplex.Messaging.Protocol.RecipientService
instance Simplex.Messaging.Protocol.PartyI 'Simplex.Messaging.Protocol.Sender
instance Simplex.Messaging.Protocol.PartyI 'Simplex.Messaging.Protocol.IdleClient
instance Simplex.Messaging.Protocol.PartyI 'Simplex.Messaging.Protocol.Notifier
instance Simplex.Messaging.Protocol.PartyI 'Simplex.Messaging.Protocol.NotifierService
instance Simplex.Messaging.Protocol.PartyI 'Simplex.Messaging.Protocol.LinkClient
instance Simplex.Messaging.Protocol.PartyI 'Simplex.Messaging.Protocol.ProxiedClient
instance Simplex.Messaging.Protocol.PartyI 'Simplex.Messaging.Protocol.ProxyService
instance Data.Type.Equality.TestEquality Simplex.Messaging.Protocol.SParty
instance Simplex.Messaging.Version.VersionScope Simplex.Messaging.Protocol.SMPClientVersion

module Simplex.Messaging.Transport.HTTP2.Client
data HTTP2Client
HTTP2Client :: Maybe (Async HTTP2Response) -> SessionId -> Maybe ALPN -> Maybe APublicVerifyKey -> CertificateChain -> UTCTime -> (Request -> (Response -> IO HTTP2Response) -> IO HTTP2Response) -> HClient -> HTTP2Client
[$sel:action:HTTP2Client] :: HTTP2Client -> Maybe (Async HTTP2Response)
[$sel:sessionId:HTTP2Client] :: HTTP2Client -> SessionId
[$sel:sessionALPN:HTTP2Client] :: HTTP2Client -> Maybe ALPN
[$sel:serverKey:HTTP2Client] :: HTTP2Client -> Maybe APublicVerifyKey
[$sel:serverCerts:HTTP2Client] :: HTTP2Client -> CertificateChain
[$sel:sessionTs:HTTP2Client] :: HTTP2Client -> UTCTime
[$sel:sendReq:HTTP2Client] :: HTTP2Client -> Request -> (Response -> IO HTTP2Response) -> IO HTTP2Response
[$sel:client_:HTTP2Client] :: HTTP2Client -> HClient
data HClient
HClient :: TVar Bool -> IO () -> TransportHost -> ServiceName -> HTTP2ClientConfig -> TBQueue (Request, TMVar HTTP2Response) -> HClient
[$sel:connected:HClient] :: HClient -> TVar Bool
[$sel:disconnected:HClient] :: HClient -> IO ()
[$sel:host:HClient] :: HClient -> TransportHost
[$sel:port:HClient] :: HClient -> ServiceName
[$sel:config:HClient] :: HClient -> HTTP2ClientConfig
[$sel:reqQ:HClient] :: HClient -> TBQueue (Request, TMVar HTTP2Response)
data HTTP2Response
HTTP2Response :: Response -> HTTP2Body -> HTTP2Response
[$sel:response:HTTP2Response] :: HTTP2Response -> Response
[$sel:respBody:HTTP2Response] :: HTTP2Response -> HTTP2Body
data HTTP2ClientConfig
HTTP2ClientConfig :: Natural -> Int -> TransportClientConfig -> BufferSize -> Int -> Supported -> HTTP2ClientConfig
[$sel:qSize:HTTP2ClientConfig] :: HTTP2ClientConfig -> Natural
[$sel:connTimeout:HTTP2ClientConfig] :: HTTP2ClientConfig -> Int
[$sel:transportConfig:HTTP2ClientConfig] :: HTTP2ClientConfig -> TransportClientConfig
[$sel:bufferSize:HTTP2ClientConfig] :: HTTP2ClientConfig -> BufferSize
[$sel:bodyHeadSize:HTTP2ClientConfig] :: HTTP2ClientConfig -> Int
[$sel:suportedTLSParams:HTTP2ClientConfig] :: HTTP2ClientConfig -> Supported
data HTTP2ClientError
HCResponseTimeout :: HTTP2ClientError
HCNetworkError :: NetworkError -> HTTP2ClientError
HCIOError :: IOException -> HTTP2ClientError
defaultHTTP2ClientConfig :: HTTP2ClientConfig
getHTTP2Client :: HostName -> ServiceName -> Maybe CertificateStore -> HTTP2ClientConfig -> IO () -> IO (Either HTTP2ClientError HTTP2Client)
getVerifiedHTTP2Client :: Maybe SocksCredentials -> TransportHost -> ServiceName -> Maybe KeyHash -> Maybe CertificateStore -> HTTP2ClientConfig -> IO () -> IO (Either HTTP2ClientError HTTP2Client)
attachHTTP2Client :: forall p. TransportPeerI p => HTTP2ClientConfig -> TransportHost -> ServiceName -> IO () -> Int -> TLS p -> IO (Either HTTP2ClientError HTTP2Client)

-- | Disconnects client from the server and terminates client threads.
closeHTTP2Client :: HTTP2Client -> IO ()
sendRequest :: HTTP2Client -> Request -> Maybe Int -> IO (Either HTTP2ClientError HTTP2Response)

-- | this function should not be used until HTTP2 is thread safe, use
--   sendRequest
sendRequestDirect :: HTTP2Client -> Request -> Maybe Int -> IO (Either HTTP2ClientError HTTP2Response)
instance GHC.Show.Show Simplex.Messaging.Transport.HTTP2.Client.HTTP2ClientConfig
instance GHC.Show.Show Simplex.Messaging.Transport.HTTP2.Client.HTTP2ClientError

module Simplex.Messaging.Server.Stats
data ServerStats
ServerStats :: IORef UTCTime -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef TimeBuckets -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> PeriodStats -> IORef Int -> IORef Int -> PeriodStats -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> ProxyStats -> ProxyStats -> ProxyStats -> ProxyStats -> IORef Int -> ServiceStats -> ServiceStats -> IORef Int -> IORef Int -> IORef Int -> ServerStats
[fromTime] :: ServerStats -> IORef UTCTime
[qCreated] :: ServerStats -> IORef Int
[qSecured] :: ServerStats -> IORef Int
[qDeletedAll] :: ServerStats -> IORef Int
[qDeletedAllB] :: ServerStats -> IORef Int
[qDeletedNew] :: ServerStats -> IORef Int
[qDeletedSecured] :: ServerStats -> IORef Int
[qBlocked] :: ServerStats -> IORef Int
[qSub] :: ServerStats -> IORef Int
[qSubAllB] :: ServerStats -> IORef Int
[qSubAuth] :: ServerStats -> IORef Int
[qSubDuplicate] :: ServerStats -> IORef Int
[qSubProhibited] :: ServerStats -> IORef Int
[qSubEnd] :: ServerStats -> IORef Int
[qSubEndB] :: ServerStats -> IORef Int
[ntfCreated] :: ServerStats -> IORef Int
[ntfNewCreated] :: ServerStats -> IORef Int
[ntfDeleted] :: ServerStats -> IORef Int
[ntfDeletedB] :: ServerStats -> IORef Int
[ntfSub] :: ServerStats -> IORef Int
[ntfSubB] :: ServerStats -> IORef Int
[ntfSubAuth] :: ServerStats -> IORef Int
[ntfSubDuplicate] :: ServerStats -> IORef Int
[msgSent] :: ServerStats -> IORef Int
[msgSentAuth] :: ServerStats -> IORef Int
[msgSentQuota] :: ServerStats -> IORef Int
[msgSentLarge] :: ServerStats -> IORef Int
[msgSentBlock] :: ServerStats -> IORef Int
[msgRecv] :: ServerStats -> IORef Int
[msgRecvAckTimes] :: ServerStats -> IORef TimeBuckets
[msgRecvGet] :: ServerStats -> IORef Int
[msgGet] :: ServerStats -> IORef Int
[msgGetNoMsg] :: ServerStats -> IORef Int
[msgGetAuth] :: ServerStats -> IORef Int
[msgGetDuplicate] :: ServerStats -> IORef Int
[msgGetProhibited] :: ServerStats -> IORef Int
[msgExpired] :: ServerStats -> IORef Int
[activeQueues] :: ServerStats -> PeriodStats
[msgSentNtf] :: ServerStats -> IORef Int
[msgRecvNtf] :: ServerStats -> IORef Int
[activeQueuesNtf] :: ServerStats -> PeriodStats
[msgNtfs] :: ServerStats -> IORef Int
[msgNtfsB] :: ServerStats -> IORef Int
[msgNtfNoSub] :: ServerStats -> IORef Int
[msgNtfLost] :: ServerStats -> IORef Int
[msgNtfExpired] :: ServerStats -> IORef Int
[pRelays] :: ServerStats -> ProxyStats
[pRelaysOwn] :: ServerStats -> ProxyStats
[pMsgFwds] :: ServerStats -> ProxyStats
[pMsgFwdsOwn] :: ServerStats -> ProxyStats
[pMsgFwdsRecv] :: ServerStats -> IORef Int
[rcvServices] :: ServerStats -> ServiceStats
[ntfServices] :: ServerStats -> ServiceStats
[qCount] :: ServerStats -> IORef Int
[msgCount] :: ServerStats -> IORef Int
[ntfCount] :: ServerStats -> IORef Int
data ServerStatsData
ServerStatsData :: UTCTime -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> TimeBuckets -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> PeriodStatsData -> Int -> Int -> PeriodStatsData -> Int -> Int -> Int -> Int -> Int -> ProxyStatsData -> ProxyStatsData -> ProxyStatsData -> ProxyStatsData -> Int -> ServiceStatsData -> ServiceStatsData -> Int -> Int -> Int -> ServerStatsData
[_fromTime] :: ServerStatsData -> UTCTime
[_qCreated] :: ServerStatsData -> Int
[_qSecured] :: ServerStatsData -> Int
[_qDeletedAll] :: ServerStatsData -> Int
[_qDeletedAllB] :: ServerStatsData -> Int
[_qDeletedNew] :: ServerStatsData -> Int
[_qDeletedSecured] :: ServerStatsData -> Int
[_qBlocked] :: ServerStatsData -> Int
[_qSub] :: ServerStatsData -> Int
[_qSubAllB] :: ServerStatsData -> Int
[_qSubAuth] :: ServerStatsData -> Int
[_qSubDuplicate] :: ServerStatsData -> Int
[_qSubProhibited] :: ServerStatsData -> Int
[_qSubEnd] :: ServerStatsData -> Int
[_qSubEndB] :: ServerStatsData -> Int
[_ntfCreated] :: ServerStatsData -> Int
[_ntfNewCreated] :: ServerStatsData -> Int
[_ntfDeleted] :: ServerStatsData -> Int
[_ntfDeletedB] :: ServerStatsData -> Int
[_ntfSub] :: ServerStatsData -> Int
[_ntfSubB] :: ServerStatsData -> Int
[_ntfSubAuth] :: ServerStatsData -> Int
[_ntfSubDuplicate] :: ServerStatsData -> Int
[_msgSent] :: ServerStatsData -> Int
[_msgSentAuth] :: ServerStatsData -> Int
[_msgSentQuota] :: ServerStatsData -> Int
[_msgSentLarge] :: ServerStatsData -> Int
[_msgSentBlock] :: ServerStatsData -> Int
[_msgRecv] :: ServerStatsData -> Int
[_msgRecvAckTimes] :: ServerStatsData -> TimeBuckets
[_msgRecvGet] :: ServerStatsData -> Int
[_msgGet] :: ServerStatsData -> Int
[_msgGetNoMsg] :: ServerStatsData -> Int
[_msgGetAuth] :: ServerStatsData -> Int
[_msgGetDuplicate] :: ServerStatsData -> Int
[_msgGetProhibited] :: ServerStatsData -> Int
[_msgExpired] :: ServerStatsData -> Int
[_activeQueues] :: ServerStatsData -> PeriodStatsData
[_msgSentNtf] :: ServerStatsData -> Int
[_msgRecvNtf] :: ServerStatsData -> Int
[_activeQueuesNtf] :: ServerStatsData -> PeriodStatsData
[_msgNtfs] :: ServerStatsData -> Int
[_msgNtfsB] :: ServerStatsData -> Int
[_msgNtfNoSub] :: ServerStatsData -> Int
[_msgNtfLost] :: ServerStatsData -> Int
[_msgNtfExpired] :: ServerStatsData -> Int
[_pRelays] :: ServerStatsData -> ProxyStatsData
[_pRelaysOwn] :: ServerStatsData -> ProxyStatsData
[_pMsgFwds] :: ServerStatsData -> ProxyStatsData
[_pMsgFwdsOwn] :: ServerStatsData -> ProxyStatsData
[_pMsgFwdsRecv] :: ServerStatsData -> Int
[_ntfServices] :: ServerStatsData -> ServiceStatsData
[_rcvServices] :: ServerStatsData -> ServiceStatsData
[_qCount] :: ServerStatsData -> Int
[_msgCount] :: ServerStatsData -> Int
[_ntfCount] :: ServerStatsData -> Int
data PeriodStats
PeriodStats :: IORef IntSet -> IORef IntSet -> IORef IntSet -> PeriodStats
[day] :: PeriodStats -> IORef IntSet
[week] :: PeriodStats -> IORef IntSet
[month] :: PeriodStats -> IORef IntSet
data PeriodStatsData
PeriodStatsData :: IntSet -> IntSet -> IntSet -> PeriodStatsData
[_day] :: PeriodStatsData -> IntSet
[_week] :: PeriodStatsData -> IntSet
[_month] :: PeriodStatsData -> IntSet
data PeriodStatCounts
PeriodStatCounts :: Text -> Text -> Text -> PeriodStatCounts
[dayCount] :: PeriodStatCounts -> Text
[weekCount] :: PeriodStatCounts -> Text
[monthCount] :: PeriodStatCounts -> Text
data ProxyStats
ProxyStats :: IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> ProxyStats
[pRequests] :: ProxyStats -> IORef Int
[pSuccesses] :: ProxyStats -> IORef Int
[pErrorsConnect] :: ProxyStats -> IORef Int
[pErrorsCompat] :: ProxyStats -> IORef Int
[pErrorsOther] :: ProxyStats -> IORef Int
data ProxyStatsData
ProxyStatsData :: Int -> Int -> Int -> Int -> Int -> ProxyStatsData
[_pRequests] :: ProxyStatsData -> Int
[_pSuccesses] :: ProxyStatsData -> Int
[_pErrorsConnect] :: ProxyStatsData -> Int
[_pErrorsCompat] :: ProxyStatsData -> Int
[_pErrorsOther] :: ProxyStatsData -> Int
data ServiceStats
ServiceStats :: IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> ServiceStats
[srvAssocNew] :: ServiceStats -> IORef Int
[srvAssocDuplicate] :: ServiceStats -> IORef Int
[srvAssocUpdated] :: ServiceStats -> IORef Int
[srvAssocRemoved] :: ServiceStats -> IORef Int
[srvSubCount] :: ServiceStats -> IORef Int
[srvSubDuplicate] :: ServiceStats -> IORef Int
[srvSubQueues] :: ServiceStats -> IORef Int
[srvSubEnd] :: ServiceStats -> IORef Int
data ServiceStatsData
ServiceStatsData :: Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> ServiceStatsData
[_srvAssocNew] :: ServiceStatsData -> Int
[_srvAssocDuplicate] :: ServiceStatsData -> Int
[_srvAssocUpdated] :: ServiceStatsData -> Int
[_srvAssocRemoved] :: ServiceStatsData -> Int
[_srvSubCount] :: ServiceStatsData -> Int
[_srvSubDuplicate] :: ServiceStatsData -> Int
[_srvSubQueues] :: ServiceStatsData -> Int
[_srvSubEnd] :: ServiceStatsData -> Int
data TimeBuckets
TimeBuckets :: Int64 -> Int64 -> IntMap Int -> TimeBuckets
[sumTime] :: TimeBuckets -> Int64
[maxTime] :: TimeBuckets -> Int64
[timeBuckets] :: TimeBuckets -> IntMap Int
newServerStats :: UTCTime -> IO ServerStats
getServerStatsData :: ServerStats -> IO ServerStatsData
setServerStats :: ServerStats -> ServerStatsData -> IO ()
newPeriodStats :: IO PeriodStats
newPeriodStatsData :: PeriodStatsData
getPeriodStatsData :: PeriodStats -> IO PeriodStatsData
setPeriodStats :: PeriodStats -> PeriodStatsData -> IO ()
periodStatDataCounts :: PeriodStatsData -> PeriodStatCounts
periodStatCounts :: PeriodStats -> UTCTime -> IO PeriodStatCounts
updatePeriodStats :: PeriodStats -> EntityId -> IO ()
newProxyStats :: IO ProxyStats
newProxyStatsData :: ProxyStatsData
getProxyStatsData :: ProxyStats -> IO ProxyStatsData
getResetProxyStatsData :: ProxyStats -> IO ProxyStatsData
setProxyStats :: ProxyStats -> ProxyStatsData -> IO ()
newServiceStatsData :: ServiceStatsData
newServiceStats :: IO ServiceStats
getServiceStatsData :: ServiceStats -> IO ServiceStatsData
getResetServiceStatsData :: ServiceStats -> IO ServiceStatsData
setServiceStats :: ServiceStats -> ServiceStatsData -> IO ()
emptyTimeBuckets :: TimeBuckets
updateTimeBuckets :: SystemSeconds -> SystemSeconds -> TimeBuckets -> TimeBuckets
instance GHC.Show.Show Simplex.Messaging.Server.Stats.PeriodStatsData
instance GHC.Show.Show Simplex.Messaging.Server.Stats.ProxyStatsData
instance GHC.Show.Show Simplex.Messaging.Server.Stats.ServiceStatsData
instance GHC.Show.Show Simplex.Messaging.Server.Stats.TimeBuckets
instance GHC.Show.Show Simplex.Messaging.Server.Stats.ServerStatsData
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Server.Stats.ServerStatsData
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Server.Stats.ServiceStatsData
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Server.Stats.ProxyStatsData
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Server.Stats.PeriodStatsData

module Simplex.FileTransfer.Server.Stats
data FileServerStats
FileServerStats :: IORef UTCTime -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> IORef Int -> PeriodStats -> IORef Int -> IORef Int -> IORef Int -> IORef Int64 -> FileServerStats
[$sel:fromTime:FileServerStats] :: FileServerStats -> IORef UTCTime
[$sel:filesCreated:FileServerStats] :: FileServerStats -> IORef Int
[$sel:fileRecipients:FileServerStats] :: FileServerStats -> IORef Int
[$sel:filesUploaded:FileServerStats] :: FileServerStats -> IORef Int
[$sel:filesExpired:FileServerStats] :: FileServerStats -> IORef Int
[$sel:filesDeleted:FileServerStats] :: FileServerStats -> IORef Int
[$sel:filesBlocked:FileServerStats] :: FileServerStats -> IORef Int
[$sel:filesDownloaded:FileServerStats] :: FileServerStats -> PeriodStats
[$sel:fileDownloads:FileServerStats] :: FileServerStats -> IORef Int
[$sel:fileDownloadAcks:FileServerStats] :: FileServerStats -> IORef Int
[$sel:filesCount:FileServerStats] :: FileServerStats -> IORef Int
[$sel:filesSize:FileServerStats] :: FileServerStats -> IORef Int64
data FileServerStatsData
FileServerStatsData :: UTCTime -> Int -> Int -> Int -> Int -> Int -> Int -> PeriodStatsData -> Int -> Int -> Int -> Int64 -> FileServerStatsData
[$sel:_fromTime:FileServerStatsData] :: FileServerStatsData -> UTCTime
[$sel:_filesCreated:FileServerStatsData] :: FileServerStatsData -> Int
[$sel:_fileRecipients:FileServerStatsData] :: FileServerStatsData -> Int
[$sel:_filesUploaded:FileServerStatsData] :: FileServerStatsData -> Int
[$sel:_filesExpired:FileServerStatsData] :: FileServerStatsData -> Int
[$sel:_filesDeleted:FileServerStatsData] :: FileServerStatsData -> Int
[$sel:_filesBlocked:FileServerStatsData] :: FileServerStatsData -> Int
[$sel:_filesDownloaded:FileServerStatsData] :: FileServerStatsData -> PeriodStatsData
[$sel:_fileDownloads:FileServerStatsData] :: FileServerStatsData -> Int
[$sel:_fileDownloadAcks:FileServerStatsData] :: FileServerStatsData -> Int
[$sel:_filesCount:FileServerStatsData] :: FileServerStatsData -> Int
[$sel:_filesSize:FileServerStatsData] :: FileServerStatsData -> Int64
newFileServerStats :: UTCTime -> IO FileServerStats
getFileServerStatsData :: FileServerStats -> IO FileServerStatsData
setFileServerStats :: FileServerStats -> FileServerStatsData -> IO ()
instance GHC.Show.Show Simplex.FileTransfer.Server.Stats.FileServerStatsData
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.FileTransfer.Server.Stats.FileServerStatsData

module Simplex.FileTransfer.Server.Prometheus
data FileServerMetrics
FileServerMetrics :: FileServerStatsData -> PeriodStatCounts -> Text -> FileServerMetrics
[$sel:statsData:FileServerMetrics] :: FileServerMetrics -> FileServerStatsData
[$sel:filesDownloadedPeriods:FileServerMetrics] :: FileServerMetrics -> PeriodStatCounts
[$sel:rtsOptions:FileServerMetrics] :: FileServerMetrics -> Text
rtsOptionsEnv :: Text
xftpPrometheusMetrics :: FileServerMetrics -> UTCTime -> Text

module Simplex.Messaging.Server.QueueStore
data QueueRec
QueueRec :: NonEmpty RcvPublicAuthKey -> RcvDhSecret -> SenderId -> Maybe SndPublicAuthKey -> Maybe QueueMode -> Maybe (LinkId, QueueLinkData) -> Maybe NtfCreds -> ServerEntityStatus -> Maybe SystemDate -> Maybe ServiceId -> QueueRec
[$sel:recipientKeys:QueueRec] :: QueueRec -> NonEmpty RcvPublicAuthKey
[$sel:rcvDhSecret:QueueRec] :: QueueRec -> RcvDhSecret
[$sel:senderId:QueueRec] :: QueueRec -> SenderId
[$sel:senderKey:QueueRec] :: QueueRec -> Maybe SndPublicAuthKey
[$sel:queueMode:QueueRec] :: QueueRec -> Maybe QueueMode
[$sel:queueData:QueueRec] :: QueueRec -> Maybe (LinkId, QueueLinkData)
[$sel:notifier:QueueRec] :: QueueRec -> Maybe NtfCreds
[$sel:status:QueueRec] :: QueueRec -> ServerEntityStatus
[$sel:updatedAt:QueueRec] :: QueueRec -> Maybe SystemDate
[$sel:rcvServiceId:QueueRec] :: QueueRec -> Maybe ServiceId
data NtfCreds
NtfCreds :: NotifierId -> NtfPublicAuthKey -> RcvNtfDhSecret -> Maybe ServiceId -> NtfCreds
[$sel:notifierId:NtfCreds] :: NtfCreds -> NotifierId
[$sel:notifierKey:NtfCreds] :: NtfCreds -> NtfPublicAuthKey
[$sel:rcvNtfDhSecret:NtfCreds] :: NtfCreds -> RcvNtfDhSecret
[$sel:ntfServiceId:NtfCreds] :: NtfCreds -> Maybe ServiceId
data ServiceRec
ServiceRec :: ServiceId -> SMPServiceRole -> CertificateChain -> Fingerprint -> SystemDate -> ServiceRec
[$sel:serviceId:ServiceRec] :: ServiceRec -> ServiceId
[$sel:serviceRole:ServiceRec] :: ServiceRec -> SMPServiceRole
[$sel:serviceCert:ServiceRec] :: ServiceRec -> CertificateChain
[$sel:serviceCertHash:ServiceRec] :: ServiceRec -> Fingerprint
[$sel:serviceCreatedAt:ServiceRec] :: ServiceRec -> SystemDate
type CertFingerprint = ByteString
data ServerEntityStatus
EntityActive :: ServerEntityStatus
EntityBlocked :: BlockingInfo -> ServerEntityStatus
EntityOff :: ServerEntityStatus
instance GHC.Show.Show Simplex.Messaging.Server.QueueStore.NtfCreds
instance GHC.Show.Show Simplex.Messaging.Server.QueueStore.ServiceRec
instance GHC.Show.Show Simplex.Messaging.Server.QueueStore.ServerEntityStatus
instance GHC.Classes.Eq Simplex.Messaging.Server.QueueStore.ServerEntityStatus
instance GHC.Show.Show Simplex.Messaging.Server.QueueStore.QueueRec
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Server.QueueStore.ServerEntityStatus
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Server.QueueStore.ServiceRec
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Server.QueueStore.NtfCreds

module Simplex.Messaging.Server.StoreLog

-- | opaque container for file handle with a type-safe IOMode constructors
--   are not exported, openWriteStoreLog and openReadStoreLog should be
--   used instead
data StoreLog (a :: IOMode)
data StoreLogRecord
CreateQueue :: RecipientId -> QueueRec -> StoreLogRecord
CreateLink :: RecipientId -> LinkId -> QueueLinkData -> StoreLogRecord
DeleteLink :: RecipientId -> StoreLogRecord
SecureQueue :: QueueId -> SndPublicAuthKey -> StoreLogRecord
UpdateKeys :: RecipientId -> NonEmpty RcvPublicAuthKey -> StoreLogRecord
AddNotifier :: QueueId -> NtfCreds -> StoreLogRecord
SuspendQueue :: QueueId -> StoreLogRecord
BlockQueue :: QueueId -> BlockingInfo -> StoreLogRecord
UnblockQueue :: QueueId -> StoreLogRecord
DeleteQueue :: QueueId -> StoreLogRecord
DeleteNotifier :: QueueId -> StoreLogRecord
UpdateTime :: QueueId -> SystemDate -> StoreLogRecord
NewService :: ServiceRec -> StoreLogRecord
QueueService :: RecipientId -> ASubscriberParty -> Maybe ServiceId -> StoreLogRecord
openWriteStoreLog :: Bool -> FilePath -> IO (StoreLog 'WriteMode)
openReadStoreLog :: FilePath -> IO (StoreLog 'ReadMode)
storeLogFilePath :: StoreLog a -> FilePath
closeStoreLog :: StoreLog a -> IO ()
writeStoreLogRecord :: StrEncoding r => StoreLog 'WriteMode -> r -> IO ()
logCreateQueue :: StoreLog 'WriteMode -> RecipientId -> QueueRec -> IO ()
logCreateLink :: StoreLog 'WriteMode -> RecipientId -> LinkId -> QueueLinkData -> IO ()
logDeleteLink :: StoreLog 'WriteMode -> RecipientId -> IO ()
logSecureQueue :: StoreLog 'WriteMode -> QueueId -> SndPublicAuthKey -> IO ()
logUpdateKeys :: StoreLog 'WriteMode -> QueueId -> NonEmpty RcvPublicAuthKey -> IO ()
logAddNotifier :: StoreLog 'WriteMode -> QueueId -> NtfCreds -> IO ()
logSuspendQueue :: StoreLog 'WriteMode -> QueueId -> IO ()
logBlockQueue :: StoreLog 'WriteMode -> QueueId -> BlockingInfo -> IO ()
logUnblockQueue :: StoreLog 'WriteMode -> QueueId -> IO ()
logDeleteQueue :: StoreLog 'WriteMode -> QueueId -> IO ()
logDeleteNotifier :: StoreLog 'WriteMode -> QueueId -> IO ()
logUpdateQueueTime :: StoreLog 'WriteMode -> QueueId -> SystemDate -> IO ()
logNewService :: StoreLog 'WriteMode -> ServiceRec -> IO ()
logQueueService :: (PartyI p, ServiceParty p) => StoreLog 'WriteMode -> RecipientId -> SParty p -> Maybe ServiceId -> IO ()
readWriteStoreLog :: (FilePath -> s -> IO ()) -> (StoreLog 'WriteMode -> s -> IO ()) -> FilePath -> s -> IO (StoreLog 'WriteMode)
readLogLines :: Bool -> FilePath -> (Bool -> ByteString -> IO ()) -> IO ()
foldLogLines :: Bool -> FilePath -> (a -> Bool -> ByteString -> IO a) -> a -> IO a
instance GHC.Show.Show Simplex.Messaging.Server.StoreLog.StoreLogRecord
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Server.StoreLog.SLRTag
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Server.StoreLog.StoreLogRecord
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Server.QueueStore.QueueRec

module Simplex.Messaging.Server.QueueStore.Types
class StoreQueueClass q
recipientId :: StoreQueueClass q => q -> RecipientId
queueRec :: StoreQueueClass q => q -> TVar (Maybe QueueRec)
withQueueLock :: StoreQueueClass q => q -> Text -> IO a -> IO a
class StoreQueueClass q => QueueStoreClass q s where {
    type QueueStoreCfg s;
}
newQueueStore :: QueueStoreClass q s => QueueStoreCfg s -> IO s
closeQueueStore :: QueueStoreClass q s => s -> IO ()
getEntityCounts :: QueueStoreClass q s => s -> IO EntityCounts
loadedQueues :: QueueStoreClass q s => s -> TMap RecipientId q
compactQueues :: QueueStoreClass q s => s -> IO Int64
addQueue_ :: QueueStoreClass q s => s -> (RecipientId -> QueueRec -> IO q) -> RecipientId -> QueueRec -> IO (Either ErrorType q)
getQueue_ :: (QueueStoreClass q s, QueueParty p) => s -> (Bool -> RecipientId -> QueueRec -> IO q) -> SParty p -> QueueId -> IO (Either ErrorType q)
getQueues_ :: (QueueStoreClass q s, BatchParty p) => s -> (Bool -> RecipientId -> QueueRec -> IO q) -> SParty p -> [QueueId] -> IO [Either ErrorType q]
getQueueLinkData :: QueueStoreClass q s => s -> q -> LinkId -> IO (Either ErrorType QueueLinkData)
addQueueLinkData :: QueueStoreClass q s => s -> q -> LinkId -> QueueLinkData -> IO (Either ErrorType ())
deleteQueueLinkData :: QueueStoreClass q s => s -> q -> IO (Either ErrorType ())
secureQueue :: QueueStoreClass q s => s -> q -> SndPublicAuthKey -> IO (Either ErrorType ())
updateKeys :: QueueStoreClass q s => s -> q -> NonEmpty RcvPublicAuthKey -> IO (Either ErrorType ())
addQueueNotifier :: QueueStoreClass q s => s -> q -> NtfCreds -> IO (Either ErrorType (Maybe NtfCreds))
deleteQueueNotifier :: QueueStoreClass q s => s -> q -> IO (Either ErrorType (Maybe NtfCreds))
suspendQueue :: QueueStoreClass q s => s -> q -> IO (Either ErrorType ())
blockQueue :: QueueStoreClass q s => s -> q -> BlockingInfo -> IO (Either ErrorType ())
unblockQueue :: QueueStoreClass q s => s -> q -> IO (Either ErrorType ())
updateQueueTime :: QueueStoreClass q s => s -> q -> SystemDate -> IO (Either ErrorType QueueRec)
deleteStoreQueue :: QueueStoreClass q s => s -> q -> IO (Either ErrorType QueueRec)
getCreateService :: QueueStoreClass q s => s -> ServiceRec -> IO (Either ErrorType ServiceId)
setQueueService :: (QueueStoreClass q s, PartyI p, ServiceParty p) => s -> q -> SParty p -> Maybe ServiceId -> IO (Either ErrorType ())
getQueueNtfServices :: QueueStoreClass q s => s -> [(NotifierId, a)] -> IO (Either ErrorType ([(Maybe ServiceId, [(NotifierId, a)])], [(NotifierId, a)]))
getServiceQueueCount :: (QueueStoreClass q s, PartyI p, ServiceParty p) => s -> SParty p -> ServiceId -> IO (Either ErrorType Int64)
data EntityCounts
EntityCounts :: Int -> Int -> Int -> Int -> Int -> Int -> EntityCounts
[queueCount] :: EntityCounts -> Int
[notifierCount] :: EntityCounts -> Int
[rcvServiceCount] :: EntityCounts -> Int
[ntfServiceCount] :: EntityCounts -> Int
[rcvServiceQueuesCount] :: EntityCounts -> Int
[ntfServiceQueuesCount] :: EntityCounts -> Int
withLoadedQueues :: (Monoid a, QueueStoreClass q s) => s -> (q -> IO a) -> IO a

module Simplex.Messaging.Server.QueueStore.STM
data STMQueueStore q
STMQueueStore :: TMap RecipientId q -> TMap SenderId RecipientId -> TMap NotifierId RecipientId -> TMap ServiceId STMService -> TMap CertFingerprint ServiceId -> TMap LinkId RecipientId -> TVar (Maybe (StoreLog 'WriteMode)) -> STMQueueStore q
[$sel:queues:STMQueueStore] :: STMQueueStore q -> TMap RecipientId q
[$sel:senders:STMQueueStore] :: STMQueueStore q -> TMap SenderId RecipientId
[$sel:notifiers:STMQueueStore] :: STMQueueStore q -> TMap NotifierId RecipientId
[$sel:services:STMQueueStore] :: STMQueueStore q -> TMap ServiceId STMService
[$sel:serviceCerts:STMQueueStore] :: STMQueueStore q -> TMap CertFingerprint ServiceId
[$sel:links:STMQueueStore] :: STMQueueStore q -> TMap LinkId RecipientId
[$sel:storeLog:STMQueueStore] :: STMQueueStore q -> TVar (Maybe (StoreLog 'WriteMode))
data STMService
STMService :: ServiceRec -> TVar (Set RecipientId) -> TVar (Set NotifierId) -> STMService
[$sel:serviceRec:STMService] :: STMService -> ServiceRec
[$sel:serviceRcvQueues:STMService] :: STMService -> TVar (Set RecipientId)
[$sel:serviceNtfQueues:STMService] :: STMService -> TVar (Set NotifierId)
setStoreLog :: STMQueueStore q -> StoreLog 'WriteMode -> IO ()
withLog' :: Text -> TVar (Maybe (StoreLog 'WriteMode)) -> (StoreLog 'WriteMode -> IO ()) -> IO (Either ErrorType ())
readQueueRecIO :: TVar (Maybe QueueRec) -> IO (Either ErrorType QueueRec)
setStatus :: TVar (Maybe QueueRec) -> ServerEntityStatus -> IO (Either ErrorType ())
instance Simplex.Messaging.Server.QueueStore.Types.StoreQueueClass q => Simplex.Messaging.Server.QueueStore.Types.QueueStoreClass q (Simplex.Messaging.Server.QueueStore.STM.STMQueueStore q)

module Simplex.Messaging.Server.StoreLog.ReadWrite
writeQueueStore :: forall q. StoreQueueClass q => StoreLog 'WriteMode -> STMQueueStore q -> IO ()
readQueueStore :: forall q. StoreQueueClass q => Bool -> (RecipientId -> QueueRec -> IO q) -> FilePath -> STMQueueStore q -> IO ()

module Simplex.Messaging.Server.NtfStore
newtype NtfStore
NtfStore :: TMap NotifierId (TVar [MsgNtf]) -> NtfStore
data MsgNtf
MsgNtf :: MsgId -> SystemTime -> CbNonce -> EncNMsgMeta -> MsgNtf
[ntfMsgId] :: MsgNtf -> MsgId
[ntfTs] :: MsgNtf -> SystemTime
[ntfNonce] :: MsgNtf -> CbNonce
[ntfEncMeta] :: MsgNtf -> EncNMsgMeta
data NtfLogRecord
NLRv1 :: NotifierId -> MsgNtf -> NtfLogRecord
storeNtf :: NtfStore -> NotifierId -> MsgNtf -> IO ()
deleteNtfs :: NtfStore -> NotifierId -> IO Int
deleteExpiredNtfs :: NtfStore -> Int64 -> IO Int
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Server.NtfStore.NtfLogRecord
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Server.NtfStore.MsgNtf

module Simplex.Messaging.Server.MsgStore.Types
class (Monad (StoreMonad s), QueueStoreClass (StoreQueue s) (QueueStore s)) => MsgStoreClass s where {
    type StoreMonad s = (m :: Type -> Type) | m -> s;
    type MsgStoreConfig s = c | c -> s;
    type MsgQueue s = q | q -> s;
    type StoreQueue s = q | q -> s;
    type QueueStore s = qs | qs -> s;
}
newMsgStore :: MsgStoreClass s => MsgStoreConfig s -> IO s
closeMsgStore :: MsgStoreClass s => s -> IO ()
withActiveMsgQueues :: (MsgStoreClass s, Monoid a) => s -> (StoreQueue s -> IO a) -> IO a
unsafeWithAllMsgQueues :: (MsgStoreClass s, Monoid a) => Bool -> s -> (StoreQueue s -> IO a) -> IO a
expireOldMessages :: MsgStoreClass s => Bool -> s -> Int64 -> Int64 -> IO MessageStats
logQueueStates :: MsgStoreClass s => s -> IO ()
logQueueState :: MsgStoreClass s => StoreQueue s -> StoreMonad s ()
queueStore :: MsgStoreClass s => s -> QueueStore s
loadedQueueCounts :: MsgStoreClass s => s -> IO LoadedQueueCounts
mkQueue :: MsgStoreClass s => s -> Bool -> RecipientId -> QueueRec -> IO (StoreQueue s)
getMsgQueue :: MsgStoreClass s => s -> StoreQueue s -> Bool -> StoreMonad s (MsgQueue s)
getPeekMsgQueue :: MsgStoreClass s => s -> StoreQueue s -> StoreMonad s (Maybe (MsgQueue s, Message))
withIdleMsgQueue :: MsgStoreClass s => Int64 -> s -> StoreQueue s -> (MsgQueue s -> StoreMonad s a) -> StoreMonad s (Maybe a, Int)
deleteQueue :: MsgStoreClass s => s -> StoreQueue s -> IO (Either ErrorType QueueRec)
deleteQueueSize :: MsgStoreClass s => s -> StoreQueue s -> IO (Either ErrorType (QueueRec, Int))
getQueueMessages_ :: MsgStoreClass s => Bool -> StoreQueue s -> MsgQueue s -> StoreMonad s [Message]
writeMsg :: MsgStoreClass s => s -> StoreQueue s -> Bool -> Message -> ExceptT ErrorType IO (Maybe (Message, Bool))
setOverQuota_ :: MsgStoreClass s => StoreQueue s -> IO ()
getQueueSize_ :: MsgStoreClass s => MsgQueue s -> StoreMonad s Int
tryPeekMsg_ :: MsgStoreClass s => StoreQueue s -> MsgQueue s -> StoreMonad s (Maybe Message)
tryDeleteMsg_ :: MsgStoreClass s => StoreQueue s -> MsgQueue s -> Bool -> StoreMonad s ()
isolateQueue :: MsgStoreClass s => s -> StoreQueue s -> Text -> StoreMonad s a -> ExceptT ErrorType IO a
unsafeRunStore :: MsgStoreClass s => StoreQueue s -> Text -> StoreMonad s a -> IO a
tryPeekMsg :: MsgStoreClass s => s -> StoreQueue s -> ExceptT ErrorType IO (Maybe Message)
tryDelMsg :: MsgStoreClass s => s -> StoreQueue s -> MsgId -> ExceptT ErrorType IO (Maybe Message)
tryDelPeekMsg :: MsgStoreClass s => s -> StoreQueue s -> MsgId -> ExceptT ErrorType IO (Maybe Message, Maybe Message)
deleteExpiredMsgs :: MsgStoreClass s => s -> StoreQueue s -> Int64 -> ExceptT ErrorType IO Int
getQueueSize :: MsgStoreClass s => s -> StoreQueue s -> ExceptT ErrorType IO Int
data MSType
MSMemory :: MSType
MSJournal :: MSType
MSPostgres :: MSType
data QSType
QSMemory :: QSType
QSPostgres :: QSType
data SMSType :: MSType -> Type
[SMSMemory] :: SMSType 'MSMemory
[SMSJournal] :: SMSType 'MSJournal
[SMSPostgres] :: SMSType 'MSPostgres
data SQSType :: QSType -> Type
[SQSMemory] :: SQSType 'QSMemory
[SQSPostgres] :: SQSType 'QSPostgres
data MessageStats
MessageStats :: Int -> Int -> Int -> MessageStats
[$sel:storedMsgsCount:MessageStats] :: MessageStats -> Int
[$sel:expiredMsgsCount:MessageStats] :: MessageStats -> Int
[$sel:storedQueues:MessageStats] :: MessageStats -> Int
data LoadedQueueCounts
LoadedQueueCounts :: Int -> Int -> Int -> Int -> Int -> LoadedQueueCounts
[$sel:loadedQueueCount:LoadedQueueCounts] :: LoadedQueueCounts -> Int
[$sel:loadedNotifierCount:LoadedQueueCounts] :: LoadedQueueCounts -> Int
[$sel:openJournalCount:LoadedQueueCounts] :: LoadedQueueCounts -> Int
[$sel:queueLockCount:LoadedQueueCounts] :: LoadedQueueCounts -> Int
[$sel:notifierLockCount:LoadedQueueCounts] :: LoadedQueueCounts -> Int
newMessageStats :: MessageStats
addQueue :: MsgStoreClass s => s -> RecipientId -> QueueRec -> IO (Either ErrorType (StoreQueue s))
getQueue :: (MsgStoreClass s, QueueParty p) => s -> SParty p -> QueueId -> IO (Either ErrorType (StoreQueue s))
getQueueRec :: (MsgStoreClass s, QueueParty p) => s -> SParty p -> QueueId -> IO (Either ErrorType (StoreQueue s, QueueRec))
getQueues :: (MsgStoreClass s, BatchParty p) => s -> SParty p -> [QueueId] -> IO [Either ErrorType (StoreQueue s)]
getQueueRecs :: (MsgStoreClass s, BatchParty p) => s -> SParty p -> [QueueId] -> IO [Either ErrorType (StoreQueue s, QueueRec)]
readQueueRec :: StoreQueueClass q => q -> IO (Either ErrorType (q, QueueRec))
withPeekMsgQueue :: MsgStoreClass s => s -> StoreQueue s -> Text -> (Maybe (MsgQueue s, Message) -> StoreMonad s a) -> ExceptT ErrorType IO a
expireQueueMsgs :: MsgStoreClass s => s -> Int64 -> Int64 -> StoreQueue s -> StoreMonad s MessageStats
deleteExpireMsgs_ :: MsgStoreClass s => Int64 -> StoreQueue s -> MsgQueue s -> StoreMonad s Int
instance GHC.Show.Show Simplex.Messaging.Server.MsgStore.Types.MessageStats
instance GHC.Base.Monoid Simplex.Messaging.Server.MsgStore.Types.MessageStats
instance GHC.Base.Semigroup Simplex.Messaging.Server.MsgStore.Types.MessageStats

module Simplex.Messaging.Server.Prometheus
data ServerMetrics
ServerMetrics :: ServerStatsData -> PeriodStatCounts -> PeriodStatCounts -> EntityCounts -> Text -> ServerMetrics
[statsData] :: ServerMetrics -> ServerStatsData
[activeQueueCounts] :: ServerMetrics -> PeriodStatCounts
[activeNtfCounts] :: ServerMetrics -> PeriodStatCounts
[entityCounts] :: ServerMetrics -> EntityCounts
[rtsOptions] :: ServerMetrics -> Text
data RealTimeMetrics
RealTimeMetrics :: [(ServiceName, SocketStats)] -> Int -> Int -> RTSubscriberMetrics -> TimeBuckets -> RTSubscriberMetrics -> RTSubscriberMetrics -> LoadedQueueCounts -> RealTimeMetrics
[socketStats] :: RealTimeMetrics -> [(ServiceName, SocketStats)]
[threadsCount] :: RealTimeMetrics -> Int
[clientsCount] :: RealTimeMetrics -> Int
[deliveredSubs] :: RealTimeMetrics -> RTSubscriberMetrics
[deliveredTimes] :: RealTimeMetrics -> TimeBuckets
[smpSubs] :: RealTimeMetrics -> RTSubscriberMetrics
[ntfSubs] :: RealTimeMetrics -> RTSubscriberMetrics
[loadedCounts] :: RealTimeMetrics -> LoadedQueueCounts
data RTSubscriberMetrics
RTSubscriberMetrics :: Int -> Int -> Int -> RTSubscriberMetrics
[subsCount] :: RTSubscriberMetrics -> Int
[subClientsCount] :: RTSubscriberMetrics -> Int
[subServicesCount] :: RTSubscriberMetrics -> Int
rtsOptionsEnv :: Text
prometheusMetrics :: ServerMetrics -> RealTimeMetrics -> UTCTime -> Text

module Simplex.Messaging.Server.MsgStore.STM
data STMMsgStore
STMMsgStore :: STMStoreConfig -> STMQueueStore STMQueue -> STMMsgStore
[$sel:storeConfig:STMMsgStore] :: STMMsgStore -> STMStoreConfig
[$sel:queueStore_:STMMsgStore] :: STMMsgStore -> STMQueueStore STMQueue
data STMStoreConfig
STMStoreConfig :: Maybe FilePath -> Int -> STMStoreConfig
[$sel:storePath:STMStoreConfig] :: STMStoreConfig -> Maybe FilePath
[$sel:quota:STMStoreConfig] :: STMStoreConfig -> Int
data STMQueue
instance Simplex.Messaging.Server.MsgStore.Types.MsgStoreClass Simplex.Messaging.Server.MsgStore.STM.STMMsgStore
instance Simplex.Messaging.Server.QueueStore.Types.StoreQueueClass Simplex.Messaging.Server.MsgStore.STM.STMQueue

module Simplex.Messaging.Server.MsgStore
data MsgLogRecord
MLRv3 :: RecipientId -> Message -> MsgLogRecord
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Server.MsgStore.MsgLogRecord

module Simplex.Messaging.Server.Control
data CPClientRole
CPRNone :: CPClientRole
CPRUser :: CPClientRole
CPRAdmin :: CPClientRole
data ControlProtocol
CPAuth :: BasicAuth -> ControlProtocol
CPSuspend :: ControlProtocol
CPResume :: ControlProtocol
CPClients :: ControlProtocol
CPStats :: ControlProtocol
CPStatsRTS :: ControlProtocol
CPThreads :: ControlProtocol
CPSockets :: ControlProtocol
CPSocketThreads :: ControlProtocol
CPServerInfo :: ControlProtocol
CPDelete :: SenderId -> ControlProtocol
CPStatus :: SenderId -> ControlProtocol
CPBlock :: SenderId -> BlockingInfo -> ControlProtocol
CPUnblock :: SenderId -> ControlProtocol
CPSave :: ControlProtocol
CPHelp :: ControlProtocol
CPQuit :: ControlProtocol
CPSkip :: ControlProtocol
instance GHC.Show.Show Simplex.Messaging.Server.Control.CPClientRole
instance GHC.Classes.Eq Simplex.Messaging.Server.Control.CPClientRole
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Server.Control.ControlProtocol


-- | This module provides a functional client API for SMP protocol.
--   
--   See
--   <a>https://github.com/simplex-chat/simplexmq/blob/master/protocol/simplex-messaging.md</a>
module Simplex.Messaging.Client

-- | Transport session key - includes entity ID if `sessionMode =
--   TSMEntity`. Please note that for SMP connection ID is used as entity
--   ID, not queue ID.
type TransportSession msg = (UserId, ProtoServer msg, Maybe ByteString)
type SMPTransportSession = TransportSession BrokerMsg

-- | <a>SMPClient</a> is a handle used to send commands to a specific SMP
--   server.
--   
--   Use <tt>getSMPClient</tt> to connect to an SMP server and create a
--   client handle.
data ProtocolClient v err msg
type SMPClient = ProtocolClient SMPVersion ErrorType BrokerMsg
data ProxiedRelay
ProxiedRelay :: SessionId -> VersionSMP -> Maybe BasicAuth -> PublicKeyX25519 -> ProxiedRelay
[$sel:prSessionId:ProxiedRelay] :: ProxiedRelay -> SessionId
[$sel:prVersion:ProxiedRelay] :: ProxiedRelay -> VersionSMP
[$sel:prBasicAuth:ProxiedRelay] :: ProxiedRelay -> Maybe BasicAuth
[$sel:prServerKey:ProxiedRelay] :: ProxiedRelay -> PublicKeyX25519

-- | Connects to <a>ProtocolServer</a> using passed client configuration
--   and queue for messages and notifications.
--   
--   A single queue can be used for multiple <a>SMPClient</a> instances, as
--   <tt>SMPServerTransmission</tt> includes server information.
getProtocolClient :: forall v err msg. Protocol v err msg => TVar ChaChaDRG -> NetworkRequestMode -> TransportSession msg -> ProtocolClientConfig v -> [HostName] -> Maybe (TBQueue (ServerTransmissionBatch v err msg)) -> UTCTime -> (ProtocolClient v err msg -> IO ()) -> IO (Either (ProtocolClientError err) (ProtocolClient v err msg))

-- | Disconnects client from the server and terminates client threads.
closeProtocolClient :: ProtocolClient v err msg -> IO ()
protocolClientServer :: ProtocolTypeI (ProtoType msg) => ProtocolClient v err msg -> String
protocolClientServer' :: ProtocolClient v err msg -> ProtoServer msg
transportHost' :: ProtocolClient v err msg -> TransportHost
transportSession' :: ProtocolClient v err msg -> TransportSession msg
useWebPort :: NetworkConfig -> [HostName] -> ProtocolServer p -> Bool
isPresetDomain :: [HostName] -> TransportHost -> Bool

-- | Create a new SMP queue.
--   
--   
--   <a>https://github.com/simplex-chat/simplexmq/blob/master/protocol/simplex-messaging.md#create-queue-command</a>
createSMPQueue :: SMPClient -> NetworkRequestMode -> Maybe CbNonce -> AAuthKeyPair -> RcvPublicDhKey -> Maybe BasicAuth -> SubscriptionMode -> QueueReqData -> Maybe NewNtfCreds -> ExceptT SMPClientError IO QueueIdsKeys

-- | Subscribe to the SMP queue.
--   
--   
--   <a>https://github.com/simplex-chat/simplexmq/blob/master/protocol/simplex-messaging.md#subscribe-to-queue</a>
--   This command is always sent in background request mode
subscribeSMPQueue :: SMPClient -> RcvPrivateAuthKey -> RecipientId -> ExceptT SMPClientError IO (Maybe ServiceId)

-- | Subscribe to multiple SMP queues batching commands if supported. This
--   command is always sent in background request mode
subscribeSMPQueues :: SMPClient -> NonEmpty (RecipientId, RcvPrivateAuthKey) -> IO (NonEmpty (Either SMPClientError (Maybe ServiceId)))
streamSubscribeSMPQueues :: SMPClient -> NonEmpty (RecipientId, RcvPrivateAuthKey) -> ([(RecipientId, Either SMPClientError (Maybe ServiceId))] -> IO ()) -> IO ()

-- | Get message from SMP queue. The server returns ERR PROHIBITED if a
--   client uses SUB and GET via the same transport connection for the same
--   queue
--   
--   
--   <a>https://github.covm/simplex-chat/simplexmq/blob/master/protocol/simplex-messaging.md#receive-a-message-from-the-queue</a>
--   This command is always sent in interactive request mode, as NSE has
--   limited time
getSMPMessage :: SMPClient -> RcvPrivateAuthKey -> RecipientId -> ExceptT SMPClientError IO (Maybe RcvMessage)

-- | Subscribe to the SMP queue notifications.
--   
--   
--   <a>https://github.com/simplex-chat/simplexmq/blob/master/protocol/simplex-messaging.md#subscribe-to-queue-notifications</a>
--   This command is always sent in background request mode
subscribeSMPQueueNotifications :: SMPClient -> NtfPrivateAuthKey -> NotifierId -> ExceptT SMPClientError IO (Maybe ServiceId)

-- | Subscribe to multiple SMP queues notifications batching commands if
--   supported. This command is always sent in background request mode
subscribeSMPQueuesNtfs :: SMPClient -> NonEmpty (NotifierId, NtfPrivateAuthKey) -> IO (NonEmpty (Either SMPClientError (Maybe ServiceId)))
subscribeService :: forall p. (PartyI p, ServiceParty p) => SMPClient -> SParty p -> ExceptT SMPClientError IO Int64
smpClientService :: SMPClient -> Maybe THClientService

-- | Secure the SMP queue by adding a sender public key.
--   
--   
--   <a>https://github.com/simplex-chat/simplexmq/blob/master/protocol/simplex-messaging.md#secure-queue-command</a>
secureSMPQueue :: SMPClient -> NetworkRequestMode -> RcvPrivateAuthKey -> RecipientId -> SndPublicAuthKey -> ExceptT SMPClientError IO ()

-- | Secure the SMP queue via sender queue ID.
secureSndSMPQueue :: SMPClient -> NetworkRequestMode -> SndPrivateAuthKey -> SenderId -> ExceptT SMPClientError IO ()
proxySecureSndSMPQueue :: SMPClient -> NetworkRequestMode -> ProxiedRelay -> SndPrivateAuthKey -> SenderId -> ExceptT SMPClientError IO (Either ProxyClientError ())

-- | Add or update date for queue link
addSMPQueueLink :: SMPClient -> NetworkRequestMode -> RcvPrivateAuthKey -> RecipientId -> LinkId -> QueueLinkData -> ExceptT SMPClientError IO ()

-- | Delete queue link
deleteSMPQueueLink :: SMPClient -> NetworkRequestMode -> RcvPrivateAuthKey -> RecipientId -> ExceptT SMPClientError IO ()

-- | Get 1-time inviation SMP queue link data and secure the queue via
--   queue link ID.
secureGetSMPQueueLink :: SMPClient -> NetworkRequestMode -> SndPrivateAuthKey -> LinkId -> ExceptT SMPClientError IO (SenderId, QueueLinkData)
proxySecureGetSMPQueueLink :: SMPClient -> NetworkRequestMode -> ProxiedRelay -> SndPrivateAuthKey -> LinkId -> ExceptT SMPClientError IO (Either ProxyClientError (SenderId, QueueLinkData))

-- | Get contact address SMP queue link data.
getSMPQueueLink :: SMPClient -> NetworkRequestMode -> LinkId -> ExceptT SMPClientError IO (SenderId, QueueLinkData)
proxyGetSMPQueueLink :: SMPClient -> NetworkRequestMode -> ProxiedRelay -> LinkId -> ExceptT SMPClientError IO (Either ProxyClientError (SenderId, QueueLinkData))

-- | Enable notifications for the queue for push notifications server.
--   
--   
--   <a>https://github.com/simplex-chat/simplexmq/blob/master/protocol/simplex-messaging.md#enable-notifications-command</a>
enableSMPQueueNotifications :: SMPClient -> RcvPrivateAuthKey -> RecipientId -> NtfPublicAuthKey -> RcvNtfPublicDhKey -> ExceptT SMPClientError IO (NotifierId, RcvNtfPublicDhKey)

-- | Disable notifications for the queue for push notifications server.
--   
--   
--   <a>https://github.com/simplex-chat/simplexmq/blob/master/protocol/simplex-messaging.md#disable-notifications-command</a>
--   This command is always sent in background request mode
disableSMPQueueNotifications :: SMPClient -> RcvPrivateAuthKey -> RecipientId -> ExceptT SMPClientError IO ()

-- | Enable notifications for the multiple queues for push notifications
--   server. This command is always sent in background request mode
enableSMPQueuesNtfs :: SMPClient -> NonEmpty (RecipientId, RcvPrivateAuthKey, NtfPublicAuthKey, RcvNtfPublicDhKey) -> IO (NonEmpty (Either SMPClientError (NotifierId, RcvNtfPublicDhKey)))

-- | Disable notifications for multiple queues for push notifications
--   server. This command is always sent in background request mode
disableSMPQueuesNtfs :: SMPClient -> NonEmpty (RecipientId, RcvPrivateAuthKey) -> IO (NonEmpty (Either SMPClientError ()))

-- | Send SMP message.
--   
--   
--   <a>https://github.com/simplex-chat/simplexmq/blob/master/protocol/simplex-messaging.md#send-message</a>
sendSMPMessage :: SMPClient -> NetworkRequestMode -> Maybe SndPrivateAuthKey -> SenderId -> MsgFlags -> MsgBody -> ExceptT SMPClientError IO ()

-- | Acknowledge message delivery (server deletes the message).
--   
--   
--   <a>https://github.com/simplex-chat/simplexmq/blob/master/protocol/simplex-messaging.md#acknowledge-message-delivery</a>
--   This command is always sent in background request mode
ackSMPMessage :: SMPClient -> RcvPrivateAuthKey -> QueueId -> MsgId -> ExceptT SMPClientError IO ()

-- | Irreversibly suspend SMP queue. The existing messages from the queue
--   will still be delivered.
--   
--   
--   <a>https://github.com/simplex-chat/simplexmq/blob/master/protocol/simplex-messaging.md#suspend-queue</a>
suspendSMPQueue :: SMPClient -> NetworkRequestMode -> RcvPrivateAuthKey -> QueueId -> ExceptT SMPClientError IO ()

-- | Irreversibly delete SMP queue and all messages in it.
--   
--   
--   <a>https://github.com/simplex-chat/simplexmq/blob/master/protocol/simplex-messaging.md#delete-queue</a>
deleteSMPQueue :: SMPClient -> NetworkRequestMode -> RcvPrivateAuthKey -> RecipientId -> ExceptT SMPClientError IO ()

-- | Delete multiple SMP queues batching commands if supported.
deleteSMPQueues :: SMPClient -> NetworkRequestMode -> NonEmpty (RecipientId, RcvPrivateAuthKey) -> IO (NonEmpty (Either SMPClientError ()))
connectSMPProxiedRelay :: SMPClient -> NetworkRequestMode -> SMPServer -> Maybe BasicAuth -> ExceptT SMPClientError IO ProxiedRelay
proxySMPMessage :: SMPClient -> NetworkRequestMode -> ProxiedRelay -> Maybe SndPrivateAuthKey -> SenderId -> MsgFlags -> MsgBody -> ExceptT SMPClientError IO (Either ProxyClientError ())
forwardSMPTransmission :: SMPClient -> CorrId -> VersionSMP -> PublicKeyX25519 -> EncTransmission -> ExceptT SMPClientError IO EncResponse
getSMPQueueInfo :: SMPClient -> NetworkRequestMode -> APrivateAuthKey -> QueueId -> ExceptT SMPClientError IO QueueInfo

-- | Send Protocol command
sendProtocolCommand :: forall v err msg. Protocol v err msg => ProtocolClient v err msg -> NetworkRequestMode -> Maybe APrivateAuthKey -> EntityId -> ProtoCommand msg -> ExceptT (ProtocolClientError err) IO msg

-- | Send multiple commands with batching and collect responses
sendProtocolCommands :: forall v err msg. Protocol v err msg => ProtocolClient v err msg -> NetworkRequestMode -> NonEmpty (ClientCommand msg) -> IO (NonEmpty (Response err msg))

-- | SMP client error type.
data ProtocolClientError err

-- | Correctly parsed SMP server ERR response. This error is forwarded to
--   the agent client as `ERR SMP err`.
PCEProtocolError :: err -> ProtocolClientError err

-- | Invalid server response that failed to parse. Forwarded to the agent
--   client as `ERR BROKER RESPONSE`.
PCEResponseError :: err -> ProtocolClientError err

-- | Different response from what is expected to a certain SMP command,
--   e.g. server should respond <a>IDS</a> or <a>ERR</a> to <a>NEW</a>
--   command, other responses would result in this error. Forwarded to the
--   agent client as `ERR BROKER UNEXPECTED`.
PCEUnexpectedResponse :: ByteString -> ProtocolClientError err

-- | Used for TCP connection and command response timeouts. Forwarded to
--   the agent client as `ERR BROKER TIMEOUT`.
PCEResponseTimeout :: ProtocolClientError err

-- | Failure to establish TCP connection. Forwarded to the agent client as
--   `ERR BROKER NETWORK`.
PCENetworkError :: NetworkError -> ProtocolClientError err

-- | No host compatible with network configuration
PCEIncompatibleHost :: ProtocolClientError err

-- | Service is unavailable for command that requires service connection
PCEServiceUnavailable :: ProtocolClientError err

-- | TCP transport handshake or some other transport error. Forwarded to
--   the agent client as `ERR BROKER TRANSPORT e`.
PCETransportError :: TransportError -> ProtocolClientError err

-- | Error when cryptographically "signing" the command or when
--   initializing crypto_box.
PCECryptoError :: CryptoError -> ProtocolClientError err

-- | IO Error
PCEIOError :: IOException -> ProtocolClientError err
type SMPClientError = ProtocolClientError ErrorType
data ProxyClientError

-- | protocol error response from proxy
ProxyProtocolError :: ErrorType -> ProxyClientError
[$sel:protocolErr:ProxyProtocolError] :: ProxyClientError -> ErrorType

-- | unexpexted response
ProxyUnexpectedResponse :: String -> ProxyClientError
[$sel:responseStr:ProxyProtocolError] :: ProxyClientError -> String

-- | error between proxy and server
ProxyResponseError :: ErrorType -> ProxyClientError
[$sel:responseErr:ProxyProtocolError] :: ProxyClientError -> ErrorType
data Response err msg
Response :: EntityId -> Either (ProtocolClientError err) msg -> Response err msg
[$sel:entityId:Response] :: Response err msg -> EntityId
[$sel:response:Response] :: Response err msg -> Either (ProtocolClientError err) msg
unexpectedResponse :: Show r => r -> ProtocolClientError err

-- | protocol client configuration.
data ProtocolClientConfig v
ProtocolClientConfig :: Natural -> (ServiceName, ATransport 'TClient) -> NetworkConfig -> Maybe [ALPN] -> Maybe ServiceCredentials -> VersionRange v -> Bool -> Bool -> Bool -> ProtocolClientConfig v

-- | size of TBQueue to use for server commands and responses
[$sel:qSize:ProtocolClientConfig] :: ProtocolClientConfig v -> Natural

-- | default server port if port is not specified in ProtocolServer
[$sel:defaultTransport:ProtocolClientConfig] :: ProtocolClientConfig v -> (ServiceName, ATransport 'TClient)

-- | network configuration
[$sel:networkConfig:ProtocolClientConfig] :: ProtocolClientConfig v -> NetworkConfig
[$sel:clientALPN:ProtocolClientConfig] :: ProtocolClientConfig v -> Maybe [ALPN]
[$sel:serviceCredentials:ProtocolClientConfig] :: ProtocolClientConfig v -> Maybe ServiceCredentials

-- | client-server protocol version range
[$sel:serverVRange:ProtocolClientConfig] :: ProtocolClientConfig v -> VersionRange v

-- | agree shared session secret (used in SMP proxy for additional
--   encryption layer)
[$sel:agreeSecret:ProtocolClientConfig] :: ProtocolClientConfig v -> Bool

-- | Whether connecting client is a proxy server. See comment in
--   ClientHandshake
[$sel:proxyServer:ProtocolClientConfig] :: ProtocolClientConfig v -> Bool

-- | send SNI to server, False for SMP
[$sel:useSNI:ProtocolClientConfig] :: ProtocolClientConfig v -> Bool

-- | network configuration for the client
data NetworkConfig
NetworkConfig :: Maybe SocksProxyWithAuth -> SocksMode -> HostMode -> Bool -> TransportSessionMode -> SMPProxyMode -> SMPProxyFallback -> SMPWebPortServers -> NetworkTimeout -> NetworkTimeout -> Int64 -> Int -> Maybe KeepAliveOpts -> Int64 -> Int -> Bool -> NetworkConfig

-- | use SOCKS5 proxy
[$sel:socksProxy:NetworkConfig] :: NetworkConfig -> Maybe SocksProxyWithAuth

-- | when to use SOCKS proxy
[$sel:socksMode:NetworkConfig] :: NetworkConfig -> SocksMode

-- | determines critera which host is chosen from the list
[$sel:hostMode:NetworkConfig] :: NetworkConfig -> HostMode

-- | if above criteria is not met, if the below setting is True return
--   error, otherwise use the first host
[$sel:requiredHostMode:NetworkConfig] :: NetworkConfig -> Bool

-- | transport sessions are created per user or per entity
[$sel:sessionMode:NetworkConfig] :: NetworkConfig -> TransportSessionMode

-- | SMP proxy mode
[$sel:smpProxyMode:NetworkConfig] :: NetworkConfig -> SMPProxyMode

-- | Fallback to direct connection when destination SMP relay does not
--   support SMP proxy protocol extensions
[$sel:smpProxyFallback:NetworkConfig] :: NetworkConfig -> SMPProxyFallback

-- | use web port 443 for SMP protocol
[$sel:smpWebPortServers:NetworkConfig] :: NetworkConfig -> SMPWebPortServers

-- | timeout for the initial client TCP/TLS connection (microseconds)
[$sel:tcpConnectTimeout:NetworkConfig] :: NetworkConfig -> NetworkTimeout

-- | timeout of protocol commands (microseconds)
[$sel:tcpTimeout:NetworkConfig] :: NetworkConfig -> NetworkTimeout

-- | additional timeout per kilobyte (1024 bytes) to be sent
[$sel:tcpTimeoutPerKb:NetworkConfig] :: NetworkConfig -> Int64

-- | break response timeouts into groups, so later responses get later
--   deadlines
[$sel:rcvConcurrency:NetworkConfig] :: NetworkConfig -> Int

-- | TCP keep-alive options, Nothing to skip enabling keep-alive
[$sel:tcpKeepAlive:NetworkConfig] :: NetworkConfig -> Maybe KeepAliveOpts

-- | period for SMP ping commands (microseconds, 0 to disable)
[$sel:smpPingInterval:NetworkConfig] :: NetworkConfig -> Int64

-- | the count of timeout errors after which SMP client terminates (and
--   will be reconnected), 0 to disable
[$sel:smpPingCount:NetworkConfig] :: NetworkConfig -> Int
[$sel:logTLSErrors:NetworkConfig] :: NetworkConfig -> Bool
data NetworkTimeout
NetworkTimeout :: Int -> Int -> NetworkTimeout
[$sel:backgroundTimeout:NetworkTimeout] :: NetworkTimeout -> Int
[$sel:interactiveTimeout:NetworkTimeout] :: NetworkTimeout -> Int
data NetworkRequestMode
NRMBackground :: NetworkRequestMode
NRMInteractive' :: Int -> NetworkRequestMode
[$sel:retryCount:NRMBackground] :: NetworkRequestMode -> Int
pattern NRMInteractive :: NetworkRequestMode
data TransportSessionMode
TSMUser :: TransportSessionMode
TSMSession :: TransportSessionMode
TSMServer :: TransportSessionMode
TSMEntity :: TransportSessionMode
data HostMode

-- | prefer (or require) onion hosts when connecting via SOCKS proxy
HMOnionViaSocks :: HostMode

-- | prefer (or require) onion hosts
HMOnion :: HostMode

-- | prefer (or require) public hosts
HMPublic :: HostMode
data SocksMode

-- | always use SOCKS proxy when enabled
SMAlways :: SocksMode

-- | use SOCKS proxy only for .onion hosts when no public host is available
--   This mode is used in SMP proxy and in notifications server to minimize
--   SOCKS proxy usage.
SMOnion :: SocksMode
data SMPProxyMode
SPMAlways :: SMPProxyMode
SPMUnknown :: SMPProxyMode
SPMUnprotected :: SMPProxyMode
SPMNever :: SMPProxyMode
data SMPProxyFallback
SPFAllow :: SMPProxyFallback
SPFAllowProtected :: SMPProxyFallback
SPFProhibit :: SMPProxyFallback
data SMPWebPortServers
SWPAll :: SMPWebPortServers
SWPPreset :: SMPWebPortServers
SWPOff :: SMPWebPortServers
netTimeoutInt :: NetworkTimeout -> NetworkRequestMode -> Int

-- | Default protocol client configuration.
defaultClientConfig :: Maybe [ALPN] -> Bool -> VersionRange v -> ProtocolClientConfig v
defaultSMPClientConfig :: ProtocolClientConfig SMPVersion
defaultNetworkConfig :: NetworkConfig
transportClientConfig :: NetworkConfig -> NetworkRequestMode -> TransportHost -> Bool -> Maybe [ALPN] -> TransportClientConfig
clientSocksCredentials :: ProtocolTypeI (ProtoType msg) => NetworkConfig -> UTCTime -> TransportSession msg -> Maybe SocksCredentials
chooseTransportHost :: NetworkConfig -> NonEmpty TransportHost -> Either (ProtocolClientError err) TransportHost
temporaryClientError :: ProtocolClientError err -> Bool
smpClientServiceError :: SMPClientError -> Bool
smpProxyError :: SMPClientError -> ErrorType
smpErrorClientNotice :: SMPClientError -> Maybe (Maybe ClientNotice)
textToHostMode :: Text -> Either String HostMode

-- | Type synonym for transmission from SPM servers. Batch response is
--   presented as a single <a>ServerTransmissionBatch</a> tuple.
type ServerTransmissionBatch v err msg = (TransportSession msg, Version v, SessionId, NonEmpty (EntityId, ServerTransmission err msg))
data ServerTransmission err msg
STEvent :: Either (ProtocolClientError err) msg -> ServerTransmission err msg
STResponse :: ProtoCommand msg -> Either (ProtocolClientError err) msg -> ServerTransmission err msg
STUnexpectedError :: ProtocolClientError err -> ServerTransmission err msg

-- | Type for client command data
type ClientCommand msg = (EntityId, Maybe APrivateAuthKey, ProtoCommand msg)
type PCTransmission err msg = (Either TransportError SentRawTransmission, Request err msg)
mkTransmission :: Protocol v err msg => ProtocolClient v err msg -> ClientCommand msg -> IO (PCTransmission err msg)
authTransmission :: Maybe (THandleAuth 'TClient) -> Bool -> Maybe APrivateAuthKey -> CbNonce -> ByteString -> Either TransportError (Maybe TAuthorizations)
smpClientStub :: TVar ChaChaDRG -> ByteString -> VersionSMP -> Maybe (THandleAuth 'TClient) -> IO SMPClient
data TBQueueInfo
TBQueueInfo :: Int -> Bool -> TBQueueInfo
[$sel:qLength:TBQueueInfo] :: TBQueueInfo -> Int
[$sel:qFull:TBQueueInfo] :: TBQueueInfo -> Bool
getTBQueueInfo :: TBQueue a -> STM TBQueueInfo
getProtocolClientQueuesInfo :: ProtocolClient v err msg -> IO (TBQueueInfo, TBQueueInfo)
nonBlockingWriteTBQueue :: TBQueue a -> a -> IO ()
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Client.TBQueueInfo
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Client.TBQueueInfo
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Client.ProxyClientError
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Client.ProxyClientError
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Client.NetworkConfig
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Client.NetworkConfig
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Client.NetworkTimeout
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Client.NetworkTimeout
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Client.SMPWebPortServers
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Client.SMPWebPortServers
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Client.SMPProxyFallback
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Client.SMPProxyFallback
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Client.SMPProxyMode
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Client.SMPProxyMode
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Client.TransportSessionMode
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Client.TransportSessionMode
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Client.SocksMode
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Client.SocksMode
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Client.HostMode
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Client.HostMode
instance GHC.Show.Show Simplex.Messaging.Client.HostMode
instance GHC.Classes.Eq Simplex.Messaging.Client.HostMode
instance GHC.Show.Show Simplex.Messaging.Client.SocksMode
instance GHC.Classes.Eq Simplex.Messaging.Client.SocksMode
instance GHC.Show.Show Simplex.Messaging.Client.NetworkTimeout
instance GHC.Classes.Eq Simplex.Messaging.Client.NetworkTimeout
instance GHC.Show.Show Simplex.Messaging.Client.TransportSessionMode
instance GHC.Classes.Eq Simplex.Messaging.Client.TransportSessionMode
instance GHC.Show.Show Simplex.Messaging.Client.SMPProxyMode
instance GHC.Classes.Eq Simplex.Messaging.Client.SMPProxyMode
instance GHC.Show.Show Simplex.Messaging.Client.SMPProxyFallback
instance GHC.Classes.Eq Simplex.Messaging.Client.SMPProxyFallback
instance GHC.Show.Show Simplex.Messaging.Client.SMPWebPortServers
instance GHC.Classes.Eq Simplex.Messaging.Client.SMPWebPortServers
instance GHC.Show.Show Simplex.Messaging.Client.NetworkConfig
instance GHC.Classes.Eq Simplex.Messaging.Client.NetworkConfig
instance (Data.Typeable.Internal.Typeable err, GHC.Show.Show err) => GHC.Exception.Type.Exception (Simplex.Messaging.Client.ProtocolClientError err)
instance GHC.Show.Show err => GHC.Show.Show (Simplex.Messaging.Client.ProtocolClientError err)
instance GHC.Classes.Eq err => GHC.Classes.Eq (Simplex.Messaging.Client.ProtocolClientError err)
instance GHC.Exception.Type.Exception Simplex.Messaging.Client.ProxyClientError
instance GHC.Show.Show Simplex.Messaging.Client.ProxyClientError
instance GHC.Classes.Eq Simplex.Messaging.Client.ProxyClientError
instance GHC.Show.Show Simplex.Messaging.Client.TBQueueInfo
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Client.ProxyClientError
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Client.SMPWebPortServers
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Client.SMPProxyFallback
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Client.SMPProxyMode
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Client.SocksMode

module Simplex.Messaging.Client.Agent
data SMPClientAgent p
SMPClientAgent :: SMPClientAgentConfig -> SParty p -> TVar Bool -> UTCTime -> TBQueue (ServerTransmissionBatch SMPVersion ErrorType BrokerMsg) -> TBQueue SMPClientAgentEvent -> TVar ChaChaDRG -> TMap SMPServer SMPClientVar -> TMap SessionId (OwnServer, SMPClient) -> TMap SMPServer (TVar (Maybe ((ServiceId, Int64), SessionId))) -> TMap SMPServer (TMap QueueId (SessionId, APrivateAuthKey)) -> TMap SMPServer (TVar (Maybe (ServiceId, Int64))) -> TMap SMPServer (TMap QueueId APrivateAuthKey) -> TMap SMPServer (SessionVar (Async ())) -> TVar Int -> SMPClientAgent p
[$sel:agentCfg:SMPClientAgent] :: SMPClientAgent p -> SMPClientAgentConfig
[$sel:agentParty:SMPClientAgent] :: SMPClientAgent p -> SParty p
[$sel:active:SMPClientAgent] :: SMPClientAgent p -> TVar Bool
[$sel:startedAt:SMPClientAgent] :: SMPClientAgent p -> UTCTime
[$sel:msgQ:SMPClientAgent] :: SMPClientAgent p -> TBQueue (ServerTransmissionBatch SMPVersion ErrorType BrokerMsg)
[$sel:agentQ:SMPClientAgent] :: SMPClientAgent p -> TBQueue SMPClientAgentEvent
[$sel:randomDrg:SMPClientAgent] :: SMPClientAgent p -> TVar ChaChaDRG
[$sel:smpClients:SMPClientAgent] :: SMPClientAgent p -> TMap SMPServer SMPClientVar
[$sel:smpSessions:SMPClientAgent] :: SMPClientAgent p -> TMap SessionId (OwnServer, SMPClient)
[$sel:activeServiceSubs:SMPClientAgent] :: SMPClientAgent p -> TMap SMPServer (TVar (Maybe ((ServiceId, Int64), SessionId)))
[$sel:activeQueueSubs:SMPClientAgent] :: SMPClientAgent p -> TMap SMPServer (TMap QueueId (SessionId, APrivateAuthKey))
[$sel:pendingServiceSubs:SMPClientAgent] :: SMPClientAgent p -> TMap SMPServer (TVar (Maybe (ServiceId, Int64)))
[$sel:pendingQueueSubs:SMPClientAgent] :: SMPClientAgent p -> TMap SMPServer (TMap QueueId APrivateAuthKey)
[$sel:smpSubWorkers:SMPClientAgent] :: SMPClientAgent p -> TMap SMPServer (SessionVar (Async ()))
[$sel:workerSeq:SMPClientAgent] :: SMPClientAgent p -> TVar Int
data SMPClientAgentConfig
SMPClientAgentConfig :: ProtocolClientConfig SMPVersion -> RetryInterval -> NominalDiffTime -> Natural -> Natural -> Int -> [ByteString] -> SMPClientAgentConfig
[$sel:smpCfg:SMPClientAgentConfig] :: SMPClientAgentConfig -> ProtocolClientConfig SMPVersion
[$sel:reconnectInterval:SMPClientAgentConfig] :: SMPClientAgentConfig -> RetryInterval
[$sel:persistErrorInterval:SMPClientAgentConfig] :: SMPClientAgentConfig -> NominalDiffTime
[$sel:msgQSize:SMPClientAgentConfig] :: SMPClientAgentConfig -> Natural
[$sel:agentQSize:SMPClientAgentConfig] :: SMPClientAgentConfig -> Natural
[$sel:agentSubsBatchSize:SMPClientAgentConfig] :: SMPClientAgentConfig -> Int
[$sel:ownServerDomains:SMPClientAgentConfig] :: SMPClientAgentConfig -> [ByteString]
data SMPClientAgentEvent
CAConnected :: SMPServer -> Maybe ServiceId -> SMPClientAgentEvent
CADisconnected :: SMPServer -> NonEmpty QueueId -> SMPClientAgentEvent
CASubscribed :: SMPServer -> Maybe ServiceId -> NonEmpty QueueId -> SMPClientAgentEvent
CASubError :: SMPServer -> NonEmpty (QueueId, SMPClientError) -> SMPClientAgentEvent
CAServiceDisconnected :: SMPServer -> (ServiceId, Int64) -> SMPClientAgentEvent
CAServiceSubscribed :: SMPServer -> (ServiceId, Int64) -> Int64 -> SMPClientAgentEvent
CAServiceSubError :: SMPServer -> (ServiceId, Int64) -> SMPClientError -> SMPClientAgentEvent
CAServiceUnavailable :: SMPServer -> (ServiceId, Int64) -> SMPClientAgentEvent
type OwnServer = Bool
defaultSMPClientAgentConfig :: SMPClientAgentConfig
newSMPClientAgent :: SParty p -> SMPClientAgentConfig -> TVar ChaChaDRG -> IO (SMPClientAgent p)
getSMPServerClient'' :: SMPClientAgent p -> SMPServer -> ExceptT SMPClientError IO (OwnServer, SMPClient)
getConnectedSMPServerClient :: SMPClientAgent p -> SMPServer -> IO (Maybe (Either SMPClientError (OwnServer, SMPClient)))
closeSMPClientAgent :: SMPClientAgent p -> IO ()
lookupSMPServerClient :: SMPClientAgent p -> SessionId -> IO (Maybe (OwnServer, SMPClient))
isOwnServer :: SMPClientAgent p -> SMPServer -> OwnServer
subscribeServiceNtfs :: SMPClientAgent 'NotifierService -> SMPServer -> (ServiceId, Int64) -> IO ()
subscribeQueuesNtfs :: SMPClientAgent 'NotifierService -> SMPServer -> NonEmpty (NotifierId, NtfPrivateAuthKey) -> IO ()
activeClientSession' :: SMPClientAgent p -> SessionId -> SMPServer -> STM Bool
removeActiveSub :: SMPClientAgent p -> SMPServer -> QueueId -> STM ()
removeActiveSubs :: SMPClientAgent p -> SMPServer -> [QueueId] -> STM ()
removePendingSub :: SMPClientAgent p -> SMPServer -> QueueId -> STM ()
removePendingSubs :: SMPClientAgent p -> SMPServer -> [QueueId] -> STM ()

module Simplex.FileTransfer.Client.Presets
defaultXFTPServers :: NonEmpty XFTPServerWithAuth

module Simplex.Messaging.Notifications.Transport
data NTFVersion
type VersionRangeNTF = VersionRange NTFVersion
pattern VersionNTF :: Word16 -> VersionNTF
type THandleNTF c p = THandle NTFVersion c p
invalidReasonNTFVersion :: VersionNTF
supportedClientNTFVRange :: VersionRangeNTF
supportedServerNTFVRange :: VersionRangeNTF
alpnSupportedNTFHandshakes :: [ALPN]

-- | Notifcations server transport handshake.
ntfServerHandshake :: forall c. Transport c => APrivateSignKey -> c 'TServer -> KeyPairX25519 -> KeyHash -> VersionRangeNTF -> ExceptT TransportError IO (THandleNTF c 'TServer)

-- | Notifcations server client transport handshake.
ntfClientHandshake :: forall c. Transport c => c 'TClient -> KeyHash -> VersionRangeNTF -> Bool -> Maybe (ServiceCredentials, KeyPairEd25519) -> ExceptT TransportError IO (THandleNTF c 'TClient)
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Notifications.Transport.NtfClientHandshake
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Notifications.Transport.NtfServerHandshake
instance Simplex.Messaging.Version.VersionScope Simplex.Messaging.Notifications.Transport.NTFVersion

module Simplex.Messaging.Crypto.Ratchet
data Ratchet a
Ratchet :: RatchetVersions -> Str -> PrivateKey a -> Maybe RatchetKEM -> PQSupport -> PQEncryption -> PQEncryption -> PQEncryption -> RatchetKey -> Maybe (SndRatchet a) -> Maybe RcvRatchet -> Word32 -> Word32 -> Word32 -> HeaderKey -> HeaderKey -> Ratchet a
[$sel:rcVersion:Ratchet] :: Ratchet a -> RatchetVersions
[$sel:rcAD:Ratchet] :: Ratchet a -> Str
[$sel:rcDHRs:Ratchet] :: Ratchet a -> PrivateKey a
[$sel:rcKEM:Ratchet] :: Ratchet a -> Maybe RatchetKEM
[$sel:rcSupportKEM:Ratchet] :: Ratchet a -> PQSupport
[$sel:rcEnableKEM:Ratchet] :: Ratchet a -> PQEncryption
[$sel:rcSndKEM:Ratchet] :: Ratchet a -> PQEncryption
[$sel:rcRcvKEM:Ratchet] :: Ratchet a -> PQEncryption
[$sel:rcRK:Ratchet] :: Ratchet a -> RatchetKey
[$sel:rcSnd:Ratchet] :: Ratchet a -> Maybe (SndRatchet a)
[$sel:rcRcv:Ratchet] :: Ratchet a -> Maybe RcvRatchet
[$sel:rcNs:Ratchet] :: Ratchet a -> Word32
[$sel:rcNr:Ratchet] :: Ratchet a -> Word32
[$sel:rcPN:Ratchet] :: Ratchet a -> Word32
[$sel:rcNHKs:Ratchet] :: Ratchet a -> HeaderKey
[$sel:rcNHKr:Ratchet] :: Ratchet a -> HeaderKey
type RatchetX448 = Ratchet 'X448
data MsgEncryptKey a
MsgEncryptKey :: VersionE2E -> MessageKey -> ByteString -> ByteString -> MsgEncryptKey a
[$sel:msgRcVersion:MsgEncryptKey] :: MsgEncryptKey a -> VersionE2E
[$sel:msgKey:MsgEncryptKey] :: MsgEncryptKey a -> MessageKey
[$sel:msgRcAD:MsgEncryptKey] :: MsgEncryptKey a -> ByteString
[$sel:msgEncHeader:MsgEncryptKey] :: MsgEncryptKey a -> ByteString
type MsgEncryptKeyX448 = MsgEncryptKey 'X448
data SkippedMsgDiff
SMDNoChange :: SkippedMsgDiff
SMDRemove :: HeaderKey -> Word32 -> SkippedMsgDiff
SMDAdd :: SkippedMsgKeys -> SkippedMsgDiff
type SkippedMsgKeys = Map HeaderKey SkippedHdrMsgKeys
data InitialKeys
IKUsePQ :: InitialKeys
IKLinkPQ :: PQSupport -> InitialKeys
pattern IKPQOn :: InitialKeys
pattern IKPQOff :: InitialKeys
newtype PQEncryption
PQEncryption :: Bool -> PQEncryption
[$sel:enablePQ:PQEncryption] :: PQEncryption -> Bool
pattern PQEncOn :: PQEncryption
pattern PQEncOff :: PQEncryption
newtype PQSupport
PQSupport :: Bool -> PQSupport
[$sel:supportPQ:PQSupport] :: PQSupport -> Bool
pattern PQSupportOn :: PQSupport
pattern PQSupportOff :: PQSupport
data AUseKEM
AUseKEM :: SRatchetKEMState s -> UseKEM s -> AUseKEM
data RatchetKEMState
RKSProposed :: RatchetKEMState
RKSAccepted :: RatchetKEMState
data SRatchetKEMState (s :: RatchetKEMState)
[SRKSProposed] :: SRatchetKEMState 'RKSProposed
[SRKSAccepted] :: SRatchetKEMState 'RKSAccepted
type RcvPrivRKEMParams = PrivRKEMParams 'RKSProposed
data APrivRKEMParams
APRKP :: SRatchetKEMState s -> PrivRKEMParams s -> APrivRKEMParams
type RcvE2ERatchetParamsUri a = E2ERatchetParamsUri 'RKSProposed a
type RcvE2ERatchetParams a = E2ERatchetParams 'RKSProposed a
type SndE2ERatchetParams a = AE2ERatchetParams a
data AE2ERatchetParams (a :: Algorithm)
AE2ERatchetParams :: SRatchetKEMState s -> E2ERatchetParams s a -> AE2ERatchetParams (a :: Algorithm)
data E2ERatchetParamsUri (s :: RatchetKEMState) (a :: Algorithm)
E2ERatchetParamsUri :: VersionRangeE2E -> PublicKey a -> PublicKey a -> Maybe (RKEMParams s) -> E2ERatchetParamsUri (s :: RatchetKEMState) (a :: Algorithm)
data E2ERatchetParams (s :: RatchetKEMState) (a :: Algorithm)
E2ERatchetParams :: VersionE2E -> PublicKey a -> PublicKey a -> Maybe (RKEMParams s) -> E2ERatchetParams (s :: RatchetKEMState) (a :: Algorithm)
type VersionE2E = Version E2EVersion
type VersionRangeE2E = VersionRange E2EVersion
pattern VersionE2E :: Word16 -> VersionE2E
data RatchetVersions
RatchetVersions :: VersionE2E -> VersionE2E -> RatchetVersions
[$sel:current:RatchetVersions] :: RatchetVersions -> VersionE2E
[$sel:maxSupported:RatchetVersions] :: RatchetVersions -> VersionE2E
kdfX3DHE2EEncryptVersion :: VersionE2E
pqRatchetE2EEncryptVersion :: VersionE2E
currentE2EEncryptVersion :: VersionE2E
supportedE2EEncryptVRange :: VersionRangeE2E
generateRcvE2EParams :: (AlgorithmI a, DhAlgorithm a) => TVar ChaChaDRG -> VersionE2E -> PQSupport -> IO (PrivateKey a, PrivateKey a, Maybe (PrivRKEMParams 'RKSProposed), E2ERatchetParams 'RKSProposed a)
generateSndE2EParams :: forall a. (AlgorithmI a, DhAlgorithm a) => TVar ChaChaDRG -> VersionE2E -> Maybe AUseKEM -> IO (PrivateKey a, PrivateKey a, Maybe APrivRKEMParams, AE2ERatchetParams a)
mkRcvE2ERatchetParams :: VersionE2E -> (PrivateKey a, PrivateKey a, Maybe RcvPrivRKEMParams) -> RcvE2ERatchetParams a
initialPQEncryption :: Bool -> InitialKeys -> PQSupport
connPQEncryption :: InitialKeys -> PQSupport
joinContactInitialKeys :: Bool -> PQSupport -> InitialKeys
replyKEM_ :: VersionE2E -> Maybe (RKEMParams 'RKSProposed) -> PQSupport -> Maybe AUseKEM
pqSupportToEnc :: PQSupport -> PQEncryption
pqEncToSupport :: PQEncryption -> PQSupport
pqSupportAnd :: PQSupport -> PQSupport -> PQSupport
pqEnableSupport :: VersionE2E -> PQSupport -> PQEncryption -> PQSupport
pqX3dhSnd :: DhAlgorithm a => PrivateKey a -> PrivateKey a -> Maybe APrivRKEMParams -> E2ERatchetParams 'RKSProposed a -> Either CryptoError (RatchetInitParams, Maybe KEMKeyPair)
pqX3dhRcv :: forall s a. (RatchetKEMStateI s, DhAlgorithm a) => PrivateKey a -> PrivateKey a -> Maybe (PrivRKEMParams 'RKSProposed) -> E2ERatchetParams s a -> ExceptT CryptoError IO (RatchetInitParams, Maybe KEMKeyPair)

-- | Sending ratchet initialization
--   
--   Please note that sPKey is not stored, and its public part together
--   with random salt is sent to the recipient. <tt>
--   RatchetInitAlicePQ2HE(state, SK, bob_dh_public_key, shared_hka,
--   shared_nhkb, bob_pq_kem_encapsulation_key) // below added for
--   post-quantum KEM state.PQRs = GENERATE_PQKEM() state.PQRr =
--   bob_pq_kem_encapsulation_key state.PQRss = random // shared secret for
--   KEM state.PQRct = PQKEM-ENC(state.PQRr, state.PQRss) // encapsulated
--   additional shared secret // above added for KEM </tt>
initSndRatchet :: forall a. (AlgorithmI a, DhAlgorithm a) => RatchetVersions -> PublicKey a -> PrivateKey a -> (RatchetInitParams, Maybe KEMKeyPair) -> Ratchet a

-- | Receiving ratchet initialization, equivalent to RatchetInitBobPQ2HE in
--   double ratchet spec
--   
--   def RatchetInitBobPQ2HE(state, SK, bob_dh_key_pair, shared_hka,
--   shared_nhkb, bob_pq_kem_key_pair)
--   
--   Please note that the public part of rcDHRs was sent to the sender as
--   part of the connection request and random salt was received from the
--   sender.
initRcvRatchet :: forall a. (AlgorithmI a, DhAlgorithm a) => RatchetVersions -> PrivateKey a -> (RatchetInitParams, Maybe KEMKeyPair) -> PQSupport -> Ratchet a
rcCheckCanPad :: Int -> ByteString -> ExceptT CryptoError IO ()
rcEncryptHeader :: AlgorithmI a => Ratchet a -> Maybe PQEncryption -> VersionE2E -> ExceptT CryptoError IO (MsgEncryptKey a, Ratchet a)
rcEncryptMsg :: AlgorithmI a => MsgEncryptKey a -> Int -> ByteString -> ExceptT CryptoError IO ByteString
rcDecrypt :: forall a. (AlgorithmI a, DhAlgorithm a) => TVar ChaChaDRG -> Ratchet a -> SkippedMsgKeys -> ByteString -> ExceptT CryptoError IO (DecryptResult a)
data MsgHeader a
MsgHeader :: VersionE2E -> PublicKey a -> Maybe ARKEMParams -> Word32 -> Word32 -> MsgHeader a

-- | max supported ratchet version
[$sel:msgMaxVersion:MsgHeader] :: MsgHeader a -> VersionE2E
[$sel:msgDHRs:MsgHeader] :: MsgHeader a -> PublicKey a
[$sel:msgKEM:MsgHeader] :: MsgHeader a -> Maybe ARKEMParams
[$sel:msgPN:MsgHeader] :: MsgHeader a -> Word32
[$sel:msgNs:MsgHeader] :: MsgHeader a -> Word32
data RatchetInitParams
RatchetInitParams :: Str -> RatchetKey -> HeaderKey -> HeaderKey -> Maybe RatchetKEMAccepted -> RatchetInitParams
[$sel:assocData:RatchetInitParams] :: RatchetInitParams -> Str
[$sel:ratchetKey:RatchetInitParams] :: RatchetInitParams -> RatchetKey
[$sel:sndHK:RatchetInitParams] :: RatchetInitParams -> HeaderKey
[$sel:rcvNextHK:RatchetInitParams] :: RatchetInitParams -> HeaderKey
[$sel:kemAccepted:RatchetInitParams] :: RatchetInitParams -> Maybe RatchetKEMAccepted
data UseKEM (s :: RatchetKEMState)
[ProposeKEM] :: UseKEM 'RKSProposed
[AcceptKEM] :: KEMPublicKey -> UseKEM 'RKSAccepted
data RKEMParams (s :: RatchetKEMState)
[RKParamsProposed] :: KEMPublicKey -> RKEMParams 'RKSProposed
[RKParamsAccepted] :: KEMCiphertext -> KEMPublicKey -> RKEMParams 'RKSAccepted
data ARKEMParams
ARKP :: SRatchetKEMState s -> RKEMParams s -> ARKEMParams
data SndRatchet a
SndRatchet :: PublicKey a -> RatchetKey -> HeaderKey -> SndRatchet a
[$sel:rcDHRr:SndRatchet] :: SndRatchet a -> PublicKey a
[$sel:rcCKs:SndRatchet] :: SndRatchet a -> RatchetKey
[$sel:rcHKs:SndRatchet] :: SndRatchet a -> HeaderKey
data RcvRatchet
RcvRatchet :: RatchetKey -> HeaderKey -> RcvRatchet
[$sel:rcCKr:RcvRatchet] :: RcvRatchet -> RatchetKey
[$sel:rcHKr:RcvRatchet] :: RcvRatchet -> HeaderKey
data RatchetKEM
RatchetKEM :: KEMKeyPair -> Maybe RatchetKEMAccepted -> RatchetKEM
[$sel:rcPQRs:RatchetKEM] :: RatchetKEM -> KEMKeyPair
[$sel:rcKEMs:RatchetKEM] :: RatchetKEM -> Maybe RatchetKEMAccepted
data RatchetKEMAccepted
RatchetKEMAccepted :: KEMPublicKey -> KEMSharedKey -> KEMCiphertext -> RatchetKEMAccepted
[$sel:rcPQRr:RatchetKEMAccepted] :: RatchetKEMAccepted -> KEMPublicKey
[$sel:rcPQRss:RatchetKEMAccepted] :: RatchetKEMAccepted -> KEMSharedKey
[$sel:rcPQRct:RatchetKEMAccepted] :: RatchetKEMAccepted -> KEMCiphertext

-- | Input key material for double ratchet HKDF functions
newtype RatchetKey
RatchetKey :: ByteString -> RatchetKey
fullHeaderLen :: VersionE2E -> PQSupport -> Int

-- | this function is only used in tests to apply changes in skipped
--   messages, in the agent the diff is persisted, and the whole state is
--   loaded for the next message.
applySMDiff :: SkippedMsgKeys -> SkippedMsgDiff -> SkippedMsgKeys
encodeMsgHeader :: AlgorithmI a => VersionE2E -> MsgHeader a -> ByteString
msgHeaderP :: AlgorithmI a => VersionE2E -> Parser (MsgHeader a)
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Crypto.Ratchet.RatchetKEM
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Crypto.Ratchet.RatchetKEM
instance Simplex.Messaging.Crypto.AlgorithmI a => Data.Aeson.Types.ToJSON.ToJSON (Simplex.Messaging.Crypto.Ratchet.SndRatchet a)
instance Simplex.Messaging.Crypto.AlgorithmI a => Data.Aeson.Types.FromJSON.FromJSON (Simplex.Messaging.Crypto.Ratchet.SndRatchet a)
instance Simplex.Messaging.Crypto.AlgorithmI a => Data.Aeson.Types.ToJSON.ToJSON (Simplex.Messaging.Crypto.Ratchet.Ratchet a)
instance Simplex.Messaging.Crypto.AlgorithmI a => Data.Aeson.Types.FromJSON.FromJSON (Simplex.Messaging.Crypto.Ratchet.Ratchet a)
instance Simplex.Messaging.Crypto.AlgorithmI a => Database.SQLite.Simple.ToField.ToField (Simplex.Messaging.Crypto.Ratchet.Ratchet a)
instance (Simplex.Messaging.Crypto.AlgorithmI a, Data.Typeable.Internal.Typeable a) => Database.SQLite.Simple.FromField.FromField (Simplex.Messaging.Crypto.Ratchet.Ratchet a)
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Crypto.Ratchet.PQEncryption
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Crypto.Ratchet.PQEncryption
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Crypto.Ratchet.PQSupport
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Crypto.Ratchet.PQSupport
instance forall k (a :: k). Simplex.Messaging.Encoding.Encoding (Simplex.Messaging.Crypto.Ratchet.MsgEncryptKey a)
instance Simplex.Messaging.Crypto.AlgorithmI a => Database.SQLite.Simple.ToField.ToField (Simplex.Messaging.Crypto.Ratchet.MsgEncryptKey a)
instance (Simplex.Messaging.Crypto.AlgorithmI a, Data.Typeable.Internal.Typeable a) => Database.SQLite.Simple.FromField.FromField (Simplex.Messaging.Crypto.Ratchet.MsgEncryptKey a)
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Crypto.Ratchet.RatchetKEMAccepted
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Crypto.Ratchet.RatchetKEMAccepted
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Crypto.Ratchet.RcvRatchet
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Crypto.Ratchet.RcvRatchet
instance GHC.Show.Show (Simplex.Messaging.Crypto.Ratchet.E2ERatchetParams s a)
instance GHC.Show.Show (Simplex.Messaging.Crypto.Ratchet.E2ERatchetParamsUri s a)
instance GHC.Classes.Eq (Simplex.Messaging.Crypto.Ratchet.E2ERatchetParamsUri s a)
instance GHC.Show.Show Simplex.Messaging.Crypto.Ratchet.RatchetVersions
instance GHC.Classes.Eq Simplex.Messaging.Crypto.Ratchet.RatchetVersions
instance GHC.Show.Show Simplex.Messaging.Crypto.Ratchet.RatchetKEMAccepted
instance GHC.Show.Show Simplex.Messaging.Crypto.Ratchet.RatchetKEM
instance GHC.Show.Show Simplex.Messaging.Crypto.Ratchet.MessageKey
instance GHC.Show.Show Simplex.Messaging.Crypto.Ratchet.RatchetKey
instance GHC.Show.Show Simplex.Messaging.Crypto.Ratchet.RcvRatchet
instance GHC.Show.Show (Simplex.Messaging.Crypto.Ratchet.SndRatchet a)
instance GHC.Show.Show Simplex.Messaging.Crypto.Ratchet.RatchetInitParams
instance GHC.Show.Show (Simplex.Messaging.Crypto.Ratchet.MsgHeader a)
instance GHC.Show.Show Simplex.Messaging.Crypto.Ratchet.PQEncryption
instance GHC.Classes.Eq Simplex.Messaging.Crypto.Ratchet.PQEncryption
instance GHC.Show.Show Simplex.Messaging.Crypto.Ratchet.PQSupport
instance GHC.Classes.Eq Simplex.Messaging.Crypto.Ratchet.PQSupport
instance GHC.Show.Show (Simplex.Messaging.Crypto.Ratchet.Ratchet a)
instance GHC.Show.Show Simplex.Messaging.Crypto.Ratchet.InitialKeys
instance GHC.Classes.Eq Simplex.Messaging.Crypto.Ratchet.InitialKeys
instance forall k (a :: k). GHC.Show.Show (Simplex.Messaging.Crypto.Ratchet.MsgEncryptKey a)
instance GHC.Show.Show Simplex.Messaging.Crypto.Ratchet.RatchetStep
instance GHC.Classes.Eq Simplex.Messaging.Crypto.Ratchet.RatchetStep
instance GHC.Show.Show (Simplex.Messaging.Crypto.Ratchet.SRatchetKEMState s)
instance GHC.Classes.Eq (Simplex.Messaging.Crypto.Ratchet.RKEMParams s)
instance GHC.Show.Show (Simplex.Messaging.Crypto.Ratchet.RKEMParams s)
instance GHC.Show.Show Simplex.Messaging.Crypto.Ratchet.ARKEMParams
instance GHC.Show.Show (Simplex.Messaging.Crypto.Ratchet.AE2ERatchetParams a)
instance GHC.Show.Show Simplex.Messaging.Crypto.Ratchet.AnyE2ERatchetParams
instance GHC.Show.Show (Simplex.Messaging.Crypto.Ratchet.AE2ERatchetParamsUri a)
instance GHC.Show.Show Simplex.Messaging.Crypto.Ratchet.AnyE2ERatchetParamsUri
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Crypto.Ratchet.InitialKeys
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Crypto.Ratchet.PQSupport
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Crypto.Ratchet.PQSupport
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Crypto.Ratchet.PQSupport
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Crypto.Ratchet.PQEncryption
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Crypto.Ratchet.PQEncryption
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Crypto.Ratchet.PQEncryption
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Crypto.Ratchet.EncMessageHeader
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Crypto.Ratchet.RatchetKey
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Crypto.Ratchet.RatchetKey
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Crypto.Ratchet.MessageKey
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Crypto.Ratchet.MessageKey
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Crypto.Ratchet.MessageKey
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Crypto.Ratchet.RatchetVersions
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Crypto.Ratchet.RatchetVersions
instance Simplex.Messaging.Crypto.Ratchet.RatchetKEMStateI s => Simplex.Messaging.Encoding.Encoding (Simplex.Messaging.Crypto.Ratchet.PrivRKEMParams s)
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Crypto.Ratchet.APrivRKEMParams
instance Simplex.Messaging.Crypto.Ratchet.RatchetKEMStateI s => Database.SQLite.Simple.ToField.ToField (Simplex.Messaging.Crypto.Ratchet.PrivRKEMParams s)
instance (Data.Typeable.Internal.Typeable s, Simplex.Messaging.Crypto.Ratchet.RatchetKEMStateI s) => Database.SQLite.Simple.FromField.FromField (Simplex.Messaging.Crypto.Ratchet.PrivRKEMParams s)
instance Simplex.Messaging.Crypto.AlgorithmI a => Simplex.Messaging.Encoding.String.StrEncoding (Simplex.Messaging.Crypto.Ratchet.AE2ERatchetParamsUri a)
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Crypto.Ratchet.AnyE2ERatchetParamsUri
instance Simplex.Messaging.Crypto.AlgorithmI a => Simplex.Messaging.Encoding.Encoding (Simplex.Messaging.Crypto.Ratchet.AE2ERatchetParamsUri a)
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Crypto.Ratchet.AnyE2ERatchetParamsUri
instance Simplex.Messaging.Version.VersionI Simplex.Messaging.Crypto.Ratchet.E2EVersion (Simplex.Messaging.Crypto.Ratchet.E2ERatchetParams s a)
instance Simplex.Messaging.Version.VersionRangeI Simplex.Messaging.Crypto.Ratchet.E2EVersion (Simplex.Messaging.Crypto.Ratchet.E2ERatchetParamsUri s a)
instance (Simplex.Messaging.Crypto.Ratchet.RatchetKEMStateI s, Simplex.Messaging.Crypto.AlgorithmI a) => Simplex.Messaging.Encoding.String.StrEncoding (Simplex.Messaging.Crypto.Ratchet.E2ERatchetParamsUri s a)
instance (Simplex.Messaging.Crypto.Ratchet.RatchetKEMStateI s, Simplex.Messaging.Crypto.AlgorithmI a) => Simplex.Messaging.Encoding.Encoding (Simplex.Messaging.Crypto.Ratchet.E2ERatchetParamsUri s a)
instance Simplex.Messaging.Crypto.AlgorithmI a => Simplex.Messaging.Encoding.Encoding (Simplex.Messaging.Crypto.Ratchet.AE2ERatchetParams a)
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Crypto.Ratchet.AnyE2ERatchetParams
instance (Simplex.Messaging.Crypto.Ratchet.RatchetKEMStateI s, Simplex.Messaging.Crypto.AlgorithmI a) => Simplex.Messaging.Encoding.Encoding (Simplex.Messaging.Crypto.Ratchet.E2ERatchetParams s a)
instance Simplex.Messaging.Crypto.Ratchet.RatchetKEMStateI s => Simplex.Messaging.Encoding.Encoding (Simplex.Messaging.Crypto.Ratchet.RKEMParams s)
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Crypto.Ratchet.ARKEMParams
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Crypto.Ratchet.ARKEMParams
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Crypto.Ratchet.ARKEMParams
instance Simplex.Messaging.Crypto.Ratchet.RatchetKEMStateI 'Simplex.Messaging.Crypto.Ratchet.RKSProposed
instance Simplex.Messaging.Crypto.Ratchet.RatchetKEMStateI 'Simplex.Messaging.Crypto.Ratchet.RKSAccepted
instance Data.Type.Equality.TestEquality Simplex.Messaging.Crypto.Ratchet.SRatchetKEMState
instance Simplex.Messaging.Version.VersionScope Simplex.Messaging.Crypto.Ratchet.E2EVersion

module Simplex.FileTransfer.Transport
supportedFileServerVRange :: VersionRangeXFTP
authCmdsXFTPVersion :: VersionXFTP
blockedFilesXFTPVersion :: VersionXFTP
xftpClientHandshakeStub :: c 'TClient -> Maybe KeyPairX25519 -> KeyHash -> VersionRangeXFTP -> Bool -> Maybe (ServiceCredentials, KeyPairEd25519) -> ExceptT TransportError IO (THandle XFTPVersion c 'TClient)
alpnSupportedXFTPhandshakes :: [ALPN]
xftpALPNv1 :: ALPN
data XFTPClientHandshake
XFTPClientHandshake :: VersionXFTP -> KeyHash -> XFTPClientHandshake

-- | agreed XFTP server protocol version
[$sel:xftpVersion:XFTPClientHandshake] :: XFTPClientHandshake -> VersionXFTP

-- | server identity - CA certificate fingerprint
[$sel:keyHash:XFTPClientHandshake] :: XFTPClientHandshake -> KeyHash
data XFTPServerHandshake
XFTPServerHandshake :: VersionRangeXFTP -> SessionId -> CertChainPubKey -> Maybe ASignature -> XFTPServerHandshake
[$sel:xftpVersionRange:XFTPServerHandshake] :: XFTPServerHandshake -> VersionRangeXFTP
[$sel:sessionId:XFTPServerHandshake] :: XFTPServerHandshake -> SessionId

-- | pub key to agree shared secrets for command authorization and entity
--   ID encryption.
[$sel:authPubKey:XFTPServerHandshake] :: XFTPServerHandshake -> CertChainPubKey

-- | signed identity challenge from XFTPClientHello
[$sel:webIdentityProof:XFTPServerHandshake] :: XFTPServerHandshake -> Maybe ASignature
data XFTPClientHello
XFTPClientHello :: Maybe ByteString -> XFTPClientHello

-- | a random string sent by the client to the server to prove that server
--   has identity certificate
[$sel:webChallenge:XFTPClientHello] :: XFTPClientHello -> Maybe ByteString
type THandleXFTP c p = THandle XFTPVersion c p
type THandleParamsXFTP p = THandleParams XFTPVersion p
type VersionXFTP = Version XFTPVersion
type VersionRangeXFTP = VersionRange XFTPVersion
data XFTPVersion
pattern VersionXFTP :: Word16 -> VersionXFTP
data XFTPErrorType

-- | incorrect block format, encoding or signature size
BLOCK :: XFTPErrorType

-- | incorrect SMP session ID (TLS Finished message / tls-unique binding
--   RFC5929)
SESSION :: XFTPErrorType

-- | incorrect handshake command
HANDSHAKE :: XFTPErrorType

-- | SMP command is unknown or has invalid syntax
CMD :: CommandError -> XFTPErrorType
[$sel:cmdErr:BLOCK] :: XFTPErrorType -> CommandError

-- | command authorization error - bad signature or non-existing SMP queue
AUTH :: XFTPErrorType

-- | command with the entity that was blocked
BLOCKED :: BlockingInfo -> XFTPErrorType
[$sel:blockInfo:BLOCK] :: XFTPErrorType -> BlockingInfo

-- | incorrent file size
SIZE :: XFTPErrorType

-- | storage quota exceeded
QUOTA :: XFTPErrorType

-- | incorrent file digest
DIGEST :: XFTPErrorType

-- | file encryption/decryption failed
CRYPTO :: XFTPErrorType

-- | no expected file body in request/response or no file on the server
NO_FILE :: XFTPErrorType

-- | unexpected file body
HAS_FILE :: XFTPErrorType

-- | file IO error
FILE_IO :: XFTPErrorType

-- | file sending or receiving timeout
TIMEOUT :: XFTPErrorType

-- | internal server error
INTERNAL :: XFTPErrorType

-- | used internally, never returned by the server (to be removed)
DUPLICATE_ :: XFTPErrorType
data XFTPRcvChunkSpec
XFTPRcvChunkSpec :: FilePath -> Word32 -> ByteString -> XFTPRcvChunkSpec
[$sel:filePath:XFTPRcvChunkSpec] :: XFTPRcvChunkSpec -> FilePath
[$sel:chunkSize:XFTPRcvChunkSpec] :: XFTPRcvChunkSpec -> Word32
[$sel:chunkDigest:XFTPRcvChunkSpec] :: XFTPRcvChunkSpec -> ByteString
data ReceiveFileError
RFESize :: ReceiveFileError
RFECrypto :: ReceiveFileError
receiveFile :: (Int -> IO ByteString) -> XFTPRcvChunkSpec -> ExceptT XFTPErrorType IO ()
sendEncFile :: Handle -> (Builder -> IO ()) -> SbState -> Word32 -> IO ()
receiveEncFile :: (Int -> IO ByteString) -> SbState -> XFTPRcvChunkSpec -> ExceptT XFTPErrorType IO ()
receiveSbFile :: (Int -> IO ByteString) -> Handle -> SbState -> Word32 -> IO (Either ReceiveFileError ())
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.FileTransfer.Transport.XFTPErrorType
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.FileTransfer.Transport.XFTPErrorType
instance GHC.Show.Show Simplex.FileTransfer.Transport.XFTPRcvChunkSpec
instance GHC.Show.Show Simplex.FileTransfer.Transport.XFTPErrorType
instance GHC.Classes.Eq Simplex.FileTransfer.Transport.XFTPErrorType
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.FileTransfer.Transport.XFTPErrorType
instance Simplex.Messaging.Encoding.Encoding Simplex.FileTransfer.Transport.XFTPErrorType
instance Simplex.Messaging.Encoding.Encoding Simplex.FileTransfer.Transport.XFTPClientHandshake
instance Simplex.Messaging.Encoding.Encoding Simplex.FileTransfer.Transport.XFTPServerHandshake
instance Simplex.Messaging.Encoding.Encoding Simplex.FileTransfer.Transport.XFTPClientHello
instance Simplex.Messaging.Version.VersionScope Simplex.FileTransfer.Transport.XFTPVersion

module Simplex.FileTransfer.Protocol

-- | File protocol clients
data FileParty
FRecipient :: FileParty
FSender :: FileParty
data SFileParty :: FileParty -> Type
[SFRecipient] :: SFileParty FRecipient
[SFSender] :: SFileParty FSender
data AFileParty
AFP :: SFileParty p -> AFileParty
class FilePartyI (p :: FileParty)
sFileParty :: FilePartyI p => SFileParty p
data FileCommand (p :: FileParty)
[FNEW] :: FileInfo -> NonEmpty RcvPublicAuthKey -> Maybe BasicAuth -> FileCommand FSender
[FADD] :: NonEmpty RcvPublicAuthKey -> FileCommand FSender
[FPUT] :: FileCommand FSender
[FDEL] :: FileCommand FSender
[FGET] :: RcvPublicDhKey -> FileCommand FRecipient
[FACK] :: FileCommand FRecipient
[PING] :: FileCommand FRecipient
data FileCmd
FileCmd :: SFileParty p -> FileCommand p -> FileCmd
data FileInfo
FileInfo :: SndPublicAuthKey -> Word32 -> ByteString -> FileInfo
[sndKey] :: FileInfo -> SndPublicAuthKey
[size] :: FileInfo -> Word32
[digest] :: FileInfo -> ByteString
type XFTPFileId = EntityId
data FileResponse
FRSndIds :: SenderId -> NonEmpty RecipientId -> FileResponse
FRRcvIds :: NonEmpty RecipientId -> FileResponse
FRFile :: RcvPublicDhKey -> CbNonce -> FileResponse
FROk :: FileResponse
FRErr :: XFTPErrorType -> FileResponse
FRPong :: FileResponse
xftpBlockSize :: Int
toFileParty :: SFileParty p -> FileParty
aFileParty :: FileParty -> AFileParty
checkParty :: forall t p p'. (FilePartyI p, FilePartyI p') => t p' -> Either String (t p)
xftpEncodeAuthTransmission :: ProtocolEncoding XFTPVersion XFTPErrorType c => THandleParams XFTPVersion 'TClient -> APrivateAuthKey -> Transmission c -> Either TransportError ByteString
xftpEncodeTransmission :: ProtocolEncoding XFTPVersion XFTPErrorType c => THandleParams XFTPVersion p -> Transmission c -> Either TransportError ByteString
xftpDecodeTServer :: THandleParams XFTPVersion 'TServer -> ByteString -> Either XFTPErrorType (SignedTransmissionOrError XFTPErrorType FileCmd)
xftpDecodeTClient :: THandleParams XFTPVersion 'TClient -> ByteString -> Either XFTPErrorType (Transmission (Either XFTPErrorType FileResponse))
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.FileTransfer.Protocol.FileParty
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.FileTransfer.Protocol.FileParty
instance GHC.Show.Show Simplex.FileTransfer.Protocol.FileParty
instance GHC.Classes.Eq Simplex.FileTransfer.Protocol.FileParty
instance GHC.Show.Show Simplex.FileTransfer.Protocol.FileInfo
instance GHC.Show.Show Simplex.FileTransfer.Protocol.FileResponseTag
instance GHC.Show.Show Simplex.FileTransfer.Protocol.FileResponse
instance GHC.Classes.Eq (Simplex.FileTransfer.Protocol.SFileParty p)
instance GHC.Show.Show (Simplex.FileTransfer.Protocol.SFileParty p)
instance GHC.Show.Show (Simplex.FileTransfer.Protocol.FileCommandTag p)
instance GHC.Show.Show (Simplex.FileTransfer.Protocol.FileCommand p)
instance GHC.Show.Show Simplex.FileTransfer.Protocol.FileCmd
instance Simplex.Messaging.Protocol.Protocol Simplex.FileTransfer.Transport.XFTPVersion Simplex.FileTransfer.Transport.XFTPErrorType Simplex.FileTransfer.Protocol.FileResponse
instance Simplex.FileTransfer.Protocol.FilePartyI p => Simplex.Messaging.Protocol.ProtocolEncoding Simplex.FileTransfer.Transport.XFTPVersion Simplex.FileTransfer.Transport.XFTPErrorType (Simplex.FileTransfer.Protocol.FileCommand p)
instance Simplex.Messaging.Protocol.ProtocolEncoding Simplex.FileTransfer.Transport.XFTPVersion Simplex.FileTransfer.Transport.XFTPErrorType Simplex.FileTransfer.Protocol.FileCmd
instance Simplex.Messaging.Protocol.ProtocolEncoding Simplex.FileTransfer.Transport.XFTPVersion Simplex.FileTransfer.Transport.XFTPErrorType Simplex.FileTransfer.Protocol.FileResponse
instance Simplex.Messaging.Encoding.Encoding Simplex.FileTransfer.Protocol.FileResponseTag
instance Simplex.Messaging.Protocol.ProtocolMsgTag Simplex.FileTransfer.Protocol.FileResponseTag
instance Simplex.Messaging.Encoding.Encoding Simplex.FileTransfer.Protocol.FileInfo
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.FileTransfer.Protocol.FileInfo
instance Simplex.Messaging.Encoding.Encoding Simplex.FileTransfer.Protocol.FileCmdTag
instance Simplex.Messaging.Protocol.ProtocolMsgTag Simplex.FileTransfer.Protocol.FileCmdTag
instance Simplex.FileTransfer.Protocol.FilePartyI p => Simplex.Messaging.Protocol.ProtocolMsgTag (Simplex.FileTransfer.Protocol.FileCommandTag p)
instance Simplex.FileTransfer.Protocol.FilePartyI p => Simplex.Messaging.Encoding.Encoding (Simplex.FileTransfer.Protocol.FileCommandTag p)
instance Simplex.FileTransfer.Protocol.FilePartyI 'Simplex.FileTransfer.Protocol.FRecipient
instance Simplex.FileTransfer.Protocol.FilePartyI 'Simplex.FileTransfer.Protocol.FSender
instance Data.Type.Equality.TestEquality Simplex.FileTransfer.Protocol.SFileParty

module Simplex.FileTransfer.Server.Store
data FSType
FSMemory :: FSType
FSPostgres :: FSType
data SFSType :: FSType -> Type
[SFSMemory] :: SFSType 'FSMemory
[SFSPostgres] :: SFSType 'FSPostgres
class FileStoreClass s where {
    type FileStoreConfig s;
}
newFileStore :: FileStoreClass s => FileStoreConfig s -> IO s
closeFileStore :: FileStoreClass s => s -> IO ()
addFile :: FileStoreClass s => s -> SenderId -> FileInfo -> RoundedFileTime -> ServerEntityStatus -> IO (Either XFTPErrorType ())
setFilePath :: FileStoreClass s => s -> SenderId -> FilePath -> IO (Either XFTPErrorType ())
addRecipient :: FileStoreClass s => s -> SenderId -> FileRecipient -> IO (Either XFTPErrorType ())
deleteFile :: FileStoreClass s => s -> SenderId -> IO (Either XFTPErrorType ())
deleteFiles :: FileStoreClass s => s -> [SenderId] -> IO ()
blockFile :: FileStoreClass s => s -> SenderId -> BlockingInfo -> Bool -> IO (Either XFTPErrorType ())
deleteRecipient :: FileStoreClass s => s -> RecipientId -> FileRec -> IO ()
getFile :: FileStoreClass s => s -> SFileParty p -> XFTPFileId -> IO (Either XFTPErrorType (FileRec, APublicAuthKey))
ackFile :: FileStoreClass s => s -> RecipientId -> IO (Either XFTPErrorType ())
expiredFiles :: FileStoreClass s => s -> Int64 -> Int -> IO [(SenderId, Maybe FilePath, Word32)]
getUsedStorage :: FileStoreClass s => s -> IO Int64
getFileCount :: FileStoreClass s => s -> IO Int
data FileRec
FileRec :: SenderId -> FileInfo -> TVar (Maybe FilePath) -> TVar (Set RecipientId) -> RoundedFileTime -> TVar ServerEntityStatus -> FileRec
[senderId] :: FileRec -> SenderId
[fileInfo] :: FileRec -> FileInfo
[filePath] :: FileRec -> TVar (Maybe FilePath)
[recipientIds] :: FileRec -> TVar (Set RecipientId)
[createdAt] :: FileRec -> RoundedFileTime
[fileStatus] :: FileRec -> TVar ServerEntityStatus
data FileRecipient
FileRecipient :: RecipientId -> APublicAuthKey -> FileRecipient
data STMFileStore
STMFileStore :: TMap SenderId FileRec -> TMap RecipientId (SenderId, RcvPublicAuthKey) -> TVar (Maybe (StoreLog 'WriteMode)) -> STMFileStore
[files] :: STMFileStore -> TMap SenderId FileRec
[recipients] :: STMFileStore -> TMap RecipientId (SenderId, RcvPublicAuthKey)
[stmStoreLog] :: STMFileStore -> TVar (Maybe (StoreLog 'WriteMode))
type RoundedFileTime = RoundedSystemTime 3600
fileTimePrecision :: Int64
instance GHC.Show.Show Simplex.FileTransfer.Server.Store.FileRecipient
instance Simplex.FileTransfer.Server.Store.FileStoreClass Simplex.FileTransfer.Server.Store.STMFileStore
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.FileTransfer.Server.Store.FileRecipient

module Simplex.FileTransfer.Server.StoreLog

-- | opaque container for file handle with a type-safe IOMode constructors
--   are not exported, openWriteStoreLog and openReadStoreLog should be
--   used instead
data StoreLog (a :: IOMode)
data FileStoreLogRecord
AddFile :: SenderId -> FileInfo -> RoundedFileTime -> ServerEntityStatus -> FileStoreLogRecord
PutFile :: SenderId -> FilePath -> FileStoreLogRecord
AddRecipients :: SenderId -> NonEmpty FileRecipient -> FileStoreLogRecord
DeleteFile :: SenderId -> FileStoreLogRecord
BlockFile :: SenderId -> BlockingInfo -> FileStoreLogRecord
AckFile :: RecipientId -> FileStoreLogRecord
closeStoreLog :: StoreLog a -> IO ()
readWriteFileStore :: FilePath -> STMFileStore -> IO (StoreLog 'WriteMode)
writeFileStore :: StoreLog 'WriteMode -> STMFileStore -> IO ()
logAddFile :: StoreLog 'WriteMode -> SenderId -> FileInfo -> RoundedFileTime -> ServerEntityStatus -> IO ()
logPutFile :: StoreLog 'WriteMode -> SenderId -> FilePath -> IO ()
logAddRecipients :: StoreLog 'WriteMode -> SenderId -> NonEmpty FileRecipient -> IO ()
logDeleteFile :: StoreLog 'WriteMode -> SenderId -> IO ()
logBlockFile :: StoreLog 'WriteMode -> SenderId -> BlockingInfo -> IO ()
logAckFile :: StoreLog 'WriteMode -> RecipientId -> IO ()
instance GHC.Show.Show Simplex.FileTransfer.Server.StoreLog.FileStoreLogRecord
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.FileTransfer.Server.StoreLog.FileStoreLogRecord

module Simplex.FileTransfer.Server.Control
data ControlProtocol
CPAuth :: BasicAuth -> ControlProtocol
CPStatsRTS :: ControlProtocol
CPDelete :: XFTPFileId -> ControlProtocol
CPBlock :: XFTPFileId -> BlockingInfo -> ControlProtocol
CPHelp :: ControlProtocol
CPQuit :: ControlProtocol
CPSkip :: ControlProtocol
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.FileTransfer.Server.Control.ControlProtocol

module Simplex.FileTransfer.Description
data FileDescription (p :: FileParty)
FileDescription :: SFileParty p -> FileSize Int64 -> FileDigest -> SbKey -> CbNonce -> FileSize Word32 -> [FileChunk] -> Maybe RedirectFileInfo -> FileDescription (p :: FileParty)
[$sel:party:FileDescription] :: FileDescription (p :: FileParty) -> SFileParty p
[$sel:size:FileDescription] :: FileDescription (p :: FileParty) -> FileSize Int64
[$sel:digest:FileDescription] :: FileDescription (p :: FileParty) -> FileDigest
[$sel:key:FileDescription] :: FileDescription (p :: FileParty) -> SbKey
[$sel:nonce:FileDescription] :: FileDescription (p :: FileParty) -> CbNonce
[$sel:chunkSize:FileDescription] :: FileDescription (p :: FileParty) -> FileSize Word32
[$sel:chunks:FileDescription] :: FileDescription (p :: FileParty) -> [FileChunk]
[$sel:redirect:FileDescription] :: FileDescription (p :: FileParty) -> Maybe RedirectFileInfo
data RedirectFileInfo
RedirectFileInfo :: FileSize Int64 -> FileDigest -> RedirectFileInfo
[$sel:size:RedirectFileInfo] :: RedirectFileInfo -> FileSize Int64
[$sel:digest:RedirectFileInfo] :: RedirectFileInfo -> FileDigest
data AFileDescription
AFD :: FileDescription p -> AFileDescription
data ValidFileDescription p
pattern ValidFileDescription :: FileDescription p -> ValidFileDescription p
data AValidFileDescription
AVFD :: ValidFileDescription p -> AValidFileDescription
newtype FileDigest
FileDigest :: ByteString -> FileDigest
[$sel:unFileDigest:FileDigest] :: FileDigest -> ByteString
data FileChunk
FileChunk :: Int -> FileSize Word32 -> FileDigest -> [FileChunkReplica] -> FileChunk
[$sel:chunkNo:FileChunk] :: FileChunk -> Int
[$sel:chunkSize:FileChunk] :: FileChunk -> FileSize Word32
[$sel:digest:FileChunk] :: FileChunk -> FileDigest
[$sel:replicas:FileChunk] :: FileChunk -> [FileChunkReplica]
data FileChunkReplica
FileChunkReplica :: XFTPServer -> ChunkReplicaId -> APrivateAuthKey -> FileChunkReplica
[$sel:server:FileChunkReplica] :: FileChunkReplica -> XFTPServer
[$sel:replicaId:FileChunkReplica] :: FileChunkReplica -> ChunkReplicaId
[$sel:replicaKey:FileChunkReplica] :: FileChunkReplica -> APrivateAuthKey
data FileServerReplica
FileServerReplica :: Int -> XFTPServer -> ChunkReplicaId -> APrivateAuthKey -> Maybe FileDigest -> Maybe (FileSize Word32) -> FileServerReplica
[$sel:chunkNo:FileServerReplica] :: FileServerReplica -> Int
[$sel:server:FileServerReplica] :: FileServerReplica -> XFTPServer
[$sel:replicaId:FileServerReplica] :: FileServerReplica -> ChunkReplicaId
[$sel:replicaKey:FileServerReplica] :: FileServerReplica -> APrivateAuthKey
[$sel:digest:FileServerReplica] :: FileServerReplica -> Maybe FileDigest
[$sel:chunkSize:FileServerReplica] :: FileServerReplica -> Maybe (FileSize Word32)
newtype FileSize a
FileSize :: a -> FileSize a
[$sel:unFileSize:FileSize] :: FileSize a -> a
newtype ChunkReplicaId
ChunkReplicaId :: XFTPFileId -> ChunkReplicaId
[$sel:unChunkReplicaId:ChunkReplicaId] :: ChunkReplicaId -> XFTPFileId
data YAMLFileDescription
YAMLFileDescription :: FileParty -> String -> FileDigest -> SbKey -> CbNonce -> String -> [YAMLServerReplicas] -> Maybe RedirectFileInfo -> YAMLFileDescription
[$sel:party:YAMLFileDescription] :: YAMLFileDescription -> FileParty
[$sel:size:YAMLFileDescription] :: YAMLFileDescription -> String
[$sel:digest:YAMLFileDescription] :: YAMLFileDescription -> FileDigest
[$sel:key:YAMLFileDescription] :: YAMLFileDescription -> SbKey
[$sel:nonce:YAMLFileDescription] :: YAMLFileDescription -> CbNonce
[$sel:chunkSize:YAMLFileDescription] :: YAMLFileDescription -> String
[$sel:replicas:YAMLFileDescription] :: YAMLFileDescription -> [YAMLServerReplicas]
[$sel:redirect:YAMLFileDescription] :: YAMLFileDescription -> Maybe RedirectFileInfo
data YAMLServerReplicas
YAMLServerReplicas :: XFTPServer -> [String] -> YAMLServerReplicas
[$sel:server:YAMLServerReplicas] :: YAMLServerReplicas -> XFTPServer
[$sel:chunks:YAMLServerReplicas] :: YAMLServerReplicas -> [String]
validateFileDescription :: FileDescription p -> Either String (ValidFileDescription p)
groupReplicasByServer :: FileSize Word32 -> [FileChunk] -> [NonEmpty FileServerReplica]
fdSeparator :: IsString s => s
kb :: Integral a => a -> a
mb :: Integral a => a -> a
gb :: Integral a => a -> a
data FileDescriptionURI
FileDescriptionURI :: ServiceScheme -> ValidFileDescription 'FRecipient -> Maybe FileClientData -> FileDescriptionURI
[$sel:scheme:FileDescriptionURI] :: FileDescriptionURI -> ServiceScheme
[$sel:description:FileDescriptionURI] :: FileDescriptionURI -> ValidFileDescription 'FRecipient
[$sel:clientData:FileDescriptionURI] :: FileDescriptionURI -> Maybe FileClientData
type FileClientData = Text
fileDescriptionURI :: ValidFileDescription 'FRecipient -> FileDescriptionURI

-- | URL length in QR code before jumping up to a next size.
qrSizeLimit :: Int

-- | Soft limit for XFTP clients. Should be checked and reported to user.
maxFileSize :: Int64
maxFileSizeStr :: String

-- | Hard internal limit for XFTP agent after which it refuses to prepare
--   chunks.
maxFileSizeHard :: Int64
fileSizeLen :: Int64
instance GHC.Show.Show Simplex.FileTransfer.Description.FileDescriptionURI
instance GHC.Classes.Eq Simplex.FileTransfer.Description.FileDescriptionURI
instance Database.SQLite.Simple.FromField.FromField a => Database.SQLite.Simple.FromField.FromField (Simplex.FileTransfer.Description.FileSize a)
instance Database.SQLite.Simple.ToField.ToField a => Database.SQLite.Simple.ToField.ToField (Simplex.FileTransfer.Description.FileSize a)
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.FileTransfer.Description.FileDescriptionURI
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.FileTransfer.Description.YAMLFileDescription
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.FileTransfer.Description.YAMLFileDescription
instance Simplex.FileTransfer.Protocol.FilePartyI p => Simplex.Messaging.Encoding.String.StrEncoding (Simplex.FileTransfer.Description.ValidFileDescription p)
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.FileTransfer.Description.AValidFileDescription
instance Simplex.FileTransfer.Protocol.FilePartyI p => Simplex.Messaging.Encoding.String.StrEncoding (Simplex.FileTransfer.Description.FileDescription p)
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.FileTransfer.Description.AFileDescription
instance (GHC.Real.Integral a, GHC.Show.Show a) => Simplex.Messaging.Encoding.String.StrEncoding (Simplex.FileTransfer.Description.FileSize a)
instance (GHC.Real.Integral a, GHC.Show.Show a) => Data.String.IsString (Simplex.FileTransfer.Description.FileSize a)
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.FileTransfer.Description.RedirectFileInfo
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.FileTransfer.Description.RedirectFileInfo
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.FileTransfer.Description.YAMLServerReplicas
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.FileTransfer.Description.YAMLServerReplicas
instance Database.SQLite.Simple.FromField.FromField Simplex.FileTransfer.Description.FileDigest
instance GHC.Show.Show Simplex.FileTransfer.Description.FileDigest
instance GHC.Classes.Eq Simplex.FileTransfer.Description.FileDigest
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.FileTransfer.Description.ChunkReplicaId
instance GHC.Show.Show Simplex.FileTransfer.Description.ChunkReplicaId
instance GHC.Classes.Eq Simplex.FileTransfer.Description.ChunkReplicaId
instance GHC.Show.Show Simplex.FileTransfer.Description.FileChunkReplica
instance GHC.Classes.Eq Simplex.FileTransfer.Description.FileChunkReplica
instance GHC.Show.Show Simplex.FileTransfer.Description.YAMLServerReplicas
instance GHC.Classes.Eq Simplex.FileTransfer.Description.YAMLServerReplicas
instance GHC.Show.Show a => GHC.Show.Show (Simplex.FileTransfer.Description.FileSize a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Simplex.FileTransfer.Description.FileSize a)
instance GHC.Show.Show Simplex.FileTransfer.Description.FileServerReplica
instance GHC.Show.Show Simplex.FileTransfer.Description.FileChunk
instance GHC.Classes.Eq Simplex.FileTransfer.Description.FileChunk
instance GHC.Show.Show Simplex.FileTransfer.Description.RedirectFileInfo
instance GHC.Classes.Eq Simplex.FileTransfer.Description.RedirectFileInfo
instance GHC.Show.Show Simplex.FileTransfer.Description.YAMLFileDescription
instance GHC.Classes.Eq Simplex.FileTransfer.Description.YAMLFileDescription
instance GHC.Show.Show (Simplex.FileTransfer.Description.FileDescription p)
instance GHC.Classes.Eq (Simplex.FileTransfer.Description.FileDescription p)
instance GHC.Show.Show (Simplex.FileTransfer.Description.ValidFileDescription p)
instance GHC.Classes.Eq (Simplex.FileTransfer.Description.ValidFileDescription p)
instance Data.Aeson.Types.FromJSON.FromJSON a => Data.Aeson.Types.FromJSON.FromJSON (Simplex.FileTransfer.Description.FileSize a)
instance Data.Aeson.Types.ToJSON.ToJSON a => Data.Aeson.Types.ToJSON.ToJSON (Simplex.FileTransfer.Description.FileSize a)
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.FileTransfer.Description.ChunkReplicaId
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.FileTransfer.Description.ChunkReplicaId
instance Database.SQLite.Simple.ToField.ToField Simplex.FileTransfer.Description.FileDigest
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.FileTransfer.Description.FileDigest
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.FileTransfer.Description.FileDigest
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.FileTransfer.Description.FileDigest

module Simplex.FileTransfer.Client
data XFTPClient
XFTPClient :: HTTP2Client -> TransportSession FileResponse -> THandleParams XFTPVersion 'TClient -> XFTPClientConfig -> XFTPClient
[$sel:http2Client:XFTPClient] :: XFTPClient -> HTTP2Client
[$sel:transportSession:XFTPClient] :: XFTPClient -> TransportSession FileResponse
[$sel:thParams:XFTPClient] :: XFTPClient -> THandleParams XFTPVersion 'TClient
[$sel:config:XFTPClient] :: XFTPClient -> XFTPClientConfig
data XFTPClientConfig
XFTPClientConfig :: NetworkConfig -> VersionRangeXFTP -> Maybe [ALPN] -> XFTPClientConfig
[$sel:xftpNetworkConfig:XFTPClientConfig] :: XFTPClientConfig -> NetworkConfig
[$sel:serverVRange:XFTPClientConfig] :: XFTPClientConfig -> VersionRangeXFTP
[$sel:clientALPN:XFTPClientConfig] :: XFTPClientConfig -> Maybe [ALPN]
data XFTPChunkSpec
XFTPChunkSpec :: FilePath -> Int64 -> Word32 -> XFTPChunkSpec
[$sel:filePath:XFTPChunkSpec] :: XFTPChunkSpec -> FilePath
[$sel:chunkOffset:XFTPChunkSpec] :: XFTPChunkSpec -> Int64
[$sel:chunkSize:XFTPChunkSpec] :: XFTPChunkSpec -> Word32
type XFTPClientError = ProtocolClientError XFTPErrorType
defaultXFTPClientConfig :: XFTPClientConfig
getXFTPClient :: TransportSession FileResponse -> XFTPClientConfig -> [HostName] -> UTCTime -> (XFTPClient -> IO ()) -> IO (Either XFTPClientError XFTPClient)
closeXFTPClient :: XFTPClient -> IO ()
xftpClientServer :: XFTPClient -> String
xftpTransportHost :: XFTPClient -> TransportHost
createXFTPChunk :: XFTPClient -> APrivateAuthKey -> FileInfo -> NonEmpty APublicAuthKey -> Maybe BasicAuth -> ExceptT XFTPClientError IO (SenderId, NonEmpty RecipientId)
addXFTPRecipients :: XFTPClient -> APrivateAuthKey -> XFTPFileId -> NonEmpty APublicAuthKey -> ExceptT XFTPClientError IO (NonEmpty RecipientId)
uploadXFTPChunk :: XFTPClient -> APrivateAuthKey -> XFTPFileId -> XFTPChunkSpec -> ExceptT XFTPClientError IO ()
downloadXFTPChunk :: TVar ChaChaDRG -> XFTPClient -> APrivateAuthKey -> XFTPFileId -> XFTPRcvChunkSpec -> ExceptT XFTPClientError IO ()
deleteXFTPChunk :: XFTPClient -> APrivateAuthKey -> SenderId -> ExceptT XFTPClientError IO ()
ackXFTPChunk :: XFTPClient -> APrivateAuthKey -> RecipientId -> ExceptT XFTPClientError IO ()
pingXFTP :: XFTPClient -> ExceptT XFTPClientError IO ()
singleChunkSize :: Int64 -> Maybe Word32
prepareChunkSizes :: Int64 -> [Word32]
prepareChunkSpecs :: FilePath -> [Word32] -> [XFTPChunkSpec]
getChunkDigest :: XFTPChunkSpec -> IO ByteString
instance GHC.Show.Show Simplex.FileTransfer.Client.XFTPChunkSpec
instance GHC.Classes.Eq Simplex.FileTransfer.Client.XFTPChunkSpec

module Simplex.FileTransfer.Types
type RcvFileId = ByteString
type SndFileId = ByteString
data FileHeader
FileHeader :: Text -> Maybe Text -> FileHeader
[$sel:fileName:FileHeader] :: FileHeader -> Text
[$sel:fileExtra:FileHeader] :: FileHeader -> Maybe Text
type DBRcvFileId = Int64
data RcvFile
RcvFile :: DBRcvFileId -> RcvFileId -> Int64 -> FileSize Int64 -> FileDigest -> SbKey -> CbNonce -> FileSize Word32 -> Maybe RcvFileRedirect -> [RcvFileChunk] -> FilePath -> Maybe FilePath -> CryptoFile -> RcvFileStatus -> Bool -> RcvFile
[$sel:rcvFileId:RcvFile] :: RcvFile -> DBRcvFileId
[$sel:rcvFileEntityId:RcvFile] :: RcvFile -> RcvFileId
[$sel:userId:RcvFile] :: RcvFile -> Int64
[$sel:size:RcvFile] :: RcvFile -> FileSize Int64
[$sel:digest:RcvFile] :: RcvFile -> FileDigest
[$sel:key:RcvFile] :: RcvFile -> SbKey
[$sel:nonce:RcvFile] :: RcvFile -> CbNonce
[$sel:chunkSize:RcvFile] :: RcvFile -> FileSize Word32
[$sel:redirect:RcvFile] :: RcvFile -> Maybe RcvFileRedirect
[$sel:chunks:RcvFile] :: RcvFile -> [RcvFileChunk]
[$sel:prefixPath:RcvFile] :: RcvFile -> FilePath
[$sel:tmpPath:RcvFile] :: RcvFile -> Maybe FilePath
[$sel:saveFile:RcvFile] :: RcvFile -> CryptoFile
[$sel:status:RcvFile] :: RcvFile -> RcvFileStatus
[$sel:deleted:RcvFile] :: RcvFile -> Bool
data RcvFileStatus
RFSReceiving :: RcvFileStatus
RFSReceived :: RcvFileStatus
RFSDecrypting :: RcvFileStatus
RFSComplete :: RcvFileStatus
RFSError :: RcvFileStatus
data RcvFileChunk
RcvFileChunk :: DBRcvFileId -> RcvFileId -> Int64 -> Int64 -> Int -> FileSize Word32 -> FileDigest -> [RcvFileChunkReplica] -> FilePath -> Maybe FilePath -> RcvFileChunk
[$sel:rcvFileId:RcvFileChunk] :: RcvFileChunk -> DBRcvFileId
[$sel:rcvFileEntityId:RcvFileChunk] :: RcvFileChunk -> RcvFileId
[$sel:userId:RcvFileChunk] :: RcvFileChunk -> Int64
[$sel:rcvChunkId:RcvFileChunk] :: RcvFileChunk -> Int64
[$sel:chunkNo:RcvFileChunk] :: RcvFileChunk -> Int
[$sel:chunkSize:RcvFileChunk] :: RcvFileChunk -> FileSize Word32
[$sel:digest:RcvFileChunk] :: RcvFileChunk -> FileDigest
[$sel:replicas:RcvFileChunk] :: RcvFileChunk -> [RcvFileChunkReplica]
[$sel:fileTmpPath:RcvFileChunk] :: RcvFileChunk -> FilePath
[$sel:chunkTmpPath:RcvFileChunk] :: RcvFileChunk -> Maybe FilePath
data RcvFileChunkReplica
RcvFileChunkReplica :: Int64 -> XFTPServer -> ChunkReplicaId -> APrivateAuthKey -> Bool -> Maybe Int64 -> Int -> RcvFileChunkReplica
[$sel:rcvChunkReplicaId:RcvFileChunkReplica] :: RcvFileChunkReplica -> Int64
[$sel:server:RcvFileChunkReplica] :: RcvFileChunkReplica -> XFTPServer
[$sel:replicaId:RcvFileChunkReplica] :: RcvFileChunkReplica -> ChunkReplicaId
[$sel:replicaKey:RcvFileChunkReplica] :: RcvFileChunkReplica -> APrivateAuthKey
[$sel:received:RcvFileChunkReplica] :: RcvFileChunkReplica -> Bool
[$sel:delay:RcvFileChunkReplica] :: RcvFileChunkReplica -> Maybe Int64
[$sel:retries:RcvFileChunkReplica] :: RcvFileChunkReplica -> Int
data RcvFileRedirect
RcvFileRedirect :: DBRcvFileId -> RcvFileId -> RedirectFileInfo -> RcvFileRedirect
[$sel:redirectDbId:RcvFileRedirect] :: RcvFileRedirect -> DBRcvFileId
[$sel:redirectEntityId:RcvFileRedirect] :: RcvFileRedirect -> RcvFileId
[$sel:redirectFileInfo:RcvFileRedirect] :: RcvFileRedirect -> RedirectFileInfo
type DBSndFileId = Int64
data SndFile
SndFile :: DBSndFileId -> SndFileId -> Int64 -> Int -> Maybe FileDigest -> SbKey -> CbNonce -> [SndFileChunk] -> CryptoFile -> Maybe FilePath -> SndFileStatus -> Bool -> Maybe RedirectFileInfo -> SndFile
[$sel:sndFileId:SndFile] :: SndFile -> DBSndFileId
[$sel:sndFileEntityId:SndFile] :: SndFile -> SndFileId
[$sel:userId:SndFile] :: SndFile -> Int64
[$sel:numRecipients:SndFile] :: SndFile -> Int
[$sel:digest:SndFile] :: SndFile -> Maybe FileDigest
[$sel:key:SndFile] :: SndFile -> SbKey
[$sel:nonce:SndFile] :: SndFile -> CbNonce
[$sel:chunks:SndFile] :: SndFile -> [SndFileChunk]
[$sel:srcFile:SndFile] :: SndFile -> CryptoFile
[$sel:prefixPath:SndFile] :: SndFile -> Maybe FilePath
[$sel:status:SndFile] :: SndFile -> SndFileStatus
[$sel:deleted:SndFile] :: SndFile -> Bool
[$sel:redirect:SndFile] :: SndFile -> Maybe RedirectFileInfo
data SndFileStatus
SFSNew :: SndFileStatus
SFSEncrypting :: SndFileStatus
SFSEncrypted :: SndFileStatus
SFSUploading :: SndFileStatus
SFSComplete :: SndFileStatus
SFSError :: SndFileStatus
data SndFileChunk
SndFileChunk :: DBSndFileId -> SndFileId -> Int64 -> Int -> Int64 -> Int -> XFTPChunkSpec -> FilePath -> FileDigest -> [SndFileChunkReplica] -> SndFileChunk
[$sel:sndFileId:SndFileChunk] :: SndFileChunk -> DBSndFileId
[$sel:sndFileEntityId:SndFileChunk] :: SndFileChunk -> SndFileId
[$sel:userId:SndFileChunk] :: SndFileChunk -> Int64
[$sel:numRecipients:SndFileChunk] :: SndFileChunk -> Int
[$sel:sndChunkId:SndFileChunk] :: SndFileChunk -> Int64
[$sel:chunkNo:SndFileChunk] :: SndFileChunk -> Int
[$sel:chunkSpec:SndFileChunk] :: SndFileChunk -> XFTPChunkSpec
[$sel:filePrefixPath:SndFileChunk] :: SndFileChunk -> FilePath
[$sel:digest:SndFileChunk] :: SndFileChunk -> FileDigest
[$sel:replicas:SndFileChunk] :: SndFileChunk -> [SndFileChunkReplica]
data NewSndChunkReplica
NewSndChunkReplica :: XFTPServer -> ChunkReplicaId -> APrivateAuthKey -> [(ChunkReplicaId, APrivateAuthKey)] -> NewSndChunkReplica
[$sel:server:NewSndChunkReplica] :: NewSndChunkReplica -> XFTPServer
[$sel:replicaId:NewSndChunkReplica] :: NewSndChunkReplica -> ChunkReplicaId
[$sel:replicaKey:NewSndChunkReplica] :: NewSndChunkReplica -> APrivateAuthKey
[$sel:rcvIdsKeys:NewSndChunkReplica] :: NewSndChunkReplica -> [(ChunkReplicaId, APrivateAuthKey)]
data SndFileChunkReplica
SndFileChunkReplica :: Int64 -> XFTPServer -> ChunkReplicaId -> APrivateAuthKey -> [(ChunkReplicaId, APrivateAuthKey)] -> SndFileReplicaStatus -> Maybe Int64 -> Int -> SndFileChunkReplica
[$sel:sndChunkReplicaId:SndFileChunkReplica] :: SndFileChunkReplica -> Int64
[$sel:server:SndFileChunkReplica] :: SndFileChunkReplica -> XFTPServer
[$sel:replicaId:SndFileChunkReplica] :: SndFileChunkReplica -> ChunkReplicaId
[$sel:replicaKey:SndFileChunkReplica] :: SndFileChunkReplica -> APrivateAuthKey
[$sel:rcvIdsKeys:SndFileChunkReplica] :: SndFileChunkReplica -> [(ChunkReplicaId, APrivateAuthKey)]
[$sel:replicaStatus:SndFileChunkReplica] :: SndFileChunkReplica -> SndFileReplicaStatus
[$sel:delay:SndFileChunkReplica] :: SndFileChunkReplica -> Maybe Int64
[$sel:retries:SndFileChunkReplica] :: SndFileChunkReplica -> Int
data SndFileReplicaStatus
SFRSCreated :: SndFileReplicaStatus
SFRSUploaded :: SndFileReplicaStatus
data DeletedSndChunkReplica
DeletedSndChunkReplica :: Int64 -> Int64 -> XFTPServer -> ChunkReplicaId -> APrivateAuthKey -> FileDigest -> Maybe Int64 -> Int -> DeletedSndChunkReplica
[$sel:deletedSndChunkReplicaId:DeletedSndChunkReplica] :: DeletedSndChunkReplica -> Int64
[$sel:userId:DeletedSndChunkReplica] :: DeletedSndChunkReplica -> Int64
[$sel:server:DeletedSndChunkReplica] :: DeletedSndChunkReplica -> XFTPServer
[$sel:replicaId:DeletedSndChunkReplica] :: DeletedSndChunkReplica -> ChunkReplicaId
[$sel:replicaKey:DeletedSndChunkReplica] :: DeletedSndChunkReplica -> APrivateAuthKey
[$sel:chunkDigest:DeletedSndChunkReplica] :: DeletedSndChunkReplica -> FileDigest
[$sel:delay:DeletedSndChunkReplica] :: DeletedSndChunkReplica -> Maybe Int64
[$sel:retries:DeletedSndChunkReplica] :: DeletedSndChunkReplica -> Int
data SentRecipientReplica
SentRecipientReplica :: Int -> XFTPServer -> Int -> ChunkReplicaId -> APrivateAuthKey -> FileDigest -> FileSize Word32 -> SentRecipientReplica
[$sel:chunkNo:SentRecipientReplica] :: SentRecipientReplica -> Int
[$sel:server:SentRecipientReplica] :: SentRecipientReplica -> XFTPServer
[$sel:rcvNo:SentRecipientReplica] :: SentRecipientReplica -> Int
[$sel:replicaId:SentRecipientReplica] :: SentRecipientReplica -> ChunkReplicaId
[$sel:replicaKey:SentRecipientReplica] :: SentRecipientReplica -> APrivateAuthKey
[$sel:digest:SentRecipientReplica] :: SentRecipientReplica -> FileDigest
[$sel:chunkSize:SentRecipientReplica] :: SentRecipientReplica -> FileSize Word32
data FileErrorType

-- | cannot proceed with download from not approved relays without proxy
NOT_APPROVED :: FileErrorType

-- | max file size exceeded
SIZE :: FileErrorType

-- | bad redirect data
REDIRECT :: String -> FileErrorType
[$sel:redirectError:NOT_APPROVED] :: FileErrorType -> String

-- | file crypto error
FILE_IO :: String -> FileErrorType
[$sel:fileIOError:NOT_APPROVED] :: FileErrorType -> String

-- | file not found or was deleted
NO_FILE :: FileErrorType
authTagSize :: Int64
sndFileEncPath :: FilePath -> FilePath
sndChunkSize :: SndFileChunk -> Word32
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.FileTransfer.Types.FileErrorType
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.FileTransfer.Types.FileErrorType
instance GHC.Show.Show Simplex.FileTransfer.Types.FileHeader
instance GHC.Classes.Eq Simplex.FileTransfer.Types.FileHeader
instance GHC.Show.Show Simplex.FileTransfer.Types.RcvFileStatus
instance GHC.Classes.Eq Simplex.FileTransfer.Types.RcvFileStatus
instance GHC.Show.Show Simplex.FileTransfer.Types.RcvFileChunkReplica
instance GHC.Show.Show Simplex.FileTransfer.Types.RcvFileChunk
instance GHC.Show.Show Simplex.FileTransfer.Types.RcvFileRedirect
instance GHC.Show.Show Simplex.FileTransfer.Types.RcvFile
instance GHC.Show.Show Simplex.FileTransfer.Types.SndFileStatus
instance GHC.Classes.Eq Simplex.FileTransfer.Types.SndFileStatus
instance GHC.Show.Show Simplex.FileTransfer.Types.NewSndChunkReplica
instance GHC.Show.Show Simplex.FileTransfer.Types.SndFileReplicaStatus
instance GHC.Classes.Eq Simplex.FileTransfer.Types.SndFileReplicaStatus
instance GHC.Show.Show Simplex.FileTransfer.Types.SndFileChunkReplica
instance GHC.Show.Show Simplex.FileTransfer.Types.SndFileChunk
instance GHC.Show.Show Simplex.FileTransfer.Types.SndFile
instance GHC.Show.Show Simplex.FileTransfer.Types.DeletedSndChunkReplica
instance GHC.Show.Show Simplex.FileTransfer.Types.FileErrorType
instance GHC.Classes.Eq Simplex.FileTransfer.Types.FileErrorType
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.FileTransfer.Types.FileErrorType
instance Database.SQLite.Simple.FromField.FromField Simplex.FileTransfer.Types.SndFileReplicaStatus
instance Database.SQLite.Simple.ToField.ToField Simplex.FileTransfer.Types.SndFileReplicaStatus
instance Simplex.Messaging.Encoding.String.TextEncoding Simplex.FileTransfer.Types.SndFileReplicaStatus
instance Database.SQLite.Simple.FromField.FromField Simplex.FileTransfer.Types.SndFileStatus
instance Database.SQLite.Simple.ToField.ToField Simplex.FileTransfer.Types.SndFileStatus
instance Simplex.Messaging.Encoding.String.TextEncoding Simplex.FileTransfer.Types.SndFileStatus
instance Database.SQLite.Simple.FromField.FromField Simplex.FileTransfer.Types.RcvFileStatus
instance Database.SQLite.Simple.ToField.ToField Simplex.FileTransfer.Types.RcvFileStatus
instance Simplex.Messaging.Encoding.String.TextEncoding Simplex.FileTransfer.Types.RcvFileStatus
instance Simplex.Messaging.Encoding.Encoding Simplex.FileTransfer.Types.FileHeader

module Simplex.FileTransfer.Crypto
encryptFile :: CryptoFile -> ByteString -> SbKey -> CbNonce -> Int64 -> Int64 -> FilePath -> ExceptT FTCryptoError IO ()
decryptChunks :: Int64 -> [FilePath] -> SbKey -> CbNonce -> (Text -> ExceptT String IO CryptoFile) -> ExceptT FTCryptoError IO CryptoFile
readChunks :: [FilePath] -> IO ByteString

module Simplex.FileTransfer.Client.Agent
type XFTPClientVar = TMVar (Either XFTPClientAgentError XFTPClient)
data XFTPClientAgent
XFTPClientAgent :: TMap XFTPServer XFTPClientVar -> UTCTime -> XFTPClientAgentConfig -> XFTPClientAgent
[$sel:xftpClients:XFTPClientAgent] :: XFTPClientAgent -> TMap XFTPServer XFTPClientVar
[$sel:startedAt:XFTPClientAgent] :: XFTPClientAgent -> UTCTime
[$sel:config:XFTPClientAgent] :: XFTPClientAgent -> XFTPClientAgentConfig
data XFTPClientAgentConfig
XFTPClientAgentConfig :: XFTPClientConfig -> RetryInterval -> XFTPClientAgentConfig
[$sel:xftpConfig:XFTPClientAgentConfig] :: XFTPClientAgentConfig -> XFTPClientConfig
[$sel:reconnectInterval:XFTPClientAgentConfig] :: XFTPClientAgentConfig -> RetryInterval
data XFTPClientAgentError
XFTPClientAgentError :: XFTPServer -> XFTPClientError -> XFTPClientAgentError
defaultXFTPClientAgentConfig :: XFTPClientAgentConfig
newXFTPAgent :: XFTPClientAgentConfig -> IO XFTPClientAgent
getXFTPServerClient :: XFTPClientAgent -> XFTPServer -> ME XFTPClient
showServer :: XFTPServer -> Text
closeXFTPServerClient :: XFTPClientAgent -> XFTPServer -> IO ()
instance GHC.Exception.Type.Exception Simplex.FileTransfer.Client.Agent.XFTPClientAgentError
instance GHC.Show.Show Simplex.FileTransfer.Client.Agent.XFTPClientAgentError

module Simplex.RemoteControl.Discovery.Multicast

-- | Toggle multicast group membership.
--   
--   NB: Group membership is per-host, not per-process. A socket is only
--   used to access system interface for groups.
setMembership :: Socket -> HostAddress -> Bool -> IO (Either CInt ())

module Simplex.RemoteControl.Types
data RCErrorType
RCEInternal :: String -> RCErrorType
[$sel:internalErr:RCEInternal] :: RCErrorType -> String
RCEIdentity :: RCErrorType
RCENoLocalAddress :: RCErrorType
RCENewController :: RCErrorType
RCENotDiscovered :: RCErrorType
RCETLSStartFailed :: RCErrorType
RCEException :: String -> RCErrorType
[$sel:exception:RCEInternal] :: RCErrorType -> String
RCECtrlAuth :: RCErrorType
RCECtrlNotFound :: RCErrorType
RCECtrlError :: String -> RCErrorType
[$sel:ctrlErr:RCEInternal] :: RCErrorType -> String
RCEInvitation :: RCErrorType
RCEVersion :: RCErrorType
RCEEncrypt :: RCErrorType
RCEDecrypt :: RCErrorType
RCEBlockSize :: RCErrorType
RCESyntax :: String -> RCErrorType
[$sel:syntaxErr:RCEInternal] :: RCErrorType -> String
data RCPVersion
type VersionRCP = Version RCPVersion
type VersionRangeRCP = VersionRange RCPVersion
data RCHostHello
RCHostHello :: VersionRCP -> KeyHash -> Value -> KEMPublicKey -> RCHostHello
[$sel:v:RCHostHello] :: RCHostHello -> VersionRCP
[$sel:ca:RCHostHello] :: RCHostHello -> KeyHash
[$sel:app:RCHostHello] :: RCHostHello -> Value
[$sel:kem:RCHostHello] :: RCHostHello -> KEMPublicKey
data RCCtrlHello
RCCtrlHello :: RCCtrlHello

-- | Long-term part of controller (desktop) connection to host (mobile)
data RCHostPairing
RCHostPairing :: APrivateSignKey -> SignedCertificate -> PrivateKeyEd25519 -> Maybe KnownHostPairing -> RCHostPairing
[$sel:caKey:RCHostPairing] :: RCHostPairing -> APrivateSignKey
[$sel:caCert:RCHostPairing] :: RCHostPairing -> SignedCertificate
[$sel:idPrivKey:RCHostPairing] :: RCHostPairing -> PrivateKeyEd25519
[$sel:knownHost:RCHostPairing] :: RCHostPairing -> Maybe KnownHostPairing
data KnownHostPairing
KnownHostPairing :: KeyHash -> PublicKeyX25519 -> KnownHostPairing
[$sel:hostFingerprint:KnownHostPairing] :: KnownHostPairing -> KeyHash
[$sel:hostDhPubKey:KnownHostPairing] :: KnownHostPairing -> PublicKeyX25519
data RCCtrlAddress
RCCtrlAddress :: TransportHost -> Text -> RCCtrlAddress
[$sel:address:RCCtrlAddress] :: RCCtrlAddress -> TransportHost
[$sel:interface:RCCtrlAddress] :: RCCtrlAddress -> Text

-- | Long-term part of host (mobile) connection to controller (desktop)
data RCCtrlPairing
RCCtrlPairing :: APrivateSignKey -> SignedCertificate -> KeyHash -> PublicKeyEd25519 -> PrivateKeyX25519 -> Maybe PrivateKeyX25519 -> RCCtrlPairing
[$sel:caKey:RCCtrlPairing] :: RCCtrlPairing -> APrivateSignKey
[$sel:caCert:RCCtrlPairing] :: RCCtrlPairing -> SignedCertificate
[$sel:ctrlFingerprint:RCCtrlPairing] :: RCCtrlPairing -> KeyHash
[$sel:idPubKey:RCCtrlPairing] :: RCCtrlPairing -> PublicKeyEd25519
[$sel:dhPrivKey:RCCtrlPairing] :: RCCtrlPairing -> PrivateKeyX25519
[$sel:prevDhPrivKey:RCCtrlPairing] :: RCCtrlPairing -> Maybe PrivateKeyX25519
data RCHostKeys
RCHostKeys :: KeyPairEd25519 -> KeyPairX25519 -> RCHostKeys
[$sel:sessKeys:RCHostKeys] :: RCHostKeys -> KeyPairEd25519
[$sel:dhKeys:RCHostKeys] :: RCHostKeys -> KeyPairX25519
data RCHostSession
RCHostSession :: TLS 'TServer -> HostSessKeys -> RCHostSession
[$sel:tls:RCHostSession] :: RCHostSession -> TLS 'TServer
[$sel:sessionKeys:RCHostSession] :: RCHostSession -> HostSessKeys
data HostSessKeys
HostSessKeys :: TSbChainKeys -> PrivateKeyEd25519 -> PrivateKeyEd25519 -> HostSessKeys
[$sel:chainKeys:HostSessKeys] :: HostSessKeys -> TSbChainKeys
[$sel:idPrivKey:HostSessKeys] :: HostSessKeys -> PrivateKeyEd25519
[$sel:sessPrivKey:HostSessKeys] :: HostSessKeys -> PrivateKeyEd25519
data RCCtrlSession
RCCtrlSession :: TLS 'TClient -> CtrlSessKeys -> RCCtrlSession
[$sel:tls:RCCtrlSession] :: RCCtrlSession -> TLS 'TClient
[$sel:sessionKeys:RCCtrlSession] :: RCCtrlSession -> CtrlSessKeys
data CtrlSessKeys
CtrlSessKeys :: TSbChainKeys -> PublicKeyEd25519 -> PublicKeyEd25519 -> CtrlSessKeys
[$sel:chainKeys:CtrlSessKeys] :: CtrlSessKeys -> TSbChainKeys
[$sel:idPubKey:CtrlSessKeys] :: CtrlSessKeys -> PublicKeyEd25519
[$sel:sessPubKey:CtrlSessKeys] :: CtrlSessKeys -> PublicKeyEd25519
data RCHostEncHello
RCHostEncHello :: PublicKeyX25519 -> CbNonce -> ByteString -> RCHostEncHello
[$sel:dhPubKey:RCHostEncHello] :: RCHostEncHello -> PublicKeyX25519
[$sel:nonce:RCHostEncHello] :: RCHostEncHello -> CbNonce
[$sel:encBody:RCHostEncHello] :: RCHostEncHello -> ByteString
data RCCtrlEncHello
RCCtrlEncHello :: KEMCiphertext -> ByteString -> RCCtrlEncHello
[$sel:kem:RCCtrlEncHello] :: RCCtrlEncHello -> KEMCiphertext
[$sel:encBody:RCCtrlEncHello] :: RCCtrlEncHello -> ByteString
RCCtrlEncError :: CbNonce -> ByteString -> RCCtrlEncHello
[$sel:nonce:RCCtrlEncHello] :: RCCtrlEncHello -> CbNonce
[$sel:encMessage:RCCtrlEncHello] :: RCCtrlEncHello -> ByteString

-- | tlsunique channel binding
type SessionCode = ByteString
type RCStepTMVar a = TMVar (Either RCErrorType a)
currentRCPVersion :: VersionRCP
supportedRCPVRange :: VersionRangeRCP
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.RemoteControl.Types.RCCtrlAddress
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.RemoteControl.Types.RCCtrlAddress
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.RemoteControl.Types.RCErrorType
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.RemoteControl.Types.RCErrorType
instance GHC.Classes.Eq Simplex.RemoteControl.Types.RCCtrlAddress
instance GHC.Show.Show Simplex.RemoteControl.Types.RCCtrlAddress
instance GHC.Show.Show Simplex.RemoteControl.Types.RCHostEncHello
instance GHC.Show.Show Simplex.RemoteControl.Types.RCCtrlEncHello
instance Simplex.Messaging.Encoding.Encoding Simplex.RemoteControl.Types.RCCtrlEncHello
instance Simplex.Messaging.Encoding.Encoding Simplex.RemoteControl.Types.RCHostEncHello
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.RemoteControl.Types.RCCtrlHello
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.RemoteControl.Types.RCCtrlHello
instance GHC.Show.Show Simplex.RemoteControl.Types.RCCtrlHello
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.RemoteControl.Types.RCHostHello
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.RemoteControl.Types.RCHostHello
instance GHC.Exception.Type.Exception Simplex.RemoteControl.Types.RCErrorType
instance GHC.Show.Show Simplex.RemoteControl.Types.RCErrorType
instance GHC.Classes.Eq Simplex.RemoteControl.Types.RCErrorType
instance GHC.Show.Show Simplex.RemoteControl.Types.RCHostHello
instance Simplex.Messaging.Version.VersionScope Simplex.RemoteControl.Types.RCPVersion
instance Simplex.Messaging.Util.AnyError Simplex.RemoteControl.Types.RCErrorType
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.RemoteControl.Types.RCErrorType

module Simplex.RemoteControl.Invitation
data RCInvitation
RCInvitation :: KeyHash -> TransportHost -> Word16 -> VersionRangeRCP -> Value -> SystemTime -> PublicKeyEd25519 -> PublicKeyEd25519 -> PublicKeyX25519 -> RCInvitation

-- | CA TLS certificate fingerprint of the controller.
--   
--   This is part of long term identity of the controller established
--   during the first session, and repeated in the subsequent session
--   announcements.
[$sel:ca:RCInvitation] :: RCInvitation -> KeyHash
[$sel:host:RCInvitation] :: RCInvitation -> TransportHost
[$sel:port:RCInvitation] :: RCInvitation -> Word16

-- | Supported version range for remote control protocol
[$sel:v:RCInvitation] :: RCInvitation -> VersionRangeRCP

-- | Application information
[$sel:app:RCInvitation] :: RCInvitation -> Value

-- | Session start time in seconds since epoch
[$sel:ts:RCInvitation] :: RCInvitation -> SystemTime

-- | Session Ed25519 public key used to verify the announcement and
--   commands
--   
--   This mitigates the compromise of the long term signature key, as the
--   controller will have to sign each command with this key first.
[$sel:skey:RCInvitation] :: RCInvitation -> PublicKeyEd25519

-- | Long-term Ed25519 public key used to verify the announcement and
--   commands.
--   
--   Is apart of the long term controller identity.
[$sel:idkey:RCInvitation] :: RCInvitation -> PublicKeyEd25519

-- | Session X25519 DH key
[$sel:dh:RCInvitation] :: RCInvitation -> PublicKeyX25519
signInvitation :: PrivateKey 'Ed25519 -> PrivateKey 'Ed25519 -> RCInvitation -> RCSignedInvitation
data RCSignedInvitation
RCSignedInvitation :: RCInvitation -> Signature 'Ed25519 -> Signature 'Ed25519 -> RCSignedInvitation
[$sel:invitation:RCSignedInvitation] :: RCSignedInvitation -> RCInvitation
[$sel:ssig:RCSignedInvitation] :: RCSignedInvitation -> Signature 'Ed25519
[$sel:idsig:RCSignedInvitation] :: RCSignedInvitation -> Signature 'Ed25519
verifySignedInvitation :: RCSignedInvitation -> Maybe RCVerifiedInvitation
newtype RCVerifiedInvitation
RCVerifiedInvitation :: RCInvitation -> RCVerifiedInvitation
data RCEncInvitation
RCEncInvitation :: PublicKeyX25519 -> CbNonce -> ByteString -> RCEncInvitation
[$sel:dhPubKey:RCEncInvitation] :: RCEncInvitation -> PublicKeyX25519
[$sel:nonce:RCEncInvitation] :: RCEncInvitation -> CbNonce
[$sel:encInvitation:RCEncInvitation] :: RCEncInvitation -> ByteString
instance GHC.Show.Show Simplex.RemoteControl.Invitation.RCInvitation
instance GHC.Show.Show Simplex.RemoteControl.Invitation.RCSignedInvitation
instance GHC.Show.Show Simplex.RemoteControl.Invitation.RCVerifiedInvitation
instance Simplex.Messaging.Encoding.Encoding Simplex.RemoteControl.Invitation.RCEncInvitation
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.RemoteControl.Invitation.RCSignedInvitation
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.RemoteControl.Invitation.RCInvitation

module Simplex.RemoteControl.Discovery
pattern ANY_ADDR_V4 :: (IsString a, Eq a) => a
getLocalAddress :: Maybe RCCtrlAddress -> IO [RCCtrlAddress]
mkLastLocalHost :: [RCCtrlAddress] -> [RCCtrlAddress]
preferAddress :: RCCtrlAddress -> [RCCtrlAddress] -> [RCCtrlAddress]
startTLSServer :: Maybe Word16 -> TMVar (Maybe PortNumber) -> Credential -> ServerHooks -> (TLS 'TServer -> IO ()) -> IO (Async ())
withSender :: (UDPSocket -> IO a) -> IO a
withListener :: TMVar Int -> (ListenSocket -> IO a) -> IO a
recvAnnounce :: ListenSocket -> IO (SockAddr, ByteString)


-- | Types, parsers, serializers and functions to send and receive SMP
--   agent protocol commands and responses.
--   
--   See
--   <a>https://github.com/simplex-chat/simplexmq/blob/master/protocol/agent-protocol.md</a>
module Simplex.Messaging.Agent.Protocol
type VersionSMPA = Version SMPAgentVersion
type VersionRangeSMPA = VersionRange SMPAgentVersion
pattern VersionSMPA :: Word16 -> VersionSMPA
duplexHandshakeSMPAgentVersion :: VersionSMPA
ratchetSyncSMPAgentVersion :: VersionSMPA
deliveryRcptsSMPAgentVersion :: VersionSMPA
pqdrSMPAgentVersion :: VersionSMPA
sndAuthKeySMPAgentVersion :: VersionSMPA
ratchetOnConfSMPAgentVersion :: VersionSMPA
currentSMPAgentVersion :: VersionSMPA
supportedSMPAgentVRange :: VersionRangeSMPA
e2eEncConnInfoLength :: VersionSMPA -> PQSupport -> Int
e2eEncAgentMsgLength :: VersionSMPA -> PQSupport -> Int
type ConnInfo = ByteString
type SndQueueSecured = Bool
type AEntityId = ByteString
data ACommand
NEW :: Bool -> AConnectionMode -> InitialKeys -> SubscriptionMode -> ACommand
LSET :: UserConnLinkData 'CMContact -> Maybe CRClientData -> ACommand
LGET :: ConnShortLink 'CMContact -> ACommand
JOIN :: Bool -> AConnectionRequestUri -> PQSupport -> SubscriptionMode -> ConnInfo -> ACommand
LET :: ConfirmationId -> ConnInfo -> ACommand
ACK :: AgentMsgId -> Maybe MsgReceiptInfo -> ACommand
SWCH :: ACommand
DEL :: ACommand

-- | Parameterized type for SMP agent events
data AEvent (e :: AEntity)
[INV] :: AConnectionRequestUri -> Maybe ClientServiceId -> AEvent AEConn
[LINK] :: ConnShortLink 'CMContact -> UserConnLinkData 'CMContact -> AEvent AEConn
[LDATA] :: FixedLinkData 'CMContact -> ConnLinkData 'CMContact -> AEvent AEConn
[CONF] :: ConfirmationId -> PQSupport -> [SMPServer] -> ConnInfo -> AEvent AEConn
[REQ] :: InvitationId -> PQSupport -> NonEmpty SMPServer -> ConnInfo -> AEvent AEConn
[INFO] :: PQSupport -> ConnInfo -> AEvent AEConn
[CON] :: PQEncryption -> AEvent AEConn
[END] :: AEvent AEConn
[DELD] :: AEvent AEConn
[CONNECT] :: AProtocolType -> TransportHost -> AEvent AENone
[DISCONNECT] :: AProtocolType -> TransportHost -> AEvent AENone
[DOWN] :: SMPServer -> [ConnId] -> AEvent AENone
[UP] :: SMPServer -> [ConnId] -> AEvent AENone
[SWITCH] :: QueueDirection -> SwitchPhase -> ConnectionStats -> AEvent AEConn
[RSYNC] :: RatchetSyncState -> Maybe AgentCryptoError -> ConnectionStats -> AEvent AEConn
[SENT] :: AgentMsgId -> Maybe SMPServer -> AEvent AEConn
[MWARN] :: AgentMsgId -> AgentErrorType -> AEvent AEConn
[MERR] :: AgentMsgId -> AgentErrorType -> AEvent AEConn
[MERRS] :: NonEmpty AgentMsgId -> AgentErrorType -> AEvent AEConn
[MSG] :: MsgMeta -> MsgFlags -> MsgBody -> AEvent AEConn
[MSGNTF] :: MsgId -> Maybe UTCTime -> AEvent AEConn
[RCVD] :: MsgMeta -> NonEmpty MsgReceipt -> AEvent AEConn
[QCONT] :: AEvent AEConn
[DEL_RCVQS] :: NonEmpty (ConnId, SMPServer, RecipientId, Maybe AgentErrorType) -> AEvent AEConn
[DEL_CONNS] :: NonEmpty ConnId -> AEvent AEConn
[DEL_USER] :: Int64 -> AEvent AENone
[STAT] :: ConnectionStats -> AEvent AEConn
[OK] :: AEvent AEConn
[JOINED] :: SndQueueSecured -> Maybe ClientServiceId -> AEvent AEConn
[ERR] :: AgentErrorType -> AEvent AEConn
[ERRS] :: NonEmpty (ConnId, AgentErrorType) -> AEvent AENone
[SUSPENDED] :: AEvent AENone
[RFPROG] :: Int64 -> Int64 -> AEvent AERcvFile
[RFDONE] :: FilePath -> AEvent AERcvFile
[RFERR] :: AgentErrorType -> AEvent AERcvFile
[RFWARN] :: AgentErrorType -> AEvent AERcvFile
[SFPROG] :: Int64 -> Int64 -> AEvent AESndFile
[SFDONE] :: ValidFileDescription 'FSender -> [ValidFileDescription 'FRecipient] -> AEvent AESndFile
[SFERR] :: AgentErrorType -> AEvent AESndFile
[SFWARN] :: AgentErrorType -> AEvent AESndFile
data AEvt
AEvt :: SAEntity e -> AEvent e -> AEvt
data ACommandTag
NEW_ :: ACommandTag
LSET_ :: ACommandTag
LGET_ :: ACommandTag
JOIN_ :: ACommandTag
LET_ :: ACommandTag
ACK_ :: ACommandTag
SWCH_ :: ACommandTag
DEL_ :: ACommandTag
data AEventTag (e :: AEntity)
[INV_] :: AEventTag AEConn
[LINK_] :: AEventTag AEConn
[LDATA_] :: AEventTag AEConn
[CONF_] :: AEventTag AEConn
[REQ_] :: AEventTag AEConn
[INFO_] :: AEventTag AEConn
[CON_] :: AEventTag AEConn
[END_] :: AEventTag AEConn
[DELD_] :: AEventTag AEConn
[CONNECT_] :: AEventTag AENone
[DISCONNECT_] :: AEventTag AENone
[DOWN_] :: AEventTag AENone
[UP_] :: AEventTag AENone
[SWITCH_] :: AEventTag AEConn
[RSYNC_] :: AEventTag AEConn
[SENT_] :: AEventTag AEConn
[MWARN_] :: AEventTag AEConn
[MERR_] :: AEventTag AEConn
[MERRS_] :: AEventTag AEConn
[MSG_] :: AEventTag AEConn
[MSGNTF_] :: AEventTag AEConn
[RCVD_] :: AEventTag AEConn
[QCONT_] :: AEventTag AEConn
[DEL_RCVQS_] :: AEventTag AEConn
[DEL_CONNS_] :: AEventTag AEConn
[DEL_USER_] :: AEventTag AENone
[STAT_] :: AEventTag AEConn
[OK_] :: AEventTag AEConn
[JOINED_] :: AEventTag AEConn
[ERR_] :: AEventTag AEConn
[ERRS_] :: AEventTag AENone
[SUSPENDED_] :: AEventTag AENone
[RFDONE_] :: AEventTag AERcvFile
[RFPROG_] :: AEventTag AERcvFile
[RFERR_] :: AEventTag AERcvFile
[RFWARN_] :: AEventTag AERcvFile
[SFPROG_] :: AEventTag AESndFile
[SFDONE_] :: AEventTag AESndFile
[SFERR_] :: AEventTag AESndFile
[SFWARN_] :: AEventTag AESndFile
data AEvtTag
AEvtTag :: SAEntity e -> AEventTag e -> AEvtTag
aCommandTag :: ACommand -> ACommandTag
aEventTag :: AEvent e -> AEventTag e
data AEntity
AEConn :: AEntity
AERcvFile :: AEntity
AESndFile :: AEntity
AENone :: AEntity
data SAEntity :: AEntity -> Type
[SAEConn] :: SAEntity AEConn
[SAERcvFile] :: SAEntity AERcvFile
[SAESndFile] :: SAEntity AESndFile
[SAENone] :: SAEntity AENone
class AEntityI (e :: AEntity)
sAEntity :: AEntityI e => SAEntity e
type MsgHash = ByteString

-- | Agent message metadata sent to the client
data MsgMeta
MsgMeta :: MsgIntegrity -> (AgentMsgId, UTCTime) -> (MsgId, UTCTime) -> AgentMsgId -> PQEncryption -> MsgMeta
[$sel:integrity:MsgMeta] :: MsgMeta -> MsgIntegrity
[$sel:recipient:MsgMeta] :: MsgMeta -> (AgentMsgId, UTCTime)
[$sel:broker:MsgMeta] :: MsgMeta -> (MsgId, UTCTime)
[$sel:sndMsgId:MsgMeta] :: MsgMeta -> AgentMsgId
[$sel:pqEncryption:MsgMeta] :: MsgMeta -> PQEncryption
data RcvQueueInfo
RcvQueueInfo :: SMPServer -> QueueStatus -> Maybe RcvSwitchStatus -> Bool -> SubscriptionStatus -> RcvQueueInfo
[$sel:rcvServer:RcvQueueInfo] :: RcvQueueInfo -> SMPServer
[$sel:status:RcvQueueInfo] :: RcvQueueInfo -> QueueStatus
[$sel:rcvSwitchStatus:RcvQueueInfo] :: RcvQueueInfo -> Maybe RcvSwitchStatus
[$sel:canAbortSwitch:RcvQueueInfo] :: RcvQueueInfo -> Bool
[$sel:subStatus:RcvQueueInfo] :: RcvQueueInfo -> SubscriptionStatus
data SndQueueInfo
SndQueueInfo :: SMPServer -> QueueStatus -> Maybe SndSwitchStatus -> SndQueueInfo
[$sel:sndServer:SndQueueInfo] :: SndQueueInfo -> SMPServer
[$sel:status:SndQueueInfo] :: SndQueueInfo -> QueueStatus
[$sel:sndSwitchStatus:SndQueueInfo] :: SndQueueInfo -> Maybe SndSwitchStatus
data SubscriptionStatus
SSActive :: SubscriptionStatus
SSPending :: SubscriptionStatus
SSRemoved :: String -> SubscriptionStatus
[$sel:subError:SSActive] :: SubscriptionStatus -> String
SSNoSub :: SubscriptionStatus
data ConnectionStats
ConnectionStats :: VersionSMPA -> [RcvQueueInfo] -> [SndQueueInfo] -> RatchetSyncState -> Bool -> Maybe SubscriptionStatus -> ConnectionStats
[$sel:connAgentVersion:ConnectionStats] :: ConnectionStats -> VersionSMPA
[$sel:rcvQueuesInfo:ConnectionStats] :: ConnectionStats -> [RcvQueueInfo]
[$sel:sndQueuesInfo:ConnectionStats] :: ConnectionStats -> [SndQueueInfo]
[$sel:ratchetSyncState:ConnectionStats] :: ConnectionStats -> RatchetSyncState
[$sel:ratchetSyncSupported:ConnectionStats] :: ConnectionStats -> Bool
[$sel:subStatus:ConnectionStats] :: ConnectionStats -> Maybe SubscriptionStatus
data SwitchPhase
SPStarted :: SwitchPhase
SPConfirmed :: SwitchPhase
SPSecured :: SwitchPhase
SPCompleted :: SwitchPhase
data RcvSwitchStatus
RSSwitchStarted :: RcvSwitchStatus
RSSendingQADD :: RcvSwitchStatus
RSSendingQUSE :: RcvSwitchStatus
RSReceivedMessage :: RcvSwitchStatus
data SndSwitchStatus
SSSendingQKEY :: SndSwitchStatus
SSSendingQTEST :: SndSwitchStatus
data QueueDirection
QDRcv :: QueueDirection
QDSnd :: QueueDirection
data RatchetSyncState
RSOk :: RatchetSyncState
RSAllowed :: RatchetSyncState
RSRequired :: RatchetSyncState
RSStarted :: RatchetSyncState
RSAgreed :: RatchetSyncState
data SMPConfirmation
SMPConfirmation :: Maybe SndPublicAuthKey -> PublicKeyX25519 -> ConnInfo -> [SMPQueueInfo] -> VersionSMPC -> SMPConfirmation

-- | sender's public key to use for authentication of sender's commands at
--   the recepient's server
[$sel:senderKey:SMPConfirmation] :: SMPConfirmation -> Maybe SndPublicAuthKey

-- | sender's DH public key for simple per-queue e2e encryption
[$sel:e2ePubKey:SMPConfirmation] :: SMPConfirmation -> PublicKeyX25519

-- | sender's information to be associated with the connection, e.g.
--   sender's profile information
[$sel:connInfo:SMPConfirmation] :: SMPConfirmation -> ConnInfo

-- | optional reply queues included in confirmation (added in agent
--   protocol v2)
[$sel:smpReplyQueues:SMPConfirmation] :: SMPConfirmation -> [SMPQueueInfo]

-- | SMP client version
[$sel:smpClientVersion:SMPConfirmation] :: SMPConfirmation -> VersionSMPC
data AgentMsgEnvelope
AgentConfirmation :: VersionSMPA -> Maybe (SndE2ERatchetParams 'X448) -> ByteString -> AgentMsgEnvelope
[$sel:agentVersion:AgentConfirmation] :: AgentMsgEnvelope -> VersionSMPA
[$sel:e2eEncryption_:AgentConfirmation] :: AgentMsgEnvelope -> Maybe (SndE2ERatchetParams 'X448)
[$sel:encConnInfo:AgentConfirmation] :: AgentMsgEnvelope -> ByteString
AgentMsgEnvelope :: VersionSMPA -> ByteString -> AgentMsgEnvelope
[$sel:agentVersion:AgentConfirmation] :: AgentMsgEnvelope -> VersionSMPA
[$sel:encAgentMessage:AgentConfirmation] :: AgentMsgEnvelope -> ByteString
AgentInvitation :: VersionSMPA -> ConnectionRequestUri 'CMInvitation -> ByteString -> AgentMsgEnvelope
[$sel:agentVersion:AgentConfirmation] :: AgentMsgEnvelope -> VersionSMPA
[$sel:connReq:AgentConfirmation] :: AgentMsgEnvelope -> ConnectionRequestUri 'CMInvitation
[$sel:connInfo:AgentConfirmation] :: AgentMsgEnvelope -> ByteString
AgentRatchetKey :: VersionSMPA -> RcvE2ERatchetParams 'X448 -> ByteString -> AgentMsgEnvelope
[$sel:agentVersion:AgentConfirmation] :: AgentMsgEnvelope -> VersionSMPA
[$sel:e2eEncryption:AgentConfirmation] :: AgentMsgEnvelope -> RcvE2ERatchetParams 'X448
[$sel:info:AgentConfirmation] :: AgentMsgEnvelope -> ByteString
data AgentMessage
AgentConnInfo :: ConnInfo -> AgentMessage
AgentConnInfoReply :: NonEmpty SMPQueueInfo -> ConnInfo -> AgentMessage
AgentRatchetInfo :: ByteString -> AgentMessage
AgentMessage :: APrivHeader -> AMessage -> AgentMessage
data AgentMessageType
AM_CONN_INFO :: AgentMessageType
AM_CONN_INFO_REPLY :: AgentMessageType
AM_RATCHET_INFO :: AgentMessageType
AM_HELLO_ :: AgentMessageType
AM_A_MSG_ :: AgentMessageType
AM_A_RCVD_ :: AgentMessageType
AM_QCONT_ :: AgentMessageType
AM_QADD_ :: AgentMessageType
AM_QKEY_ :: AgentMessageType
AM_QUSE_ :: AgentMessageType
AM_QTEST_ :: AgentMessageType
AM_EREADY_ :: AgentMessageType
data APrivHeader
APrivHeader :: AgentMsgId -> MsgHash -> APrivHeader

-- | sequential ID assigned by the sending agent
[$sel:sndMsgId:APrivHeader] :: APrivHeader -> AgentMsgId

-- | digest of the previous message
[$sel:prevMsgHash:APrivHeader] :: APrivHeader -> MsgHash

-- | Messages sent between SMP agents once SMP queue is secured.
--   
--   
--   <a>https://github.com/simplex-chat/simplexmq/blob/master/protocol/agent-protocol.md#messages-between-smp-agents</a>
data AMessage

-- | the first message in the queue to validate it is secured
HELLO :: AMessage

-- | agent envelope for the client message
A_MSG :: MsgBody -> AMessage

-- | agent envelope for delivery receipt
A_RCVD :: NonEmpty AMessageReceipt -> AMessage

-- | the message instructing the client to continue sending messages (after
--   ERR QUOTA)
A_QCONT :: SndQAddr -> AMessage
QADD :: NonEmpty (SMPQueueUri, Maybe SndQAddr) -> AMessage
QKEY :: NonEmpty (SMPQueueInfo, SndPublicAuthKey) -> AMessage
QUSE :: NonEmpty (SndQAddr, Bool) -> AMessage
QTEST :: NonEmpty SndQAddr -> AMessage
EREADY :: AgentMsgId -> AMessage

-- | this type is used to send as part of the protocol between different
--   clients TODO possibly, rename fields and types referring to external
--   and internal IDs to make them different
data AMessageReceipt
AMessageReceipt :: AgentMsgId -> MsgHash -> MsgReceiptInfo -> AMessageReceipt
[$sel:agentMsgId:AMessageReceipt] :: AMessageReceipt -> AgentMsgId
[$sel:msgHash:AMessageReceipt] :: AMessageReceipt -> MsgHash
[$sel:rcptInfo:AMessageReceipt] :: AMessageReceipt -> MsgReceiptInfo

-- | this type is used as part of agent protocol to communicate with the
--   user application
data MsgReceipt
MsgReceipt :: AgentMsgId -> MsgReceiptStatus -> MsgReceipt
[$sel:agentMsgId:MsgReceipt] :: MsgReceipt -> AgentMsgId
[$sel:msgRcptStatus:MsgReceipt] :: MsgReceipt -> MsgReceiptStatus
type MsgReceiptInfo = ByteString
data MsgReceiptStatus
MROk :: MsgReceiptStatus
MRBadMsgHash :: MsgReceiptStatus
type SndQAddr = (SMPServer, SenderId)
type SMPServer = ProtocolServer 'PSMP
pattern SMPServer :: NonEmpty TransportHost -> ServiceName -> KeyHash -> ProtocolServer 'PSMP
pattern ProtoServerWithAuth :: () => ProtocolServer p -> Maybe BasicAuth -> ProtoServerWithAuth p
type SMPServerWithAuth = ProtoServerWithAuth 'PSMP
data SrvLoc
SrvLoc :: HostName -> ServiceName -> SrvLoc
class SMPQueue q
qServer :: SMPQueue q => q -> SMPServer
queueId :: SMPQueue q => q -> QueueId
qAddress :: SMPQueue q => q -> (SMPServer, QueueId)
sameQueue :: SMPQueue q => (SMPServer, QueueId) -> q -> Bool
sameQAddress :: (SMPServer, QueueId) -> (SMPServer, QueueId) -> Bool
noAuthSrv :: ProtocolServer p -> ProtoServerWithAuth p

-- | SMP queue information sent out-of-band.
--   
--   
--   <a>https://github.com/simplex-chat/simplexmq/blob/master/protocol/simplex-messaging.md#out-of-band-messages</a>
data SMPQueueUri
SMPQueueUri :: VersionRangeSMPC -> SMPQueueAddress -> SMPQueueUri
[$sel:clientVRange:SMPQueueUri] :: SMPQueueUri -> VersionRangeSMPC
[$sel:queueAddress:SMPQueueUri] :: SMPQueueUri -> SMPQueueAddress
data SMPQueueInfo
SMPQueueInfo :: VersionSMPC -> SMPQueueAddress -> SMPQueueInfo
[$sel:clientVersion:SMPQueueInfo] :: SMPQueueInfo -> VersionSMPC
[$sel:queueAddress:SMPQueueInfo] :: SMPQueueInfo -> SMPQueueAddress
data SMPQueueAddress
SMPQueueAddress :: SMPServer -> SenderId -> PublicKeyX25519 -> Maybe QueueMode -> SMPQueueAddress
[$sel:smpServer:SMPQueueAddress] :: SMPQueueAddress -> SMPServer
[$sel:senderId:SMPQueueAddress] :: SMPQueueAddress -> SenderId
[$sel:dhPublicKey:SMPQueueAddress] :: SMPQueueAddress -> PublicKeyX25519
[$sel:queueMode:SMPQueueAddress] :: SMPQueueAddress -> Maybe QueueMode
data ConnectionMode
CMInvitation :: ConnectionMode
CMContact :: ConnectionMode
data SConnectionMode (m :: ConnectionMode)
[SCMInvitation] :: SConnectionMode CMInvitation
[SCMContact] :: SConnectionMode CMContact
data AConnectionMode
ACM :: SConnectionMode m -> AConnectionMode
class ConnectionModeI (m :: ConnectionMode)
sConnectionMode :: ConnectionModeI m => SConnectionMode m
data ConnectionRequestUri (m :: ConnectionMode)
[CRInvitationUri] :: ConnReqUriData -> RcvE2ERatchetParamsUri 'X448 -> ConnectionRequestUri CMInvitation
[CRContactUri] :: ConnReqUriData -> ConnectionRequestUri CMContact
data AConnectionRequestUri
ACR :: SConnectionMode m -> ConnectionRequestUri m -> AConnectionRequestUri
data ShortLinkCreds
ShortLinkCreds :: LinkId -> LinkKey -> PrivateKeyEd25519 -> Maybe PublicKeyEd25519 -> EncFixedDataBytes -> ShortLinkCreds
[$sel:shortLinkId:ShortLinkCreds] :: ShortLinkCreds -> LinkId
[$sel:shortLinkKey:ShortLinkCreds] :: ShortLinkCreds -> LinkKey
[$sel:linkPrivSigKey:ShortLinkCreds] :: ShortLinkCreds -> PrivateKeyEd25519
[$sel:linkRootSigKey:ShortLinkCreds] :: ShortLinkCreds -> Maybe PublicKeyEd25519
[$sel:linkEncFixedData:ShortLinkCreds] :: ShortLinkCreds -> EncFixedDataBytes
data ConnReqUriData
ConnReqUriData :: ServiceScheme -> VersionRangeSMPA -> NonEmpty SMPQueueUri -> Maybe CRClientData -> ConnReqUriData
[$sel:crScheme:ConnReqUriData] :: ConnReqUriData -> ServiceScheme
[$sel:crAgentVRange:ConnReqUriData] :: ConnReqUriData -> VersionRangeSMPA
[$sel:crSmpQueues:ConnReqUriData] :: ConnReqUriData -> NonEmpty SMPQueueUri
[$sel:crClientData:ConnReqUriData] :: ConnReqUriData -> Maybe CRClientData
type CRClientData = Text
data ServiceScheme
data FixedLinkData c
FixedLinkData :: VersionRangeSMPA -> PublicKeyEd25519 -> ConnectionRequestUri c -> Maybe ByteString -> FixedLinkData c
[$sel:agentVRange:FixedLinkData] :: FixedLinkData c -> VersionRangeSMPA
[$sel:rootKey:FixedLinkData] :: FixedLinkData c -> PublicKeyEd25519
[$sel:linkConnReq:FixedLinkData] :: FixedLinkData c -> ConnectionRequestUri c
[$sel:linkEntityId:FixedLinkData] :: FixedLinkData c -> Maybe ByteString
data AConnLinkData
ACLD :: SConnectionMode m -> ConnLinkData m -> AConnLinkData
data ConnLinkData c
[InvitationLinkData] :: VersionRangeSMPA -> UserLinkData -> ConnLinkData 'CMInvitation
[ContactLinkData] :: VersionRangeSMPA -> UserContactData -> ConnLinkData 'CMContact
data AUserConnLinkData
AULD :: SConnectionMode m -> UserConnLinkData m -> AUserConnLinkData
data UserConnLinkData c
[UserInvLinkData] :: UserLinkData -> UserConnLinkData 'CMInvitation
[UserContactLinkData] :: UserContactData -> UserConnLinkData 'CMContact
data UserContactData
UserContactData :: Bool -> [OwnerAuth] -> [ConnShortLink 'CMContact] -> UserLinkData -> UserContactData
[$sel:direct:UserContactData] :: UserContactData -> Bool
[$sel:owners:UserContactData] :: UserContactData -> [OwnerAuth]
[$sel:relays:UserContactData] :: UserContactData -> [ConnShortLink 'CMContact]
[$sel:userData:UserContactData] :: UserContactData -> UserLinkData
newtype UserLinkData
UserLinkData :: ByteString -> UserLinkData
data OwnerAuth
OwnerAuth :: OwnerId -> PublicKeyEd25519 -> Signature 'Ed25519 -> OwnerAuth
[$sel:ownerId:OwnerAuth] :: OwnerAuth -> OwnerId
[$sel:ownerKey:OwnerAuth] :: OwnerAuth -> PublicKeyEd25519
[$sel:authOwnerSig:OwnerAuth] :: OwnerAuth -> Signature 'Ed25519
type OwnerId = ByteString
data ConnectionLink m
CLFull :: ConnectionRequestUri m -> ConnectionLink m
CLShort :: ConnShortLink m -> ConnectionLink m
data AConnectionLink
ACL :: SConnectionMode m -> ConnectionLink m -> AConnectionLink
data ConnShortLink (m :: ConnectionMode)
[CSLInvitation] :: ShortLinkScheme -> SMPServer -> LinkId -> LinkKey -> ConnShortLink 'CMInvitation
[CSLContact] :: ShortLinkScheme -> ContactConnType -> SMPServer -> LinkKey -> ConnShortLink 'CMContact
data AConnShortLink
ACSL :: SConnectionMode m -> ConnShortLink m -> AConnShortLink
data CreatedConnLink m
CCLink :: ConnectionRequestUri m -> Maybe (ConnShortLink m) -> CreatedConnLink m
[$sel:connFullLink:CCLink] :: CreatedConnLink m -> ConnectionRequestUri m
[$sel:connShortLink:CCLink] :: CreatedConnLink m -> Maybe (ConnShortLink m)
data ACreatedConnLink
ACCL :: SConnectionMode m -> CreatedConnLink m -> ACreatedConnLink
data ContactConnType
CCTContact :: ContactConnType
CCTChannel :: ContactConnType
CCTGroup :: ContactConnType
CCTRelay :: ContactConnType
data ShortLinkScheme
SLSSimplex :: ShortLinkScheme
SLSServer :: ShortLinkScheme
newtype LinkKey
LinkKey :: ByteString -> LinkKey

-- | Parameters for creating a connection with a prepared link.
data PreparedLinkParams
PreparedLinkParams :: CbNonce -> KeyPairX25519 -> LinkKey -> PrivateKeyEd25519 -> ByteString -> SMPServerWithAuth -> PreparedLinkParams

-- | Correlation ID / determines sender ID
[$sel:plpNonce:PreparedLinkParams] :: PreparedLinkParams -> CbNonce

-- | Queue E2EE DH key pair
[$sel:plpQueueE2EKeys:PreparedLinkParams] :: PreparedLinkParams -> KeyPairX25519

-- | For encrypting link data
[$sel:plpLinkKey:PreparedLinkParams] :: PreparedLinkParams -> LinkKey

-- | Root signing key (for signing link data)
[$sel:plpRootPrivKey:PreparedLinkParams] :: PreparedLinkParams -> PrivateKeyEd25519

-- | smpEncode of FixedLinkData (includes linkEntityId)
[$sel:plpSignedFixedData:PreparedLinkParams] :: PreparedLinkParams -> ByteString

-- | Server with basic auth (not stored in link)
[$sel:plpSrvWithAuth:PreparedLinkParams] :: PreparedLinkParams -> SMPServerWithAuth
data StoredClientService (s :: DBStored)
ClientService :: DBEntityId' s -> ServiceId -> StoredClientService (s :: DBStored)
[$sel:dbServiceId:ClientService] :: StoredClientService (s :: DBStored) -> DBEntityId' s
[$sel:serviceId:ClientService] :: StoredClientService (s :: DBStored) -> ServiceId
type ClientService = StoredClientService 'DBStored
type ClientServiceId = DBEntityId
validateOwners :: Maybe ShortLinkCreds -> UserContactData -> Either String ()
validateLinkOwners :: PublicKeyEd25519 -> [OwnerAuth] -> Either String ()
sameConnReqContact :: ConnectionRequestUri 'CMContact -> ConnectionRequestUri 'CMContact -> Bool
sameShortLinkContact :: ConnShortLink 'CMContact -> ConnShortLink 'CMContact -> Bool
simplexChat :: ServiceScheme
connReqUriP' :: forall m. ConnectionModeI m => Maybe ServiceScheme -> Parser (ConnectionRequestUri m)
simplexConnReqUri :: ConnectionRequestUri m -> ConnectionRequestUri m
simplexShortLink :: ConnShortLink m -> ConnShortLink m

-- | Error type used in errors sent to agent clients.
data AgentErrorType

-- | command or response error
CMD :: CommandErrorType -> String -> AgentErrorType
[$sel:cmdErr:CMD] :: AgentErrorType -> CommandErrorType
[$sel:errContext:CMD] :: AgentErrorType -> String

-- | connection errors
CONN :: ConnectionErrorType -> String -> AgentErrorType
[$sel:connErr:CMD] :: AgentErrorType -> ConnectionErrorType
[$sel:errContext:CMD] :: AgentErrorType -> String

-- | user not found in database
NO_USER :: AgentErrorType

-- | SMP protocol errors forwarded to agent clients
SMP :: String -> ErrorType -> AgentErrorType
[$sel:serverAddress:CMD] :: AgentErrorType -> String
[$sel:smpErr:CMD] :: AgentErrorType -> ErrorType

-- | NTF protocol errors forwarded to agent clients
NTF :: String -> ErrorType -> AgentErrorType
[$sel:serverAddress:CMD] :: AgentErrorType -> String
[$sel:ntfErr:CMD] :: AgentErrorType -> ErrorType

-- | XFTP protocol errors forwarded to agent clients
XFTP :: String -> XFTPErrorType -> AgentErrorType
[$sel:serverAddress:CMD] :: AgentErrorType -> String
[$sel:xftpErr:CMD] :: AgentErrorType -> XFTPErrorType

-- | XFTP agent errors
FILE :: FileErrorType -> AgentErrorType
[$sel:fileErr:CMD] :: AgentErrorType -> FileErrorType

-- | SMP proxy errors
PROXY :: String -> String -> ProxyClientError -> AgentErrorType
[$sel:proxyServer:CMD] :: AgentErrorType -> String
[$sel:relayServer:CMD] :: AgentErrorType -> String
[$sel:proxyErr:CMD] :: AgentErrorType -> ProxyClientError

-- | XRCP protocol errors forwarded to agent clients
RCP :: RCErrorType -> AgentErrorType
[$sel:rcpErr:CMD] :: AgentErrorType -> RCErrorType

-- | SMP server errors
BROKER :: String -> BrokerErrorType -> AgentErrorType
[$sel:brokerAddress:CMD] :: AgentErrorType -> String
[$sel:brokerErr:CMD] :: AgentErrorType -> BrokerErrorType

-- | errors of other agents
AGENT :: SMPAgentError -> AgentErrorType
[$sel:agentErr:CMD] :: AgentErrorType -> SMPAgentError

-- | client notice
NOTICE :: Text -> Bool -> Maybe UTCTime -> AgentErrorType
[$sel:server:CMD] :: AgentErrorType -> Text
[$sel:preset:CMD] :: AgentErrorType -> Bool
[$sel:expiresAt:CMD] :: AgentErrorType -> Maybe UTCTime

-- | agent implementation or dependency errors
INTERNAL :: String -> AgentErrorType
[$sel:internalErr:CMD] :: AgentErrorType -> String

-- | critical agent errors that should be shown to the user, optionally
--   with restart button
CRITICAL :: Bool -> String -> AgentErrorType
[$sel:offerRestart:CMD] :: AgentErrorType -> Bool
[$sel:criticalErr:CMD] :: AgentErrorType -> String

-- | agent inactive
INACTIVE :: AgentErrorType

-- | SMP agent protocol command or response error.
data CommandErrorType

-- | command is prohibited in this context
PROHIBITED :: CommandErrorType

-- | command syntax is invalid
SYNTAX :: CommandErrorType

-- | entity ID is required with this command
NO_CONN :: CommandErrorType

-- | message size is not correct (no terminating space)
SIZE :: CommandErrorType

-- | message does not fit in SMP block
LARGE :: CommandErrorType

-- | Connection error.
data ConnectionErrorType

-- | connection is not in the database
NOT_FOUND :: ConnectionErrorType

-- | connection already exists
DUPLICATE :: ConnectionErrorType

-- | connection is simplex, but operation requires another queue
SIMPLEX :: ConnectionErrorType

-- | connection not accepted on join HELLO after timeout
NOT_ACCEPTED :: ConnectionErrorType

-- | connection not available on reply confirmation/HELLO after timeout
NOT_AVAILABLE :: ConnectionErrorType

-- | SMP server errors.
data BrokerErrorType

-- | invalid server response (failed to parse)
RESPONSE :: String -> BrokerErrorType
[$sel:respErr:RESPONSE] :: BrokerErrorType -> String

-- | unexpected response
UNEXPECTED :: String -> BrokerErrorType
[$sel:respErr:RESPONSE] :: BrokerErrorType -> String

-- | network error
NETWORK :: NetworkError -> BrokerErrorType
[$sel:networkError:RESPONSE] :: BrokerErrorType -> NetworkError

-- | no compatible server host (e.g. onion when public is required, or vice
--   versa)
HOST :: BrokerErrorType

-- | service unavailable client-side - used in agent errors
NO_SERVICE :: BrokerErrorType

-- | handshake or other transport error
TRANSPORT :: TransportError -> BrokerErrorType
[$sel:transportErr:RESPONSE] :: BrokerErrorType -> TransportError

-- | command response timeout
TIMEOUT :: BrokerErrorType

-- | Errors of another SMP agent.
data SMPAgentError

-- | client or agent message that failed to parse
A_MESSAGE :: SMPAgentError

-- | prohibited SMP/agent message
A_PROHIBITED :: String -> SMPAgentError
[$sel:prohibitedErr:A_MESSAGE] :: SMPAgentError -> String

-- | incompatible version of SMP client, agent or encryption protocols
A_VERSION :: SMPAgentError

-- | failed signature, hash or senderId verification of retrieved link data
A_LINK :: String -> SMPAgentError
[$sel:linkErr:A_MESSAGE] :: SMPAgentError -> String

-- | cannot decrypt message
A_CRYPTO :: AgentCryptoError -> SMPAgentError
[$sel:cryptoErr:A_MESSAGE] :: SMPAgentError -> AgentCryptoError

-- | duplicate message - this error is detected by ratchet decryption -
--   this message will be ignored and not shown. it may also indicate a
--   loss of ratchet synchronization (when only one message is sent via
--   copied ratchet). when message is dropped after too many reception
--   attempts, DroppedMsg is included.
A_DUPLICATE :: Maybe DroppedMsg -> SMPAgentError
[$sel:droppedMsg_:A_MESSAGE] :: SMPAgentError -> Maybe DroppedMsg

-- | error in the message to add<i>delete</i>etc queue in connection
A_QUEUE :: String -> SMPAgentError
[$sel:queueErr:A_MESSAGE] :: SMPAgentError -> String
data DroppedMsg
DroppedMsg :: UTCTime -> Int -> DroppedMsg
[$sel:brokerTs:DroppedMsg] :: DroppedMsg -> UTCTime
[$sel:attempts:DroppedMsg] :: DroppedMsg -> Int
data AgentCryptoError

-- | AES decryption error
DECRYPT_AES :: AgentCryptoError
DECRYPT_CB :: AgentCryptoError

-- | can't decrypt ratchet header, possibly ratchet out of sync due to
--   device change
RATCHET_HEADER :: AgentCryptoError

-- | earlier message number (or, possibly, skipped message that failed to
--   decrypt?)
RATCHET_EARLIER :: Word32 -> AgentCryptoError

-- | too many skipped messages
RATCHET_SKIPPED :: Word32 -> AgentCryptoError

-- | ratchet synchronization error
RATCHET_SYNC :: AgentCryptoError
cryptoErrToSyncState :: AgentCryptoError -> RatchetSyncState

-- | SMP agent event
type ATransmission = (ACorrId, AEntityId, AEvt)

-- | SMP agent connection ID.
type ConnId = ByteString
type ConfirmationId = ByteString
type InvitationId = ByteString

-- | Result of received message integrity validation.
data MsgIntegrity
MsgOk :: MsgIntegrity
MsgError :: MsgErrorType -> MsgIntegrity
[$sel:errorInfo:MsgOk] :: MsgIntegrity -> MsgErrorType

-- | Error of message integrity validation.
data MsgErrorType
MsgSkipped :: AgentMsgId -> AgentMsgId -> MsgErrorType
[$sel:fromMsgId:MsgSkipped] :: MsgErrorType -> AgentMsgId
[$sel:toMsgId:MsgSkipped] :: MsgErrorType -> AgentMsgId
MsgBadId :: AgentMsgId -> MsgErrorType
[$sel:msgId:MsgSkipped] :: MsgErrorType -> AgentMsgId
MsgBadHash :: MsgErrorType
MsgDuplicate :: MsgErrorType

-- | SMP queue status.
data QueueStatus

-- | queue is created
New :: QueueStatus

-- | queue is confirmed by the sender
Confirmed :: QueueStatus

-- | queue is secured with sender key (only used by the queue recipient)
Secured :: QueueStatus

-- | queue is active
Active :: QueueStatus

-- | queue is disabled (only used by the queue recipient)
Disabled :: QueueStatus
type UserId = Int64
type ACorrId = ByteString
type AgentMsgId = Int64
data NotificationsMode
NMPeriodic :: NotificationsMode
NMInstant :: NotificationsMode
data NotificationInfo
NotificationInfo :: ConnId -> Int64 -> SystemTime -> Maybe NMsgMeta -> NotificationInfo
[$sel:ntfConnId:NotificationInfo] :: NotificationInfo -> ConnId
[$sel:ntfDbQueueId:NotificationInfo] :: NotificationInfo -> Int64
[$sel:ntfTs:NotificationInfo] :: NotificationInfo -> SystemTime
[$sel:ntfMsgMeta:NotificationInfo] :: NotificationInfo -> Maybe NMsgMeta
data ConnMsgReq
ConnMsgReq :: ConnId -> Int64 -> Maybe UTCTime -> ConnMsgReq
[$sel:msgConnId:ConnMsgReq] :: ConnMsgReq -> ConnId
[$sel:msgDbQueueId:ConnMsgReq] :: ConnMsgReq -> Int64
[$sel:msgTs:ConnMsgReq] :: ConnMsgReq -> Maybe UTCTime

-- | Serialize SMP agent command.
serializeCommand :: ACommand -> ByteString
connMode :: SConnectionMode m -> ConnectionMode
connMode' :: ConnectionMode -> AConnectionMode

-- | SMP agent command and response parser for commands stored in db (fully
--   parses binary bodies)
dbCommandP :: Parser ACommand
connModeT :: Text -> Maybe ConnectionMode
serializeQueueStatus :: QueueStatus -> Text
queueStatusT :: Text -> Maybe QueueStatus
agentMessageType :: AgentMessage -> AgentMessageType
aMessageType :: AMessage -> AgentMessageType
extraSMPServerHosts :: Map TransportHost TransportHost
updateSMPServerHosts :: SMPServer -> SMPServer
shortenShortLink :: NonEmpty SMPServer -> ConnShortLink m -> ConnShortLink m
restoreShortLink :: NonEmpty SMPServer -> ConnShortLink m -> ConnShortLink m
isPresetServer :: Foldable t => SMPServer -> t SMPServer -> Bool
linkUserData :: ConnLinkData c -> UserLinkData
linkUserData' :: ConnLinkData c -> ByteString
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Protocol.SwitchPhase
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Protocol.SwitchPhase
instance Simplex.Messaging.Agent.Protocol.ConnectionModeI m => Data.Aeson.Types.FromJSON.FromJSON (Simplex.Messaging.Agent.Protocol.CreatedConnLink m)
instance Simplex.Messaging.Agent.Protocol.ConnectionModeI m => Data.Aeson.Types.ToJSON.ToJSON (Simplex.Messaging.Agent.Protocol.CreatedConnLink m)
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Protocol.ACreatedConnLink
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Protocol.ACreatedConnLink
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Protocol.QueueDirection
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Protocol.QueueDirection
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Protocol.AgentErrorType
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Protocol.AgentErrorType
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Protocol.SMPAgentError
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Protocol.SMPAgentError
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Protocol.DroppedMsg
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Protocol.DroppedMsg
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Protocol.AgentCryptoError
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Protocol.AgentCryptoError
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Protocol.ConnectionErrorType
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Protocol.ConnectionErrorType
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Protocol.CommandErrorType
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Protocol.CommandErrorType
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Protocol.MsgIntegrity
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Protocol.MsgIntegrity
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Protocol.MsgErrorType
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Protocol.MsgErrorType
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Protocol.ConnectionStats
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Protocol.ConnectionStats
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Protocol.SndQueueInfo
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Protocol.SndQueueInfo
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Protocol.RcvQueueInfo
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Protocol.RcvQueueInfo
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Protocol.SubscriptionStatus
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Protocol.SubscriptionStatus
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Protocol.QueueStatus
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Protocol.QueueStatus
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.AEntity
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.AEntity
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.ACommandTag
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.QueueDirection
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.QueueDirection
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.SwitchPhase
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.SwitchPhase
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.RcvSwitchStatus
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.RcvSwitchStatus
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.SndSwitchStatus
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.SndSwitchStatus
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.RatchetSyncState
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.RatchetSyncState
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.SubscriptionStatus
instance GHC.Classes.Ord Simplex.Messaging.Agent.Protocol.SubscriptionStatus
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.SubscriptionStatus
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.NotificationsMode
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.NotificationsMode
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.ConnectionMode
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.ConnectionMode
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.DroppedMsg
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.DroppedMsg
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.AgentMessageType
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.AgentMessageType
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.AMsgType
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.MsgReceiptStatus
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.MsgReceiptStatus
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.ConnMsgReq
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.NotificationInfo
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.SMPQueueAddress
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.SMPQueueAddress
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.SMPQueueUri
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.SMPQueueUri
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.SMPQueueInfo
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.SMPQueueInfo
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.SMPConfirmation
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.ShortLinkScheme
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.ShortLinkScheme
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Agent.Protocol.LinkKey
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Agent.Protocol.LinkKey
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.LinkKey
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.LinkKey
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.ShortLinkCreds
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.PreparedLinkParams
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.ContactConnType
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.ContactConnType
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.ConnReqUriData
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.ConnReqUriData
instance GHC.Show.Show (Simplex.Messaging.Agent.Protocol.CreatedConnLink m)
instance GHC.Classes.Eq (Simplex.Messaging.Agent.Protocol.CreatedConnLink m)
instance GHC.Show.Show (Simplex.Messaging.Agent.Protocol.ConnectionLink m)
instance GHC.Classes.Eq (Simplex.Messaging.Agent.Protocol.ConnectionLink m)
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.AgentMsgEnvelope
instance GHC.Show.Show (Simplex.Messaging.Agent.Protocol.FixedLinkData c)
instance GHC.Classes.Eq (Simplex.Messaging.Agent.Protocol.FixedLinkData c)
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.UserLinkData
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.UserLinkData
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.OwnerAuth
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.OwnerAuth
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.UserContactData
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.UserContactData
instance GHC.Show.Show (Simplex.Messaging.Agent.Protocol.StoredClientService s)
instance GHC.Classes.Eq (Simplex.Messaging.Agent.Protocol.StoredClientService s)
instance GHC.Read.Read Simplex.Messaging.Agent.Protocol.QueueStatus
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.QueueStatus
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.QueueStatus
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.SndQueueInfo
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.SndQueueInfo
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.RcvQueueInfo
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.RcvQueueInfo
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.ConnectionStats
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.ConnectionStats
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.MsgReceipt
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.MsgReceipt
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.AMessageReceipt
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.AMessage
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.APrivHeader
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.AgentMessage
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.ACommand
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.ACommand
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.MsgErrorType
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.MsgErrorType
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.MsgIntegrity
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.MsgIntegrity
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.MsgMeta
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.MsgMeta
instance GHC.Exception.Type.Exception Simplex.Messaging.Agent.Protocol.CommandErrorType
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.CommandErrorType
instance GHC.Read.Read Simplex.Messaging.Agent.Protocol.CommandErrorType
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.CommandErrorType
instance GHC.Exception.Type.Exception Simplex.Messaging.Agent.Protocol.ConnectionErrorType
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.ConnectionErrorType
instance GHC.Read.Read Simplex.Messaging.Agent.Protocol.ConnectionErrorType
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.ConnectionErrorType
instance GHC.Exception.Type.Exception Simplex.Messaging.Agent.Protocol.AgentCryptoError
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.AgentCryptoError
instance GHC.Read.Read Simplex.Messaging.Agent.Protocol.AgentCryptoError
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.AgentCryptoError
instance GHC.Exception.Type.Exception Simplex.Messaging.Agent.Protocol.SMPAgentError
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.SMPAgentError
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.SMPAgentError
instance GHC.Exception.Type.Exception Simplex.Messaging.Agent.Protocol.AgentErrorType
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.AgentErrorType
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.AgentErrorType
instance GHC.Show.Show (Simplex.Messaging.Agent.Protocol.SAEntity e)
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.AEvt
instance GHC.Classes.Eq (Simplex.Messaging.Agent.Protocol.AEvent e)
instance GHC.Show.Show (Simplex.Messaging.Agent.Protocol.AEvent e)
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.AEvtTag
instance GHC.Classes.Eq (Simplex.Messaging.Agent.Protocol.AEventTag e)
instance GHC.Show.Show (Simplex.Messaging.Agent.Protocol.AEventTag e)
instance GHC.Classes.Eq (Simplex.Messaging.Agent.Protocol.SConnectionMode m)
instance GHC.Show.Show (Simplex.Messaging.Agent.Protocol.SConnectionMode m)
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.AConnectionMode
instance GHC.Classes.Eq (Simplex.Messaging.Agent.Protocol.ConnectionRequestUri m)
instance GHC.Show.Show (Simplex.Messaging.Agent.Protocol.ConnectionRequestUri m)
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.AConnectionRequestUri
instance GHC.Classes.Eq (Simplex.Messaging.Agent.Protocol.ConnShortLink m)
instance GHC.Show.Show (Simplex.Messaging.Agent.Protocol.ConnShortLink m)
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.AConnShortLink
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.ACreatedConnLink
instance GHC.Show.Show Simplex.Messaging.Agent.Protocol.AConnectionLink
instance GHC.Classes.Eq (Simplex.Messaging.Agent.Protocol.ConnLinkData c)
instance GHC.Show.Show (Simplex.Messaging.Agent.Protocol.ConnLinkData c)
instance GHC.Classes.Eq (Simplex.Messaging.Agent.Protocol.UserConnLinkData m)
instance GHC.Show.Show (Simplex.Messaging.Agent.Protocol.UserConnLinkData m)
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.AEvt
instance Simplex.Messaging.Util.AnyError Simplex.Messaging.Agent.Protocol.AgentErrorType
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Agent.Protocol.MsgIntegrity
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Agent.Protocol.MsgErrorType
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Agent.Protocol.AgentMessage
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Agent.Protocol.APrivHeader
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Agent.Protocol.AMessage
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Agent.Protocol.AMessage
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Agent.Protocol.AMessage
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Agent.Protocol.AMessageReceipt
instance Simplex.Messaging.Agent.Protocol.ConnectionModeI c => Simplex.Messaging.Encoding.Encoding (Simplex.Messaging.Agent.Protocol.ConnLinkData c)
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Agent.Protocol.AConnLinkData
instance Simplex.Messaging.Agent.Protocol.ConnectionModeI c => Simplex.Messaging.Encoding.Encoding (Simplex.Messaging.Agent.Protocol.UserConnLinkData c)
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Agent.Protocol.AUserConnLinkData
instance Simplex.Messaging.Agent.Protocol.ConnectionModeI c => Simplex.Messaging.Encoding.String.StrEncoding (Simplex.Messaging.Agent.Protocol.UserConnLinkData c)
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Agent.Protocol.UserContactData
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Agent.Protocol.OwnerAuth
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Agent.Protocol.UserLinkData
instance Simplex.Messaging.Agent.Protocol.ConnectionModeI c => Simplex.Messaging.Encoding.Encoding (Simplex.Messaging.Agent.Protocol.FixedLinkData c)
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Agent.Protocol.AgentMsgEnvelope
instance Simplex.Messaging.Agent.Protocol.ConnectionModeI m => Simplex.Messaging.Encoding.Encoding (Simplex.Messaging.Agent.Protocol.ConnectionRequestUri m)
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Agent.Protocol.AConnectionRequestUri
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Agent.Protocol.AConnectionRequestUri
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Protocol.AConnectionRequestUri
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Protocol.AConnectionRequestUri
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.AConnectionRequestUri
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Agent.Protocol.AConnectionLink
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.AConnectionLink
instance Simplex.Messaging.Agent.Protocol.ConnectionModeI m => Simplex.Messaging.Encoding.String.StrEncoding (Simplex.Messaging.Agent.Protocol.ConnectionLink m)
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Protocol.AConnectionLink
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Protocol.AConnectionLink
instance Simplex.Messaging.Agent.Protocol.ConnectionModeI c => Database.SQLite.Simple.ToField.ToField (Simplex.Messaging.Agent.Protocol.ConnectionLink c)
instance (Data.Typeable.Internal.Typeable c, Simplex.Messaging.Agent.Protocol.ConnectionModeI c) => Database.SQLite.Simple.FromField.FromField (Simplex.Messaging.Agent.Protocol.ConnectionLink c)
instance Simplex.Messaging.Agent.Protocol.ConnectionModeI m => Data.Aeson.Types.ToJSON.ToJSON (Simplex.Messaging.Agent.Protocol.ConnectionLink m)
instance Simplex.Messaging.Agent.Protocol.ConnectionModeI m => Data.Aeson.Types.FromJSON.FromJSON (Simplex.Messaging.Agent.Protocol.ConnectionLink m)
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.ACreatedConnLink
instance Simplex.Messaging.Agent.Protocol.ConnectionModeI m => Simplex.Messaging.Encoding.String.StrEncoding (Simplex.Messaging.Agent.Protocol.ConnectionRequestUri m)
instance Simplex.Messaging.Agent.Protocol.ConnectionModeI m => Data.Aeson.Types.FromJSON.FromJSON (Simplex.Messaging.Agent.Protocol.ConnectionRequestUri m)
instance Simplex.Messaging.Agent.Protocol.ConnectionModeI m => Data.Aeson.Types.ToJSON.ToJSON (Simplex.Messaging.Agent.Protocol.ConnectionRequestUri m)
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Agent.Protocol.ConnReqUriData
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Protocol.AConnShortLink
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Protocol.AConnShortLink
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.AConnShortLink
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Agent.Protocol.AConnShortLink
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Agent.Protocol.AConnShortLink
instance Simplex.Messaging.Agent.Protocol.ConnectionModeI m => Simplex.Messaging.Encoding.String.StrEncoding (Simplex.Messaging.Agent.Protocol.ConnShortLink m)
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Agent.Protocol.AConnShortLink
instance Simplex.Messaging.Agent.Protocol.ConnectionModeI m => Simplex.Messaging.Encoding.Encoding (Simplex.Messaging.Agent.Protocol.ConnShortLink m)
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Agent.Protocol.AConnShortLink
instance Simplex.Messaging.Agent.Protocol.ConnectionModeI m => Data.Aeson.Types.FromJSON.FromJSON (Simplex.Messaging.Agent.Protocol.ConnShortLink m)
instance Simplex.Messaging.Agent.Protocol.ConnectionModeI m => Data.Aeson.Types.ToJSON.ToJSON (Simplex.Messaging.Agent.Protocol.ConnShortLink m)
instance Simplex.Messaging.Agent.Protocol.ConnectionModeI c => Database.SQLite.Simple.ToField.ToField (Simplex.Messaging.Agent.Protocol.ConnShortLink c)
instance (Data.Typeable.Internal.Typeable c, Simplex.Messaging.Agent.Protocol.ConnectionModeI c) => Database.SQLite.Simple.FromField.FromField (Simplex.Messaging.Agent.Protocol.ConnShortLink c)
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Agent.Protocol.LinkKey
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Agent.Protocol.SMPQueueInfo
instance Simplex.Messaging.Version.VersionI Simplex.Messaging.Protocol.SMPClientVersion Simplex.Messaging.Agent.Protocol.SMPQueueInfo
instance Simplex.Messaging.Version.VersionRangeI Simplex.Messaging.Protocol.SMPClientVersion Simplex.Messaging.Agent.Protocol.SMPQueueUri
instance Simplex.Messaging.Agent.Protocol.SMPQueue Simplex.Messaging.Agent.Protocol.SMPQueueInfo
instance Simplex.Messaging.Agent.Protocol.SMPQueue Simplex.Messaging.Agent.Protocol.SMPQueueUri
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Agent.Protocol.SMPQueueUri
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Agent.Protocol.SMPQueueUri
instance Simplex.Messaging.Agent.Protocol.SMPQueue Simplex.Messaging.Agent.Protocol.SMPQueueAddress
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Agent.Protocol.MsgReceiptStatus
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Protocol.MsgReceiptStatus
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Protocol.MsgReceiptStatus
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Agent.Protocol.AMsgType
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Agent.Protocol.AgentMessageType
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.AConnectionMode
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Agent.Protocol.AConnectionMode
instance Simplex.Messaging.Agent.Protocol.ConnectionModeI 'Simplex.Messaging.Agent.Protocol.CMInvitation
instance Simplex.Messaging.Agent.Protocol.ConnectionModeI 'Simplex.Messaging.Agent.Protocol.CMContact
instance Data.Type.Equality.TestEquality Simplex.Messaging.Agent.Protocol.SConnectionMode
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Agent.Protocol.ConnectionMode
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Agent.Protocol.ConnectionMode
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Protocol.ConnectionMode
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Protocol.ConnectionMode
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Agent.Protocol.NotificationsMode
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Protocol.NotificationsMode
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Protocol.NotificationsMode
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Agent.Protocol.NotificationsMode
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Agent.Protocol.NotificationsMode
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Agent.Protocol.RatchetSyncState
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Agent.Protocol.RatchetSyncState
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Agent.Protocol.RatchetSyncState
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Protocol.RatchetSyncState
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Protocol.RatchetSyncState
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Agent.Protocol.SndSwitchStatus
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Agent.Protocol.SndSwitchStatus
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Agent.Protocol.SndSwitchStatus
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Protocol.SndSwitchStatus
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Protocol.SndSwitchStatus
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Agent.Protocol.RcvSwitchStatus
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Agent.Protocol.RcvSwitchStatus
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Agent.Protocol.RcvSwitchStatus
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Protocol.RcvSwitchStatus
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Protocol.RcvSwitchStatus
instance GHC.Classes.Eq Simplex.Messaging.Agent.Protocol.AEvtTag
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Agent.Protocol.ACommandTag
instance Simplex.Messaging.Agent.Protocol.AEntityI 'Simplex.Messaging.Agent.Protocol.AEConn
instance Simplex.Messaging.Agent.Protocol.AEntityI 'Simplex.Messaging.Agent.Protocol.AERcvFile
instance Simplex.Messaging.Agent.Protocol.AEntityI 'Simplex.Messaging.Agent.Protocol.AESndFile
instance Simplex.Messaging.Agent.Protocol.AEntityI 'Simplex.Messaging.Agent.Protocol.AENone
instance Data.Type.Equality.TestEquality Simplex.Messaging.Agent.Protocol.SAEntity
instance Simplex.Messaging.Version.VersionScope Simplex.Messaging.Agent.Protocol.SMPAgentVersion

module Simplex.Messaging.Server.Information
data ServerInformation
ServerInformation :: ServerPublicConfig -> Maybe ServerPublicInfo -> ServerInformation
[$sel:config:ServerInformation] :: ServerInformation -> ServerPublicConfig
[$sel:information:ServerInformation] :: ServerInformation -> Maybe ServerPublicInfo
data ServerPublicConfig
ServerPublicConfig :: ServerPersistenceMode -> Maybe Int64 -> Bool -> Bool -> Bool -> ServerPublicConfig
[$sel:persistence:ServerPublicConfig] :: ServerPublicConfig -> ServerPersistenceMode
[$sel:messageExpiration:ServerPublicConfig] :: ServerPublicConfig -> Maybe Int64
[$sel:statsEnabled:ServerPublicConfig] :: ServerPublicConfig -> Bool
[$sel:newQueuesAllowed:ServerPublicConfig] :: ServerPublicConfig -> Bool
[$sel:basicAuthEnabled:ServerPublicConfig] :: ServerPublicConfig -> Bool
data ServerPublicInfo
ServerPublicInfo :: Text -> Maybe ServerConditions -> Maybe Entity -> Maybe Text -> Maybe ServerContactAddress -> Maybe ServerContactAddress -> Maybe Entity -> Maybe HostingType -> Maybe Text -> ServerPublicInfo
[$sel:sourceCode:ServerPublicInfo] :: ServerPublicInfo -> Text
[$sel:usageConditions:ServerPublicInfo] :: ServerPublicInfo -> Maybe ServerConditions
[$sel:operator:ServerPublicInfo] :: ServerPublicInfo -> Maybe Entity
[$sel:website:ServerPublicInfo] :: ServerPublicInfo -> Maybe Text
[$sel:adminContacts:ServerPublicInfo] :: ServerPublicInfo -> Maybe ServerContactAddress
[$sel:complaintsContacts:ServerPublicInfo] :: ServerPublicInfo -> Maybe ServerContactAddress
[$sel:hosting:ServerPublicInfo] :: ServerPublicInfo -> Maybe Entity
[$sel:hostingType:ServerPublicInfo] :: ServerPublicInfo -> Maybe HostingType
[$sel:serverCountry:ServerPublicInfo] :: ServerPublicInfo -> Maybe Text
data ServerPersistenceMode
SPMMemoryOnly :: ServerPersistenceMode
SPMQueues :: ServerPersistenceMode
SPMMessages :: ServerPersistenceMode
data ServerConditions
ServerConditions :: Text -> Maybe Text -> ServerConditions
[$sel:conditions:ServerConditions] :: ServerConditions -> Text
[$sel:amendments:ServerConditions] :: ServerConditions -> Maybe Text
data HostingType
HTVirtual :: HostingType
HTDedicated :: HostingType
HTColocation :: HostingType
HTOwned :: HostingType
data Entity
Entity :: Text -> Maybe Text -> Entity
[$sel:name:Entity] :: Entity -> Text
[$sel:country:Entity] :: Entity -> Maybe Text
data ServerContactAddress
ServerContactAddress :: Maybe (ConnectionLink 'CMContact) -> Maybe Text -> Maybe PGPKey -> ServerContactAddress
[$sel:simplex:ServerContactAddress] :: ServerContactAddress -> Maybe (ConnectionLink 'CMContact)
[$sel:email:ServerContactAddress] :: ServerContactAddress -> Maybe Text
[$sel:pgp:ServerContactAddress] :: ServerContactAddress -> Maybe PGPKey
data PGPKey
PGPKey :: Text -> Text -> PGPKey
[$sel:pkURI:PGPKey] :: PGPKey -> Text
[$sel:pkFingerprint:PGPKey] :: PGPKey -> Text
emptyServerInfo :: Text -> ServerPublicInfo
hasServerInfo :: ServerPublicInfo -> Bool
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Server.Information.ServerInformation
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Server.Information.ServerInformation
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Server.Information.ServerPublicInfo
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Server.Information.ServerPublicInfo
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Server.Information.ServerPublicConfig
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Server.Information.ServerPublicConfig
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Server.Information.ServerContactAddress
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Server.Information.ServerContactAddress
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Server.Information.PGPKey
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Server.Information.PGPKey
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Server.Information.Entity
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Server.Information.Entity
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Server.Information.ServerConditions
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Server.Information.ServerConditions
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Server.Information.ServerPersistenceMode
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Server.Information.ServerPersistenceMode
instance GHC.Show.Show Simplex.Messaging.Server.Information.ServerPersistenceMode
instance GHC.Show.Show Simplex.Messaging.Server.Information.ServerPublicConfig
instance GHC.Show.Show Simplex.Messaging.Server.Information.ServerConditions
instance GHC.Show.Show Simplex.Messaging.Server.Information.HostingType
instance GHC.Show.Show Simplex.Messaging.Server.Information.Entity
instance GHC.Show.Show Simplex.Messaging.Server.Information.PGPKey
instance GHC.Show.Show Simplex.Messaging.Server.Information.ServerContactAddress
instance GHC.Show.Show Simplex.Messaging.Server.Information.ServerPublicInfo
instance GHC.Show.Show Simplex.Messaging.Server.Information.ServerInformation
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Server.Information.HostingType
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Server.Information.HostingType
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Server.Information.HostingType

module Simplex.Messaging.Notifications.Protocol
data NtfEntity
Token :: NtfEntity
Subscription :: NtfEntity
data SNtfEntity :: NtfEntity -> Type
[SToken] :: SNtfEntity 'Token
[SSubscription] :: SNtfEntity 'Subscription
class NtfEntityI (e :: NtfEntity)
sNtfEntity :: NtfEntityI e => SNtfEntity e
data NtfCommandTag (e :: NtfEntity)
[TNEW_] :: NtfCommandTag 'Token
[TVFY_] :: NtfCommandTag 'Token
[TCHK_] :: NtfCommandTag 'Token
[TRPL_] :: NtfCommandTag 'Token
[TDEL_] :: NtfCommandTag 'Token
[TCRN_] :: NtfCommandTag 'Token
[SNEW_] :: NtfCommandTag 'Subscription
[SCHK_] :: NtfCommandTag 'Subscription
[SDEL_] :: NtfCommandTag 'Subscription
[PING_] :: NtfCommandTag 'Subscription
data NtfCmdTag
NCT :: SNtfEntity e -> NtfCommandTag e -> NtfCmdTag
newtype NtfRegCode
NtfRegCode :: ByteString -> NtfRegCode
data NewNtfEntity (e :: NtfEntity)
[NewNtfTkn] :: DeviceToken -> NtfPublicAuthKey -> PublicKeyX25519 -> NewNtfEntity 'Token
[NewNtfSub] :: NtfTokenId -> SMPQueueNtf -> NtfPrivateAuthKey -> NewNtfEntity 'Subscription
data ANewNtfEntity
ANE :: SNtfEntity e -> NewNtfEntity e -> ANewNtfEntity
data NtfCommand (e :: NtfEntity)

-- | register new device token for notifications
[TNEW] :: NewNtfEntity 'Token -> NtfCommand 'Token

-- | verify token - uses e2e encrypted random string sent to the device via
--   PN to confirm that the device has the token
[TVFY] :: NtfRegCode -> NtfCommand 'Token

-- | check token status
[TCHK] :: NtfCommand 'Token

-- | replace device token (while keeping all existing subscriptions)
[TRPL] :: DeviceToken -> NtfCommand 'Token

-- | delete token - all subscriptions will be removed and no more
--   notifications will be sent
[TDEL] :: NtfCommand 'Token

-- | enable periodic background notification to fetch the new messages -
--   interval is in minutes, minimum is 20, 0 to disable
[TCRN] :: Word16 -> NtfCommand 'Token

-- | create SMP subscription
[SNEW] :: NewNtfEntity 'Subscription -> NtfCommand 'Subscription

-- | check SMP subscription status (response is SUB)
[SCHK] :: NtfCommand 'Subscription

-- | delete SMP subscription
[SDEL] :: NtfCommand 'Subscription

-- | keep-alive command
[PING] :: NtfCommand 'Subscription
data NtfCmd
NtfCmd :: SNtfEntity e -> NtfCommand e -> NtfCmd
data NtfResponseTag
NRTknId_ :: NtfResponseTag
NRSubId_ :: NtfResponseTag
NROk_ :: NtfResponseTag
NRErr_ :: NtfResponseTag
NRTkn_ :: NtfResponseTag
NRSub_ :: NtfResponseTag
NRPong_ :: NtfResponseTag
data NtfResponse
NRTknId :: NtfEntityId -> PublicKeyX25519 -> NtfResponse
NRSubId :: NtfEntityId -> NtfResponse
NROk :: NtfResponse
NRErr :: ErrorType -> NtfResponse
NRTkn :: NtfTknStatus -> NtfResponse
NRSub :: NtfSubStatus -> NtfResponse
NRPong :: NtfResponse
data SMPQueueNtf
SMPQueueNtf :: SMPServer -> NotifierId -> SMPQueueNtf
[smpServer] :: SMPQueueNtf -> SMPServer
[notifierId] :: SMPQueueNtf -> NotifierId
data PushProvider
PPApnsDev :: PushProvider
PPApnsProd :: PushProvider
PPApnsTest :: PushProvider
PPApnsNull :: PushProvider
data DeviceToken
DeviceToken :: PushProvider -> ByteString -> DeviceToken
data PNMessageData
PNMessageData :: SMPQueueNtf -> SystemTime -> CbNonce -> EncNMsgMeta -> PNMessageData
[smpQueue] :: PNMessageData -> SMPQueueNtf
[ntfTs] :: PNMessageData -> SystemTime
[nmsgNonce] :: PNMessageData -> CbNonce
[encNMsgMeta] :: PNMessageData -> EncNMsgMeta
type NtfEntityId = EntityId
type NtfSubscriptionId = NtfEntityId
type NtfTokenId = NtfEntityId
data NtfSubStatus

-- | state after SNEW
NSNew :: NtfSubStatus

-- | pending connection/subscription to SMP server
NSPending :: NtfSubStatus

-- | connected and subscribed to SMP server
NSActive :: NtfSubStatus

-- | disconnected/unsubscribed from SMP server
NSInactive :: NtfSubStatus

-- | END received
NSEnd :: NtfSubStatus

-- | DELD received (connection was deleted)
NSDeleted :: NtfSubStatus

-- | SMP AUTH error
NSAuth :: NtfSubStatus

-- | SMP SERVICE error - rejected service signature on individual
--   subscriptions
NSService :: NtfSubStatus

-- | SMP error other than AUTH
NSErr :: ByteString -> NtfSubStatus
data NtfTknStatus

-- | Token created in DB
NTNew :: NtfTknStatus

-- | state after registration (TNEW)
NTRegistered :: NtfTknStatus

-- | if initial notification failed (push provider error) or verification
--   failed
NTInvalid :: Maybe NTInvalidReason -> NtfTknStatus

-- | Token confirmed via notification (accepted by push provider or
--   verification code received by client)
NTConfirmed :: NtfTknStatus

-- | after successful verification (TVFY)
NTActive :: NtfTknStatus

-- | after it is no longer valid (push provider error)
NTExpired :: NtfTknStatus
data NTInvalidReason
NTIRBadToken :: NTInvalidReason
NTIRTokenNotForTopic :: NTInvalidReason
NTIRExpiredToken :: NTInvalidReason
NTIRUnregistered :: NTInvalidReason
encodePNMessages :: NonEmpty PNMessageData -> ByteString
pnMessagesP :: Parser (NonEmpty PNMessageData)
ntfShouldSubscribe :: NtfSubStatus -> Bool
allowTokenVerification :: NtfTknStatus -> Bool
allowNtfSubCommands :: NtfTknStatus -> Bool
checkEntity :: forall t e e'. (NtfEntityI e, NtfEntityI e') => t e' -> Either String (t e)
instance GHC.Show.Show Simplex.Messaging.Notifications.Protocol.NtfEntity
instance GHC.Show.Show Simplex.Messaging.Notifications.Protocol.NtfRegCode
instance GHC.Classes.Eq Simplex.Messaging.Notifications.Protocol.NtfRegCode
instance GHC.Show.Show Simplex.Messaging.Notifications.Protocol.NtfResponseTag
instance GHC.Show.Show Simplex.Messaging.Notifications.Protocol.SMPQueueNtf
instance GHC.Classes.Ord Simplex.Messaging.Notifications.Protocol.SMPQueueNtf
instance GHC.Classes.Eq Simplex.Messaging.Notifications.Protocol.SMPQueueNtf
instance GHC.Show.Show Simplex.Messaging.Notifications.Protocol.PushProvider
instance GHC.Classes.Ord Simplex.Messaging.Notifications.Protocol.PushProvider
instance GHC.Classes.Eq Simplex.Messaging.Notifications.Protocol.PushProvider
instance GHC.Show.Show Simplex.Messaging.Notifications.Protocol.DeviceToken
instance GHC.Classes.Ord Simplex.Messaging.Notifications.Protocol.DeviceToken
instance GHC.Classes.Eq Simplex.Messaging.Notifications.Protocol.DeviceToken
instance GHC.Show.Show Simplex.Messaging.Notifications.Protocol.PNMessageData
instance GHC.Show.Show Simplex.Messaging.Notifications.Protocol.NtfSubStatus
instance GHC.Classes.Ord Simplex.Messaging.Notifications.Protocol.NtfSubStatus
instance GHC.Classes.Eq Simplex.Messaging.Notifications.Protocol.NtfSubStatus
instance GHC.Show.Show Simplex.Messaging.Notifications.Protocol.NTInvalidReason
instance GHC.Classes.Eq Simplex.Messaging.Notifications.Protocol.NTInvalidReason
instance GHC.Show.Show Simplex.Messaging.Notifications.Protocol.NtfTknStatus
instance GHC.Classes.Eq Simplex.Messaging.Notifications.Protocol.NtfTknStatus
instance GHC.Show.Show Simplex.Messaging.Notifications.Protocol.NtfResponse
instance GHC.Show.Show (Simplex.Messaging.Notifications.Protocol.SNtfEntity e)
instance GHC.Show.Show (Simplex.Messaging.Notifications.Protocol.NtfCommandTag e)
instance GHC.Show.Show (Simplex.Messaging.Notifications.Protocol.NewNtfEntity e)
instance GHC.Show.Show Simplex.Messaging.Notifications.Protocol.ANewNtfEntity
instance GHC.Show.Show (Simplex.Messaging.Notifications.Protocol.NtfCommand e)
instance GHC.Show.Show Simplex.Messaging.Notifications.Protocol.NtfCmd
instance Simplex.Messaging.Protocol.Protocol Simplex.Messaging.Notifications.Transport.NTFVersion Simplex.Messaging.Protocol.ErrorType Simplex.Messaging.Notifications.Protocol.NtfResponse
instance Simplex.Messaging.Notifications.Protocol.NtfEntityI e => Simplex.Messaging.Protocol.ProtocolEncoding Simplex.Messaging.Notifications.Transport.NTFVersion Simplex.Messaging.Protocol.ErrorType (Simplex.Messaging.Notifications.Protocol.NtfCommand e)
instance Simplex.Messaging.Protocol.ProtocolEncoding Simplex.Messaging.Notifications.Transport.NTFVersion Simplex.Messaging.Protocol.ErrorType Simplex.Messaging.Notifications.Protocol.NtfCmd
instance Simplex.Messaging.Protocol.ProtocolEncoding Simplex.Messaging.Notifications.Transport.NTFVersion Simplex.Messaging.Protocol.ErrorType Simplex.Messaging.Notifications.Protocol.NtfResponse
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Notifications.Protocol.NtfTknStatus
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Notifications.Protocol.NtfTknStatus
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Notifications.Protocol.NtfTknStatus
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Notifications.Protocol.NtfTknStatus
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Notifications.Protocol.NtfTknStatus
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Notifications.Protocol.NtfTknStatus
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Notifications.Protocol.NTInvalidReason
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Notifications.Protocol.NTInvalidReason
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Notifications.Protocol.NtfSubStatus
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Notifications.Protocol.NtfSubStatus
instance Simplex.Messaging.Notifications.Protocol.NtfEntityI e => Simplex.Messaging.Encoding.Encoding (Simplex.Messaging.Notifications.Protocol.NewNtfEntity e)
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Notifications.Protocol.ANewNtfEntity
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Notifications.Protocol.PNMessageData
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Notifications.Protocol.DeviceToken
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Notifications.Protocol.DeviceToken
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Notifications.Protocol.DeviceToken
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Notifications.Protocol.DeviceToken
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Notifications.Protocol.PushProvider
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Notifications.Protocol.PushProvider
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Notifications.Protocol.PushProvider
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Notifications.Protocol.PushProvider
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Notifications.Protocol.SMPQueueNtf
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Notifications.Protocol.SMPQueueNtf
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Notifications.Protocol.NtfResponseTag
instance Simplex.Messaging.Protocol.ProtocolMsgTag Simplex.Messaging.Notifications.Protocol.NtfResponseTag
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Notifications.Protocol.NtfRegCode
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Notifications.Protocol.NtfRegCode
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Notifications.Protocol.NtfRegCode
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Notifications.Protocol.NtfRegCode
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Notifications.Protocol.NtfCmdTag
instance Simplex.Messaging.Protocol.ProtocolMsgTag Simplex.Messaging.Notifications.Protocol.NtfCmdTag
instance Simplex.Messaging.Notifications.Protocol.NtfEntityI e => Simplex.Messaging.Protocol.ProtocolMsgTag (Simplex.Messaging.Notifications.Protocol.NtfCommandTag e)
instance Simplex.Messaging.Notifications.Protocol.NtfEntityI e => Simplex.Messaging.Encoding.Encoding (Simplex.Messaging.Notifications.Protocol.NtfCommandTag e)
instance Simplex.Messaging.Notifications.Protocol.NtfEntityI 'Simplex.Messaging.Notifications.Protocol.Token
instance Simplex.Messaging.Notifications.Protocol.NtfEntityI 'Simplex.Messaging.Notifications.Protocol.Subscription
instance Data.Type.Equality.TestEquality Simplex.Messaging.Notifications.Protocol.SNtfEntity

module Simplex.Messaging.Notifications.Types
data NtfTknAction
NTARegister :: NtfTknAction
NTAVerify :: NtfRegCode -> NtfTknAction
NTACheck :: NtfTknAction
NTADelete :: NtfTknAction
data NtfToken
NtfToken :: DeviceToken -> NtfServer -> Maybe NtfTokenId -> APublicAuthKey -> APrivateAuthKey -> KeyPairX25519 -> Maybe DhSecretX25519 -> NtfTknStatus -> Maybe NtfTknAction -> NotificationsMode -> NtfToken
[$sel:deviceToken:NtfToken] :: NtfToken -> DeviceToken
[$sel:ntfServer:NtfToken] :: NtfToken -> NtfServer
[$sel:ntfTokenId:NtfToken] :: NtfToken -> Maybe NtfTokenId

-- | key used by the ntf server to verify transmissions
[$sel:ntfPubKey:NtfToken] :: NtfToken -> APublicAuthKey

-- | key used by the ntf client to sign transmissions
[$sel:ntfPrivKey:NtfToken] :: NtfToken -> APrivateAuthKey

-- | client's DH keys (to repeat registration if necessary)
[$sel:ntfDhKeys:NtfToken] :: NtfToken -> KeyPairX25519

-- | shared DH secret used to encrypt/decrypt notifications e2e
[$sel:ntfDhSecret:NtfToken] :: NtfToken -> Maybe DhSecretX25519

-- | token status
[$sel:ntfTknStatus:NtfToken] :: NtfToken -> NtfTknStatus

-- | pending token action and the earliest time
[$sel:ntfTknAction:NtfToken] :: NtfToken -> Maybe NtfTknAction
[$sel:ntfMode:NtfToken] :: NtfToken -> NotificationsMode
data NtfSubAction
NSANtf :: NtfSubNTFAction -> NtfSubAction
NSASMP :: NtfSubSMPAction -> NtfSubAction
type NtfActionTs = UTCTime
data NtfSubNTFAction
NSACreate :: NtfSubNTFAction
NSACheck :: NtfSubNTFAction
NSADelete :: NtfSubNTFAction
NSARotate :: NtfSubNTFAction
data NtfSubSMPAction
NSASmpKey :: NtfSubSMPAction
NSASmpDelete :: NtfSubSMPAction
data NtfAgentSubStatus

-- | subscription started
NASNew :: NtfAgentSubStatus

-- | state after NKEY - notifier ID is assigned to queue on SMP server
NASKey :: NtfAgentSubStatus

-- | state after SNEW - subscription created on notification server
NASCreated :: NtfSubStatus -> NtfAgentSubStatus

-- | state after SDEL (subscription is deleted on notification server)
NASOff :: NtfAgentSubStatus

-- | state after NDEL (notifier credentials are deleted on SMP server) Can
--   only exist transiently - if subscription record was updated by
--   notification supervisor mid worker operation, and hence got updated
--   instead of being fully deleted in the database post operation by
--   worker
NASDeleted :: NtfAgentSubStatus
data NtfSubscription
NtfSubscription :: UserId -> ConnId -> SMPServer -> Maybe NotifierId -> NtfServer -> Maybe NtfSubscriptionId -> NtfAgentSubStatus -> NtfSubscription
[$sel:userId:NtfSubscription] :: NtfSubscription -> UserId
[$sel:connId:NtfSubscription] :: NtfSubscription -> ConnId
[$sel:smpServer:NtfSubscription] :: NtfSubscription -> SMPServer
[$sel:ntfQueueId:NtfSubscription] :: NtfSubscription -> Maybe NotifierId
[$sel:ntfServer:NtfSubscription] :: NtfSubscription -> NtfServer
[$sel:ntfSubId:NtfSubscription] :: NtfSubscription -> Maybe NtfSubscriptionId
[$sel:ntfSubStatus:NtfSubscription] :: NtfSubscription -> NtfAgentSubStatus
newNtfToken :: DeviceToken -> NtfServer -> AAuthKeyPair -> KeyPairX25519 -> NotificationsMode -> NtfToken
isDeleteNtfSubAction :: NtfSubAction -> Bool
newNtfSubscription :: UserId -> ConnId -> SMPServer -> Maybe NotifierId -> NtfServer -> NtfAgentSubStatus -> NtfSubscription
instance GHC.Show.Show Simplex.Messaging.Notifications.Types.NtfTknAction
instance GHC.Show.Show Simplex.Messaging.Notifications.Types.NtfToken
instance GHC.Show.Show Simplex.Messaging.Notifications.Types.NtfSubNTFAction
instance GHC.Show.Show Simplex.Messaging.Notifications.Types.NtfSubSMPAction
instance GHC.Show.Show Simplex.Messaging.Notifications.Types.NtfSubAction
instance GHC.Show.Show Simplex.Messaging.Notifications.Types.NtfAgentSubStatus
instance GHC.Classes.Eq Simplex.Messaging.Notifications.Types.NtfAgentSubStatus
instance GHC.Show.Show Simplex.Messaging.Notifications.Types.NtfSubscription
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Notifications.Types.NtfAgentSubStatus
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Notifications.Types.NtfAgentSubStatus
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Notifications.Types.NtfAgentSubStatus
instance Simplex.Messaging.Encoding.String.TextEncoding Simplex.Messaging.Notifications.Types.NtfSubSMPAction
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Notifications.Types.NtfSubSMPAction
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Notifications.Types.NtfSubSMPAction
instance Simplex.Messaging.Encoding.String.TextEncoding Simplex.Messaging.Notifications.Types.NtfSubNTFAction
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Notifications.Types.NtfSubNTFAction
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Notifications.Types.NtfSubNTFAction
instance Simplex.Messaging.Encoding.Encoding Simplex.Messaging.Notifications.Types.NtfTknAction
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Notifications.Types.NtfTknAction
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Notifications.Types.NtfTknAction

module Simplex.Messaging.Notifications.Client
type NtfClient = ProtocolClient NTFVersion ErrorType NtfResponse
type NtfClientError = ProtocolClientError ErrorType
defaultNTFClientConfig :: ProtocolClientConfig NTFVersion
ntfRegisterToken :: NtfClient -> NetworkRequestMode -> APrivateAuthKey -> NewNtfEntity 'Token -> ExceptT NtfClientError IO (NtfTokenId, PublicKeyX25519)
ntfVerifyToken :: NtfClient -> NetworkRequestMode -> APrivateAuthKey -> NtfTokenId -> NtfRegCode -> ExceptT NtfClientError IO ()
ntfCheckToken :: NtfClient -> NetworkRequestMode -> APrivateAuthKey -> NtfTokenId -> ExceptT NtfClientError IO NtfTknStatus
ntfReplaceToken :: NtfClient -> NetworkRequestMode -> APrivateAuthKey -> NtfTokenId -> DeviceToken -> ExceptT NtfClientError IO ()
ntfDeleteToken :: NtfClient -> NetworkRequestMode -> APrivateAuthKey -> NtfTokenId -> ExceptT NtfClientError IO ()
ntfSetCronInterval :: NtfClient -> NetworkRequestMode -> APrivateAuthKey -> NtfTokenId -> Word16 -> ExceptT NtfClientError IO ()
ntfCreateSubscription :: NtfClient -> APrivateAuthKey -> NewNtfEntity 'Subscription -> ExceptT NtfClientError IO NtfSubscriptionId
ntfCreateSubscriptions :: NtfClient -> APrivateAuthKey -> NonEmpty (NewNtfEntity 'Subscription) -> IO (NonEmpty (Either NtfClientError NtfSubscriptionId))
ntfCheckSubscription :: NtfClient -> APrivateAuthKey -> NtfSubscriptionId -> ExceptT NtfClientError IO NtfSubStatus
ntfCheckSubscriptions :: NtfClient -> APrivateAuthKey -> NonEmpty NtfSubscriptionId -> IO (NonEmpty (Either NtfClientError NtfSubStatus))
ntfDeleteSubscription :: NtfClient -> APrivateAuthKey -> NtfSubscriptionId -> ExceptT NtfClientError IO ()

-- | Send notification server command
sendNtfCommand :: NtfEntityI e => NtfClient -> NetworkRequestMode -> Maybe APrivateAuthKey -> NtfEntityId -> NtfCommand e -> ExceptT NtfClientError IO NtfResponse
okNtfCommand :: NtfEntityI e => NtfCommand e -> NtfClient -> NetworkRequestMode -> APrivateAuthKey -> NtfEntityId -> ExceptT NtfClientError IO ()

module Simplex.Messaging.Agent.Store.SQLite.Migrations
initialize :: DBStore -> Maybe Query -> IO ()
run :: DBStore -> Maybe Query -> Bool -> MigrationsToRun -> IO ()
getCurrentMigrations :: Maybe Query -> Connection -> IO [Migration]

module Simplex.Messaging.Agent.Store.SQLite
data DBOpts
DBOpts :: FilePath -> [SQLiteFuncDef] -> ScrubbedBytes -> Bool -> Bool -> TrackQueries -> DBOpts
[$sel:dbFilePath:DBOpts] :: DBOpts -> FilePath
[$sel:dbFunctions:DBOpts] :: DBOpts -> [SQLiteFuncDef]
[$sel:dbKey:DBOpts] :: DBOpts -> ScrubbedBytes
[$sel:keepKey:DBOpts] :: DBOpts -> Bool
[$sel:vacuum:DBOpts] :: DBOpts -> Bool
[$sel:track:DBOpts] :: DBOpts -> TrackQueries
getCurrentMigrations :: Maybe Query -> Connection -> IO [Migration]
migrateDBSchema :: DBStore -> DBOpts -> Maybe Query -> [Migration] -> MigrationConfig -> IO (Either MigrationError ())
createDBStore :: DBOpts -> [Migration] -> MigrationConfig -> IO (Either MigrationError DBStore)
closeDBStore :: DBStore -> IO ()
reopenDBStore :: DBStore -> IO ()
execSQL :: Connection -> Text -> IO [Text]
sqlString :: Text -> Text
keyString :: ScrubbedBytes -> Text
storeKey :: ScrubbedBytes -> Bool -> Maybe ScrubbedBytes
connectSQLiteStore :: DBOpts -> IO DBStore
openSQLiteStore :: DBStore -> ScrubbedBytes -> Bool -> IO ()

module Simplex.Messaging.Agent.Store.Interface

module Simplex.Messaging.Agent.Store
type RcvQueue = StoredRcvQueue 'DBStored
type NewRcvQueue = StoredRcvQueue 'DBNew

-- | A receive queue. SMP queue through which the agent receives messages
--   from a sender.
data StoredRcvQueue (q :: DBStored)
RcvQueue :: UserId -> ConnId -> SMPServer -> RecipientId -> RcvPrivateAuthKey -> RcvDhSecret -> PrivateKeyX25519 -> Maybe DhSecretX25519 -> SenderId -> Maybe QueueMode -> Maybe ShortLinkCreds -> Maybe (StoredClientService q) -> QueueStatus -> Bool -> Maybe NoticeId -> DBEntityId' q -> Bool -> Maybe Int64 -> Maybe RcvSwitchStatus -> VersionSMPC -> Maybe ClientNtfCreds -> Int -> StoredRcvQueue (q :: DBStored)
[$sel:userId:RcvQueue] :: StoredRcvQueue (q :: DBStored) -> UserId
[$sel:connId:RcvQueue] :: StoredRcvQueue (q :: DBStored) -> ConnId
[$sel:server:RcvQueue] :: StoredRcvQueue (q :: DBStored) -> SMPServer

-- | recipient queue ID
[$sel:rcvId:RcvQueue] :: StoredRcvQueue (q :: DBStored) -> RecipientId

-- | key used by the recipient to authorize transmissions
[$sel:rcvPrivateKey:RcvQueue] :: StoredRcvQueue (q :: DBStored) -> RcvPrivateAuthKey

-- | shared DH secret used to encrypt/decrypt message bodies from server to
--   recipient
[$sel:rcvDhSecret:RcvQueue] :: StoredRcvQueue (q :: DBStored) -> RcvDhSecret

-- | private DH key related to public sent to sender out-of-band (to agree
--   simple per-queue e2e)
[$sel:e2ePrivKey:RcvQueue] :: StoredRcvQueue (q :: DBStored) -> PrivateKeyX25519

-- | public sender's DH key and agreed shared DH secret for simple
--   per-queue e2e
[$sel:e2eDhSecret:RcvQueue] :: StoredRcvQueue (q :: DBStored) -> Maybe DhSecretX25519

-- | sender queue ID
[$sel:sndId:RcvQueue] :: StoredRcvQueue (q :: DBStored) -> SenderId

-- | sender can secure the queue
[$sel:queueMode:RcvQueue] :: StoredRcvQueue (q :: DBStored) -> Maybe QueueMode

-- | short link ID and credentials
[$sel:shortLink:RcvQueue] :: StoredRcvQueue (q :: DBStored) -> Maybe ShortLinkCreds

-- | associated client service
[$sel:clientService:RcvQueue] :: StoredRcvQueue (q :: DBStored) -> Maybe (StoredClientService q)

-- | queue status
[$sel:status:RcvQueue] :: StoredRcvQueue (q :: DBStored) -> QueueStatus

-- | to enable notifications for this queue - this field is duplicated from
--   ConnData
[$sel:enableNtfs:RcvQueue] :: StoredRcvQueue (q :: DBStored) -> Bool

-- | client notice
[$sel:clientNoticeId:RcvQueue] :: StoredRcvQueue (q :: DBStored) -> Maybe NoticeId

-- | database queue ID (within connection)
[$sel:dbQueueId:RcvQueue] :: StoredRcvQueue (q :: DBStored) -> DBEntityId' q

-- | True for a primary or a next primary queue of the connection (next if
--   dbReplaceQueueId is set)
[$sel:primary:RcvQueue] :: StoredRcvQueue (q :: DBStored) -> Bool

-- | database queue ID to replace, Nothing if this queue is not replacing
--   another, `Just Nothing` is used for replacing old queues
[$sel:dbReplaceQueueId:RcvQueue] :: StoredRcvQueue (q :: DBStored) -> Maybe Int64
[$sel:rcvSwchStatus:RcvQueue] :: StoredRcvQueue (q :: DBStored) -> Maybe RcvSwitchStatus

-- | SMP client version
[$sel:smpClientVersion:RcvQueue] :: StoredRcvQueue (q :: DBStored) -> VersionSMPC

-- | credentials used in context of notifications
[$sel:clientNtfCreds:RcvQueue] :: StoredRcvQueue (q :: DBStored) -> Maybe ClientNtfCreds
[$sel:deleteErrors:RcvQueue] :: StoredRcvQueue (q :: DBStored) -> Int
data RcvQueueSub
RcvQueueSub :: UserId -> ConnId -> SMPServer -> RecipientId -> RcvPrivateAuthKey -> QueueStatus -> Bool -> Maybe NoticeId -> Int64 -> Bool -> Maybe Int64 -> RcvQueueSub
[$sel:userId:RcvQueueSub] :: RcvQueueSub -> UserId
[$sel:connId:RcvQueueSub] :: RcvQueueSub -> ConnId
[$sel:server:RcvQueueSub] :: RcvQueueSub -> SMPServer
[$sel:rcvId:RcvQueueSub] :: RcvQueueSub -> RecipientId
[$sel:rcvPrivateKey:RcvQueueSub] :: RcvQueueSub -> RcvPrivateAuthKey
[$sel:status:RcvQueueSub] :: RcvQueueSub -> QueueStatus
[$sel:enableNtfs:RcvQueueSub] :: RcvQueueSub -> Bool
[$sel:clientNoticeId:RcvQueueSub] :: RcvQueueSub -> Maybe NoticeId
[$sel:dbQueueId:RcvQueueSub] :: RcvQueueSub -> Int64
[$sel:primary:RcvQueueSub] :: RcvQueueSub -> Bool
[$sel:dbReplaceQueueId:RcvQueueSub] :: RcvQueueSub -> Maybe Int64
data ClientNtfCreds
ClientNtfCreds :: NtfPublicAuthKey -> NtfPrivateAuthKey -> NotifierId -> RcvNtfDhSecret -> ClientNtfCreds

-- | key pair to be used by the notification server to authorize
--   transmissions
[$sel:ntfPublicKey:ClientNtfCreds] :: ClientNtfCreds -> NtfPublicAuthKey
[$sel:ntfPrivateKey:ClientNtfCreds] :: ClientNtfCreds -> NtfPrivateAuthKey

-- | queue ID to be used by the notification server for NSUB command
[$sel:notifierId:ClientNtfCreds] :: ClientNtfCreds -> NotifierId

-- | shared DH secret used to encrypt/decrypt notification metadata
--   (NMsgMeta) from server to recipient
[$sel:rcvNtfDhSecret:ClientNtfCreds] :: ClientNtfCreds -> RcvNtfDhSecret
data InvShortLink
InvShortLink :: SMPServer -> LinkId -> LinkKey -> SndPrivateAuthKey -> Maybe SenderId -> InvShortLink
[$sel:server:InvShortLink] :: InvShortLink -> SMPServer
[$sel:linkId:InvShortLink] :: InvShortLink -> LinkId
[$sel:linkKey:InvShortLink] :: InvShortLink -> LinkKey
[$sel:sndPrivateKey:InvShortLink] :: InvShortLink -> SndPrivateAuthKey
[$sel:sndId:InvShortLink] :: InvShortLink -> Maybe SenderId
type SndQueue = StoredSndQueue 'DBStored
type NewSndQueue = StoredSndQueue 'DBNew

-- | A send queue. SMP queue through which the agent sends messages to a
--   recipient.
data StoredSndQueue (q :: DBStored)
SndQueue :: UserId -> ConnId -> SMPServer -> SenderId -> Maybe QueueMode -> SndPrivateAuthKey -> Maybe PublicKeyX25519 -> DhSecretX25519 -> QueueStatus -> DBEntityId' q -> Bool -> Maybe Int64 -> Maybe SndSwitchStatus -> VersionSMPC -> StoredSndQueue (q :: DBStored)
[$sel:userId:SndQueue] :: StoredSndQueue (q :: DBStored) -> UserId
[$sel:connId:SndQueue] :: StoredSndQueue (q :: DBStored) -> ConnId
[$sel:server:SndQueue] :: StoredSndQueue (q :: DBStored) -> SMPServer

-- | sender queue ID
[$sel:sndId:SndQueue] :: StoredSndQueue (q :: DBStored) -> SenderId

-- | sender can secure the queue
[$sel:queueMode:SndQueue] :: StoredSndQueue (q :: DBStored) -> Maybe QueueMode

-- | sender key used to authorize transmissions
[$sel:sndPrivateKey:SndQueue] :: StoredSndQueue (q :: DBStored) -> SndPrivateAuthKey

-- | DH public key used to negotiate per-queue e2e encryption
[$sel:e2ePubKey:SndQueue] :: StoredSndQueue (q :: DBStored) -> Maybe PublicKeyX25519

-- | shared DH secret agreed for simple per-queue e2e encryption
[$sel:e2eDhSecret:SndQueue] :: StoredSndQueue (q :: DBStored) -> DhSecretX25519

-- | queue status
[$sel:status:SndQueue] :: StoredSndQueue (q :: DBStored) -> QueueStatus

-- | database queue ID (within connection)
[$sel:dbQueueId:SndQueue] :: StoredSndQueue (q :: DBStored) -> DBEntityId' q

-- | True for a primary or a next primary queue of the connection (next if
--   dbReplaceQueueId is set)
[$sel:primary:SndQueue] :: StoredSndQueue (q :: DBStored) -> Bool

-- | ID of the queue this one is replacing
[$sel:dbReplaceQueueId:SndQueue] :: StoredSndQueue (q :: DBStored) -> Maybe Int64
[$sel:sndSwchStatus:SndQueue] :: StoredSndQueue (q :: DBStored) -> Maybe SndSwitchStatus

-- | SMP client version
[$sel:smpClientVersion:SndQueue] :: StoredSndQueue (q :: DBStored) -> VersionSMPC
class SMPQueue q => SMPQueueRec q
qUserId :: SMPQueueRec q => q -> UserId
qConnId :: SMPQueueRec q => q -> ConnId
dbQId :: SMPQueueRec q => q -> Int64
qPrimary :: SMPQueueRec q => q -> Bool
dbReplaceQId :: SMPQueueRec q => q -> Maybe Int64
class SMPQueueRec q => SomeRcvQueue q
rcvAuthKey :: SomeRcvQueue q => q -> RcvPrivateAuthKey

-- | Type of a connection.
data ConnType
CNew :: ConnType
CRcv :: ConnType
CSnd :: ConnType
CDuplex :: ConnType
CContact :: ConnType

-- | Connection of a specific type.
--   
--   <ul>
--   <li>RcvConnection is a connection that only has a receive queue set
--   up, typically created by a recipient initiating a duplex
--   connection.</li>
--   <li>SndConnection is a connection that only has a send queue set up,
--   typically created by a sender joining a duplex connection through a
--   recipient's invitation.</li>
--   <li>DuplexConnection is a connection that has both receive and send
--   queues set up, typically created by upgrading a receive or a send
--   connection with a missing queue.</li>
--   </ul>
data Connection' (d :: ConnType) rq sq
[NewConnection] :: ConnData -> Connection' CNew rq sq
[RcvConnection] :: ConnData -> rq -> Connection' CRcv rq sq
[SndConnection] :: ConnData -> sq -> Connection' CSnd rq sq
[DuplexConnection] :: ConnData -> NonEmpty rq -> NonEmpty sq -> Connection' CDuplex rq sq
[ContactConnection] :: ConnData -> rq -> Connection' CContact rq sq
type Connection d = Connection' d RcvQueue SndQueue
data SConnType :: ConnType -> Type
[SCNew] :: SConnType CNew
[SCRcv] :: SConnType CRcv
[SCSnd] :: SConnType CSnd
[SCDuplex] :: SConnType CDuplex
[SCContact] :: SConnType CContact

-- | Connection of an unknown type. Used to refer to an arbitrary
--   connection when retrieving from store.
data SomeConn' rq sq
SomeConn :: SConnType d -> Connection' d rq sq -> SomeConn' rq sq
type SomeConn = SomeConn' RcvQueue SndQueue
type SomeConnSub = SomeConn' RcvQueueSub SndQueue
data ConnData
ConnData :: ConnId -> UserId -> VersionSMPA -> Bool -> PrevExternalSndId -> Bool -> RatchetSyncState -> PQSupport -> ConnData
[$sel:connId:ConnData] :: ConnData -> ConnId
[$sel:userId:ConnData] :: ConnData -> UserId
[$sel:connAgentVersion:ConnData] :: ConnData -> VersionSMPA
[$sel:enableNtfs:ConnData] :: ConnData -> Bool
[$sel:lastExternalSndId:ConnData] :: ConnData -> PrevExternalSndId
[$sel:deleted:ConnData] :: ConnData -> Bool
[$sel:ratchetSyncState:ConnData] :: ConnData -> RatchetSyncState
[$sel:pqSupport:ConnData] :: ConnData -> PQSupport
type NoticeId = Int64
data PendingCommand
PendingCommand :: AsyncCmdId -> ACorrId -> UserId -> ConnId -> AgentCommand -> PendingCommand
[$sel:cmdId:PendingCommand] :: PendingCommand -> AsyncCmdId
[$sel:corrId:PendingCommand] :: PendingCommand -> ACorrId
[$sel:userId:PendingCommand] :: PendingCommand -> UserId
[$sel:connId:PendingCommand] :: PendingCommand -> ConnId
[$sel:command:PendingCommand] :: PendingCommand -> AgentCommand
data AgentCmdType
ACClient :: AgentCmdType
ACInternal :: AgentCmdType
data AgentCommand
AClientCommand :: ACommand -> AgentCommand
AInternalCommand :: InternalCommand -> AgentCommand
data AgentCommandTag
AClientCommandTag :: ACommandTag -> AgentCommandTag
AInternalCommandTag :: InternalCommandTag -> AgentCommandTag
data InternalCommand
ICAck :: RecipientId -> MsgId -> InternalCommand
ICAckDel :: RecipientId -> MsgId -> InternalId -> InternalCommand
ICAllowSecure :: RecipientId -> Maybe SndPublicAuthKey -> InternalCommand
ICDuplexSecure :: RecipientId -> SndPublicAuthKey -> InternalCommand
ICDeleteConn :: InternalCommand
ICDeleteRcvQueue :: RecipientId -> InternalCommand
ICQSecure :: RecipientId -> SndPublicAuthKey -> InternalCommand
ICQDelete :: RecipientId -> InternalCommand
data InternalCommandTag
ICAck_ :: InternalCommandTag
ICAckDel_ :: InternalCommandTag
ICAllowSecure_ :: InternalCommandTag
ICDuplexSecure_ :: InternalCommandTag
ICDeleteConn_ :: InternalCommandTag
ICDeleteRcvQueue_ :: InternalCommandTag
ICQSecure_ :: InternalCommandTag
ICQDelete_ :: InternalCommandTag
data NewConfirmation
NewConfirmation :: ConnId -> SMPConfirmation -> RatchetX448 -> NewConfirmation
[$sel:connId:NewConfirmation] :: NewConfirmation -> ConnId
[$sel:senderConf:NewConfirmation] :: NewConfirmation -> SMPConfirmation
[$sel:ratchetState:NewConfirmation] :: NewConfirmation -> RatchetX448
data AcceptedConfirmation
AcceptedConfirmation :: ConfirmationId -> ConnId -> SMPConfirmation -> RatchetX448 -> ConnInfo -> AcceptedConfirmation
[$sel:confirmationId:AcceptedConfirmation] :: AcceptedConfirmation -> ConfirmationId
[$sel:connId:AcceptedConfirmation] :: AcceptedConfirmation -> ConnId
[$sel:senderConf:AcceptedConfirmation] :: AcceptedConfirmation -> SMPConfirmation
[$sel:ratchetState:AcceptedConfirmation] :: AcceptedConfirmation -> RatchetX448
[$sel:ownConnInfo:AcceptedConfirmation] :: AcceptedConfirmation -> ConnInfo
data NewInvitation
NewInvitation :: ConnId -> ConnectionRequestUri 'CMInvitation -> ConnInfo -> NewInvitation
[$sel:contactConnId:NewInvitation] :: NewInvitation -> ConnId
[$sel:connReq:NewInvitation] :: NewInvitation -> ConnectionRequestUri 'CMInvitation
[$sel:recipientConnInfo:NewInvitation] :: NewInvitation -> ConnInfo
data Invitation
Invitation :: InvitationId -> Maybe ConnId -> ConnectionRequestUri 'CMInvitation -> ConnInfo -> Maybe ConnInfo -> Bool -> Invitation
[$sel:invitationId:Invitation] :: Invitation -> InvitationId
[$sel:contactConnId_:Invitation] :: Invitation -> Maybe ConnId
[$sel:connReq:Invitation] :: Invitation -> ConnectionRequestUri 'CMInvitation
[$sel:recipientConnInfo:Invitation] :: Invitation -> ConnInfo
[$sel:ownConnInfo:Invitation] :: Invitation -> Maybe ConnInfo
[$sel:accepted:Invitation] :: Invitation -> Bool

-- | Corresponds to <tt>last_external_snd_msg_id</tt> in
--   <tt>connections</tt> table
type PrevExternalSndId = Int64

-- | Corresponds to <tt>last_rcv_msg_hash</tt> in <tt>connections</tt>
--   table
type PrevRcvMsgHash = MsgHash

-- | Corresponds to <tt>last_snd_msg_hash</tt> in <tt>connections</tt>
--   table
type PrevSndMsgHash = MsgHash
data RcvMsgData
RcvMsgData :: MsgMeta -> AgentMessageType -> MsgFlags -> MsgBody -> InternalRcvId -> MsgHash -> MsgHash -> MsgHash -> RcvMsgData
[$sel:msgMeta:RcvMsgData] :: RcvMsgData -> MsgMeta
[$sel:msgType:RcvMsgData] :: RcvMsgData -> AgentMessageType
[$sel:msgFlags:RcvMsgData] :: RcvMsgData -> MsgFlags
[$sel:msgBody:RcvMsgData] :: RcvMsgData -> MsgBody
[$sel:internalRcvId:RcvMsgData] :: RcvMsgData -> InternalRcvId
[$sel:internalHash:RcvMsgData] :: RcvMsgData -> MsgHash
[$sel:externalPrevSndHash:RcvMsgData] :: RcvMsgData -> MsgHash
[$sel:encryptedMsgHash:RcvMsgData] :: RcvMsgData -> MsgHash
data RcvMsg
RcvMsg :: InternalId -> MsgMeta -> AgentMessageType -> MsgBody -> MsgHash -> Maybe MsgReceipt -> Bool -> RcvMsg
[$sel:internalId:RcvMsg] :: RcvMsg -> InternalId
[$sel:msgMeta:RcvMsg] :: RcvMsg -> MsgMeta
[$sel:msgType:RcvMsg] :: RcvMsg -> AgentMessageType
[$sel:msgBody:RcvMsg] :: RcvMsg -> MsgBody
[$sel:internalHash:RcvMsg] :: RcvMsg -> MsgHash
[$sel:msgReceipt:RcvMsg] :: RcvMsg -> Maybe MsgReceipt
[$sel:userAck:RcvMsg] :: RcvMsg -> Bool
data SndMsgData
SndMsgData :: InternalId -> InternalSndId -> InternalTs -> AgentMessageType -> MsgFlags -> MsgBody -> PQEncryption -> MsgHash -> MsgHash -> Maybe SndMsgPrepData -> SndMsgData
[$sel:internalId:SndMsgData] :: SndMsgData -> InternalId
[$sel:internalSndId:SndMsgData] :: SndMsgData -> InternalSndId
[$sel:internalTs:SndMsgData] :: SndMsgData -> InternalTs
[$sel:msgType:SndMsgData] :: SndMsgData -> AgentMessageType
[$sel:msgFlags:SndMsgData] :: SndMsgData -> MsgFlags
[$sel:msgBody:SndMsgData] :: SndMsgData -> MsgBody
[$sel:pqEncryption:SndMsgData] :: SndMsgData -> PQEncryption
[$sel:internalHash:SndMsgData] :: SndMsgData -> MsgHash
[$sel:prevMsgHash:SndMsgData] :: SndMsgData -> MsgHash
[$sel:sndMsgPrepData_:SndMsgData] :: SndMsgData -> Maybe SndMsgPrepData
data SndMsgPrepData
SndMsgPrepData :: MsgEncryptKeyX448 -> Int -> Int64 -> SndMsgPrepData
[$sel:encryptKey:SndMsgPrepData] :: SndMsgPrepData -> MsgEncryptKeyX448
[$sel:paddedLen:SndMsgPrepData] :: SndMsgPrepData -> Int
[$sel:sndMsgBodyId:SndMsgPrepData] :: SndMsgPrepData -> Int64
data SndMsg
SndMsg :: InternalId -> InternalSndId -> AgentMessageType -> MsgHash -> Maybe MsgReceipt -> SndMsg
[$sel:internalId:SndMsg] :: SndMsg -> InternalId
[$sel:internalSndId:SndMsg] :: SndMsg -> InternalSndId
[$sel:msgType:SndMsg] :: SndMsg -> AgentMessageType
[$sel:internalHash:SndMsg] :: SndMsg -> MsgHash
[$sel:msgReceipt:SndMsg] :: SndMsg -> Maybe MsgReceipt
data PendingMsgData
PendingMsgData :: InternalId -> AgentMessageType -> MsgFlags -> MsgBody -> PQEncryption -> Maybe RI2State -> InternalTs -> InternalSndId -> PrevSndMsgHash -> Maybe PendingMsgPrepData -> PendingMsgData
[$sel:msgId:PendingMsgData] :: PendingMsgData -> InternalId
[$sel:msgType:PendingMsgData] :: PendingMsgData -> AgentMessageType
[$sel:msgFlags:PendingMsgData] :: PendingMsgData -> MsgFlags
[$sel:msgBody:PendingMsgData] :: PendingMsgData -> MsgBody
[$sel:pqEncryption:PendingMsgData] :: PendingMsgData -> PQEncryption
[$sel:msgRetryState:PendingMsgData] :: PendingMsgData -> Maybe RI2State
[$sel:internalTs:PendingMsgData] :: PendingMsgData -> InternalTs
[$sel:internalSndId:PendingMsgData] :: PendingMsgData -> InternalSndId
[$sel:prevMsgHash:PendingMsgData] :: PendingMsgData -> PrevSndMsgHash
[$sel:pendingMsgPrepData_:PendingMsgData] :: PendingMsgData -> Maybe PendingMsgPrepData
data PendingMsgPrepData
PendingMsgPrepData :: MsgEncryptKeyX448 -> Int -> AMessage -> PendingMsgPrepData
[$sel:encryptKey:PendingMsgPrepData] :: PendingMsgPrepData -> MsgEncryptKeyX448
[$sel:paddedLen:PendingMsgPrepData] :: PendingMsgPrepData -> Int
[$sel:sndMsgBody:PendingMsgPrepData] :: PendingMsgPrepData -> AMessage
newtype InternalRcvId
InternalRcvId :: Int64 -> InternalRcvId
[$sel:unRcvId:InternalRcvId] :: InternalRcvId -> Int64
type ExternalSndId = Int64
type ExternalSndTs = UTCTime
type BrokerId = MsgId
type BrokerTs = UTCTime
newtype InternalSndId
InternalSndId :: Int64 -> InternalSndId
[$sel:unSndId:InternalSndId] :: InternalSndId -> Int64

-- | Base message data independent of direction.
data MsgBase
MsgBase :: ConnId -> InternalId -> InternalTs -> MsgBody -> MsgHash -> MsgBase
[$sel:connId:MsgBase] :: MsgBase -> ConnId

-- | Monotonically increasing id of a message per connection, internal to
--   the agent. Internal Id preserves ordering between both received and
--   sent messages, and is needed to track the order of the conversation
--   (which can be different for the sender / receiver) and address
--   messages in commands. External [sender] Id cannot be used for this
--   purpose due to a possibility of implementation errors in different
--   agents.
[$sel:internalId:MsgBase] :: MsgBase -> InternalId
[$sel:internalTs:MsgBase] :: MsgBase -> InternalTs
[$sel:msgBody:MsgBase] :: MsgBase -> MsgBody

-- | Hash of the message as computed by agent.
[$sel:internalHash:MsgBase] :: MsgBase -> MsgHash
newtype InternalId
InternalId :: Int64 -> InternalId
[$sel:unId:InternalId] :: InternalId -> Int64
type InternalTs = UTCTime
type AsyncCmdId = Int64

-- | Agent store error.
data StoreError

-- | IO exceptions in store actions.
SEInternal :: ByteString -> StoreError

-- | Database busy
SEDatabaseBusy :: ByteString -> StoreError

-- | Failed to generate unique random ID
SEUniqueID :: StoreError

-- | User ID not found
SEUserNotFound :: StoreError

-- | Connection not found (or both queues absent).
SEConnNotFound :: StoreError

-- | Server not found.
SEServerNotFound :: StoreError

-- | Connection already used.
SEConnDuplicate :: StoreError

-- | Confirmed snd queue already exists.
SESndQueueExists :: StoreError

-- | Wrong connection type, e.g. "send" connection when "receive" or
--   "duplex" is expected, or vice versa. <tt>upgradeRcvConnToDuplex</tt>
--   and <tt>upgradeSndConnToDuplex</tt> do not allow duplex connections -
--   they would also return this error.
SEBadConnType :: String -> ConnType -> StoreError

-- | Confirmation not found.
SEConfirmationNotFound :: StoreError

-- | Invitation not found
SEInvitationNotFound :: String -> InvitationId -> StoreError

-- | Message not found
SEMsgNotFound :: String -> StoreError

-- | Command not found
SECmdNotFound :: StoreError

-- | Currently not used. The intention was to pass current expected queue
--   status in methods, as we always know what it should be at any stage of
--   the protocol, and in case it does not match use this error.
SEBadQueueStatus :: StoreError

-- | connection does not have associated double-ratchet state
SERatchetNotFound :: StoreError

-- | connection does not have associated x3dh keys
SEX3dhKeysNotFound :: StoreError

-- | Used to wrap agent errors inside store operations to avoid race
--   conditions
SEAgentError :: AgentErrorType -> StoreError

-- | XFTP Server not found.
SEXFTPServerNotFound :: StoreError

-- | XFTP File not found.
SEFileNotFound :: StoreError

-- | XFTP Deleted snd chunk replica not found.
SEDeletedSndChunkReplicaNotFound :: StoreError

-- | Error when reading work item that suspends worker - do not use!
SEWorkItemError :: String -> StoreError
[$sel:errContext:SEInternal] :: StoreError -> String

-- | Servers stats not found.
SEServersStatsNotFound :: StoreError
class (Show e, AnyError e) => AnyStoreError e
isWorkItemError :: AnyStoreError e => e -> Bool
mkWorkItemError :: AnyStoreError e => String -> e
createStore :: DBOpts -> MigrationConfig -> IO (Either MigrationError DBStore)
rcvQueueSub :: RcvQueue -> RcvQueueSub
clientServiceId :: RcvQueue -> Maybe ClientServiceId
rcvSMPQueueAddress :: RcvQueue -> SMPQueueAddress
canAbortRcvSwitch :: RcvQueue -> Bool
findQ :: SMPQueue q => (SMPServer, QueueId) -> NonEmpty q -> Maybe q
removeQ :: SMPQueue q => (SMPServer, QueueId) -> NonEmpty q -> Maybe (q, [q])
removeQP :: (q -> Bool) -> NonEmpty q -> Maybe (q, [q])
sndAddress :: RcvQueue -> (SMPServer, SenderId)
findRQ :: (SMPServer, SenderId) -> NonEmpty RcvQueue -> Maybe RcvQueue
switchingRQ :: NonEmpty RcvQueue -> Maybe RcvQueue
updatedQs :: SMPQueueRec q => q -> NonEmpty q -> NonEmpty q
toConnData :: Connection' d rq sq -> ConnData
updateConnection :: ConnData -> Connection' d rq sq -> Connection' d rq sq
connType :: SConnType c -> ConnType
ratchetSyncAllowed :: ConnData -> Bool
ratchetSyncSendProhibited :: ConnData -> Bool
agentCommandTag :: AgentCommand -> AgentCommandTag
internalCmdTag :: InternalCommand -> InternalCommandTag
instance GHC.Show.Show Simplex.Messaging.Agent.Store.ClientNtfCreds
instance GHC.Show.Show Simplex.Messaging.Agent.Store.InvShortLink
instance GHC.Show.Show (Simplex.Messaging.Agent.Store.StoredSndQueue q)
instance GHC.Show.Show Simplex.Messaging.Agent.Store.ConnType
instance GHC.Classes.Eq Simplex.Messaging.Agent.Store.ConnType
instance GHC.Show.Show Simplex.Messaging.Agent.Store.RcvQueueSub
instance GHC.Show.Show (Simplex.Messaging.Agent.Store.StoredRcvQueue q)
instance GHC.Show.Show Simplex.Messaging.Agent.Store.InternalCommandTag
instance GHC.Show.Show Simplex.Messaging.Agent.Store.AgentCommandTag
instance GHC.Show.Show Simplex.Messaging.Agent.Store.ConnData
instance GHC.Classes.Eq Simplex.Messaging.Agent.Store.ConnData
instance GHC.Show.Show Simplex.Messaging.Agent.Store.SndMsgPrepData
instance GHC.Show.Show Simplex.Messaging.Agent.Store.PendingMsgPrepData
instance GHC.Show.Show Simplex.Messaging.Agent.Store.InternalRcvId
instance GHC.Classes.Eq Simplex.Messaging.Agent.Store.InternalRcvId
instance GHC.Show.Show Simplex.Messaging.Agent.Store.InternalSndId
instance GHC.Classes.Eq Simplex.Messaging.Agent.Store.InternalSndId
instance GHC.Show.Show Simplex.Messaging.Agent.Store.InternalId
instance GHC.Classes.Eq Simplex.Messaging.Agent.Store.InternalId
instance GHC.Show.Show Simplex.Messaging.Agent.Store.MsgBase
instance GHC.Classes.Eq Simplex.Messaging.Agent.Store.MsgBase
instance GHC.Show.Show Simplex.Messaging.Agent.Store.PendingMsgData
instance GHC.Exception.Type.Exception Simplex.Messaging.Agent.Store.StoreError
instance GHC.Show.Show Simplex.Messaging.Agent.Store.StoreError
instance GHC.Classes.Eq Simplex.Messaging.Agent.Store.StoreError
instance (GHC.Show.Show rq, GHC.Show.Show sq) => GHC.Show.Show (Simplex.Messaging.Agent.Store.Connection' d rq sq)
instance GHC.Show.Show (Simplex.Messaging.Agent.Store.SConnType d)
instance (GHC.Show.Show rq, GHC.Show.Show sq) => GHC.Show.Show (Simplex.Messaging.Agent.Store.SomeConn' rq sq)
instance Simplex.Messaging.Agent.Store.AnyStoreError Simplex.Messaging.Agent.Store.StoreError
instance Simplex.Messaging.Util.AnyError Simplex.Messaging.Agent.Store.StoreError
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Agent.Store.AgentCommand
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Agent.Store.InternalCommand
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Agent.Store.InternalId
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Agent.Store.AgentCommandTag
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Agent.Store.InternalCommandTag
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Agent.Store.AgentCmdType
instance Simplex.Messaging.Agent.Protocol.SMPQueue Simplex.Messaging.Agent.Store.RcvQueue
instance Simplex.Messaging.Agent.Store.SMPQueueRec Simplex.Messaging.Agent.Store.RcvQueue
instance Simplex.Messaging.Agent.Store.SomeRcvQueue Simplex.Messaging.Agent.Store.RcvQueue
instance Simplex.Messaging.Agent.Protocol.SMPQueue Simplex.Messaging.Agent.Store.NewRcvQueue
instance Simplex.Messaging.Agent.Protocol.SMPQueue Simplex.Messaging.Agent.Store.RcvQueueSub
instance Simplex.Messaging.Agent.Store.SMPQueueRec Simplex.Messaging.Agent.Store.RcvQueueSub
instance Simplex.Messaging.Agent.Store.SomeRcvQueue Simplex.Messaging.Agent.Store.RcvQueueSub
instance Data.Type.Equality.TestEquality Simplex.Messaging.Agent.Store.SConnType
instance Simplex.Messaging.Agent.Store.SMPQueueRec Simplex.Messaging.Agent.Store.SndQueue
instance Simplex.Messaging.Agent.Protocol.SMPQueue Simplex.Messaging.Agent.Store.SndQueue

module Simplex.Messaging.Agent.TSessionSubs
data TSessionSubs
data SessSubs
SessSubs :: TVar (Maybe SessionId) -> TMap RecipientId RcvQueueSub -> TMap RecipientId RcvQueueSub -> SessSubs
[subsSessId] :: SessSubs -> TVar (Maybe SessionId)
[activeSubs] :: SessSubs -> TMap RecipientId RcvQueueSub
[pendingSubs] :: SessSubs -> TMap RecipientId RcvQueueSub
emptyIO :: IO TSessionSubs
clear :: TSessionSubs -> STM ()
hasActiveSub :: SMPTransportSession -> RecipientId -> TSessionSubs -> STM Bool
hasPendingSub :: SMPTransportSession -> RecipientId -> TSessionSubs -> STM Bool
addPendingSub :: SMPTransportSession -> RcvQueueSub -> TSessionSubs -> STM ()
setSessionId :: SMPTransportSession -> SessionId -> TSessionSubs -> STM ()
addActiveSub :: SMPTransportSession -> SessionId -> RcvQueueSub -> TSessionSubs -> STM ()
batchAddActiveSubs :: SMPTransportSession -> SessionId -> [RcvQueueSub] -> TSessionSubs -> STM ()
batchAddPendingSubs :: SMPTransportSession -> [RcvQueueSub] -> TSessionSubs -> STM ()
deletePendingSub :: SMPTransportSession -> RecipientId -> TSessionSubs -> STM ()
batchDeletePendingSubs :: SMPTransportSession -> Set RecipientId -> TSessionSubs -> STM ()
deleteSub :: SMPTransportSession -> RecipientId -> TSessionSubs -> STM ()
batchDeleteSubs :: SomeRcvQueue q => SMPTransportSession -> [q] -> TSessionSubs -> STM ()
hasPendingSubs :: SMPTransportSession -> TSessionSubs -> STM Bool
getPendingSubs :: SMPTransportSession -> TSessionSubs -> STM (Map RecipientId RcvQueueSub)
getActiveSubs :: SMPTransportSession -> TSessionSubs -> STM (Map RecipientId RcvQueueSub)
setSubsPending :: TransportSessionMode -> SMPTransportSession -> SessionId -> TSessionSubs -> STM (Map RecipientId RcvQueueSub)
updateClientNotices :: SMPTransportSession -> [(RecipientId, Maybe Int64)] -> TSessionSubs -> STM ()
foldSessionSubs :: (a -> (SMPTransportSession, SessSubs) -> IO a) -> a -> TSessionSubs -> IO a
mapSubs :: (Map RecipientId RcvQueueSub -> a) -> SessSubs -> IO (a, a)

module Simplex.Messaging.Agent.Stats
data AgentSMPServerStats
AgentSMPServerStats :: TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> AgentSMPServerStats
[$sel:sentDirect:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:sentViaProxy:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:sentProxied:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:sentDirectAttempts:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:sentViaProxyAttempts:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:sentProxiedAttempts:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:sentAuthErrs:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:sentQuotaErrs:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:sentExpiredErrs:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:sentOtherErrs:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:recvMsgs:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:recvDuplicates:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:recvCryptoErrs:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:recvErrs:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:ackMsgs:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:ackAttempts:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:ackNoMsgErrs:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:ackOtherErrs:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:connCreated:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:connSecured:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:connCompleted:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:connDeleted:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:connDelAttempts:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:connDelErrs:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:connSubscribed:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:connSubAttempts:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:connSubIgnored:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:connSubErrs:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:ntfKey:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:ntfKeyAttempts:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:ntfKeyDeleted:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
[$sel:ntfKeyDeleteAttempts:AgentSMPServerStats] :: AgentSMPServerStats -> TVar Int
data AgentSMPServerStatsData
AgentSMPServerStatsData :: Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> OptionalInt -> OptionalInt -> OptionalInt -> OptionalInt -> AgentSMPServerStatsData
[$sel:_sentDirect:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> Int
[$sel:_sentViaProxy:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> Int
[$sel:_sentProxied:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> Int
[$sel:_sentDirectAttempts:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> Int
[$sel:_sentViaProxyAttempts:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> Int
[$sel:_sentProxiedAttempts:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> Int
[$sel:_sentAuthErrs:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> Int
[$sel:_sentQuotaErrs:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> Int
[$sel:_sentExpiredErrs:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> Int
[$sel:_sentOtherErrs:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> Int
[$sel:_recvMsgs:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> Int
[$sel:_recvDuplicates:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> Int
[$sel:_recvCryptoErrs:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> Int
[$sel:_recvErrs:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> Int
[$sel:_ackMsgs:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> Int
[$sel:_ackAttempts:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> Int
[$sel:_ackNoMsgErrs:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> Int
[$sel:_ackOtherErrs:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> Int
[$sel:_connCreated:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> Int
[$sel:_connSecured:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> Int
[$sel:_connCompleted:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> Int
[$sel:_connDeleted:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> Int
[$sel:_connDelAttempts:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> Int
[$sel:_connDelErrs:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> Int
[$sel:_connSubscribed:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> Int
[$sel:_connSubAttempts:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> Int
[$sel:_connSubIgnored:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> Int
[$sel:_connSubErrs:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> Int
[$sel:_ntfKey:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> OptionalInt
[$sel:_ntfKeyAttempts:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> OptionalInt
[$sel:_ntfKeyDeleted:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> OptionalInt
[$sel:_ntfKeyDeleteAttempts:AgentSMPServerStatsData] :: AgentSMPServerStatsData -> OptionalInt
newtype OptionalInt
OInt :: Int -> OptionalInt
[$sel:toInt:OInt] :: OptionalInt -> Int
data AgentXFTPServerStats
AgentXFTPServerStats :: TVar Int -> TVar Int64 -> TVar Int -> TVar Int -> TVar Int -> TVar Int64 -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> AgentXFTPServerStats
[$sel:uploads:AgentXFTPServerStats] :: AgentXFTPServerStats -> TVar Int
[$sel:uploadsSize:AgentXFTPServerStats] :: AgentXFTPServerStats -> TVar Int64
[$sel:uploadAttempts:AgentXFTPServerStats] :: AgentXFTPServerStats -> TVar Int
[$sel:uploadErrs:AgentXFTPServerStats] :: AgentXFTPServerStats -> TVar Int
[$sel:downloads:AgentXFTPServerStats] :: AgentXFTPServerStats -> TVar Int
[$sel:downloadsSize:AgentXFTPServerStats] :: AgentXFTPServerStats -> TVar Int64
[$sel:downloadAttempts:AgentXFTPServerStats] :: AgentXFTPServerStats -> TVar Int
[$sel:downloadAuthErrs:AgentXFTPServerStats] :: AgentXFTPServerStats -> TVar Int
[$sel:downloadErrs:AgentXFTPServerStats] :: AgentXFTPServerStats -> TVar Int
[$sel:deletions:AgentXFTPServerStats] :: AgentXFTPServerStats -> TVar Int
[$sel:deleteAttempts:AgentXFTPServerStats] :: AgentXFTPServerStats -> TVar Int
[$sel:deleteErrs:AgentXFTPServerStats] :: AgentXFTPServerStats -> TVar Int
data AgentXFTPServerStatsData
AgentXFTPServerStatsData :: Int -> Int64 -> Int -> Int -> Int -> Int64 -> Int -> Int -> Int -> Int -> Int -> Int -> AgentXFTPServerStatsData
[$sel:_uploads:AgentXFTPServerStatsData] :: AgentXFTPServerStatsData -> Int
[$sel:_uploadsSize:AgentXFTPServerStatsData] :: AgentXFTPServerStatsData -> Int64
[$sel:_uploadAttempts:AgentXFTPServerStatsData] :: AgentXFTPServerStatsData -> Int
[$sel:_uploadErrs:AgentXFTPServerStatsData] :: AgentXFTPServerStatsData -> Int
[$sel:_downloads:AgentXFTPServerStatsData] :: AgentXFTPServerStatsData -> Int
[$sel:_downloadsSize:AgentXFTPServerStatsData] :: AgentXFTPServerStatsData -> Int64
[$sel:_downloadAttempts:AgentXFTPServerStatsData] :: AgentXFTPServerStatsData -> Int
[$sel:_downloadAuthErrs:AgentXFTPServerStatsData] :: AgentXFTPServerStatsData -> Int
[$sel:_downloadErrs:AgentXFTPServerStatsData] :: AgentXFTPServerStatsData -> Int
[$sel:_deletions:AgentXFTPServerStatsData] :: AgentXFTPServerStatsData -> Int
[$sel:_deleteAttempts:AgentXFTPServerStatsData] :: AgentXFTPServerStatsData -> Int
[$sel:_deleteErrs:AgentXFTPServerStatsData] :: AgentXFTPServerStatsData -> Int
data AgentNtfServerStats
AgentNtfServerStats :: TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> TVar Int -> AgentNtfServerStats
[$sel:ntfCreated:AgentNtfServerStats] :: AgentNtfServerStats -> TVar Int
[$sel:ntfCreateAttempts:AgentNtfServerStats] :: AgentNtfServerStats -> TVar Int
[$sel:ntfChecked:AgentNtfServerStats] :: AgentNtfServerStats -> TVar Int
[$sel:ntfCheckAttempts:AgentNtfServerStats] :: AgentNtfServerStats -> TVar Int
[$sel:ntfDeleted:AgentNtfServerStats] :: AgentNtfServerStats -> TVar Int
[$sel:ntfDelAttempts:AgentNtfServerStats] :: AgentNtfServerStats -> TVar Int
data AgentNtfServerStatsData
AgentNtfServerStatsData :: Int -> Int -> Int -> Int -> Int -> Int -> AgentNtfServerStatsData
[$sel:_ntfCreated:AgentNtfServerStatsData] :: AgentNtfServerStatsData -> Int
[$sel:_ntfCreateAttempts:AgentNtfServerStatsData] :: AgentNtfServerStatsData -> Int
[$sel:_ntfChecked:AgentNtfServerStatsData] :: AgentNtfServerStatsData -> Int
[$sel:_ntfCheckAttempts:AgentNtfServerStatsData] :: AgentNtfServerStatsData -> Int
[$sel:_ntfDeleted:AgentNtfServerStatsData] :: AgentNtfServerStatsData -> Int
[$sel:_ntfDelAttempts:AgentNtfServerStatsData] :: AgentNtfServerStatsData -> Int
data AgentPersistedServerStats
AgentPersistedServerStats :: Map (UserId, SMPServer) AgentSMPServerStatsData -> Map (UserId, XFTPServer) AgentXFTPServerStatsData -> OptionalMap (UserId, NtfServer) AgentNtfServerStatsData -> AgentPersistedServerStats
[$sel:smpServersStats:AgentPersistedServerStats] :: AgentPersistedServerStats -> Map (UserId, SMPServer) AgentSMPServerStatsData
[$sel:xftpServersStats:AgentPersistedServerStats] :: AgentPersistedServerStats -> Map (UserId, XFTPServer) AgentXFTPServerStatsData
[$sel:ntfServersStats:AgentPersistedServerStats] :: AgentPersistedServerStats -> OptionalMap (UserId, NtfServer) AgentNtfServerStatsData
newtype OptionalMap k v
OptionalMap :: Map k v -> OptionalMap k v
newAgentSMPServerStats :: STM AgentSMPServerStats
newAgentSMPServerStatsData :: AgentSMPServerStatsData
newAgentSMPServerStats' :: AgentSMPServerStatsData -> STM AgentSMPServerStats
getAgentSMPServerStats :: AgentSMPServerStats -> IO AgentSMPServerStatsData
addSMPStatsData :: AgentSMPServerStatsData -> AgentSMPServerStatsData -> AgentSMPServerStatsData
newAgentXFTPServerStats :: STM AgentXFTPServerStats
newAgentXFTPServerStatsData :: AgentXFTPServerStatsData
newAgentXFTPServerStats' :: AgentXFTPServerStatsData -> STM AgentXFTPServerStats
getAgentXFTPServerStats :: AgentXFTPServerStats -> IO AgentXFTPServerStatsData
addXFTPStatsData :: AgentXFTPServerStatsData -> AgentXFTPServerStatsData -> AgentXFTPServerStatsData
newAgentNtfServerStats :: STM AgentNtfServerStats
newAgentNtfServerStatsData :: AgentNtfServerStatsData
newAgentNtfServerStats' :: AgentNtfServerStatsData -> STM AgentNtfServerStats
getAgentNtfServerStats :: AgentNtfServerStats -> IO AgentNtfServerStatsData
addNtfStatsData :: AgentNtfServerStatsData -> AgentNtfServerStatsData -> AgentNtfServerStatsData
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Stats.AgentPersistedServerStats
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Stats.AgentPersistedServerStats
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Agent.Stats.AgentPersistedServerStats
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Agent.Stats.AgentPersistedServerStats
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Stats.AgentNtfServerStatsData
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Stats.AgentNtfServerStatsData
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Stats.AgentXFTPServerStatsData
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Stats.AgentXFTPServerStatsData
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Stats.AgentSMPServerStatsData
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Stats.AgentSMPServerStatsData
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Stats.OptionalInt
instance GHC.Show.Show Simplex.Messaging.Agent.Stats.OptionalInt
instance GHC.Num.Num Simplex.Messaging.Agent.Stats.OptionalInt
instance GHC.Show.Show Simplex.Messaging.Agent.Stats.AgentSMPServerStatsData
instance GHC.Show.Show Simplex.Messaging.Agent.Stats.AgentXFTPServerStatsData
instance GHC.Show.Show Simplex.Messaging.Agent.Stats.AgentNtfServerStatsData
instance (Data.Aeson.Types.ToJSON.ToJSON v, Data.Aeson.Types.ToJSON.ToJSONKey k) => Data.Aeson.Types.ToJSON.ToJSON (Simplex.Messaging.Agent.Stats.OptionalMap k v)
instance (GHC.Show.Show k, GHC.Show.Show v) => GHC.Show.Show (Simplex.Messaging.Agent.Stats.OptionalMap k v)
instance GHC.Show.Show Simplex.Messaging.Agent.Stats.AgentPersistedServerStats
instance (Data.Aeson.Types.FromJSON.FromJSONKey k, GHC.Classes.Ord k, Data.Aeson.Types.FromJSON.FromJSON v) => Data.Aeson.Types.FromJSON.FromJSON (Simplex.Messaging.Agent.Stats.OptionalMap k v)
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Stats.OptionalInt

module Simplex.Messaging.Agent.Store.AgentStore
createUserRecord :: Connection -> IO UserId
getUserIds :: Connection -> IO [UserId]
deleteUserRecord :: Connection -> UserId -> IO (Either StoreError ())
setUserDeleted :: Connection -> UserId -> IO (Either StoreError [ConnId])
deleteUserWithoutConns :: Connection -> UserId -> IO Bool
deleteUsersWithoutConns :: Connection -> IO [Int64]
checkUser :: Connection -> UserId -> IO (Either StoreError ())

-- | Creates a new server, if it doesn't exist, and returns the passed key
--   hash if it is different from stored.
createServer :: Connection -> SMPServer -> IO (Maybe KeyHash)
createNewConn :: Connection -> TVar ChaChaDRG -> ConnData -> SConnectionMode c -> IO (Either StoreError ConnId)
updateNewConnRcv :: Connection -> ConnId -> NewRcvQueue -> SubscriptionMode -> IO (Either StoreError RcvQueue)
updateNewConnSnd :: Connection -> ConnId -> NewSndQueue -> IO (Either StoreError SndQueue)
createSndConn :: Connection -> TVar ChaChaDRG -> ConnData -> NewSndQueue -> IO (Either StoreError (ConnId, SndQueue))
getClientNotices :: Connection -> [SMPServer] -> IO (Map (Maybe SMPServer) (Maybe SystemSeconds))
updateClientNotices :: Connection -> SMPTransportSession -> SystemSeconds -> [(RcvQueueSub, Maybe ClientNotice)] -> IO [(RecipientId, Maybe NoticeId)]
getSubscriptionServers :: Connection -> Bool -> IO [(UserId, SMPServer)]
getUserServerRcvQueueSubs :: Connection -> UserId -> SMPServer -> Bool -> Int -> Maybe RecipientId -> IO [RcvQueueSub]
unsetQueuesToSubscribe :: Connection -> IO ()
getConnIds :: Connection -> IO [ConnId]
getConn :: Connection -> ConnId -> IO (Either StoreError SomeConn)
getDeletedConn :: Connection -> ConnId -> IO (Either StoreError SomeConn)
getConns :: Connection -> [ConnId] -> IO [Either StoreError SomeConn]
getConnSubs :: Connection -> [ConnId] -> IO [Either StoreError SomeConnSub]
getDeletedConns :: Connection -> [ConnId] -> IO [Either StoreError SomeConn]
getConnsData :: Connection -> [ConnId] -> IO [Either StoreError (Maybe (ConnData, ConnectionMode))]
lockConnForUpdate :: Connection -> ConnId -> IO ()
setConnDeleted :: Connection -> Bool -> ConnId -> IO ()
setConnUserId :: Connection -> UserId -> ConnId -> UserId -> IO ()
setConnAgentVersion :: Connection -> ConnId -> VersionSMPA -> IO ()
setConnPQSupport :: Connection -> ConnId -> PQSupport -> IO ()
updateNewConnJoin :: Connection -> ConnId -> VersionSMPA -> PQSupport -> Bool -> IO ()
getDeletedConnIds :: Connection -> IO [ConnId]
getDeletedWaitingDeliveryConnIds :: Connection -> IO [ConnId]
setConnRatchetSync :: Connection -> ConnId -> RatchetSyncState -> IO ()
addProcessedRatchetKeyHash :: Connection -> ConnId -> ByteString -> IO ()
checkRatchetKeyHashExists :: Connection -> ConnId -> ByteString -> IO Bool
deleteRatchetKeyHashesExpired :: Connection -> NominalDiffTime -> Int -> IO ()
getRcvConn :: Connection -> SMPServer -> RecipientId -> IO (Either StoreError (RcvQueue, SomeConn))
getRcvQueueById :: Connection -> ConnId -> Int64 -> IO (Either StoreError RcvQueue)
getSndQueueById :: Connection -> ConnId -> Int64 -> IO (Either StoreError SndQueue)

-- | Deletes connection, optionally checking for pending snd message
--   deliveries; returns connection id if it was deleted
deleteConn :: Connection -> Maybe NominalDiffTime -> ConnId -> IO (Maybe ConnId)
deleteConnRecord :: Connection -> ConnId -> IO ()
upgradeRcvConnToDuplex :: Connection -> ConnId -> NewSndQueue -> IO (Either StoreError SndQueue)
upgradeSndConnToDuplex :: Connection -> ConnId -> NewRcvQueue -> SubscriptionMode -> IO (Either StoreError RcvQueue)
addConnRcvQueue :: Connection -> ConnId -> NewRcvQueue -> SubscriptionMode -> IO (Either StoreError RcvQueue)
addConnSndQueue :: Connection -> ConnId -> NewSndQueue -> IO (Either StoreError SndQueue)
setRcvQueueStatus :: Connection -> RcvQueue -> QueueStatus -> IO ()
setRcvSwitchStatus :: Connection -> RcvQueue -> Maybe RcvSwitchStatus -> IO RcvQueue
setRcvQueueDeleted :: Connection -> RcvQueue -> IO ()
setRcvQueueConfirmedE2E :: Connection -> RcvQueue -> DhSecretX25519 -> VersionSMPC -> IO ()
setSndQueueStatus :: Connection -> SndQueue -> QueueStatus -> IO ()
setSndSwitchStatus :: Connection -> SndQueue -> Maybe SndSwitchStatus -> IO SndQueue
setRcvQueuePrimary :: Connection -> ConnId -> RcvQueue -> IO ()
setSndQueuePrimary :: Connection -> ConnId -> SndQueue -> IO ()
deleteConnRcvQueue :: Connection -> RcvQueue -> IO ()
incRcvDeleteErrors :: Connection -> RcvQueue -> IO ()
deleteConnSndQueue :: Connection -> ConnId -> SndQueue -> IO ()
getPrimaryRcvQueue :: Connection -> ConnId -> IO (Either StoreError RcvQueue)
getRcvQueue :: Connection -> ConnId -> SMPServer -> RecipientId -> IO (Either StoreError RcvQueue)
getDeletedRcvQueue :: Connection -> ConnId -> SMPServer -> RecipientId -> IO (Either StoreError RcvQueue)
setRcvQueueNtfCreds :: Connection -> ConnId -> Maybe ClientNtfCreds -> IO ()
createConfirmation :: Connection -> TVar ChaChaDRG -> NewConfirmation -> IO (Either StoreError ConfirmationId)
acceptConfirmation :: Connection -> ConfirmationId -> ConnInfo -> IO (Either StoreError AcceptedConfirmation)
getAcceptedConfirmation :: Connection -> ConnId -> IO (Either StoreError AcceptedConfirmation)
removeConfirmations :: Connection -> ConnId -> IO ()
createInvitation :: Connection -> TVar ChaChaDRG -> NewInvitation -> IO (Either StoreError InvitationId)
getInvitation :: Connection -> String -> InvitationId -> IO (Either StoreError Invitation)
acceptInvitation :: Connection -> InvitationId -> ConnInfo -> IO ()
unacceptInvitation :: Connection -> InvitationId -> IO ()
deleteInvitation :: Connection -> InvitationId -> IO ()
getInvShortLink :: Connection -> SMPServer -> LinkId -> IO (Maybe InvShortLink)
getInvShortLinkKeys :: Connection -> SMPServer -> SenderId -> IO (Maybe (LinkId, APrivateAuthKey))
deleteInvShortLink :: Connection -> SMPServer -> LinkId -> IO ()
createInvShortLink :: Connection -> InvShortLink -> IO ()
setInvShortLinkSndId :: Connection -> InvShortLink -> SenderId -> IO ()
updateShortLinkCreds :: Connection -> RcvQueue -> ShortLinkCreds -> IO ()
updateRcvIds :: Connection -> ConnId -> IO (InternalId, InternalRcvId, PrevExternalSndId, PrevRcvMsgHash)
createRcvMsg :: Connection -> ConnId -> RcvQueue -> RcvMsgData -> IO ()
setLastBrokerTs :: Connection -> ConnId -> DBEntityId -> UTCTime -> IO ()
updateRcvMsgHash :: Connection -> ConnId -> AgentMsgId -> InternalRcvId -> MsgHash -> IO ()
createSndMsgBody :: Connection -> AMessage -> IO Int64
updateSndIds :: Connection -> ConnId -> IO (Either StoreError (InternalId, InternalSndId, PrevSndMsgHash))
createSndMsg :: Connection -> ConnId -> SndMsgData -> IO ()
updateSndMsgHash :: Connection -> ConnId -> InternalSndId -> MsgHash -> IO ()
createSndMsgDelivery :: Connection -> SndQueue -> InternalId -> IO ()
getSndMsgViaRcpt :: Connection -> ConnId -> InternalSndId -> IO (Either StoreError SndMsg)
updateSndMsgRcpt :: Connection -> ConnId -> InternalSndId -> MsgReceipt -> IO ()
getPendingQueueMsg :: Connection -> ConnId -> SndQueue -> IO (Either StoreError (Maybe (Maybe RcvQueue, PendingMsgData)))
getConnectionsForDelivery :: Connection -> IO [ConnId]
getAllSndQueuesForDelivery :: Connection -> IO [SndQueue]
updatePendingMsgRIState :: Connection -> ConnId -> InternalId -> RI2State -> IO ()
deletePendingMsgs :: Connection -> ConnId -> SndQueue -> IO ()
getExpiredSndMessages :: Connection -> ConnId -> SndQueue -> UTCTime -> IO [InternalId]
setMsgUserAck :: Connection -> ConnId -> InternalId -> IO (Either StoreError (RcvQueue, MsgId))
getRcvMsg :: Connection -> ConnId -> InternalId -> IO (Either StoreError RcvMsg)
getLastMsg :: Connection -> ConnId -> MsgId -> IO (Maybe RcvMsg)
incMsgRcvAttempts :: Connection -> ConnId -> InternalId -> IO Int
checkRcvMsgHashExists :: Connection -> ConnId -> ByteString -> IO Bool
getRcvMsgBrokerTs :: Connection -> ConnId -> MsgId -> IO (Either StoreError BrokerTs)
deleteMsg :: Connection -> ConnId -> InternalId -> IO ()
deleteDeliveredSndMsg :: Connection -> ConnId -> InternalId -> IO ()
deleteSndMsgDelivery :: Connection -> ConnId -> SndQueue -> InternalId -> Bool -> IO ()
deleteRcvMsgHashesExpired :: Connection -> NominalDiffTime -> Int -> IO ()
deleteSndMsgsExpired :: Connection -> NominalDiffTime -> Int -> IO ()
createRatchetX3dhKeys :: Connection -> ConnId -> PrivateKeyX448 -> PrivateKeyX448 -> Maybe RcvPrivRKEMParams -> IO ()
getRatchetX3dhKeys :: Connection -> ConnId -> IO (Either StoreError (PrivateKeyX448, PrivateKeyX448, Maybe RcvPrivRKEMParams))
setRatchetX3dhKeys :: Connection -> ConnId -> PrivateKeyX448 -> PrivateKeyX448 -> Maybe RcvPrivRKEMParams -> IO ()
createSndRatchet :: Connection -> ConnId -> RatchetX448 -> AE2ERatchetParams 'X448 -> IO ()
getSndRatchet :: Connection -> ConnId -> VersionE2E -> IO (Either StoreError (RatchetX448, AE2ERatchetParams 'X448))
createRatchet :: Connection -> ConnId -> RatchetX448 -> IO ()
deleteRatchet :: Connection -> ConnId -> IO ()
getRatchet :: Connection -> ConnId -> IO (Either StoreError RatchetX448)
getRatchetForUpdate :: Connection -> ConnId -> IO (Either StoreError RatchetX448)
getSkippedMsgKeys :: Connection -> ConnId -> IO SkippedMsgKeys
updateRatchet :: Connection -> ConnId -> RatchetX448 -> SkippedMsgDiff -> IO ()
createCommand :: Connection -> ACorrId -> ConnId -> Maybe SMPServer -> AgentCommand -> IO (Either StoreError ())
getPendingCommandServers :: Connection -> [ConnId] -> IO [(ConnId, NonEmpty (Maybe SMPServer))]
getAllPendingCommandConns :: Connection -> IO [(ConnId, Maybe SMPServer)]
getPendingServerCommand :: Connection -> ConnId -> Maybe SMPServer -> IO (Either StoreError (Maybe PendingCommand))
updateCommandServer :: Connection -> AsyncCmdId -> SMPServer -> IO (Either StoreError ())
deleteCommand :: Connection -> AsyncCmdId -> IO ()
createNtfToken :: Connection -> NtfToken -> IO ()
getSavedNtfToken :: Connection -> IO (Maybe NtfToken)
updateNtfTokenRegistration :: Connection -> NtfToken -> NtfTokenId -> DhSecretX25519 -> IO ()
updateDeviceToken :: Connection -> NtfToken -> DeviceToken -> IO ()
updateNtfMode :: Connection -> NtfToken -> NotificationsMode -> IO ()
updateNtfToken :: Connection -> NtfToken -> NtfTknStatus -> Maybe NtfTknAction -> IO ()
removeNtfToken :: Connection -> NtfToken -> IO ()
addNtfTokenToDelete :: Connection -> NtfServer -> APrivateAuthKey -> NtfTokenId -> IO ()
deleteExpiredNtfTokensToDelete :: Connection -> NominalDiffTime -> IO ()
type NtfTokenToDelete = (Int64, APrivateAuthKey, NtfTokenId)
getNextNtfTokenToDelete :: Connection -> NtfServer -> IO (Either StoreError (Maybe NtfTokenToDelete))
markNtfTokenToDeleteFailed_ :: Connection -> Int64 -> IO ()
getPendingDelTknServers :: Connection -> IO [NtfServer]
deleteNtfTokenToDelete :: Connection -> Int64 -> IO ()
type NtfSupervisorSub = (NtfSubscription, Maybe (NtfSubAction, NtfActionTs))
getNtfSubscription :: Connection -> ConnId -> IO (Maybe NtfSupervisorSub)
createNtfSubscription :: Connection -> NtfSubscription -> NtfSubAction -> IO (Either StoreError ())
supervisorUpdateNtfSub :: Connection -> NtfSubscription -> NtfSubAction -> IO ()
supervisorUpdateNtfAction :: Connection -> ConnId -> NtfSubAction -> IO ()
updateNtfSubscription :: Connection -> NtfSubscription -> NtfSubAction -> NtfActionTs -> IO ()
setNullNtfSubscriptionAction :: Connection -> ConnId -> IO ()
deleteNtfSubscription :: Connection -> ConnId -> IO ()
deleteNtfSubscription' :: Connection -> ConnId -> IO ()
getNextNtfSubNTFActions :: Connection -> NtfServer -> Int -> IO (Either StoreError [Either StoreError (NtfSubNTFAction, NtfSubscription, NtfActionTs)])
markNtfSubActionNtfFailed_ :: Connection -> ConnId -> IO ()
getNextNtfSubSMPActions :: Connection -> SMPServer -> Int -> IO (Either StoreError [Either StoreError (NtfSubSMPAction, NtfSubscription)])
markNtfSubActionSMPFailed_ :: Connection -> ConnId -> IO ()
getActiveNtfToken :: Connection -> IO (Maybe NtfToken)
getNtfRcvQueue :: Connection -> SMPQueueNtf -> IO (Either StoreError (ConnId, Int64, RcvNtfDhSecret, Maybe UTCTime))
setConnectionNtfs :: Connection -> ConnId -> Bool -> IO ()
createRcvFile :: Connection -> TVar ChaChaDRG -> UserId -> FileDescription 'FRecipient -> FilePath -> FilePath -> CryptoFile -> Bool -> IO (Either StoreError RcvFileId)
createRcvFileRedirect :: Connection -> TVar ChaChaDRG -> UserId -> FileDescription 'FRecipient -> FilePath -> FilePath -> CryptoFile -> FilePath -> CryptoFile -> Bool -> IO (Either StoreError RcvFileId)
lockRcvFileForUpdate :: Connection -> DBRcvFileId -> IO ()
getRcvFile :: Connection -> DBRcvFileId -> IO (Either StoreError RcvFile)
getRcvFileByEntityId :: Connection -> RcvFileId -> IO (Either StoreError RcvFile)
getRcvFileRedirects :: Connection -> DBRcvFileId -> IO [RcvFile]
updateRcvChunkReplicaDelay :: Connection -> Int64 -> Int64 -> IO ()
updateRcvFileChunkReceived :: Connection -> Int64 -> Int64 -> FilePath -> IO ()
updateRcvFileStatus :: Connection -> DBRcvFileId -> RcvFileStatus -> IO ()
updateRcvFileError :: Connection -> DBRcvFileId -> String -> IO ()
updateRcvFileComplete :: Connection -> DBRcvFileId -> IO ()
updateRcvFileRedirect :: Connection -> DBRcvFileId -> FileDescription 'FRecipient -> IO (Either StoreError ())
updateRcvFileNoTmpPath :: Connection -> DBRcvFileId -> IO ()
updateRcvFileDeleted :: Connection -> DBRcvFileId -> IO ()
deleteRcvFile' :: Connection -> DBRcvFileId -> IO ()
getNextRcvChunkToDownload :: Connection -> XFTPServer -> NominalDiffTime -> IO (Either StoreError (Maybe (RcvFileChunk, Bool, Maybe RcvFileId)))
getNextRcvFileToDecrypt :: Connection -> NominalDiffTime -> IO (Either StoreError (Maybe RcvFile))
getPendingRcvFilesServers :: Connection -> NominalDiffTime -> IO [XFTPServer]
getCleanupRcvFilesTmpPaths :: Connection -> IO [(DBRcvFileId, RcvFileId, FilePath)]
getCleanupRcvFilesDeleted :: Connection -> IO [(DBRcvFileId, RcvFileId, FilePath)]
getRcvFilesExpired :: Connection -> NominalDiffTime -> IO [(DBRcvFileId, RcvFileId, FilePath)]
createSndFile :: Connection -> TVar ChaChaDRG -> UserId -> CryptoFile -> Int -> FilePath -> SbKey -> CbNonce -> Maybe RedirectFileInfo -> IO (Either StoreError SndFileId)
lockSndFileForUpdate :: Connection -> DBSndFileId -> IO ()
getSndFile :: Connection -> DBSndFileId -> IO (Either StoreError SndFile)
getSndFileByEntityId :: Connection -> SndFileId -> IO (Either StoreError SndFile)
getNextSndFileToPrepare :: Connection -> NominalDiffTime -> IO (Either StoreError (Maybe SndFile))
updateSndFileError :: Connection -> DBSndFileId -> String -> IO ()
updateSndFileStatus :: Connection -> DBSndFileId -> SndFileStatus -> IO ()
updateSndFileEncrypted :: Connection -> DBSndFileId -> FileDigest -> [(XFTPChunkSpec, FileDigest)] -> IO ()
updateSndFileComplete :: Connection -> DBSndFileId -> IO ()
updateSndFileNoPrefixPath :: Connection -> DBSndFileId -> IO ()
updateSndFileDeleted :: Connection -> DBSndFileId -> IO ()
deleteSndFile' :: Connection -> DBSndFileId -> IO ()
getSndFileDeleted :: Connection -> DBSndFileId -> IO Bool
createSndFileReplica :: Connection -> SndFileChunk -> NewSndChunkReplica -> IO ()
createSndFileReplica_ :: Connection -> Int64 -> NewSndChunkReplica -> IO ()
getNextSndChunkToUpload :: Connection -> XFTPServer -> NominalDiffTime -> IO (Either StoreError (Maybe SndFileChunk))
updateSndChunkReplicaDelay :: Connection -> Int64 -> Int64 -> IO ()
addSndChunkReplicaRecipients :: Connection -> SndFileChunkReplica -> [(ChunkReplicaId, APrivateAuthKey)] -> IO SndFileChunkReplica
updateSndChunkReplicaStatus :: Connection -> Int64 -> SndFileReplicaStatus -> IO ()
getPendingSndFilesServers :: Connection -> NominalDiffTime -> IO [XFTPServer]
getCleanupSndFilesPrefixPaths :: Connection -> IO [(DBSndFileId, SndFileId, FilePath)]
getCleanupSndFilesDeleted :: Connection -> IO [(DBSndFileId, SndFileId, Maybe FilePath)]
getSndFilesExpired :: Connection -> NominalDiffTime -> IO [(DBSndFileId, SndFileId, Maybe FilePath)]
createDeletedSndChunkReplica :: Connection -> UserId -> FileChunkReplica -> FileDigest -> IO ()
getNextDeletedSndChunkReplica :: Connection -> XFTPServer -> NominalDiffTime -> IO (Either StoreError (Maybe DeletedSndChunkReplica))
updateDeletedSndChunkReplicaDelay :: Connection -> Int64 -> Int64 -> IO ()
deleteDeletedSndChunkReplica :: Connection -> Int64 -> IO ()
getPendingDelFilesServers :: Connection -> NominalDiffTime -> IO [XFTPServer]
deleteDeletedSndChunkReplicasExpired :: Connection -> NominalDiffTime -> IO ()
updateServersStats :: Connection -> AgentPersistedServerStats -> IO ()
getServersStats :: Connection -> IO (Either StoreError (UTCTime, Maybe AgentPersistedServerStats))
resetServersStats :: Connection -> UTCTime -> IO ()
withConnection :: DBStore -> (Connection -> IO a) -> IO a
withTransaction :: DBStore -> (Connection -> IO a) -> IO a
withTransactionPriority :: DBStore -> Bool -> (Connection -> IO a) -> IO a
firstRow :: (a -> b) -> e -> IO [a] -> IO (Either e b)
firstRow' :: (a -> Either e b) -> e -> IO [a] -> IO (Either e b)
maybeFirstRow :: Functor f => (a -> b) -> f [a] -> f (Maybe b)
fromOnlyBI :: Only BoolInt -> Bool
getWorkItem :: (Show i, AnyStoreError e) => String -> IO (Maybe i) -> (i -> IO (Either e a)) -> (i -> IO ()) -> IO (Either e (Maybe a))
getWorkItems :: (Show i, AnyStoreError e) => String -> IO [i] -> (i -> IO (Either e a)) -> (i -> IO ()) -> IO (Either e [Either e a])
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Agent.Store.InternalRcvId
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Agent.Store.InternalSndId
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Agent.Store.InternalId
instance Database.SQLite.Simple.FromField.FromField (Simplex.Messaging.Version.Internal.Version v)
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Transport.EntityId
instance Database.SQLite.Simple.ToField.ToField Simplex.FileTransfer.Description.ChunkReplicaId
instance Database.SQLite.Simple.FromField.FromField Simplex.FileTransfer.Description.ChunkReplicaId
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Agent.Protocol.QueueStatus
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Agent.Protocol.QueueStatus
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Agent.Store.InternalRcvId
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Agent.Store.InternalSndId
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Agent.Store.InternalId
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Agent.Protocol.AgentMessageType
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Agent.Protocol.AgentMessageType
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Agent.Protocol.MsgIntegrity
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Agent.Protocol.MsgIntegrity
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Agent.Protocol.SMPQueueUri
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Agent.Protocol.SMPQueueUri
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Agent.Protocol.AConnectionRequestUri
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Agent.Protocol.AConnectionRequestUri
instance Simplex.Messaging.Agent.Protocol.ConnectionModeI c => Database.SQLite.Simple.ToField.ToField (Simplex.Messaging.Agent.Protocol.ConnectionRequestUri c)
instance (Data.Typeable.Internal.Typeable c, Simplex.Messaging.Agent.Protocol.ConnectionModeI c) => Database.SQLite.Simple.FromField.FromField (Simplex.Messaging.Agent.Protocol.ConnectionRequestUri c)
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Agent.Protocol.ConnectionMode
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Agent.Protocol.ConnectionMode
instance Database.SQLite.Simple.ToField.ToField (Simplex.Messaging.Agent.Protocol.SConnectionMode c)
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Agent.Protocol.AConnectionMode
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Protocol.MsgFlags
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Protocol.MsgFlags
instance Database.SQLite.Simple.ToField.ToField [Simplex.Messaging.Agent.Protocol.SMPQueueInfo]
instance Database.SQLite.Simple.FromField.FromField [Simplex.Messaging.Agent.Protocol.SMPQueueInfo]
instance Database.SQLite.Simple.ToField.ToField (GHC.Base.NonEmpty Simplex.Messaging.Transport.Client.TransportHost)
instance Database.SQLite.Simple.FromField.FromField (GHC.Base.NonEmpty Simplex.Messaging.Transport.Client.TransportHost)
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Agent.Store.AgentCommand
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Agent.Store.AgentCommand
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Agent.Store.AgentCommandTag
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Agent.Store.AgentCommandTag
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Agent.Protocol.MsgReceiptStatus
instance Database.SQLite.Simple.FromField.FromField Simplex.Messaging.Agent.Protocol.MsgReceiptStatus
instance Database.SQLite.Simple.ToField.ToField (Simplex.Messaging.Version.Internal.Version v)
instance Database.SQLite.Simple.ToField.ToField Simplex.Messaging.Transport.EntityId
instance (Database.SQLite.Simple.FromField.FromField a, Database.SQLite.Simple.FromField.FromField b, Database.SQLite.Simple.FromField.FromField c, Database.SQLite.Simple.FromField.FromField d, Database.SQLite.Simple.FromField.FromField e, Database.SQLite.Simple.FromField.FromField f, Database.SQLite.Simple.FromField.FromField g, Database.SQLite.Simple.FromField.FromField h, Database.SQLite.Simple.FromField.FromField i, Database.SQLite.Simple.FromField.FromField j, Database.SQLite.Simple.FromField.FromField k) => Database.SQLite.Simple.FromRow.FromRow (a, b, c, d, e, f, g, h, i, j, k)
instance (Database.SQLite.Simple.FromField.FromField a, Database.SQLite.Simple.FromField.FromField b, Database.SQLite.Simple.FromField.FromField c, Database.SQLite.Simple.FromField.FromField d, Database.SQLite.Simple.FromField.FromField e, Database.SQLite.Simple.FromField.FromField f, Database.SQLite.Simple.FromField.FromField g, Database.SQLite.Simple.FromField.FromField h, Database.SQLite.Simple.FromField.FromField i, Database.SQLite.Simple.FromField.FromField j, Database.SQLite.Simple.FromField.FromField k, Database.SQLite.Simple.FromField.FromField l) => Database.SQLite.Simple.FromRow.FromRow (a, b, c, d, e, f, g, h, i, j, k, l)
instance (Database.SQLite.Simple.ToField.ToField a, Database.SQLite.Simple.ToField.ToField b, Database.SQLite.Simple.ToField.ToField c, Database.SQLite.Simple.ToField.ToField d, Database.SQLite.Simple.ToField.ToField e, Database.SQLite.Simple.ToField.ToField f, Database.SQLite.Simple.ToField.ToField g, Database.SQLite.Simple.ToField.ToField h, Database.SQLite.Simple.ToField.ToField i, Database.SQLite.Simple.ToField.ToField j, Database.SQLite.Simple.ToField.ToField k, Database.SQLite.Simple.ToField.ToField l) => Database.SQLite.Simple.ToRow.ToRow (a, b, c, d, e, f, g, h, i, j, k, l)

module Simplex.Messaging.Agent.Env.SQLite
type AM' a = ReaderT Env IO a
type AM a = ExceptT AgentErrorType (ReaderT Env IO) a
data AgentConfig
AgentConfig :: Maybe ServiceName -> AuthAlg -> AuthAlg -> Int -> Natural -> ProtocolClientConfig SMPVersion -> ProtocolClientConfig NTFVersion -> XFTPClientConfig -> RetryInterval -> RetryInterval2 -> Int -> NominalDiffTime -> NominalDiffTime -> NominalDiffTime -> NominalDiffTime -> NominalDiffTime -> NominalDiffTime -> Int64 -> Int64 -> Int -> Int64 -> Int64 -> Int -> Int -> NominalDiffTime -> NominalDiffTime -> NominalDiffTime -> Int -> Int -> Int -> Word16 -> Int -> NominalDiffTime -> NominalDiffTime -> Int -> FilePath -> FilePath -> FilePath -> Int -> NominalDiffTime -> VersionRangeE2E -> VersionRangeSMPA -> VersionRangeSMPC -> AgentConfig
[$sel:tcpPort:AgentConfig] :: AgentConfig -> Maybe ServiceName
[$sel:rcvAuthAlg:AgentConfig] :: AgentConfig -> AuthAlg
[$sel:sndAuthAlg:AgentConfig] :: AgentConfig -> AuthAlg
[$sel:connIdBytes:AgentConfig] :: AgentConfig -> Int
[$sel:tbqSize:AgentConfig] :: AgentConfig -> Natural
[$sel:smpCfg:AgentConfig] :: AgentConfig -> ProtocolClientConfig SMPVersion
[$sel:ntfCfg:AgentConfig] :: AgentConfig -> ProtocolClientConfig NTFVersion
[$sel:xftpCfg:AgentConfig] :: AgentConfig -> XFTPClientConfig
[$sel:reconnectInterval:AgentConfig] :: AgentConfig -> RetryInterval
[$sel:messageRetryInterval:AgentConfig] :: AgentConfig -> RetryInterval2
[$sel:userNetworkInterval:AgentConfig] :: AgentConfig -> Int
[$sel:userOfflineDelay:AgentConfig] :: AgentConfig -> NominalDiffTime
[$sel:messageTimeout:AgentConfig] :: AgentConfig -> NominalDiffTime
[$sel:connDeleteDeliveryTimeout:AgentConfig] :: AgentConfig -> NominalDiffTime
[$sel:helloTimeout:AgentConfig] :: AgentConfig -> NominalDiffTime
[$sel:quotaExceededTimeout:AgentConfig] :: AgentConfig -> NominalDiffTime
[$sel:persistErrorInterval:AgentConfig] :: AgentConfig -> NominalDiffTime
[$sel:initialCleanupDelay:AgentConfig] :: AgentConfig -> Int64
[$sel:cleanupInterval:AgentConfig] :: AgentConfig -> Int64
[$sel:cleanupBatchSize:AgentConfig] :: AgentConfig -> Int
[$sel:initialLogStatsDelay:AgentConfig] :: AgentConfig -> Int64
[$sel:logStatsInterval:AgentConfig] :: AgentConfig -> Int64
[$sel:cleanupStepInterval:AgentConfig] :: AgentConfig -> Int
[$sel:maxWorkerRestartsPerMin:AgentConfig] :: AgentConfig -> Int
[$sel:storedMsgDataTTL:AgentConfig] :: AgentConfig -> NominalDiffTime
[$sel:rcvFilesTTL:AgentConfig] :: AgentConfig -> NominalDiffTime
[$sel:sndFilesTTL:AgentConfig] :: AgentConfig -> NominalDiffTime
[$sel:xftpConsecutiveRetries:AgentConfig] :: AgentConfig -> Int
[$sel:xftpMaxRecipientsPerRequest:AgentConfig] :: AgentConfig -> Int
[$sel:deleteErrorCount:AgentConfig] :: AgentConfig -> Int
[$sel:ntfCron:AgentConfig] :: AgentConfig -> Word16
[$sel:ntfBatchSize:AgentConfig] :: AgentConfig -> Int
[$sel:ntfSubFirstCheckInterval:AgentConfig] :: AgentConfig -> NominalDiffTime
[$sel:ntfSubCheckInterval:AgentConfig] :: AgentConfig -> NominalDiffTime
[$sel:subsBatchSize:AgentConfig] :: AgentConfig -> Int
[$sel:caCertificateFile:AgentConfig] :: AgentConfig -> FilePath
[$sel:privateKeyFile:AgentConfig] :: AgentConfig -> FilePath
[$sel:certificateFile:AgentConfig] :: AgentConfig -> FilePath
[$sel:rcvExpireCount:AgentConfig] :: AgentConfig -> Int
[$sel:rcvExpireInterval:AgentConfig] :: AgentConfig -> NominalDiffTime
[$sel:e2eEncryptVRange:AgentConfig] :: AgentConfig -> VersionRangeE2E
[$sel:smpAgentVRange:AgentConfig] :: AgentConfig -> VersionRangeSMPA
[$sel:smpClientVRange:AgentConfig] :: AgentConfig -> VersionRangeSMPC
data InitialAgentServers
InitialAgentServers :: Map UserId (NonEmpty (ServerCfg 'PSMP)) -> [NtfServer] -> Map UserId (NonEmpty (ServerCfg 'PXFTP)) -> NetworkConfig -> [HostName] -> [SMPServer] -> InitialAgentServers
[$sel:smp:InitialAgentServers] :: InitialAgentServers -> Map UserId (NonEmpty (ServerCfg 'PSMP))
[$sel:ntf:InitialAgentServers] :: InitialAgentServers -> [NtfServer]
[$sel:xftp:InitialAgentServers] :: InitialAgentServers -> Map UserId (NonEmpty (ServerCfg 'PXFTP))
[$sel:netCfg:InitialAgentServers] :: InitialAgentServers -> NetworkConfig
[$sel:presetDomains:InitialAgentServers] :: InitialAgentServers -> [HostName]
[$sel:presetServers:InitialAgentServers] :: InitialAgentServers -> [SMPServer]
data ServerCfg p
ServerCfg :: ProtoServerWithAuth p -> Maybe OperatorId -> Bool -> ServerRoles -> ServerCfg p
[$sel:server:ServerCfg] :: ServerCfg p -> ProtoServerWithAuth p
[$sel:operator:ServerCfg] :: ServerCfg p -> Maybe OperatorId
[$sel:enabled:ServerCfg] :: ServerCfg p -> Bool
[$sel:roles:ServerCfg] :: ServerCfg p -> ServerRoles
data ServerRoles
ServerRoles :: Bool -> Bool -> ServerRoles
[$sel:storage:ServerRoles] :: ServerRoles -> Bool
[$sel:proxy:ServerRoles] :: ServerRoles -> Bool
type OperatorId = Int64
data UserServers p
UserServers :: NonEmpty (Maybe OperatorId, ProtoServerWithAuth p) -> NonEmpty (Maybe OperatorId, ProtoServerWithAuth p) -> Set TransportHost -> UserServers p
[$sel:storageSrvs:UserServers] :: UserServers p -> NonEmpty (Maybe OperatorId, ProtoServerWithAuth p)
[$sel:proxySrvs:UserServers] :: UserServers p -> NonEmpty (Maybe OperatorId, ProtoServerWithAuth p)
[$sel:knownHosts:UserServers] :: UserServers p -> Set TransportHost

-- | network configuration for the client
data NetworkConfig
NetworkConfig :: Maybe SocksProxyWithAuth -> SocksMode -> HostMode -> Bool -> TransportSessionMode -> SMPProxyMode -> SMPProxyFallback -> SMPWebPortServers -> NetworkTimeout -> NetworkTimeout -> Int64 -> Int -> Maybe KeepAliveOpts -> Int64 -> Int -> Bool -> NetworkConfig

-- | use SOCKS5 proxy
[$sel:socksProxy:NetworkConfig] :: NetworkConfig -> Maybe SocksProxyWithAuth

-- | when to use SOCKS proxy
[$sel:socksMode:NetworkConfig] :: NetworkConfig -> SocksMode

-- | determines critera which host is chosen from the list
[$sel:hostMode:NetworkConfig] :: NetworkConfig -> HostMode

-- | if above criteria is not met, if the below setting is True return
--   error, otherwise use the first host
[$sel:requiredHostMode:NetworkConfig] :: NetworkConfig -> Bool

-- | transport sessions are created per user or per entity
[$sel:sessionMode:NetworkConfig] :: NetworkConfig -> TransportSessionMode

-- | SMP proxy mode
[$sel:smpProxyMode:NetworkConfig] :: NetworkConfig -> SMPProxyMode

-- | Fallback to direct connection when destination SMP relay does not
--   support SMP proxy protocol extensions
[$sel:smpProxyFallback:NetworkConfig] :: NetworkConfig -> SMPProxyFallback

-- | use web port 443 for SMP protocol
[$sel:smpWebPortServers:NetworkConfig] :: NetworkConfig -> SMPWebPortServers

-- | timeout for the initial client TCP/TLS connection (microseconds)
[$sel:tcpConnectTimeout:NetworkConfig] :: NetworkConfig -> NetworkTimeout

-- | timeout of protocol commands (microseconds)
[$sel:tcpTimeout:NetworkConfig] :: NetworkConfig -> NetworkTimeout

-- | additional timeout per kilobyte (1024 bytes) to be sent
[$sel:tcpTimeoutPerKb:NetworkConfig] :: NetworkConfig -> Int64

-- | break response timeouts into groups, so later responses get later
--   deadlines
[$sel:rcvConcurrency:NetworkConfig] :: NetworkConfig -> Int

-- | TCP keep-alive options, Nothing to skip enabling keep-alive
[$sel:tcpKeepAlive:NetworkConfig] :: NetworkConfig -> Maybe KeepAliveOpts

-- | period for SMP ping commands (microseconds, 0 to disable)
[$sel:smpPingInterval:NetworkConfig] :: NetworkConfig -> Int64

-- | the count of timeout errors after which SMP client terminates (and
--   will be reconnected), 0 to disable
[$sel:smpPingCount:NetworkConfig] :: NetworkConfig -> Int
[$sel:logTLSErrors:NetworkConfig] :: NetworkConfig -> Bool
presetServerCfg :: Bool -> ServerRoles -> Maybe OperatorId -> ProtoServerWithAuth p -> ServerCfg p
allRoles :: ServerRoles
mkUserServers :: NonEmpty (ServerCfg p) -> UserServers p
serverHosts :: ProtocolServer p -> Set TransportHost
defaultAgentConfig :: AgentConfig
defaultReconnectInterval :: RetryInterval
data Env
Env :: AgentConfig -> DBStore -> TVar ChaChaDRG -> TVar StdGen -> NtfSupervisor -> XFTPAgent -> TMVar Int -> Env
[$sel:config:Env] :: Env -> AgentConfig
[$sel:store:Env] :: Env -> DBStore
[$sel:random:Env] :: Env -> TVar ChaChaDRG
[$sel:randomServer:Env] :: Env -> TVar StdGen
[$sel:ntfSupervisor:Env] :: Env -> NtfSupervisor
[$sel:xftpAgent:Env] :: Env -> XFTPAgent
[$sel:multicastSubscribers:Env] :: Env -> TMVar Int
newSMPAgentEnv :: AgentConfig -> DBStore -> IO Env
createAgentStore :: DBOpts -> MigrationConfig -> IO (Either MigrationError DBStore)
data NtfSupervisor
NtfSupervisor :: TVar (Maybe NtfToken) -> TBQueue (NtfSupervisorCommand, NonEmpty ConnId) -> TMap NtfServer Worker -> TMap SMPServer Worker -> TMap NtfServer Worker -> NtfSupervisor
[$sel:ntfTkn:NtfSupervisor] :: NtfSupervisor -> TVar (Maybe NtfToken)
[$sel:ntfSubQ:NtfSupervisor] :: NtfSupervisor -> TBQueue (NtfSupervisorCommand, NonEmpty ConnId)
[$sel:ntfWorkers:NtfSupervisor] :: NtfSupervisor -> TMap NtfServer Worker
[$sel:ntfSMPWorkers:NtfSupervisor] :: NtfSupervisor -> TMap SMPServer Worker
[$sel:ntfTknDelWorkers:NtfSupervisor] :: NtfSupervisor -> TMap NtfServer Worker
data NtfSupervisorCommand
NSCCreate :: NtfSupervisorCommand
NSCSmpDelete :: NtfSupervisorCommand
NSCDeleteSub :: NtfSupervisorCommand
data XFTPAgent
XFTPAgent :: TVar (Maybe FilePath) -> TMap (Maybe XFTPServer) Worker -> TMap (Maybe XFTPServer) Worker -> TMap XFTPServer Worker -> XFTPAgent
[$sel:xftpWorkDir:XFTPAgent] :: XFTPAgent -> TVar (Maybe FilePath)
[$sel:xftpRcvWorkers:XFTPAgent] :: XFTPAgent -> TMap (Maybe XFTPServer) Worker
[$sel:xftpSndWorkers:XFTPAgent] :: XFTPAgent -> TMap (Maybe XFTPServer) Worker
[$sel:xftpDelWorkers:XFTPAgent] :: XFTPAgent -> TMap XFTPServer Worker
data Worker
Worker :: Int -> TMVar () -> TMVar (Maybe (Weak ThreadId)) -> TVar RestartCount -> Worker
[$sel:workerId:Worker] :: Worker -> Int
[$sel:doWork:Worker] :: Worker -> TMVar ()
[$sel:action:Worker] :: Worker -> TMVar (Maybe (Weak ThreadId))
[$sel:restarts:Worker] :: Worker -> TVar RestartCount
data RestartCount
RestartCount :: Int64 -> Int -> RestartCount
[$sel:restartMinute:RestartCount] :: RestartCount -> Int64
[$sel:restartCount:RestartCount] :: RestartCount -> Int
updateRestartCount :: SystemTime -> RestartCount -> RestartCount
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Env.SQLite.ServerRoles
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Env.SQLite.ServerRoles
instance Simplex.Messaging.Protocol.ProtocolTypeI p => Data.Aeson.Types.ToJSON.ToJSON (Simplex.Messaging.Agent.Env.SQLite.ServerCfg p)
instance Simplex.Messaging.Protocol.ProtocolTypeI p => Data.Aeson.Types.FromJSON.FromJSON (Simplex.Messaging.Agent.Env.SQLite.ServerCfg p)
instance GHC.Show.Show Simplex.Messaging.Agent.Env.SQLite.ServerRoles
instance GHC.Show.Show (Simplex.Messaging.Agent.Env.SQLite.ServerCfg p)
instance GHC.Show.Show Simplex.Messaging.Agent.Env.SQLite.NtfSupervisorCommand

module Simplex.Messaging.Agent.Client
data AgentClient
AgentClient :: TVar (Maybe (Weak ThreadId)) -> TVar Bool -> TBQueue ATransmission -> TBQueue (ServerTransmissionBatch SMPVersion ErrorType BrokerMsg) -> TMap UserId (UserServers 'PSMP) -> TMap SMPTransportSession SMPClientVar -> TMap SMPTransportSession SMPServerWithAuth -> TVar [NtfServer] -> TMap NtfTransportSession NtfClientVar -> TMap UserId (UserServers 'PXFTP) -> TMap XFTPTransportSession XFTPClientVar -> TVar (NetworkConfig, NetworkConfig) -> [HostName] -> [SMPServer] -> TVar UserNetworkInfo -> TVar (Maybe UTCTime) -> TVar (Set ConnId) -> TSessionSubs -> TMap (UserId, SMPServer) (TMap RecipientId SMPClientError) -> TMap (Maybe SMPServer) (Maybe SystemSeconds) -> TMVar () -> TVar Int -> TMap SndQAddr (Worker, TMVar ()) -> TMap (ConnId, Maybe SMPServer) Worker -> TVar AgentOpState -> TVar AgentOpState -> TVar AgentOpState -> TVar AgentOpState -> TVar AgentOpState -> TVar AgentState -> TMap (SMPServer, RecipientId) (TMVar ()) -> TMap ConnId Lock -> TMap ByteString Lock -> Lock -> TMap SMPTransportSession (SessionVar (Async ())) -> Int -> Env -> TVar UTCTime -> TMap (UserId, SMPServer) AgentSMPServerStats -> TMap (UserId, XFTPServer) AgentXFTPServerStats -> TMap (UserId, NtfServer) AgentNtfServerStats -> TVar UTCTime -> AgentClient
[$sel:acThread:AgentClient] :: AgentClient -> TVar (Maybe (Weak ThreadId))
[$sel:active:AgentClient] :: AgentClient -> TVar Bool
[$sel:subQ:AgentClient] :: AgentClient -> TBQueue ATransmission
[$sel:msgQ:AgentClient] :: AgentClient -> TBQueue (ServerTransmissionBatch SMPVersion ErrorType BrokerMsg)
[$sel:smpServers:AgentClient] :: AgentClient -> TMap UserId (UserServers 'PSMP)
[$sel:smpClients:AgentClient] :: AgentClient -> TMap SMPTransportSession SMPClientVar
[$sel:smpProxiedRelays:AgentClient] :: AgentClient -> TMap SMPTransportSession SMPServerWithAuth
[$sel:ntfServers:AgentClient] :: AgentClient -> TVar [NtfServer]
[$sel:ntfClients:AgentClient] :: AgentClient -> TMap NtfTransportSession NtfClientVar
[$sel:xftpServers:AgentClient] :: AgentClient -> TMap UserId (UserServers 'PXFTP)
[$sel:xftpClients:AgentClient] :: AgentClient -> TMap XFTPTransportSession XFTPClientVar
[$sel:useNetworkConfig:AgentClient] :: AgentClient -> TVar (NetworkConfig, NetworkConfig)
[$sel:presetDomains:AgentClient] :: AgentClient -> [HostName]
[$sel:presetServers:AgentClient] :: AgentClient -> [SMPServer]
[$sel:userNetworkInfo:AgentClient] :: AgentClient -> TVar UserNetworkInfo
[$sel:userNetworkUpdated:AgentClient] :: AgentClient -> TVar (Maybe UTCTime)
[$sel:subscrConns:AgentClient] :: AgentClient -> TVar (Set ConnId)
[$sel:currentSubs:AgentClient] :: AgentClient -> TSessionSubs
[$sel:removedSubs:AgentClient] :: AgentClient -> TMap (UserId, SMPServer) (TMap RecipientId SMPClientError)
[$sel:clientNotices:AgentClient] :: AgentClient -> TMap (Maybe SMPServer) (Maybe SystemSeconds)
[$sel:clientNoticesLock:AgentClient] :: AgentClient -> TMVar ()
[$sel:workerSeq:AgentClient] :: AgentClient -> TVar Int
[$sel:smpDeliveryWorkers:AgentClient] :: AgentClient -> TMap SndQAddr (Worker, TMVar ())
[$sel:asyncCmdWorkers:AgentClient] :: AgentClient -> TMap (ConnId, Maybe SMPServer) Worker
[$sel:ntfNetworkOp:AgentClient] :: AgentClient -> TVar AgentOpState
[$sel:rcvNetworkOp:AgentClient] :: AgentClient -> TVar AgentOpState
[$sel:msgDeliveryOp:AgentClient] :: AgentClient -> TVar AgentOpState
[$sel:sndNetworkOp:AgentClient] :: AgentClient -> TVar AgentOpState
[$sel:databaseOp:AgentClient] :: AgentClient -> TVar AgentOpState
[$sel:agentState:AgentClient] :: AgentClient -> TVar AgentState
[$sel:getMsgLocks:AgentClient] :: AgentClient -> TMap (SMPServer, RecipientId) (TMVar ())
[$sel:connLocks:AgentClient] :: AgentClient -> TMap ConnId Lock
[$sel:invLocks:AgentClient] :: AgentClient -> TMap ByteString Lock
[$sel:deleteLock:AgentClient] :: AgentClient -> Lock
[$sel:smpSubWorkers:AgentClient] :: AgentClient -> TMap SMPTransportSession (SessionVar (Async ()))
[$sel:clientId:AgentClient] :: AgentClient -> Int
[$sel:agentEnv:AgentClient] :: AgentClient -> Env
[$sel:proxySessTs:AgentClient] :: AgentClient -> TVar UTCTime
[$sel:smpServersStats:AgentClient] :: AgentClient -> TMap (UserId, SMPServer) AgentSMPServerStats
[$sel:xftpServersStats:AgentClient] :: AgentClient -> TMap (UserId, XFTPServer) AgentXFTPServerStats
[$sel:ntfServersStats:AgentClient] :: AgentClient -> TMap (UserId, NtfServer) AgentNtfServerStats
[$sel:srvStatsStartedAt:AgentClient] :: AgentClient -> TVar UTCTime
data ProtocolTestFailure
ProtocolTestFailure :: ProtocolTestStep -> AgentErrorType -> ProtocolTestFailure
[$sel:testStep:ProtocolTestFailure] :: ProtocolTestFailure -> ProtocolTestStep
[$sel:testError:ProtocolTestFailure] :: ProtocolTestFailure -> AgentErrorType
data ProtocolTestStep
TSConnect :: ProtocolTestStep
TSDisconnect :: ProtocolTestStep
TSCreateQueue :: ProtocolTestStep
TSSecureQueue :: ProtocolTestStep
TSDeleteQueue :: ProtocolTestStep
TSCreateFile :: ProtocolTestStep
TSUploadFile :: ProtocolTestStep
TSDownloadFile :: ProtocolTestStep
TSCompareFile :: ProtocolTestStep
TSDeleteFile :: ProtocolTestStep
TSCreateNtfToken :: ProtocolTestStep
TSDeleteNtfToken :: ProtocolTestStep
data ClntQueueReqData
CQRMessaging :: Maybe (CQRData (SenderId, QueueLinkData)) -> ClntQueueReqData
CQRContact :: Maybe (CQRData (LinkId, (SenderId, QueueLinkData))) -> ClntQueueReqData
data CQRData r
CQRData :: LinkKey -> PrivateKeyEd25519 -> r -> CQRData r
[$sel:linkKey:CQRData] :: CQRData r -> LinkKey
[$sel:privSigKey:CQRData] :: CQRData r -> PrivateKeyEd25519
[$sel:srvReq:CQRData] :: CQRData r -> r

-- | Creates an SMP agent client instance that receives commands and sends
--   responses via <a>TBQueue</a>s.
newAgentClient :: Int -> InitialAgentServers -> UTCTime -> Map (Maybe SMPServer) (Maybe SystemSeconds) -> Env -> IO AgentClient
withConnLock :: AgentClient -> ConnId -> Text -> AM a -> AM a
withConnLocks :: AgentClient -> Set ConnId -> Text -> AM' a -> AM' a
withInvLock :: AgentClient -> ByteString -> Text -> AM a -> AM a
withLockMap :: (Ord k, MonadUnliftIO m) => TMap k Lock -> k -> Text -> m a -> m a
withLocksMap :: (Ord k, MonadUnliftIO m) => TMap k Lock -> Set k -> Text -> m a -> m a
getMapLock :: Ord k => TMap k Lock -> k -> STM Lock
ipAddressProtected :: NetworkConfig -> ProtocolServer p -> Bool
closeAgentClient :: AgentClient -> IO ()
closeProtocolServerClients :: ProtocolServerClient v err msg => AgentClient -> (AgentClient -> TMap (TransportSession msg) (ClientVar msg)) -> IO ()
reconnectServerClients :: ProtocolServerClient v err msg => AgentClient -> (AgentClient -> TMap (TransportSession msg) (ClientVar msg)) -> IO ()
reconnectSMPServer :: AgentClient -> UserId -> SMPServer -> IO ()
closeXFTPServerClient :: AgentClient -> UserId -> XFTPServer -> FileDigest -> IO ()
runSMPServerTest :: AgentClient -> NetworkRequestMode -> UserId -> SMPServerWithAuth -> AM' (Maybe ProtocolTestFailure)
runXFTPServerTest :: AgentClient -> NetworkRequestMode -> UserId -> XFTPServerWithAuth -> AM' (Maybe ProtocolTestFailure)
runNTFServerTest :: AgentClient -> NetworkRequestMode -> UserId -> NtfServerWithAuth -> AM' (Maybe ProtocolTestFailure)
getXFTPWorkPath :: AM' FilePath
newRcvQueue :: AgentClient -> NetworkRequestMode -> UserId -> ConnId -> SMPServerWithAuth -> VersionRangeSMPC -> SConnectionMode c -> Bool -> SubscriptionMode -> AM (NewRcvQueue, SMPQueueUri, SMPTransportSession, SessionId)
newRcvQueue_ :: AgentClient -> NetworkRequestMode -> UserId -> ConnId -> SMPServerWithAuth -> VersionRangeSMPC -> ClntQueueReqData -> Bool -> SubscriptionMode -> Maybe CbNonce -> KeyPairX25519 -> AM (NewRcvQueue, SMPQueueUri, SMPTransportSession, SessionId)

-- | Batch by transport session and subscribe queues. The list of results
--   can have a different order.
subscribeQueues :: AgentClient -> Bool -> [RcvQueueSub] -> AM' [(RcvQueueSub, Either AgentErrorType (Maybe ServiceId))]
subscribeUserServerQueues :: AgentClient -> UserId -> SMPServer -> [RcvQueueSub] -> AM' [(RcvQueueSub, Either AgentErrorType (Maybe ServiceId))]
processClientNotices :: AgentClient -> SMPTransportSession -> [(RcvQueueSub, Maybe ClientNotice)] -> AM' ()
getQueueMessage :: AgentClient -> RcvQueue -> AM (Maybe SMPMsgMeta)
decryptSMPMessage :: RcvQueue -> RcvMessage -> AM ClientRcvMsgBody
failSubscription :: SomeRcvQueue q => AgentClient -> SMPTransportSession -> q -> SMPClientError -> STM ()
addNewQueueSubscription :: AgentClient -> RcvQueue -> SMPTransportSession -> SessionId -> AM' ()
getSubscriptions :: AgentClient -> IO (Set ConnId)
sendConfirmation :: AgentClient -> NetworkRequestMode -> SndQueue -> ByteString -> AM (Maybe SMPServer)
sendInvitation :: AgentClient -> NetworkRequestMode -> UserId -> ConnId -> Compatible SMPQueueInfo -> Compatible VersionSMPA -> ConnectionRequestUri 'CMInvitation -> ConnInfo -> AM (Maybe SMPServer)
temporaryAgentError :: AgentErrorType -> Bool
temporaryOrHostError :: AgentErrorType -> Bool
serverHostError :: AgentErrorType -> Bool
secureQueue :: AgentClient -> NetworkRequestMode -> RcvQueue -> SndPublicAuthKey -> AM ()
secureSndQueue :: AgentClient -> NetworkRequestMode -> SndQueue -> AM ()
addQueueLink :: AgentClient -> NetworkRequestMode -> RcvQueue -> LinkId -> QueueLinkData -> AM ()
deleteQueueLink :: AgentClient -> NetworkRequestMode -> RcvQueue -> AM ()
secureGetQueueLink :: AgentClient -> NetworkRequestMode -> UserId -> InvShortLink -> AM (SenderId, QueueLinkData)
getQueueLink :: AgentClient -> NetworkRequestMode -> UserId -> SMPServer -> LinkId -> AM (SenderId, QueueLinkData)
enableQueueNotifications :: AgentClient -> RcvQueue -> NtfPublicAuthKey -> RcvNtfPublicDhKey -> AM (NotifierId, RcvNtfPublicDhKey)
data EnableQueueNtfReq
EnableQueueNtfReq :: NtfSubscription -> RcvQueue -> AAuthKeyPair -> KeyPairX25519 -> EnableQueueNtfReq
[$sel:eqnrNtfSub:EnableQueueNtfReq] :: EnableQueueNtfReq -> NtfSubscription
[$sel:eqnrRq:EnableQueueNtfReq] :: EnableQueueNtfReq -> RcvQueue
[$sel:eqnrAuthKeyPair:EnableQueueNtfReq] :: EnableQueueNtfReq -> AAuthKeyPair
[$sel:eqnrRcvKeyPair:EnableQueueNtfReq] :: EnableQueueNtfReq -> KeyPairX25519
enableQueuesNtfs :: AgentClient -> [EnableQueueNtfReq] -> AM' [(EnableQueueNtfReq, Either AgentErrorType (NotifierId, RcvNtfPublicDhKey))]
disableQueueNotifications :: AgentClient -> RcvQueue -> AM ()
type DisableQueueNtfReq = (NtfSubscription, RcvQueue)
disableQueuesNtfs :: AgentClient -> [DisableQueueNtfReq] -> AM' [(DisableQueueNtfReq, Either AgentErrorType ())]
sendAgentMessage :: AgentClient -> SndQueue -> MsgFlags -> ByteString -> AM (Maybe SMPServer)
getQueueInfo :: AgentClient -> NetworkRequestMode -> RcvQueue -> AM ServerQueueInfo
agentNtfRegisterToken :: AgentClient -> NetworkRequestMode -> NtfToken -> NtfPublicAuthKey -> PublicKeyX25519 -> AM (NtfTokenId, PublicKeyX25519)
agentNtfVerifyToken :: AgentClient -> NetworkRequestMode -> NtfTokenId -> NtfToken -> NtfRegCode -> AM ()
agentNtfCheckToken :: AgentClient -> NetworkRequestMode -> NtfTokenId -> NtfToken -> AM NtfTknStatus
agentNtfReplaceToken :: AgentClient -> NetworkRequestMode -> NtfTokenId -> NtfToken -> DeviceToken -> AM ()
agentNtfDeleteToken :: AgentClient -> NetworkRequestMode -> NtfServer -> APrivateAuthKey -> NtfTokenId -> AM ()
agentNtfSetCronInterval :: AgentClient -> NetworkRequestMode -> NtfTokenId -> NtfToken -> Word16 -> AM ()
agentNtfCreateSubscription :: AgentClient -> NtfTokenId -> NtfToken -> SMPQueueNtf -> NtfPrivateAuthKey -> AM NtfSubscriptionId
agentNtfCreateSubscriptions :: AgentClient -> NtfToken -> NonEmpty (NewNtfEntity 'Subscription) -> AM' (NonEmpty (Either AgentErrorType NtfSubscriptionId))
agentNtfCheckSubscription :: AgentClient -> NtfToken -> NtfSubscriptionId -> AM NtfSubStatus
agentNtfCheckSubscriptions :: AgentClient -> NtfToken -> NonEmpty NtfSubscriptionId -> AM' (NonEmpty (Either AgentErrorType NtfSubStatus))
agentNtfDeleteSubscription :: AgentClient -> NtfSubscriptionId -> NtfToken -> AM ()
agentXFTPDownloadChunk :: AgentClient -> UserId -> FileDigest -> RcvFileChunkReplica -> XFTPRcvChunkSpec -> AM ()
agentXFTPNewChunk :: AgentClient -> SndFileChunk -> Int -> XFTPServerWithAuth -> AM NewSndChunkReplica
agentXFTPUploadChunk :: AgentClient -> UserId -> FileDigest -> SndFileChunkReplica -> XFTPChunkSpec -> AM ()
agentXFTPAddRecipients :: AgentClient -> UserId -> FileDigest -> SndFileChunkReplica -> Int -> AM (NonEmpty (ChunkReplicaId, APrivateAuthKey))
agentXFTPDeleteChunk :: AgentClient -> UserId -> DeletedSndChunkReplica -> AM ()

-- | NaCl crypto-box decrypt - both for messages received from the server
--   and per-queue E2E encrypted messages from the sender that were inside.
agentCbDecrypt :: DhSecretX25519 -> CbNonce -> ByteString -> Either AgentErrorType ByteString
cryptoError :: CryptoError -> AgentErrorType
sendAck :: AgentClient -> RcvQueue -> MsgId -> AM ()
suspendQueue :: AgentClient -> NetworkRequestMode -> RcvQueue -> AM ()
deleteQueue :: AgentClient -> NetworkRequestMode -> RcvQueue -> AM ()
deleteQueues :: AgentClient -> NetworkRequestMode -> [RcvQueue] -> AM' [(RcvQueue, Either AgentErrorType ())]
logServer :: MonadIO m => ByteString -> AgentClient -> ProtocolServer s -> EntityId -> ByteString -> m ()
logSecret :: EntityId -> ByteString
logSecret' :: ByteString -> ByteString
removeSubscription :: SomeRcvQueue q => AgentClient -> SMPTransportSession -> ConnId -> q -> STM ()
removeSubscriptions :: SomeRcvQueue q => AgentClient -> [ConnId] -> [q] -> STM ()
hasActiveSubscription :: SomeRcvQueue q => AgentClient -> q -> STM Bool
hasPendingSubscription :: SomeRcvQueue q => AgentClient -> q -> STM Bool
hasRemovedSubscription :: SomeRcvQueue q => AgentClient -> q -> STM (Maybe SMPClientError)
hasGetLock :: SomeRcvQueue q => AgentClient -> q -> IO Bool
releaseGetLock :: SomeRcvQueue q => AgentClient -> q -> STM ()
activeClientSession :: AgentClient -> SMPTransportSession -> SessionId -> STM Bool
agentClientStore :: AgentClient -> DBStore
agentDRG :: AgentClient -> TVar ChaChaDRG
data ServerQueueInfo
ServerQueueInfo :: SMPServer -> Text -> Text -> Maybe Text -> Text -> QueueInfo -> ServerQueueInfo
[$sel:server:ServerQueueInfo] :: ServerQueueInfo -> SMPServer
[$sel:rcvId:ServerQueueInfo] :: ServerQueueInfo -> Text
[$sel:sndId:ServerQueueInfo] :: ServerQueueInfo -> Text
[$sel:ntfId:ServerQueueInfo] :: ServerQueueInfo -> Maybe Text
[$sel:status:ServerQueueInfo] :: ServerQueueInfo -> Text
[$sel:info:ServerQueueInfo] :: ServerQueueInfo -> QueueInfo
data AgentServersSummary
AgentServersSummary :: Map (UserId, SMPServer) AgentSMPServerStatsData -> Map (UserId, XFTPServer) AgentXFTPServerStatsData -> Map (UserId, NtfServer) AgentNtfServerStatsData -> UTCTime -> Map (UserId, SMPServer) ServerSessions -> Map (UserId, SMPServer) SMPServerSubs -> Map (UserId, XFTPServer) ServerSessions -> [XFTPServer] -> [XFTPServer] -> [XFTPServer] -> Map (UserId, NtfServer) ServerSessions -> AgentServersSummary
[$sel:smpServersStats:AgentServersSummary] :: AgentServersSummary -> Map (UserId, SMPServer) AgentSMPServerStatsData
[$sel:xftpServersStats:AgentServersSummary] :: AgentServersSummary -> Map (UserId, XFTPServer) AgentXFTPServerStatsData
[$sel:ntfServersStats:AgentServersSummary] :: AgentServersSummary -> Map (UserId, NtfServer) AgentNtfServerStatsData
[$sel:statsStartedAt:AgentServersSummary] :: AgentServersSummary -> UTCTime
[$sel:smpServersSessions:AgentServersSummary] :: AgentServersSummary -> Map (UserId, SMPServer) ServerSessions
[$sel:smpServersSubs:AgentServersSummary] :: AgentServersSummary -> Map (UserId, SMPServer) SMPServerSubs
[$sel:xftpServersSessions:AgentServersSummary] :: AgentServersSummary -> Map (UserId, XFTPServer) ServerSessions
[$sel:xftpRcvInProgress:AgentServersSummary] :: AgentServersSummary -> [XFTPServer]
[$sel:xftpSndInProgress:AgentServersSummary] :: AgentServersSummary -> [XFTPServer]
[$sel:xftpDelInProgress:AgentServersSummary] :: AgentServersSummary -> [XFTPServer]
[$sel:ntfServersSessions:AgentServersSummary] :: AgentServersSummary -> Map (UserId, NtfServer) ServerSessions
data ServerSessions
ServerSessions :: Int -> Int -> Int -> ServerSessions
[$sel:ssConnected:ServerSessions] :: ServerSessions -> Int
[$sel:ssErrors:ServerSessions] :: ServerSessions -> Int
[$sel:ssConnecting:ServerSessions] :: ServerSessions -> Int
data SMPServerSubs
SMPServerSubs :: Int -> Int -> SMPServerSubs
[$sel:ssActive:SMPServerSubs] :: SMPServerSubs -> Int
[$sel:ssPending:SMPServerSubs] :: SMPServerSubs -> Int
getAgentSubsTotal :: AgentClient -> [UserId] -> IO (SMPServerSubs, Bool)
getAgentServersSummary :: AgentClient -> IO AgentServersSummary
getAgentSubscriptions :: AgentClient -> IO SubscriptionsInfo
slowNetworkConfig :: NetworkConfig -> NetworkConfig
protocolClientError :: (Show err, Encoding err) => (HostName -> err -> AgentErrorType) -> HostName -> ProtocolClientError err -> AgentErrorType
data Worker
Worker :: Int -> TMVar () -> TMVar (Maybe (Weak ThreadId)) -> TVar RestartCount -> Worker
[$sel:workerId:Worker] :: Worker -> Int
[$sel:doWork:Worker] :: Worker -> TMVar ()
[$sel:action:Worker] :: Worker -> TMVar (Maybe (Weak ThreadId))
[$sel:restarts:Worker] :: Worker -> TVar RestartCount
data SessionVar a
SessionVar :: TMVar a -> Int -> UTCTime -> SessionVar a
[sessionVar] :: SessionVar a -> TMVar a
[sessionVarId] :: SessionVar a -> Int
[sessionVarTs] :: SessionVar a -> UTCTime
data SubscriptionsInfo
SubscriptionsInfo :: [SubInfo] -> [SubInfo] -> [SubInfo] -> SubscriptionsInfo
[$sel:activeSubscriptions:SubscriptionsInfo] :: SubscriptionsInfo -> [SubInfo]
[$sel:pendingSubscriptions:SubscriptionsInfo] :: SubscriptionsInfo -> [SubInfo]
[$sel:removedSubscriptions:SubscriptionsInfo] :: SubscriptionsInfo -> [SubInfo]
data SubInfo
SubInfo :: UserId -> Text -> Text -> Maybe String -> SubInfo
[$sel:userId:SubInfo] :: SubInfo -> UserId
[$sel:server:SubInfo] :: SubInfo -> Text
[$sel:rcvId:SubInfo] :: SubInfo -> Text
[$sel:subError:SubInfo] :: SubInfo -> Maybe String
data AgentOperation
AONtfNetwork :: AgentOperation
AORcvNetwork :: AgentOperation
AOMsgDelivery :: AgentOperation
AOSndNetwork :: AgentOperation
AODatabase :: AgentOperation
data AgentOpState
AgentOpState :: !Bool -> !Int -> AgentOpState
[$sel:opSuspended:AgentOpState] :: AgentOpState -> !Bool
[$sel:opsInProgress:AgentOpState] :: AgentOpState -> !Int
data AgentState
ASForeground :: AgentState
ASSuspending :: AgentState
ASSuspended :: AgentState
data AgentLocks
AgentLocks :: Map Text Text -> Map Text Text -> Maybe Text -> AgentLocks
[$sel:connLocks:AgentLocks] :: AgentLocks -> Map Text Text
[$sel:invLocks:AgentLocks] :: AgentLocks -> Map Text Text
[$sel:delLock:AgentLocks] :: AgentLocks -> Maybe Text
getAgentWorker :: (Ord k, Show k, AnyError e, MonadUnliftIO m) => String -> Bool -> AgentClient -> k -> TMap k Worker -> (Worker -> ExceptT e m ()) -> m Worker
getAgentWorker' :: forall a k e m. (Ord k, Show k, AnyError e, MonadUnliftIO m) => (a -> Worker) -> (Worker -> STM a) -> String -> Bool -> AgentClient -> k -> TMap k a -> (a -> ExceptT e m ()) -> m a
cancelWorker :: Worker -> IO ()
waitForWork :: MonadIO m => TMVar () -> m ()
hasWorkToDo :: Worker -> STM ()
hasWorkToDo' :: TMVar () -> STM ()
withWork :: AgentClient -> TMVar () -> (Connection -> IO (Either StoreError (Maybe a))) -> (a -> AM ()) -> AM ()
withWork_ :: (AnyStoreError e', MonadIO m) => AgentClient -> TMVar () -> ExceptT e m (Either e' (Maybe a)) -> (a -> ExceptT e m ()) -> ExceptT e m ()
withWorkItems :: (AnyStoreError e', MonadIO m) => AgentClient -> TMVar () -> ExceptT e m (Either e' [Either e' a]) -> (NonEmpty a -> ExceptT e m ()) -> ExceptT e m ()
agentOperations :: [AgentClient -> TVar AgentOpState]
agentOperationBracket :: MonadUnliftIO m => AgentClient -> AgentOperation -> (AgentClient -> IO ()) -> m a -> m a
waitUntilActive :: AgentClient -> IO ()
data UserNetworkInfo
UserNetworkInfo :: UserNetworkType -> Bool -> UserNetworkInfo
[$sel:networkType:UserNetworkInfo] :: UserNetworkInfo -> UserNetworkType
[$sel:online:UserNetworkInfo] :: UserNetworkInfo -> Bool
data UserNetworkType
UNNone :: UserNetworkType
UNCellular :: UserNetworkType
UNWifi :: UserNetworkType
UNEthernet :: UserNetworkType
UNOther :: UserNetworkType
getFastNetworkConfig :: AgentClient -> IO NetworkConfig
waitForUserNetwork :: AgentClient -> IO ()
isNetworkOnline :: AgentClient -> STM Bool
isOnline :: UserNetworkInfo -> Bool
throwWhenInactive :: AgentClient -> IO ()
throwWhenNoDelivery :: AgentClient -> SndQueue -> IO ()
beginAgentOperation :: AgentClient -> AgentOperation -> STM ()
endAgentOperation :: AgentClient -> AgentOperation -> STM ()
waitUntilForeground :: AgentClient -> IO ()
waitWhileSuspended :: AgentClient -> IO ()
suspendSendingAndDatabase :: AgentClient -> STM ()
suspendOperation :: AgentClient -> AgentOperation -> STM () -> STM ()
notifySuspended :: AgentClient -> STM ()
whenSuspending :: AgentClient -> STM () -> STM ()
withStore :: AgentClient -> (Connection -> IO (Either StoreError a)) -> AM a
withStore' :: AgentClient -> (Connection -> IO a) -> AM a
withStoreBatch :: Traversable t => AgentClient -> (Connection -> t (IO (Either AgentErrorType a))) -> AM' (t (Either AgentErrorType a))
withStoreBatch' :: Traversable t => AgentClient -> (Connection -> t (IO a)) -> AM' (t (Either AgentErrorType a))
unsafeWithStore :: AgentClient -> (Connection -> IO a) -> AM' a
storeError :: StoreError -> AgentErrorType
notifySub :: MonadIO m => AgentClient -> AEvent 'AENone -> m ()
notifySub' :: forall e m. (AEntityI e, MonadIO m) => AgentClient -> ConnId -> AEvent e -> m ()
userServers :: forall p. (ProtocolTypeI p, UserProtocol p) => AgentClient -> TMap UserId (UserServers p)
pickServer :: NonEmpty (Maybe OperatorId, ProtoServerWithAuth p) -> AM (ProtoServerWithAuth p)
getNextServer :: (ProtocolTypeI p, UserProtocol p) => AgentClient -> UserId -> (UserServers p -> NonEmpty (Maybe OperatorId, ProtoServerWithAuth p)) -> [ProtocolServer p] -> AM (ProtoServerWithAuth p)
withNextSrv :: (ProtocolTypeI p, UserProtocol p) => AgentClient -> UserId -> (UserServers p -> NonEmpty (Maybe OperatorId, ProtoServerWithAuth p)) -> TVar (Set TransportHost) -> [ProtocolServer p] -> (ProtoServerWithAuth p -> AM a) -> AM a
incSMPServerStat :: AgentClient -> UserId -> SMPServer -> (AgentSMPServerStats -> TVar Int) -> STM ()
incSMPServerStat' :: AgentClient -> UserId -> SMPServer -> (AgentSMPServerStats -> TVar Int) -> Int -> STM ()
incXFTPServerStat :: AgentClient -> UserId -> XFTPServer -> (AgentXFTPServerStats -> TVar Int) -> STM ()
incXFTPServerStat' :: AgentClient -> UserId -> XFTPServer -> (AgentXFTPServerStats -> TVar Int) -> Int -> STM ()
incXFTPServerSizeStat :: AgentClient -> UserId -> XFTPServer -> (AgentXFTPServerStats -> TVar Int64) -> Int64 -> STM ()
incNtfServerStat :: AgentClient -> UserId -> NtfServer -> (AgentNtfServerStats -> TVar Int) -> STM ()
incNtfServerStat' :: AgentClient -> UserId -> NtfServer -> (AgentNtfServerStats -> TVar Int) -> Int -> STM ()
data AgentWorkersDetails
AgentWorkersDetails :: [Text] -> [Text] -> [Text] -> Map Text WorkersDetails -> Map Text WorkersDetails -> [Text] -> Map Text WorkersDetails -> Map Text WorkersDetails -> Map Text WorkersDetails -> Map Text WorkersDetails -> Map Text WorkersDetails -> AgentWorkersDetails
[$sel:smpClients_:AgentWorkersDetails] :: AgentWorkersDetails -> [Text]
[$sel:ntfClients_:AgentWorkersDetails] :: AgentWorkersDetails -> [Text]
[$sel:xftpClients_:AgentWorkersDetails] :: AgentWorkersDetails -> [Text]
[$sel:smpDeliveryWorkers_:AgentWorkersDetails] :: AgentWorkersDetails -> Map Text WorkersDetails
[$sel:asyncCmdWorkers_:AgentWorkersDetails] :: AgentWorkersDetails -> Map Text WorkersDetails
[$sel:smpSubWorkers_:AgentWorkersDetails] :: AgentWorkersDetails -> [Text]
[$sel:ntfWorkers_:AgentWorkersDetails] :: AgentWorkersDetails -> Map Text WorkersDetails
[$sel:ntfSMPWorkers_:AgentWorkersDetails] :: AgentWorkersDetails -> Map Text WorkersDetails
[$sel:xftpRcvWorkers_:AgentWorkersDetails] :: AgentWorkersDetails -> Map Text WorkersDetails
[$sel:xftpSndWorkers_:AgentWorkersDetails] :: AgentWorkersDetails -> Map Text WorkersDetails
[$sel:xftpDelWorkers_:AgentWorkersDetails] :: AgentWorkersDetails -> Map Text WorkersDetails
getAgentWorkersDetails :: AgentClient -> IO AgentWorkersDetails
data AgentWorkersSummary
AgentWorkersSummary :: Int -> Int -> Int -> WorkersSummary -> WorkersSummary -> Int -> WorkersSummary -> WorkersSummary -> WorkersSummary -> WorkersSummary -> WorkersSummary -> AgentWorkersSummary
[$sel:smpClientsCount:AgentWorkersSummary] :: AgentWorkersSummary -> Int
[$sel:ntfClientsCount:AgentWorkersSummary] :: AgentWorkersSummary -> Int
[$sel:xftpClientsCount:AgentWorkersSummary] :: AgentWorkersSummary -> Int
[$sel:smpDeliveryWorkersCount:AgentWorkersSummary] :: AgentWorkersSummary -> WorkersSummary
[$sel:asyncCmdWorkersCount:AgentWorkersSummary] :: AgentWorkersSummary -> WorkersSummary
[$sel:smpSubWorkersCount:AgentWorkersSummary] :: AgentWorkersSummary -> Int
[$sel:ntfWorkersCount:AgentWorkersSummary] :: AgentWorkersSummary -> WorkersSummary
[$sel:ntfSMPWorkersCount:AgentWorkersSummary] :: AgentWorkersSummary -> WorkersSummary
[$sel:xftpRcvWorkersCount:AgentWorkersSummary] :: AgentWorkersSummary -> WorkersSummary
[$sel:xftpSndWorkersCount:AgentWorkersSummary] :: AgentWorkersSummary -> WorkersSummary
[$sel:xftpDelWorkersCount:AgentWorkersSummary] :: AgentWorkersSummary -> WorkersSummary
getAgentWorkersSummary :: AgentClient -> IO AgentWorkersSummary
data AgentQueuesInfo
AgentQueuesInfo :: TBQueueInfo -> TBQueueInfo -> Map Text (Int, UTCTime, ClientInfo) -> AgentQueuesInfo
[$sel:msgQInfo:AgentQueuesInfo] :: AgentQueuesInfo -> TBQueueInfo
[$sel:subQInfo:AgentQueuesInfo] :: AgentQueuesInfo -> TBQueueInfo
[$sel:smpClientsQueues:AgentQueuesInfo] :: AgentQueuesInfo -> Map Text (Int, UTCTime, ClientInfo)
getAgentQueuesInfo :: AgentClient -> IO AgentQueuesInfo
type SMPTransportSession = TransportSession BrokerMsg
type NtfTransportSession = TransportSession NtfResponse
type XFTPTransportSession = TransportSession FileResponse
data ProxiedRelay
ProxiedRelay :: SessionId -> VersionSMP -> Maybe BasicAuth -> PublicKeyX25519 -> ProxiedRelay
[$sel:prSessionId:ProxiedRelay] :: ProxiedRelay -> SessionId
[$sel:prVersion:ProxiedRelay] :: ProxiedRelay -> VersionSMP
[$sel:prBasicAuth:ProxiedRelay] :: ProxiedRelay -> Maybe BasicAuth
[$sel:prServerKey:ProxiedRelay] :: ProxiedRelay -> PublicKeyX25519
data SMPConnectedClient
SMPConnectedClient :: SMPClient -> TMap SMPServer ProxiedRelayVar -> SMPConnectedClient
[$sel:connectedClient:SMPConnectedClient] :: SMPConnectedClient -> SMPClient
[$sel:proxiedRelays:SMPConnectedClient] :: SMPConnectedClient -> TMap SMPServer ProxiedRelayVar
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Client.ServerQueueInfo
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Client.ServerQueueInfo
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Client.UserNetworkInfo
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Client.UserNetworkInfo
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Client.UserNetworkType
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Client.UserNetworkType
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Client.AgentQueuesInfo
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Client.AgentQueuesInfo
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Client.ClientInfo
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Client.ClientInfo
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Client.AgentWorkersSummary
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Client.AgentWorkersSummary
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Client.AgentWorkersDetails
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Client.AgentWorkersDetails
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Client.WorkersSummary
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Client.WorkersSummary
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Client.WorkersDetails
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Client.WorkersDetails
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Client.SubscriptionsInfo
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Client.SubscriptionsInfo
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Client.SubInfo
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Client.SubInfo
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Client.AgentServersSummary
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Client.AgentServersSummary
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Client.SMPServerSubs
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Client.SMPServerSubs
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Client.ServerSessions
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Client.ServerSessions
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Client.ProtocolTestFailure
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Client.ProtocolTestFailure
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Client.ProtocolTestStep
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Client.ProtocolTestStep
instance Data.Aeson.Types.ToJSON.ToJSON Simplex.Messaging.Agent.Client.AgentLocks
instance Data.Aeson.Types.FromJSON.FromJSON Simplex.Messaging.Agent.Client.AgentLocks
instance GHC.Show.Show Simplex.Messaging.Agent.Client.AgentOperation
instance GHC.Classes.Eq Simplex.Messaging.Agent.Client.AgentOperation
instance GHC.Show.Show Simplex.Messaging.Agent.Client.AgentState
instance GHC.Classes.Eq Simplex.Messaging.Agent.Client.AgentState
instance GHC.Show.Show Simplex.Messaging.Agent.Client.AgentLocks
instance GHC.Show.Show Simplex.Messaging.Agent.Client.UserNetworkType
instance GHC.Classes.Eq Simplex.Messaging.Agent.Client.UserNetworkType
instance GHC.Show.Show Simplex.Messaging.Agent.Client.UserNetworkInfo
instance GHC.Show.Show Simplex.Messaging.Agent.Client.ProtocolTestStep
instance GHC.Classes.Eq Simplex.Messaging.Agent.Client.ProtocolTestStep
instance GHC.Show.Show Simplex.Messaging.Agent.Client.ProtocolTestFailure
instance GHC.Classes.Eq Simplex.Messaging.Agent.Client.ProtocolTestFailure
instance GHC.Show.Show Simplex.Messaging.Agent.Client.ServerQueueInfo
instance GHC.Show.Show Simplex.Messaging.Agent.Client.SMPServerSubs
instance GHC.Show.Show Simplex.Messaging.Agent.Client.ServerSessions
instance GHC.Show.Show Simplex.Messaging.Agent.Client.AgentServersSummary
instance GHC.Show.Show Simplex.Messaging.Agent.Client.SubInfo
instance GHC.Show.Show Simplex.Messaging.Agent.Client.SubscriptionsInfo
instance GHC.Show.Show Simplex.Messaging.Agent.Client.WorkersDetails
instance GHC.Show.Show Simplex.Messaging.Agent.Client.AgentWorkersDetails
instance GHC.Show.Show Simplex.Messaging.Agent.Client.WorkersSummary
instance GHC.Show.Show Simplex.Messaging.Agent.Client.AgentWorkersSummary
instance GHC.Show.Show Simplex.Messaging.Agent.Client.ClientInfo
instance GHC.Show.Show Simplex.Messaging.Agent.Client.AgentQueuesInfo
instance Simplex.Messaging.Agent.Client.ProtocolServerClient Simplex.Messaging.Transport.SMPVersion Simplex.Messaging.Protocol.ErrorType Simplex.Messaging.Protocol.BrokerMsg
instance Simplex.Messaging.Agent.Client.ProtocolServerClient Simplex.Messaging.Notifications.Transport.NTFVersion Simplex.Messaging.Protocol.ErrorType Simplex.Messaging.Notifications.Protocol.NtfResponse
instance Simplex.Messaging.Agent.Client.ProtocolServerClient Simplex.FileTransfer.Transport.XFTPVersion Simplex.FileTransfer.Transport.XFTPErrorType Simplex.FileTransfer.Protocol.FileResponse

module Simplex.RemoteControl.Client
data RCHostClient
type RCHostConnection = (NonEmpty RCCtrlAddress, RCSignedInvitation, RCHostClient, RCStepTMVar (SessionCode, TLS 'TServer, RCStepTMVar (RCHostSession, RCHostHello, RCHostPairing)))
newRCHostPairing :: TVar ChaChaDRG -> IO RCHostPairing
connectRCHost :: TVar ChaChaDRG -> RCHostPairing -> Value -> Bool -> Maybe RCCtrlAddress -> Maybe Word16 -> ExceptT RCErrorType IO RCHostConnection
cancelHostClient :: RCHostClient -> IO ()
data RCCtrlClient
type RCCtrlConnection = (RCCtrlClient, RCStepTMVar (SessionCode, TLS 'TClient, RCStepTMVar (RCCtrlSession, RCCtrlPairing)))
connectRCCtrl :: TVar ChaChaDRG -> RCVerifiedInvitation -> Maybe RCCtrlPairing -> Value -> ExceptT RCErrorType IO RCCtrlConnection
discoverRCCtrl :: TMVar Int -> NonEmpty RCCtrlPairing -> ExceptT RCErrorType IO (RCCtrlPairing, RCVerifiedInvitation)
confirmCtrlSession :: RCCtrlClient -> Bool -> IO ()
cancelCtrlClient :: RCCtrlClient -> IO ()
type RCStepTMVar a = TMVar (Either RCErrorType a)
rcEncryptBody :: SbKeyNonce -> LazyByteString -> ExceptT RCErrorType IO LazyByteString
rcDecryptBody :: SbKeyNonce -> LazyByteString -> ExceptT RCErrorType IO LazyByteString
xrcpBlockSize :: Int
sendRCPacket :: Encoding a => TLS p -> a -> ExceptT RCErrorType IO ()
receiveRCPacket :: Encoding a => TLS p -> ExceptT RCErrorType IO a

module Simplex.Messaging.Server.MsgStore.Journal.SharedLock
withLockWaitShared :: RecipientId -> Lock -> TMVar RecipientId -> Text -> IO a -> IO a
withLockMapWaitShared :: RecipientId -> TMap RecipientId Lock -> TMVar RecipientId -> Text -> IO a -> IO a
withSharedWaitLock :: RecipientId -> TMap RecipientId Lock -> TMVar RecipientId -> IO a -> IO a

module Simplex.Messaging.Server.MsgStore.Journal
data JournalMsgStore s
data QStore (s :: QSType)
[MQStore] :: QStoreType 'QSMemory -> QStore 'QSMemory
data QStoreCfg s
[MQStoreCfg] :: QStoreCfg 'QSMemory
data JournalQueue (s :: QSType)
data JournalMsgQueue (s :: QSType)
data JMQueue
data JournalStoreConfig s
JournalStoreConfig :: FilePath -> Int -> QStoreCfg s -> Int -> Int -> Int -> Int -> Int64 -> NominalDiffTime -> Int -> JournalStoreConfig s
[$sel:storePath:JournalStoreConfig] :: JournalStoreConfig s -> FilePath
[$sel:pathParts:JournalStoreConfig] :: JournalStoreConfig s -> Int
[$sel:queueStoreCfg:JournalStoreConfig] :: JournalStoreConfig s -> QStoreCfg s
[$sel:quota:JournalStoreConfig] :: JournalStoreConfig s -> Int
[$sel:maxMsgCount:JournalStoreConfig] :: JournalStoreConfig s -> Int
[$sel:maxStateLines:JournalStoreConfig] :: JournalStoreConfig s -> Int
[$sel:stateTailSize:JournalStoreConfig] :: JournalStoreConfig s -> Int
[$sel:idleInterval:JournalStoreConfig] :: JournalStoreConfig s -> Int64
[$sel:expireBackupsAfter:JournalStoreConfig] :: JournalStoreConfig s -> NominalDiffTime
[$sel:keepMinBackups:JournalStoreConfig] :: JournalStoreConfig s -> Int
closeMsgQueue :: JournalMsgStore s -> JournalQueue s -> IO ()
closeMsgQueueHandles :: JournalMsgStore s -> JournalMsgQueue s -> IO ()
data MsgQueueState
MsgQueueState :: JournalState 'JTRead -> JournalState 'JTWrite -> Bool -> Int -> MsgQueueState
[$sel:readState:MsgQueueState] :: MsgQueueState -> JournalState 'JTRead
[$sel:writeState:MsgQueueState] :: MsgQueueState -> JournalState 'JTWrite
[$sel:canWrite:MsgQueueState] :: MsgQueueState -> Bool
[$sel:size:MsgQueueState] :: MsgQueueState -> Int
data JournalState t
JournalState :: SJournalType t -> ByteString -> Int -> Int -> Int64 -> Int64 -> JournalState t
[$sel:journalType:JournalState] :: JournalState t -> SJournalType t
[$sel:journalId:JournalState] :: JournalState t -> ByteString
[$sel:msgPos:JournalState] :: JournalState t -> Int
[$sel:msgCount:JournalState] :: JournalState t -> Int
[$sel:bytePos:JournalState] :: JournalState t -> Int64
[$sel:byteCount:JournalState] :: JournalState t -> Int64
data SJournalType (t :: JournalType)
[SJTRead] :: SJournalType 'JTRead
[SJTWrite] :: SJournalType 'JTWrite
msgQueueDirectory :: JournalMsgStore s -> RecipientId -> FilePath
msgQueueStatePath :: FilePath -> RecipientId -> FilePath
readQueueState :: JournalMsgStore s -> FilePath -> IO (Maybe MsgQueueState, Bool)
newMsgQueueState :: ByteString -> MsgQueueState
getJournalQueueMessages :: JournalMsgStore s -> JournalQueue s -> IO [Message]
newJournalId :: TVar StdGen -> IO ByteString
appendState :: Handle -> MsgQueueState -> IO ()
queueLogFileName :: String
journalFilePath :: FilePath -> ByteString -> FilePath
logFileExt :: String
stmQueueStore :: JournalMsgStore 'QSMemory -> STMQueueStore (JournalQueue 'QSMemory)
instance GHC.Show.Show (Simplex.Messaging.Server.MsgStore.Journal.JournalState t)
instance GHC.Show.Show Simplex.Messaging.Server.MsgStore.Journal.MsgQueueState
instance GHC.Base.Monad (Simplex.Messaging.Server.MsgStore.Journal.StoreIO s)
instance GHC.Base.Applicative (Simplex.Messaging.Server.MsgStore.Journal.StoreIO s)
instance GHC.Base.Functor (Simplex.Messaging.Server.MsgStore.Journal.StoreIO s)
instance GHC.Show.Show (Simplex.Messaging.Server.MsgStore.Journal.SJournalType t)
instance Simplex.Messaging.Server.MsgStore.Types.MsgStoreClass (Simplex.Messaging.Server.MsgStore.Journal.JournalMsgStore s)
instance Simplex.Messaging.Server.MsgStore.Journal.JournalTypeI 'Simplex.Messaging.Server.MsgStore.Journal.JTRead
instance Simplex.Messaging.Server.MsgStore.Journal.JournalTypeI 'Simplex.Messaging.Server.MsgStore.Journal.JTWrite
instance Simplex.Messaging.Server.MsgStore.Journal.JournalTypeI t => Simplex.Messaging.Encoding.String.StrEncoding (Simplex.Messaging.Server.MsgStore.Journal.JournalState t)
instance Simplex.Messaging.Server.QueueStore.Types.QueueStoreClass (Simplex.Messaging.Server.MsgStore.Journal.JournalQueue s) (Simplex.Messaging.Server.MsgStore.Journal.QStore s)
instance Simplex.Messaging.Server.QueueStore.Types.StoreQueueClass (Simplex.Messaging.Server.MsgStore.Journal.JournalQueue s)
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Server.MsgStore.Journal.MsgQueueState

module Simplex.Messaging.Server.Env.STM
data ServerConfig s
ServerConfig :: [(ServiceName, ASrvTransport, AddHTTP)] -> Int -> Natural -> Int -> Int -> Int -> Int -> Int -> ServerStoreCfg s -> Maybe FilePath -> Bool -> Maybe BasicAuth -> Maybe BasicAuth -> Maybe BasicAuth -> Int -> Maybe ExpirationConfig -> Bool -> Bool -> Int64 -> ExpirationConfig -> Maybe ExpirationConfig -> Maybe Int64 -> Int64 -> FilePath -> Maybe FilePath -> Maybe Int -> FilePath -> Int -> Int -> ServerCredentials -> Maybe ServerCredentials -> VersionRangeSMP -> TransportServerConfig -> Maybe ServiceName -> SMPClientAgentConfig -> Bool -> Int -> Maybe ServerPublicInfo -> StartOptions -> ServerConfig s
[$sel:transports:ServerConfig] :: ServerConfig s -> [(ServiceName, ASrvTransport, AddHTTP)]
[$sel:smpHandshakeTimeout:ServerConfig] :: ServerConfig s -> Int
[$sel:tbqSize:ServerConfig] :: ServerConfig s -> Natural
[$sel:msgQueueQuota:ServerConfig] :: ServerConfig s -> Int
[$sel:maxJournalMsgCount:ServerConfig] :: ServerConfig s -> Int
[$sel:maxJournalStateLines:ServerConfig] :: ServerConfig s -> Int
[$sel:queueIdBytes:ServerConfig] :: ServerConfig s -> Int
[$sel:msgIdBytes:ServerConfig] :: ServerConfig s -> Int
[$sel:serverStoreCfg:ServerConfig] :: ServerConfig s -> ServerStoreCfg s
[$sel:storeNtfsFile:ServerConfig] :: ServerConfig s -> Maybe FilePath

-- | set to False to prohibit creating new queues
[$sel:allowNewQueues:ServerConfig] :: ServerConfig s -> Bool

-- | simple password that the clients need to pass in handshake to be able
--   to create new queues
[$sel:newQueueBasicAuth:ServerConfig] :: ServerConfig s -> Maybe BasicAuth

-- | control port passwords,
[$sel:controlPortUserAuth:ServerConfig] :: ServerConfig s -> Maybe BasicAuth
[$sel:controlPortAdminAuth:ServerConfig] :: ServerConfig s -> Maybe BasicAuth
[$sel:dailyBlockQueueQuota:ServerConfig] :: ServerConfig s -> Int

-- | time after which the messages can be removed from the queues and check
--   interval, seconds
[$sel:messageExpiration:ServerConfig] :: ServerConfig s -> Maybe ExpirationConfig
[$sel:expireMessagesOnStart:ServerConfig] :: ServerConfig s -> Bool
[$sel:expireMessagesOnSend:ServerConfig] :: ServerConfig s -> Bool

-- | interval of inactivity after which journal queue is closed
[$sel:idleQueueInterval:ServerConfig] :: ServerConfig s -> Int64

-- | notification expiration interval (seconds)
[$sel:notificationExpiration:ServerConfig] :: ServerConfig s -> ExpirationConfig

-- | time after which the socket with inactive client can be disconnected
--   (without any messages or commands, incl. PING), and check interval,
--   seconds
[$sel:inactiveClientExpiration:ServerConfig] :: ServerConfig s -> Maybe ExpirationConfig

-- | log SMP server usage statistics, only aggregates are logged, seconds
[$sel:logStatsInterval:ServerConfig] :: ServerConfig s -> Maybe Int64

-- | time of the day when the stats are logged first, to log at consistent
--   times, irrespective of when the server is started (seconds from 00:00
--   UTC)
[$sel:logStatsStartTime:ServerConfig] :: ServerConfig s -> Int64

-- | file to log stats
[$sel:serverStatsLogFile:ServerConfig] :: ServerConfig s -> FilePath

-- | file to save and restore stats
[$sel:serverStatsBackupFile:ServerConfig] :: ServerConfig s -> Maybe FilePath

-- | interval and file to save prometheus metrics
[$sel:prometheusInterval:ServerConfig] :: ServerConfig s -> Maybe Int
[$sel:prometheusMetricsFile:ServerConfig] :: ServerConfig s -> FilePath

-- | notification delivery interval
[$sel:ntfDeliveryInterval:ServerConfig] :: ServerConfig s -> Int

-- | interval between sending pending END events to unsubscribed clients,
--   seconds
[$sel:pendingENDInterval:ServerConfig] :: ServerConfig s -> Int
[$sel:smpCredentials:ServerConfig] :: ServerConfig s -> ServerCredentials
[$sel:httpCredentials:ServerConfig] :: ServerConfig s -> Maybe ServerCredentials

-- | SMP client-server protocol version range
[$sel:smpServerVRange:ServerConfig] :: ServerConfig s -> VersionRangeSMP

-- | TCP transport config
[$sel:transportConfig:ServerConfig] :: ServerConfig s -> TransportServerConfig

-- | run listener on control port
[$sel:controlPort:ServerConfig] :: ServerConfig s -> Maybe ServiceName

-- | SMP proxy config
[$sel:smpAgentCfg:ServerConfig] :: ServerConfig s -> SMPClientAgentConfig
[$sel:allowSMPProxy:ServerConfig] :: ServerConfig s -> Bool
[$sel:serverClientConcurrency:ServerConfig] :: ServerConfig s -> Int

-- | server public information
[$sel:information:ServerConfig] :: ServerConfig s -> Maybe ServerPublicInfo
[$sel:startOptions:ServerConfig] :: ServerConfig s -> StartOptions
data ServerStoreCfg s
[SSCMemory] :: Maybe StorePaths -> ServerStoreCfg STMMsgStore
[SSCMemoryJournal] :: FilePath -> FilePath -> ServerStoreCfg (JournalMsgStore 'QSMemory)
[SSCDatabaseJournal] :: PostgresStoreCfg -> FilePath -> ServerStoreCfg (JournalMsgStore 'QSPostgres)
type family SupportedStore (qs :: QSType) (ms :: MSType) :: Constraint
data StorePaths
StorePaths :: FilePath -> Maybe FilePath -> StorePaths
[$sel:storeLogFile:StorePaths] :: StorePaths -> FilePath
[$sel:storeMsgsFile:StorePaths] :: StorePaths -> Maybe FilePath
data StartOptions
StartOptions :: Bool -> Bool -> LogLevel -> Bool -> MigrationConfirmation -> StartOptions
[$sel:maintenance:StartOptions] :: StartOptions -> Bool
[$sel:compactLog:StartOptions] :: StartOptions -> Bool
[$sel:logLevel:StartOptions] :: StartOptions -> LogLevel
[$sel:skipWarnings:StartOptions] :: StartOptions -> Bool
[$sel:confirmMigrations:StartOptions] :: StartOptions -> MigrationConfirmation
data Env s
Env :: ServerConfig s -> TVar Bool -> ServerInformation -> Server s -> KeyHash -> MsgStore s -> NtfStore -> TVar ChaChaDRG -> Credential -> Maybe Credential -> ServerStats -> TVar [(ServiceName, SocketState)] -> TVar ClientId -> ProxyAgent -> Env s
[$sel:config:Env] :: Env s -> ServerConfig s
[$sel:serverActive:Env] :: Env s -> TVar Bool
[$sel:serverInfo:Env] :: Env s -> ServerInformation
[$sel:server:Env] :: Env s -> Server s
[$sel:serverIdentity:Env] :: Env s -> KeyHash
[$sel:msgStore_:Env] :: Env s -> MsgStore s
[$sel:ntfStore:Env] :: Env s -> NtfStore
[$sel:random:Env] :: Env s -> TVar ChaChaDRG
[$sel:tlsServerCreds:Env] :: Env s -> Credential
[$sel:httpServerCreds:Env] :: Env s -> Maybe Credential
[$sel:serverStats:Env] :: Env s -> ServerStats
[$sel:sockets:Env] :: Env s -> TVar [(ServiceName, SocketState)]
[$sel:clientSeq:Env] :: Env s -> TVar ClientId
[$sel:proxyAgent:Env] :: Env s -> ProxyAgent
data Server s
Server :: ServerClients s -> ServerSubscribers s -> ServerSubscribers s -> Lock -> Server s
[$sel:clients:Server] :: Server s -> ServerClients s
[$sel:subscribers:Server] :: Server s -> ServerSubscribers s
[$sel:ntfSubscribers:Server] :: Server s -> ServerSubscribers s
[$sel:savingLock:Server] :: Server s -> Lock
data ServerSubscribers s
ServerSubscribers :: TQueue (ClientSub, ClientId) -> SubscribedClients s -> SubscribedClients s -> TVar Int64 -> TVar IntSet -> TVar (IntMap (NonEmpty (EntityId, BrokerMsg))) -> ServerSubscribers s
[$sel:subQ:ServerSubscribers] :: ServerSubscribers s -> TQueue (ClientSub, ClientId)
[$sel:queueSubscribers:ServerSubscribers] :: ServerSubscribers s -> SubscribedClients s
[$sel:serviceSubscribers:ServerSubscribers] :: ServerSubscribers s -> SubscribedClients s
[$sel:totalServiceSubs:ServerSubscribers] :: ServerSubscribers s -> TVar Int64
[$sel:subClients:ServerSubscribers] :: ServerSubscribers s -> TVar IntSet
[$sel:pendingEvents:ServerSubscribers] :: ServerSubscribers s -> TVar (IntMap (NonEmpty (EntityId, BrokerMsg)))
data SubscribedClients s
newtype ProxyAgent
ProxyAgent :: SMPClientAgent 'Sender -> ProxyAgent
[$sel:smpAgent:ProxyAgent] :: ProxyAgent -> SMPClientAgent 'Sender
data Client s
Client :: ClientId -> TMap RecipientId Sub -> TMap NotifierId () -> TVar Bool -> TVar Bool -> TVar Int64 -> TVar Int64 -> TBQueue (NonEmpty (VerifiedTransmission s)) -> TBQueue (NonEmpty (Transmission BrokerMsg), [Transmission BrokerMsg]) -> TBQueue (NonEmpty (Transmission BrokerMsg)) -> TVar Int -> TVar (IntMap (Weak ThreadId)) -> TVar Int -> THandleParams SMPVersion 'TServer -> TVar Bool -> SystemTime -> TVar SystemTime -> TVar SystemTime -> Client s
[$sel:clientId:Client] :: Client s -> ClientId
[$sel:subscriptions:Client] :: Client s -> TMap RecipientId Sub
[$sel:ntfSubscriptions:Client] :: Client s -> TMap NotifierId ()
[$sel:serviceSubscribed:Client] :: Client s -> TVar Bool
[$sel:ntfServiceSubscribed:Client] :: Client s -> TVar Bool
[$sel:serviceSubsCount:Client] :: Client s -> TVar Int64
[$sel:ntfServiceSubsCount:Client] :: Client s -> TVar Int64
[$sel:rcvQ:Client] :: Client s -> TBQueue (NonEmpty (VerifiedTransmission s))
[$sel:sndQ:Client] :: Client s -> TBQueue (NonEmpty (Transmission BrokerMsg), [Transmission BrokerMsg])
[$sel:msgQ:Client] :: Client s -> TBQueue (NonEmpty (Transmission BrokerMsg))
[$sel:procThreads:Client] :: Client s -> TVar Int
[$sel:endThreads:Client] :: Client s -> TVar (IntMap (Weak ThreadId))
[$sel:endThreadSeq:Client] :: Client s -> TVar Int
[$sel:clientTHParams:Client] :: Client s -> THandleParams SMPVersion 'TServer
[$sel:connected:Client] :: Client s -> TVar Bool
[$sel:createdAt:Client] :: Client s -> SystemTime
[$sel:rcvActiveAt:Client] :: Client s -> TVar SystemTime
[$sel:sndActiveAt:Client] :: Client s -> TVar SystemTime
type ClientId = Int
data ClientSub
CSClient :: QueueId -> Maybe ServiceId -> Maybe ServiceId -> ClientSub
CSDeleted :: QueueId -> Maybe ServiceId -> ClientSub
CSService :: ServiceId -> Int64 -> ClientSub
data Sub
Sub :: ServerSub -> TVar (Maybe (MsgId, SystemSeconds)) -> Sub
[$sel:subThread:Sub] :: Sub -> ServerSub
[$sel:delivered:Sub] :: Sub -> TVar (Maybe (MsgId, SystemSeconds))
data ServerSub
ServerSub :: TVar SubscriptionThread -> ServerSub
ProhibitSub :: ServerSub
data SubscriptionThread
NoSub :: SubscriptionThread
SubPending :: SubscriptionThread
SubThread :: Weak ThreadId -> SubscriptionThread
type family MsgStoreType (qs :: QSType) (ms :: MSType)
data MsgStore s
[StoreMemory] :: STMMsgStore -> MsgStore STMMsgStore
[StoreJournal] :: JournalMsgStore qs -> MsgStore (JournalMsgStore qs)
data AStoreType
ASType :: SQSType qs -> SMSType ms -> AStoreType
type VerifiedTransmission s = (Maybe (StoreQueue s, QueueRec), Transmission Cmd)
type ResponseAndMessage = (Transmission BrokerMsg, Maybe (Transmission BrokerMsg))
newEnv :: ServerConfig s -> IO (Env s)
mkJournalStoreConfig :: QStoreCfg s -> FilePath -> Int -> Int -> Int -> Int64 -> JournalStoreConfig s
msgStore :: Env s -> s
fromMsgStore :: MsgStore s -> s
newClient :: ClientId -> Natural -> THandleParams SMPVersion 'TServer -> SystemTime -> IO (Client s)
getServerClients :: Server s -> IO (IntMap (Client s))
getServerClient :: ClientId -> Server s -> IO (Maybe (Client s))
insertServerClient :: Client s -> Server s -> IO Bool
deleteServerClient :: ClientId -> Server s -> IO ()
getSubscribedClients :: SubscribedClients s -> IO (Map EntityId (TVar (Maybe (Client s))))
getSubscribedClient :: EntityId -> SubscribedClients s -> IO (Maybe (TVar (Maybe (Client s))))
upsertSubscribedClient :: EntityId -> Client s -> SubscribedClients s -> STM (Maybe (Client s))
lookupSubscribedClient :: EntityId -> SubscribedClients s -> STM (Maybe (Client s))
lookupDeleteSubscribedClient :: EntityId -> SubscribedClients s -> STM (Maybe (Client s))
deleteSubcribedClient :: EntityId -> Client s -> SubscribedClients s -> IO ()
sameClientId :: Client s -> Client s -> Bool
sameClient :: Client s -> TVar (Maybe (Client s)) -> STM Bool
newSubscription :: SubscriptionThread -> STM Sub
newProhibitedSub :: STM Sub
defaultMsgQueueQuota :: Int
defMsgExpirationDays :: Int64
defNtfExpirationHours :: Int64
defaultMessageExpiration :: ExpirationConfig
defaultNtfExpiration :: ExpirationConfig
defaultInactiveClientExpiration :: ExpirationConfig
defaultProxyClientConcurrency :: Int
defaultMaxJournalMsgCount :: Int
defaultMaxJournalStateLines :: Int
defaultIdleQueueInterval :: Int64
journalMsgStoreDepth :: Int
readWriteQueueStore :: forall q. StoreQueueClass q => Bool -> (RecipientId -> QueueRec -> IO q) -> FilePath -> STMQueueStore q -> IO (StoreLog 'WriteMode)
noPostgresExitStr :: String
noPostgresExit :: IO a
dbStoreCfg :: ServerStoreCfg s -> Maybe PostgresStoreCfg
storeLogFile' :: ServerStoreCfg s -> Maybe FilePath

module Simplex.Messaging.Server.CLI
data SignAlgorithm
ED448 :: SignAlgorithm
ED25519 :: SignAlgorithm
data X509Config
X509Config :: HostName -> SignAlgorithm -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> X509Config
[$sel:commonName:X509Config] :: X509Config -> HostName
[$sel:signAlgorithm:X509Config] :: X509Config -> SignAlgorithm
[$sel:caKeyFile:X509Config] :: X509Config -> FilePath
[$sel:caCrtFile:X509Config] :: X509Config -> FilePath
[$sel:serverKeyFile:X509Config] :: X509Config -> FilePath
[$sel:serverCrtFile:X509Config] :: X509Config -> FilePath
[$sel:fingerprintFile:X509Config] :: X509Config -> FilePath
[$sel:opensslCaConfFile:X509Config] :: X509Config -> FilePath
[$sel:opensslServerConfFile:X509Config] :: X509Config -> FilePath
[$sel:serverCsrFile:X509Config] :: X509Config -> FilePath
data CertOptions
CertOptions :: Maybe SignAlgorithm -> Maybe HostName -> CertOptions
[$sel:signAlgorithm_:CertOptions] :: CertOptions -> Maybe SignAlgorithm
[$sel:commonName_:CertOptions] :: CertOptions -> Maybe HostName
data IniOptions
IniOptions :: Bool -> ServiceName -> Bool -> IniOptions
[$sel:enableStoreLog:IniOptions] :: IniOptions -> Bool
[$sel:port:IniOptions] :: IniOptions -> ServiceName
[$sel:enableWebsockets:IniOptions] :: IniOptions -> Bool
exitError :: String -> IO a
confirmOrExit :: String -> String -> IO ()
defaultX509Config :: X509Config
getCliCommand' :: Parser cmd -> String -> IO cmd
simplexmqVersionCommit :: String
simplexmqCommit :: String
createServerX509 :: FilePath -> X509Config -> IO ByteString
createServerX509_ :: Bool -> FilePath -> X509Config -> IO ByteString
certOptionsP :: Parser CertOptions
dbOptsP :: DBOpts -> Parser DBOpts
startOptionsP :: Parser StartOptions
parseConfirmMigrations :: ReadM MigrationConfirmation
parseLogLevel :: ReadM LogLevel
genOnline :: FilePath -> CertOptions -> IO ()
warnCAPrivateKeyFile :: FilePath -> X509Config -> IO ()
mkIniOptions :: Ini -> IniOptions
strictIni :: Text -> Text -> Ini -> Text
readStrictIni :: Read a => Text -> Text -> Ini -> a
readIniDefault :: Read a => a -> Text -> Text -> Ini -> a
iniOnOff :: Text -> Text -> Ini -> Maybe Bool
strDecodeIni :: StrEncoding a => Text -> Text -> Ini -> Maybe (Either String a)
withPrompt :: String -> IO a -> IO a
onOffPrompt :: String -> Bool -> IO Bool
onOff :: Bool -> Text
settingIsOn :: Text -> Text -> Ini -> Maybe ()
checkSavedFingerprint :: FilePath -> X509Config -> IO ByteString
iniTransports :: Ini -> [(ServiceName, ASrvTransport, AddHTTP)]
iniDBOptions :: Ini -> DBOpts -> DBOpts
printServerConfig :: String -> [(ServiceName, ASrvTransport, AddHTTP)] -> Maybe FilePath -> IO ()
printServerTransports :: String -> [(ServiceName, ASrvTransport, AddHTTP)] -> IO ()
printSMPServerConfig :: [(ServiceName, ASrvTransport, AddHTTP)] -> ServerStoreCfg s -> IO ()
deleteDirIfExists :: FilePath -> IO ()
printServiceInfo :: ProtocolTypeI p => String -> ProtoServerWithAuth p -> IO ()
clearDirIfExists :: FilePath -> IO ()
getEnvPath :: String -> FilePath -> IO FilePath
instance GHC.Show.Show Simplex.Messaging.Server.CLI.SignAlgorithm
instance GHC.Read.Read Simplex.Messaging.Server.CLI.SignAlgorithm
instance GHC.Show.Show Simplex.Messaging.Server.CLI.CertOptions

module Simplex.Messaging.Server.Main.Init
data InitOptions
InitOptions :: Bool -> DBOpts -> Bool -> SignAlgorithm -> HostName -> Maybe HostName -> Maybe ServerPassword -> Maybe Int -> Maybe SocksProxy -> Maybe (NonEmpty TransportHost) -> Maybe Text -> ServerPublicInfo -> Maybe Text -> Maybe Text -> Maybe FilePath -> Bool -> Bool -> InitOptions
[$sel:enableStoreLog:InitOptions] :: InitOptions -> Bool
[$sel:dbOptions:InitOptions] :: InitOptions -> DBOpts
[$sel:logStats:InitOptions] :: InitOptions -> Bool
[$sel:signAlgorithm:InitOptions] :: InitOptions -> SignAlgorithm
[$sel:ip:InitOptions] :: InitOptions -> HostName
[$sel:fqdn:InitOptions] :: InitOptions -> Maybe HostName
[$sel:password:InitOptions] :: InitOptions -> Maybe ServerPassword
[$sel:controlPort:InitOptions] :: InitOptions -> Maybe Int
[$sel:socksProxy:InitOptions] :: InitOptions -> Maybe SocksProxy
[$sel:ownDomains:InitOptions] :: InitOptions -> Maybe (NonEmpty TransportHost)
[$sel:sourceCode:InitOptions] :: InitOptions -> Maybe Text
[$sel:serverInfo:InitOptions] :: InitOptions -> ServerPublicInfo
[$sel:operatorCountry:InitOptions] :: InitOptions -> Maybe Text
[$sel:hostingCountry:InitOptions] :: InitOptions -> Maybe Text
[$sel:webStaticPath:InitOptions] :: InitOptions -> Maybe FilePath
[$sel:disableWeb:InitOptions] :: InitOptions -> Bool
[$sel:scripted:InitOptions] :: InitOptions -> Bool
data ServerPassword
ServerPassword :: BasicAuth -> ServerPassword
SPRandom :: ServerPassword
defaultControlPort :: Int
defaultDBOpts :: DBOpts
defaultDeletedTTL :: Int64
iniFileContent :: FilePath -> FilePath -> InitOptions -> HostName -> Maybe BasicAuth -> Maybe (Text, Text) -> Text
informationIniContent :: InitOptions -> Text
iniDbOpts :: DBOpts -> DBOpts -> Text
optDisabled :: Maybe a -> Text
optDisabled' :: Bool -> Text
instance GHC.Show.Show Simplex.Messaging.Server.Main.Init.ServerPassword
instance GHC.Show.Show Simplex.Messaging.Server.Main.Init.InitOptions

module Simplex.FileTransfer.Server.Env
data XFTPServerConfig s
XFTPServerConfig :: ServiceName -> Maybe ServiceName -> Int -> XFTPStoreConfig s -> Maybe FilePath -> FilePath -> Maybe Int64 -> [Word32] -> Bool -> Maybe BasicAuth -> Maybe BasicAuth -> Maybe BasicAuth -> Maybe ExpirationConfig -> Int -> Maybe ExpirationConfig -> ServerCredentials -> Maybe ServerCredentials -> VersionRangeXFTP -> Maybe Int64 -> Int64 -> FilePath -> Maybe FilePath -> Maybe Int -> FilePath -> TransportServerConfig -> Int -> Maybe FilePath -> XFTPServerConfig s
[$sel:xftpPort:XFTPServerConfig] :: XFTPServerConfig s -> ServiceName
[$sel:controlPort:XFTPServerConfig] :: XFTPServerConfig s -> Maybe ServiceName
[$sel:fileIdSize:XFTPServerConfig] :: XFTPServerConfig s -> Int
[$sel:serverStoreCfg:XFTPServerConfig] :: XFTPServerConfig s -> XFTPStoreConfig s
[$sel:storeLogFile:XFTPServerConfig] :: XFTPServerConfig s -> Maybe FilePath
[$sel:filesPath:XFTPServerConfig] :: XFTPServerConfig s -> FilePath

-- | server storage quota
[$sel:fileSizeQuota:XFTPServerConfig] :: XFTPServerConfig s -> Maybe Int64

-- | allowed file chunk sizes
[$sel:allowedChunkSizes:XFTPServerConfig] :: XFTPServerConfig s -> [Word32]

-- | set to False to prohibit creating new files
[$sel:allowNewFiles:XFTPServerConfig] :: XFTPServerConfig s -> Bool

-- | simple password that the clients need to pass in handshake to be able
--   to create new files
[$sel:newFileBasicAuth:XFTPServerConfig] :: XFTPServerConfig s -> Maybe BasicAuth

-- | control port passwords,
[$sel:controlPortUserAuth:XFTPServerConfig] :: XFTPServerConfig s -> Maybe BasicAuth
[$sel:controlPortAdminAuth:XFTPServerConfig] :: XFTPServerConfig s -> Maybe BasicAuth

-- | time after which the files can be removed and check interval, seconds
[$sel:fileExpiration:XFTPServerConfig] :: XFTPServerConfig s -> Maybe ExpirationConfig

-- | timeout to receive file
[$sel:fileTimeout:XFTPServerConfig] :: XFTPServerConfig s -> Int

-- | time after which inactive clients can be disconnected and check
--   interval, seconds
[$sel:inactiveClientExpiration:XFTPServerConfig] :: XFTPServerConfig s -> Maybe ExpirationConfig
[$sel:xftpCredentials:XFTPServerConfig] :: XFTPServerConfig s -> ServerCredentials
[$sel:httpCredentials:XFTPServerConfig] :: XFTPServerConfig s -> Maybe ServerCredentials

-- | XFTP client-server protocol version range
[$sel:xftpServerVRange:XFTPServerConfig] :: XFTPServerConfig s -> VersionRangeXFTP
[$sel:logStatsInterval:XFTPServerConfig] :: XFTPServerConfig s -> Maybe Int64
[$sel:logStatsStartTime:XFTPServerConfig] :: XFTPServerConfig s -> Int64
[$sel:serverStatsLogFile:XFTPServerConfig] :: XFTPServerConfig s -> FilePath
[$sel:serverStatsBackupFile:XFTPServerConfig] :: XFTPServerConfig s -> Maybe FilePath
[$sel:prometheusInterval:XFTPServerConfig] :: XFTPServerConfig s -> Maybe Int
[$sel:prometheusMetricsFile:XFTPServerConfig] :: XFTPServerConfig s -> FilePath
[$sel:transportConfig:XFTPServerConfig] :: XFTPServerConfig s -> TransportServerConfig
[$sel:responseDelay:XFTPServerConfig] :: XFTPServerConfig s -> Int
[$sel:webStaticPath:XFTPServerConfig] :: XFTPServerConfig s -> Maybe FilePath
data XFTPStoreConfig s
[XSCMemory] :: Maybe FilePath -> XFTPStoreConfig STMFileStore
data XFTPEnv s
XFTPEnv :: XFTPServerConfig s -> FileStore s -> TVar Int64 -> Maybe (StoreLog 'WriteMode) -> TVar ChaChaDRG -> KeyHash -> Credential -> Maybe Credential -> FileServerStats -> XFTPEnv s
[$sel:config:XFTPEnv] :: XFTPEnv s -> XFTPServerConfig s
[$sel:store:XFTPEnv] :: XFTPEnv s -> FileStore s
[$sel:usedStorage:XFTPEnv] :: XFTPEnv s -> TVar Int64
[$sel:storeLog:XFTPEnv] :: XFTPEnv s -> Maybe (StoreLog 'WriteMode)
[$sel:random:XFTPEnv] :: XFTPEnv s -> TVar ChaChaDRG
[$sel:serverIdentity:XFTPEnv] :: XFTPEnv s -> KeyHash
[$sel:tlsServerCreds:XFTPEnv] :: XFTPEnv s -> Credential
[$sel:httpServerCreds:XFTPEnv] :: XFTPEnv s -> Maybe Credential
[$sel:serverStats:XFTPEnv] :: XFTPEnv s -> FileServerStats
data XFTPRequest
XFTPReqNew :: FileInfo -> NonEmpty RcvPublicAuthKey -> Maybe BasicAuth -> XFTPRequest
XFTPReqCmd :: XFTPFileId -> FileRec -> FileCmd -> XFTPRequest
XFTPReqPing :: XFTPRequest
type family XFTPStoreType (fs :: FSType)
data FileStore s
[StoreMemory] :: STMFileStore -> FileStore STMFileStore
data AFStoreType
AFSType :: SFSType fs -> AFStoreType
fileStore :: XFTPEnv s -> s
fromFileStore :: FileStore s -> s
defaultInactiveClientExpiration :: ExpirationConfig
defFileExpirationHours :: Int64
defaultFileExpiration :: ExpirationConfig
newXFTPServerEnv :: FileStoreClass s => XFTPServerConfig s -> IO (XFTPEnv s)
readFileStoreType :: Ini -> Either String AFStoreType

-- | Dispatch store config from AFStoreType singleton and run the callback.
--   CPP guards for Postgres are handled here so Main.hs stays CPP-free.
runWithStoreConfig :: AFStoreType -> Ini -> FilePath -> MigrationConfirmation -> (forall s. FileStoreClass s => XFTPStoreConfig s -> IO ()) -> IO ()

-- | Validate startup config when store_files=database.
checkFileStoreMode :: Ini -> AFStoreType -> FilePath -> IO ()

-- | Import StoreLog to PostgreSQL database.
importToDatabase :: FilePath -> Ini -> MigrationConfirmation -> IO ()

-- | Export PostgreSQL database to StoreLog.
exportFromDatabase :: FilePath -> Ini -> MigrationConfirmation -> IO ()

module Simplex.FileTransfer.Client.Main
data SendOptions
SendOptions :: FilePath -> Maybe FilePath -> Int -> [XFTPServerWithAuth] -> Int -> Maybe FilePath -> Bool -> SendOptions
[$sel:filePath:SendOptions] :: SendOptions -> FilePath
[$sel:outputDir:SendOptions] :: SendOptions -> Maybe FilePath
[$sel:numRecipients:SendOptions] :: SendOptions -> Int
[$sel:xftpServers:SendOptions] :: SendOptions -> [XFTPServerWithAuth]
[$sel:retryCount:SendOptions] :: SendOptions -> Int
[$sel:tempPath:SendOptions] :: SendOptions -> Maybe FilePath
[$sel:verbose:SendOptions] :: SendOptions -> Bool
newtype CLIError
CLIError :: String -> CLIError
xftpClientCLI :: IO ()
cliSendFile :: SendOptions -> ExceptT CLIError IO ()
cliSendFileOpts :: SendOptions -> Bool -> (Int64 -> Int64 -> IO ()) -> ExceptT CLIError IO ()

-- | Encode file description as web-compatible URI fragment. Result is
--   base64url(deflateRaw(YAML)), no leading <tt>#</tt>.
encodeWebURI :: FileDescription 'FRecipient -> ByteString

-- | Decode web URI fragment to validated file description. Input is
--   base64url-encoded DEFLATE-compressed YAML, no leading <tt>#</tt>.
decodeWebURI :: ByteString -> Either String (ValidFileDescription 'FRecipient)

-- | Extract web link host and URI fragment from a file description.
--   Returns (hostname, uriFragment) for
--   <a>https://hostname/#uriFragment</a>.
fileWebLink :: FileDescription 'FRecipient -> Maybe (ByteString, ByteString)
singleChunkSize :: Int64 -> Maybe Word32
prepareChunkSizes :: Int64 -> [Word32]
prepareChunkSpecs :: FilePath -> [Word32] -> [XFTPChunkSpec]
getChunkDigest :: XFTPChunkSpec -> IO ByteString
instance GHC.Exception.Type.Exception Simplex.FileTransfer.Client.Main.CLIError
instance GHC.Show.Show Simplex.FileTransfer.Client.Main.CLIError
instance GHC.Classes.Eq Simplex.FileTransfer.Client.Main.CLIError
instance GHC.Show.Show Simplex.FileTransfer.Client.Main.SendOptions
instance GHC.Show.Show Simplex.FileTransfer.Client.Main.ReceiveOptions
instance GHC.Show.Show Simplex.FileTransfer.Client.Main.DeleteOptions
instance GHC.Show.Show Simplex.FileTransfer.Client.Main.InfoOptions
instance GHC.Show.Show Simplex.FileTransfer.Client.Main.RandomFileOptions
instance GHC.Show.Show Simplex.FileTransfer.Client.Main.SentFileChunkReplica
instance GHC.Show.Show Simplex.FileTransfer.Client.Main.SentFileChunk


-- | This module defines SMP protocol server with in-memory persistence and
--   optional append only log of SMP queue records.
--   
--   See
--   <a>https://github.com/simplex-chat/simplexmq/blob/master/protocol/simplex-messaging.md</a>
module Simplex.Messaging.Server

-- | Runs an SMP server using passed configuration.
--   
--   See a full server here:
--   <a>https://github.com/simplex-chat/simplexmq/blob/master/apps/smp-server/Main.hs</a>
runSMPServer :: MsgStoreClass s => ServerConfig s -> Maybe AttachHTTP -> IO ()

-- | Runs an SMP server using passed configuration with signalling.
--   
--   This function uses passed TMVar to signal when the server is ready to
--   accept TCP requests (True) and when it is disconnected from the TCP
--   socket once the server thread is killed (False).
runSMPServerBlocking :: MsgStoreClass s => TMVar Bool -> ServerConfig s -> Maybe AttachHTTP -> IO ()
controlPortAuth :: Handle -> Maybe BasicAuth -> Maybe BasicAuth -> TVar CPClientRole -> BasicAuth -> IO ()
importMessages :: forall s. MsgStoreClass s => Bool -> s -> FilePath -> Maybe Int64 -> Bool -> IO MessageStats
exportMessages :: forall s. MsgStoreClass s => Bool -> MsgStore s -> FilePath -> Bool -> IO ()
printMessageStats :: Text -> MessageStats -> IO ()
disconnectTransport :: Transport c => THandle v c 'TServer -> TVar SystemTime -> TVar SystemTime -> ExpirationConfig -> IO Bool -> IO ()
verifyCmdAuthorization :: Maybe (THandleAuth 'TServer) -> Maybe TAuthorizations -> ByteString -> CorrId -> APublicAuthKey -> Bool
dummyVerifyCmd :: Maybe (THandleAuth 'TServer) -> Maybe TAuthorizations -> ByteString -> CorrId -> Bool
randomId :: Int -> M s EntityId
type AttachHTTP = Socket -> Context -> IO ()
data MessageStats
MessageStats :: Int -> Int -> Int -> MessageStats
[$sel:storedMsgsCount:MessageStats] :: MessageStats -> Int
[$sel:expiredMsgsCount:MessageStats] :: MessageStats -> Int
[$sel:storedQueues:MessageStats] :: MessageStats -> Int

module Simplex.Messaging.Server.Web
data EmbeddedWebParams
EmbeddedWebParams :: FilePath -> Maybe Int -> Maybe WebHttpsParams -> EmbeddedWebParams
[webStaticPath] :: EmbeddedWebParams -> FilePath
[webHttpPort] :: EmbeddedWebParams -> Maybe Int
[webHttpsParams] :: EmbeddedWebParams -> Maybe WebHttpsParams
data WebHttpsParams
WebHttpsParams :: Int -> FilePath -> FilePath -> WebHttpsParams
[port] :: WebHttpsParams -> Int
[cert] :: WebHttpsParams -> FilePath
[key] :: WebHttpsParams -> FilePath
data EmbeddedContent
EmbeddedContent :: ByteString -> ByteString -> [(FilePath, ByteString)] -> [(FilePath, ByteString)] -> EmbeddedContent
[indexHtml] :: EmbeddedContent -> ByteString
[linkHtml] :: EmbeddedContent -> ByteString
[mediaContent] :: EmbeddedContent -> [(FilePath, ByteString)]
[wellKnown] :: EmbeddedContent -> [(FilePath, ByteString)]
serveStaticFiles :: EmbeddedWebParams -> IO ()

-- | Prepare context and prepare HTTP handler for TLS connections that
--   already passed TLS.handshake and ALPN check.
attachStaticFiles :: FilePath -> (AttachHTTP -> IO ()) -> IO ()

-- | Serve static files via HTTP/2 directly (without WAI). Path traversal
--   protection: resolved path must stay under canonicalRoot. canonicalRoot
--   must be pre-computed via <a>canonicalizePath</a>.
serveStaticPageH2 :: FilePath -> Request -> (Response -> IO ()) -> IO Bool
generateSite :: EmbeddedContent -> ByteString -> [String] -> FilePath -> IO ()

-- | Substitutions for server information fields shared between SMP and
--   XFTP pages.
serverInfoSubsts :: String -> Maybe ServerPublicInfo -> [(ByteString, Maybe ByteString)]

-- | Rewrite source with provided substitutions
render :: ByteString -> [(ByteString, Maybe ByteString)] -> ByteString

-- | Rewrite section content inside
--   <tt><a>x-label</a>...<a>/x-label</a></tt> markers. Markers are always
--   removed when found. Closing marker is mandatory. If content is absent,
--   whole section is removed. Section content is delegated to
--   <a>item_</a>. If no sections found, the whole source is delegated.
section_ :: ByteString -> Maybe ByteString -> ByteString -> ByteString

-- | Replace all occurrences of <tt>${label}</tt> with provided content.
item_ :: ByteString -> ByteString -> ByteString -> ByteString
timedTTLText :: (Integral i, Show i) => i -> String

module Simplex.Messaging.Server.Main
data EmbeddedWebParams
EmbeddedWebParams :: FilePath -> Maybe Int -> Maybe WebHttpsParams -> EmbeddedWebParams
[webStaticPath] :: EmbeddedWebParams -> FilePath
[webHttpPort] :: EmbeddedWebParams -> Maybe Int
[webHttpsParams] :: EmbeddedWebParams -> Maybe WebHttpsParams
data WebHttpsParams
WebHttpsParams :: Int -> FilePath -> FilePath -> WebHttpsParams
[port] :: WebHttpsParams -> Int
[cert] :: WebHttpsParams -> FilePath
[key] :: WebHttpsParams -> FilePath
data CliCommand
Init :: InitOptions -> CliCommand
OnlineCert :: CertOptions -> CliCommand
Start :: StartOptions -> CliCommand
Delete :: CliCommand
Journal :: StoreCmd -> CliCommand
Database :: StoreCmd -> DatabaseTable -> DBOpts -> CliCommand
data StoreCmd
SCImport :: StoreCmd
SCExport :: StoreCmd
SCDelete :: StoreCmd
data DatabaseTable
DTQueues :: DatabaseTable
DTMessages :: DatabaseTable
DTAll :: DatabaseTable
smpServerCLI :: FilePath -> FilePath -> IO ()
smpServerCLI_ :: (ServerInformation -> Maybe TransportHost -> FilePath -> IO ()) -> (EmbeddedWebParams -> IO ()) -> (FilePath -> (AttachHTTP -> IO ()) -> IO ()) -> FilePath -> FilePath -> IO ()
newJournalMsgStore :: FilePath -> QStoreCfg s -> IO (JournalMsgStore s)
storeMsgsJournalDir' :: FilePath -> FilePath
getServerSourceCode :: IO (Maybe String)
simplexmqSource :: String
serverPublicInfo :: Ini -> Maybe ServerPublicInfo
validCountryValue :: String -> String -> Either String Text
printSourceCode :: Maybe Text -> IO ()
cliCommandP :: FilePath -> FilePath -> FilePath -> Parser CliCommand
strParse :: StrEncoding a => ReadM a
instance Simplex.Messaging.Encoding.String.StrEncoding Simplex.Messaging.Server.Main.DatabaseTable

module Simplex.FileTransfer.Server
runXFTPServer :: FileStoreClass s => XFTPServerConfig s -> IO ()
runXFTPServerBlocking :: FileStoreClass s => TMVar Bool -> XFTPServerConfig s -> IO ()

module Simplex.FileTransfer.Server.Main
xftpServerCLI :: FilePath -> FilePath -> IO ()
xftpServerCLI_ :: (forall s. XFTPServerConfig s -> Maybe ServerPublicInfo -> Maybe TransportHost -> FilePath -> IO ()) -> (EmbeddedWebParams -> IO ()) -> FilePath -> FilePath -> IO ()
instance GHC.Show.Show Simplex.FileTransfer.Server.Main.InitOptions

module Simplex.Messaging.Crypto.ShortLink
contactShortLinkKdf :: LinkKey -> (LinkId, SbKey)
invShortLinkKdf :: LinkKey -> SbKey
encodeSignLinkData :: forall c. ConnectionModeI c => KeyPairEd25519 -> VersionRangeSMPA -> ConnectionRequestUri c -> Maybe ByteString -> UserConnLinkData c -> (LinkKey, (ByteString, ByteString))
encodeSignFixedData :: ConnectionModeI c => KeyPairEd25519 -> VersionRangeSMPA -> ConnectionRequestUri c -> Maybe ByteString -> (LinkKey, ByteString)
encodeSignUserData :: ConnectionModeI c => SConnectionMode c -> PrivateKeyEd25519 -> VersionRangeSMPA -> UserConnLinkData c -> ByteString

-- | Generate a new owner key pair and create OwnerAuth signed by the
--   authorizing key. ownerId is application-specific (e.g., MemberId in
--   chat).
newOwnerAuth :: TVar ChaChaDRG -> OwnerId -> PrivateKeyEd25519 -> IO (PrivateKeyEd25519, OwnerAuth)
encryptLinkData :: TVar ChaChaDRG -> SbKey -> (ByteString, ByteString) -> ExceptT AgentErrorType IO QueueLinkData
encryptUserData :: TVar ChaChaDRG -> SbKey -> ByteString -> ExceptT AgentErrorType IO EncDataBytes
decryptLinkData :: forall c. ConnectionModeI c => LinkKey -> SbKey -> QueueLinkData -> Either AgentErrorType (FixedLinkData c, ConnLinkData c)

module Simplex.Messaging.Agent.NtfSubSupervisor
runNtfSupervisor :: AgentClient -> AM' ()
nsUpdateToken :: NtfSupervisor -> NtfToken -> STM ()
nsRemoveNtfToken :: NtfSupervisor -> STM ()
sendNtfSubCommand :: NtfSupervisor -> (NtfSupervisorCommand, NonEmpty ConnId) -> IO ()
hasInstantNotifications :: NtfSupervisor -> IO Bool
instantNotifications :: NtfToken -> Bool
deleteToken :: AgentClient -> NtfToken -> AM ()
closeNtfSupervisor :: NtfSupervisor -> IO ()
getNtfServer :: AgentClient -> AM' (Maybe NtfServer)

module Simplex.FileTransfer.Agent
startXFTPWorkers :: AgentClient -> Maybe FilePath -> AM ()
startXFTPSndWorkers :: AgentClient -> Maybe FilePath -> AM ()
closeXFTPAgent :: XFTPAgent -> IO ()
toFSFilePath :: FilePath -> AM' FilePath
xftpReceiveFile' :: AgentClient -> UserId -> ValidFileDescription 'FRecipient -> Maybe CryptoFileArgs -> Bool -> AM RcvFileId
xftpDeleteRcvFile' :: AgentClient -> RcvFileId -> AM' ()
xftpDeleteRcvFiles' :: AgentClient -> [RcvFileId] -> AM' ()
xftpSendFile' :: AgentClient -> UserId -> CryptoFile -> Int -> AM SndFileId
xftpSendDescription' :: AgentClient -> UserId -> ValidFileDescription 'FRecipient -> Int -> AM SndFileId
deleteSndFileInternal :: AgentClient -> SndFileId -> AM' ()
deleteSndFilesInternal :: AgentClient -> [SndFileId] -> AM' ()
deleteSndFileRemote :: AgentClient -> UserId -> SndFileId -> ValidFileDescription 'FSender -> AM' ()
deleteSndFilesRemote :: AgentClient -> UserId -> [(SndFileId, ValidFileDescription 'FSender)] -> AM' ()


-- | This module defines SMP protocol agent with SQLite persistence.
--   
--   See
--   <a>https://github.com/simplex-chat/simplexmq/blob/master/protocol/agent-protocol.md</a>
module Simplex.Messaging.Agent
data AgentClient
AgentClient :: TVar (Maybe (Weak ThreadId)) -> TVar Bool -> TBQueue ATransmission -> TBQueue (ServerTransmissionBatch SMPVersion ErrorType BrokerMsg) -> TMap UserId (UserServers 'PSMP) -> TMap SMPTransportSession SMPClientVar -> TMap SMPTransportSession SMPServerWithAuth -> TVar [NtfServer] -> TMap NtfTransportSession NtfClientVar -> TMap UserId (UserServers 'PXFTP) -> TMap XFTPTransportSession XFTPClientVar -> TVar (NetworkConfig, NetworkConfig) -> [HostName] -> [SMPServer] -> TVar UserNetworkInfo -> TVar (Maybe UTCTime) -> TVar (Set ConnId) -> TSessionSubs -> TMap (UserId, SMPServer) (TMap RecipientId SMPClientError) -> TMap (Maybe SMPServer) (Maybe SystemSeconds) -> TMVar () -> TVar Int -> TMap SndQAddr (Worker, TMVar ()) -> TMap (ConnId, Maybe SMPServer) Worker -> TVar AgentOpState -> TVar AgentOpState -> TVar AgentOpState -> TVar AgentOpState -> TVar AgentOpState -> TVar AgentState -> TMap (SMPServer, RecipientId) (TMVar ()) -> TMap ConnId Lock -> TMap ByteString Lock -> Lock -> TMap SMPTransportSession (SessionVar (Async ())) -> Int -> Env -> TVar UTCTime -> TMap (UserId, SMPServer) AgentSMPServerStats -> TMap (UserId, XFTPServer) AgentXFTPServerStats -> TMap (UserId, NtfServer) AgentNtfServerStats -> TVar UTCTime -> AgentClient
[$sel:acThread:AgentClient] :: AgentClient -> TVar (Maybe (Weak ThreadId))
[$sel:active:AgentClient] :: AgentClient -> TVar Bool
[$sel:subQ:AgentClient] :: AgentClient -> TBQueue ATransmission
[$sel:msgQ:AgentClient] :: AgentClient -> TBQueue (ServerTransmissionBatch SMPVersion ErrorType BrokerMsg)
[$sel:smpServers:AgentClient] :: AgentClient -> TMap UserId (UserServers 'PSMP)
[$sel:smpClients:AgentClient] :: AgentClient -> TMap SMPTransportSession SMPClientVar
[$sel:smpProxiedRelays:AgentClient] :: AgentClient -> TMap SMPTransportSession SMPServerWithAuth
[$sel:ntfServers:AgentClient] :: AgentClient -> TVar [NtfServer]
[$sel:ntfClients:AgentClient] :: AgentClient -> TMap NtfTransportSession NtfClientVar
[$sel:xftpServers:AgentClient] :: AgentClient -> TMap UserId (UserServers 'PXFTP)
[$sel:xftpClients:AgentClient] :: AgentClient -> TMap XFTPTransportSession XFTPClientVar
[$sel:useNetworkConfig:AgentClient] :: AgentClient -> TVar (NetworkConfig, NetworkConfig)
[$sel:presetDomains:AgentClient] :: AgentClient -> [HostName]
[$sel:presetServers:AgentClient] :: AgentClient -> [SMPServer]
[$sel:userNetworkInfo:AgentClient] :: AgentClient -> TVar UserNetworkInfo
[$sel:userNetworkUpdated:AgentClient] :: AgentClient -> TVar (Maybe UTCTime)
[$sel:subscrConns:AgentClient] :: AgentClient -> TVar (Set ConnId)
[$sel:currentSubs:AgentClient] :: AgentClient -> TSessionSubs
[$sel:removedSubs:AgentClient] :: AgentClient -> TMap (UserId, SMPServer) (TMap RecipientId SMPClientError)
[$sel:clientNotices:AgentClient] :: AgentClient -> TMap (Maybe SMPServer) (Maybe SystemSeconds)
[$sel:clientNoticesLock:AgentClient] :: AgentClient -> TMVar ()
[$sel:workerSeq:AgentClient] :: AgentClient -> TVar Int
[$sel:smpDeliveryWorkers:AgentClient] :: AgentClient -> TMap SndQAddr (Worker, TMVar ())
[$sel:asyncCmdWorkers:AgentClient] :: AgentClient -> TMap (ConnId, Maybe SMPServer) Worker
[$sel:ntfNetworkOp:AgentClient] :: AgentClient -> TVar AgentOpState
[$sel:rcvNetworkOp:AgentClient] :: AgentClient -> TVar AgentOpState
[$sel:msgDeliveryOp:AgentClient] :: AgentClient -> TVar AgentOpState
[$sel:sndNetworkOp:AgentClient] :: AgentClient -> TVar AgentOpState
[$sel:databaseOp:AgentClient] :: AgentClient -> TVar AgentOpState
[$sel:agentState:AgentClient] :: AgentClient -> TVar AgentState
[$sel:getMsgLocks:AgentClient] :: AgentClient -> TMap (SMPServer, RecipientId) (TMVar ())
[$sel:connLocks:AgentClient] :: AgentClient -> TMap ConnId Lock
[$sel:invLocks:AgentClient] :: AgentClient -> TMap ByteString Lock
[$sel:deleteLock:AgentClient] :: AgentClient -> Lock
[$sel:smpSubWorkers:AgentClient] :: AgentClient -> TMap SMPTransportSession (SessionVar (Async ()))
[$sel:clientId:AgentClient] :: AgentClient -> Int
[$sel:agentEnv:AgentClient] :: AgentClient -> Env
[$sel:proxySessTs:AgentClient] :: AgentClient -> TVar UTCTime
[$sel:smpServersStats:AgentClient] :: AgentClient -> TMap (UserId, SMPServer) AgentSMPServerStats
[$sel:xftpServersStats:AgentClient] :: AgentClient -> TMap (UserId, XFTPServer) AgentXFTPServerStats
[$sel:ntfServersStats:AgentClient] :: AgentClient -> TMap (UserId, NtfServer) AgentNtfServerStats
[$sel:srvStatsStartedAt:AgentClient] :: AgentClient -> TVar UTCTime
type AE a = ExceptT AgentErrorType IO a
data SubscriptionsInfo
SubscriptionsInfo :: [SubInfo] -> [SubInfo] -> [SubInfo] -> SubscriptionsInfo
[$sel:activeSubscriptions:SubscriptionsInfo] :: SubscriptionsInfo -> [SubInfo]
[$sel:pendingSubscriptions:SubscriptionsInfo] :: SubscriptionsInfo -> [SubInfo]
[$sel:removedSubscriptions:SubscriptionsInfo] :: SubscriptionsInfo -> [SubInfo]
type MsgReq = (ConnId, PQEncryption, MsgFlags, ValueOrRef MsgBody)
data ValueOrRef a
VRValue :: Maybe Int -> a -> ValueOrRef a
VRRef :: Int -> ValueOrRef a
vrValue :: a -> ValueOrRef a

-- | Creates an SMP agent client instance
getSMPAgentClient :: AgentConfig -> InitialAgentServers -> DBStore -> Bool -> IO AgentClient
getSMPAgentClient_ :: Int -> AgentConfig -> InitialAgentServers -> DBStore -> Bool -> IO AgentClient
disconnectAgentClient :: AgentClient -> IO ()
disposeAgentClient :: AgentClient -> IO ()
resumeAgentClient :: AgentClient -> IO ()
withConnLock :: AgentClient -> ConnId -> Text -> AM a -> AM a
withInvLock :: AgentClient -> ByteString -> Text -> AM a -> AM a
createUser :: AgentClient -> NonEmpty (ServerCfg 'PSMP) -> NonEmpty (ServerCfg 'PXFTP) -> AE UserId

-- | Delete user record optionally deleting all user's connections on SMP
--   servers
deleteUser :: AgentClient -> UserId -> Bool -> AE ()
connRequestPQSupport :: AgentClient -> PQSupport -> ConnectionRequestUri c -> IO (Maybe (VersionSMPA, PQSupport))

-- | Create SMP agent connection (NEW command) asynchronously, synchronous
--   response is new connection id
createConnectionAsync :: ConnectionModeI c => AgentClient -> UserId -> ACorrId -> Bool -> SConnectionMode c -> InitialKeys -> SubscriptionMode -> AE ConnId

-- | Create or update user's contact connection short link (LSET command)
--   asynchronously, no synchronous response
setConnShortLinkAsync :: AgentClient -> ACorrId -> ConnId -> UserConnLinkData 'CMContact -> Maybe CRClientData -> AE ()

-- | Get and verify data from short link (LGET<i>LKEY command)
--   asynchronously, synchronous response is new</i>passed connection id
getConnShortLinkAsync :: AgentClient -> UserId -> ACorrId -> Maybe ConnId -> ConnShortLink 'CMContact -> AE ConnId

-- | Join SMP agent connection (JOIN command) asynchronously, synchronous
--   response is new connection id. If connId is provided (for contact
--   URIs), it updates the existing connection record created by
--   getConnShortLinkAsync.
joinConnectionAsync :: AgentClient -> UserId -> ACorrId -> Maybe ConnId -> Bool -> ConnectionRequestUri c -> ConnInfo -> PQSupport -> SubscriptionMode -> AE ConnId

-- | Allow connection to continue after CONF notification (LET command), no
--   synchronous response
allowConnectionAsync :: AgentClient -> ACorrId -> ConnId -> ConfirmationId -> ConnInfo -> AE ()

-- | Accept contact after REQ notification (ACPT command) asynchronously,
--   synchronous response is new connection id
acceptContactAsync :: AgentClient -> UserId -> ACorrId -> Bool -> ConfirmationId -> ConnInfo -> PQSupport -> SubscriptionMode -> AE ConnId

-- | Acknowledge message (ACK command) asynchronously, no synchronous
--   response
ackMessageAsync :: AgentClient -> ACorrId -> ConnId -> AgentMsgId -> Maybe MsgReceiptInfo -> AE ()

-- | Switch connection to the new receive queue
switchConnectionAsync :: AgentClient -> ACorrId -> ConnId -> AE ConnectionStats

-- | Delete SMP agent connection (DEL command) asynchronously, no
--   synchronous response
deleteConnectionAsync :: AgentClient -> Bool -> ConnId -> AE ()

-- | Delete SMP agent connections using batch commands asynchronously, no
--   synchronous response
deleteConnectionsAsync :: AgentClient -> Bool -> [ConnId] -> AE ()

-- | Create SMP agent connection (NEW command)
createConnection :: ConnectionModeI c => AgentClient -> NetworkRequestMode -> UserId -> Bool -> Bool -> SConnectionMode c -> Maybe (UserConnLinkData c) -> Maybe CRClientData -> InitialKeys -> SubscriptionMode -> AE (ConnId, (CreatedConnLink c, Maybe ClientServiceId))

-- | Prepare connection link for contact mode (no network call). Caller
--   provides root signing key pair and link entity ID. Returns the created
--   link and internal params. The link address is fully determined at this
--   point.
prepareConnectionLink :: AgentClient -> UserId -> KeyPairEd25519 -> ByteString -> Bool -> Maybe CRClientData -> AE (CreatedConnLink 'CMContact, PreparedLinkParams)

-- | Create connection for prepared link (single network call). Validates
--   that server response matches the prepared link.
createConnectionForLink :: AgentClient -> NetworkRequestMode -> UserId -> Bool -> CreatedConnLink 'CMContact -> PreparedLinkParams -> UserConnLinkData 'CMContact -> InitialKeys -> SubscriptionMode -> AE ConnId

-- | Create or update user's contact connection short link
setConnShortLink :: AgentClient -> NetworkRequestMode -> ConnId -> SConnectionMode c -> UserConnLinkData c -> Maybe CRClientData -> AE (ConnShortLink c)
deleteConnShortLink :: AgentClient -> NetworkRequestMode -> ConnId -> SConnectionMode c -> AE ()

-- | Get and verify data from short link. For 1-time invitations it
--   preserves the key to allow retries
getConnShortLink :: AgentClient -> NetworkRequestMode -> UserId -> ConnShortLink c -> AE (FixedLinkData c, ConnLinkData c)
getConnLinkPrivKey :: AgentClient -> ConnId -> AE (Maybe PrivateKeyEd25519)

-- | This irreversibly deletes short link data, and it won't be retrievable
--   again
deleteLocalInvShortLink :: AgentClient -> ConnShortLink 'CMInvitation -> AE ()

-- | Changes the user id associated with a connection
changeConnectionUser :: AgentClient -> UserId -> ConnId -> UserId -> AE ()

-- | Create SMP agent connection without queue (to be joined with
--   joinConnection passing connection ID). This method is required to
--   prevent race condition when confirmation from peer is received before
--   the caller of joinConnection saves connection ID to the database.
--   Instead of it we could send confirmation asynchronously, but then it
--   would be harder to report "link deleted" (SMP AUTH) interactively, so
--   this approach is simpler overall.
prepareConnectionToJoin :: AgentClient -> UserId -> Bool -> ConnectionRequestUri c -> PQSupport -> AE ConnId

-- | Create SMP agent connection without queue (to be joined with
--   acceptContact passing invitation ID).
prepareConnectionToAccept :: AgentClient -> UserId -> Bool -> ConfirmationId -> PQSupport -> AE ConnId

-- | Join SMP agent connection (JOIN command).
joinConnection :: AgentClient -> NetworkRequestMode -> UserId -> ConnId -> Bool -> ConnectionRequestUri c -> ConnInfo -> PQSupport -> SubscriptionMode -> AE (SndQueueSecured, Maybe ClientServiceId)

-- | Allow connection to continue after CONF notification (LET command)
allowConnection :: AgentClient -> ConnId -> ConfirmationId -> ConnInfo -> AE ()

-- | Accept contact after REQ notification (ACPT command)
acceptContact :: AgentClient -> NetworkRequestMode -> UserId -> ConnId -> Bool -> ConfirmationId -> ConnInfo -> PQSupport -> SubscriptionMode -> AE (SndQueueSecured, Maybe ClientServiceId)

-- | Reject contact (RJCT command)
rejectContact :: AgentClient -> ConfirmationId -> AE ()
data DatabaseDiff a
DatabaseDiff :: [a] -> [a] -> DatabaseDiff a
[$sel:missingIds:DatabaseDiff] :: DatabaseDiff a -> [a]
[$sel:extraIds:DatabaseDiff] :: DatabaseDiff a -> [a]
compareConnections :: AgentClient -> [UserId] -> [ConnId] -> AE (DatabaseDiff UserId, DatabaseDiff ConnId)
syncConnections :: AgentClient -> [UserId] -> [ConnId] -> AE (DatabaseDiff UserId, DatabaseDiff ConnId)

-- | Subscribe to receive connection messages (SUB command)
subscribeConnection :: AgentClient -> ConnId -> AE (Maybe ClientServiceId)

-- | Subscribe to receive connection messages from multiple connections,
--   batching commands when possible
subscribeConnections :: AgentClient -> [ConnId] -> AE (Map ConnId (Either AgentErrorType (Maybe ClientServiceId)))

-- | Subscribe to all connections
subscribeAllConnections :: AgentClient -> Bool -> Maybe UserId -> AE ()

-- | Get messages for connections (GET commands)
getConnectionMessages :: AgentClient -> NonEmpty ConnMsgReq -> IO (NonEmpty (Either AgentErrorType (Maybe SMPMsgMeta)))

-- | Get connections for received notification
getNotificationConns :: AgentClient -> CbNonce -> ByteString -> AE (NonEmpty NotificationInfo)
resubscribeConnection :: AgentClient -> ConnId -> AE (Maybe ClientServiceId)
resubscribeConnections :: AgentClient -> [ConnId] -> AE (Map ConnId (Either AgentErrorType (Maybe ClientServiceId)))
subscribeClientService :: AgentClient -> ClientServiceId -> AE Int

-- | Send message to the connection (SEND command)
sendMessage :: AgentClient -> ConnId -> PQEncryption -> MsgFlags -> MsgBody -> AE (AgentMsgId, PQEncryption)

-- | Send multiple messages to different connections (SEND command)
sendMessages :: AgentClient -> [MsgReq] -> AE [Either AgentErrorType (AgentMsgId, PQEncryption)]
sendMessagesB :: Traversable t => AgentClient -> t (Either AgentErrorType MsgReq) -> AE (t (Either AgentErrorType (AgentMsgId, PQEncryption)))
ackMessage :: AgentClient -> ConnId -> AgentMsgId -> Maybe MsgReceiptInfo -> AE ()
getConnectionQueueInfo :: AgentClient -> NetworkRequestMode -> ConnId -> AE ServerQueueInfo

-- | Switch connection to the new receive queue
switchConnection :: AgentClient -> NetworkRequestMode -> ConnId -> AE ConnectionStats

-- | Abort switching connection to the new receive queue
abortConnectionSwitch :: AgentClient -> ConnId -> AE ConnectionStats

-- | Re-synchronize connection ratchet keys
synchronizeRatchet :: AgentClient -> ConnId -> PQSupport -> Bool -> AE ConnectionStats

-- | Suspend SMP agent connection (OFF command)
suspendConnection :: AgentClient -> NetworkRequestMode -> ConnId -> AE ()

-- | Delete SMP agent connection (DEL command)
deleteConnection :: AgentClient -> NetworkRequestMode -> ConnId -> AE ()

-- | Delete multiple connections, batching commands when possible
deleteConnections :: AgentClient -> NetworkRequestMode -> [ConnId] -> AE (Map ConnId (Either AgentErrorType ()))

-- | get servers used for connection
getConnectionServers :: AgentClient -> ConnId -> AE ConnectionStats

-- | get connection ratchet associated data hash for verification (should
--   match peer AD hash)
getConnectionRatchetAdHash :: AgentClient -> ConnId -> AE ByteString

-- | Change servers to be used for creating new queues. This function will
--   set all servers as enabled in case all passed servers are disabled.
setProtocolServers :: forall p. (ProtocolTypeI p, UserProtocol p) => AgentClient -> UserId -> NonEmpty (ServerCfg p) -> IO ()
checkUserServers :: Text -> NonEmpty (ServerCfg p) -> IO ()

-- | Test protocol server
testProtocolServer :: forall p. ProtocolTypeI p => AgentClient -> NetworkRequestMode -> UserId -> ProtoServerWithAuth p -> IO (Maybe ProtocolTestFailure)
setNtfServers :: AgentClient -> [NtfServer] -> IO ()

-- | set SOCKS5 proxy on/off and optionally set TCP timeouts for fast
--   network
setNetworkConfig :: AgentClient -> NetworkConfig -> IO ()
setUserNetworkInfo :: AgentClient -> UserNetworkInfo -> IO ()
reconnectAllServers :: AgentClient -> IO ()
reconnectSMPServer :: AgentClient -> UserId -> SMPServer -> IO ()

-- | Register device notifications token
registerNtfToken :: AgentClient -> NetworkRequestMode -> DeviceToken -> NotificationsMode -> AE NtfTknStatus

-- | Verify device notifications token
verifyNtfToken :: AgentClient -> NetworkRequestMode -> DeviceToken -> CbNonce -> ByteString -> AE ()
checkNtfToken :: AgentClient -> NetworkRequestMode -> DeviceToken -> AE NtfTknStatus
deleteNtfToken :: AgentClient -> DeviceToken -> AE ()
getNtfToken :: AgentClient -> AE (DeviceToken, NtfTknStatus, NotificationsMode, NtfServer)
getNtfTokenData :: AgentClient -> AE NtfToken

-- | Set connection notifications on/off
toggleConnectionNtfs :: AgentClient -> ConnId -> Bool -> AE ()
xftpStartWorkers :: AgentClient -> Maybe FilePath -> AE ()
xftpStartSndWorkers :: AgentClient -> Maybe FilePath -> AE ()

-- | Receive XFTP file
xftpReceiveFile :: AgentClient -> UserId -> ValidFileDescription 'FRecipient -> Maybe CryptoFileArgs -> Bool -> AE RcvFileId

-- | Delete XFTP rcv file (deletes work files from file system and db
--   records)
xftpDeleteRcvFile :: AgentClient -> RcvFileId -> IO ()

-- | Delete multiple rcv files, batching operations when possible (deletes
--   work files from file system and db records)
xftpDeleteRcvFiles :: AgentClient -> [RcvFileId] -> IO ()

-- | Send XFTP file
xftpSendFile :: AgentClient -> UserId -> CryptoFile -> Int -> AE SndFileId

-- | Send XFTP file
xftpSendDescription :: AgentClient -> UserId -> ValidFileDescription 'FRecipient -> Int -> AE SndFileId

-- | Delete XFTP snd file internally (deletes work files from file system
--   and db records)
xftpDeleteSndFileInternal :: AgentClient -> SndFileId -> IO ()

-- | Delete multiple snd files internally, batching operations when
--   possible (deletes work files from file system and db records)
xftpDeleteSndFilesInternal :: AgentClient -> [SndFileId] -> IO ()

-- | Delete XFTP snd file chunks on servers
xftpDeleteSndFileRemote :: AgentClient -> UserId -> SndFileId -> ValidFileDescription 'FSender -> IO ()

-- | Delete XFTP snd file chunks on servers for multiple snd files,
--   batching operations when possible
xftpDeleteSndFilesRemote :: AgentClient -> UserId -> [(SndFileId, ValidFileDescription 'FSender)] -> IO ()

-- | Create new remote host pairing
rcNewHostPairing :: AgentClient -> IO RCHostPairing

-- | start TLS server for remote host with optional multicast
rcConnectHost :: AgentClient -> RCHostPairing -> Value -> Bool -> Maybe RCCtrlAddress -> Maybe Word16 -> AE RCHostConnection

-- | connect to remote controller via URI
rcConnectCtrl :: AgentClient -> RCVerifiedInvitation -> Maybe RCCtrlPairing -> Value -> AE RCCtrlConnection

-- | connect to known remote controller via multicast
rcDiscoverCtrl :: AgentClient -> NonEmpty RCCtrlPairing -> AE (RCCtrlPairing, RCVerifiedInvitation)
getAgentSubsTotal :: AgentClient -> [UserId] -> IO (SMPServerSubs, Bool)
getAgentServersSummary :: AgentClient -> IO AgentServersSummary
resetAgentServersStats :: AgentClient -> AE ()

-- | Activate operations
foregroundAgent :: AgentClient -> IO ()

-- | Suspend operations with max delay to deliver pending messages
suspendAgent :: AgentClient -> Int -> IO ()
execAgentStoreSQL :: AgentClient -> Text -> AE [Text]
getAgentMigrations :: AgentClient -> AE [UpMigration]
debugAgentLocks :: AgentClient -> IO AgentLocks
getAgentSubscriptions :: AgentClient -> IO SubscriptionsInfo
logConnection :: AgentClient -> Bool -> IO ()
withAgentEnv :: AgentClient -> AM a -> AE a
instance Data.Aeson.Types.FromJSON.FromJSON a => Data.Aeson.Types.FromJSON.FromJSON (Simplex.Messaging.Agent.DatabaseDiff a)
instance Data.Aeson.Types.ToJSON.ToJSON a => Data.Aeson.Types.ToJSON.ToJSON (Simplex.Messaging.Agent.DatabaseDiff a)
instance GHC.Show.Show a => GHC.Show.Show (Simplex.Messaging.Agent.DatabaseDiff a)
instance GHC.Base.Functor Simplex.Messaging.Agent.ValueOrRef
instance GHC.Base.Functor Simplex.Messaging.Agent.DatabaseDiff
