mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-05-12 01:34:45 +00:00
0fe41dbf16
* generate key pair * crypto: sign/verify functions * remove extension * parse/serialize keys * use RSA recipient/sender keys (TODO sign/verify) * make PublicKey newtype, assign 0s to private_p & private_q * replace SMP command parsing with Attoparsec * rename types: Signed->Transmission, Transmission->SignedTransmission * sign and verify commands (server tests skipped, agent tests pass) * SMP client: avoid seralizing transmission twice when sending commands * update SMP server tests to use command signatures * remove support for "SEND :msg" syntax from SMP server protocol * rename RSA module name to R to avoid confusion with C used for S.M.Crypto * update key sizes to use bits `div` 8 * tidy up
30 lines
698 B
Haskell
30 lines
698 B
Haskell
{-# LANGUAGE DuplicateRecordFields #-}
|
|
|
|
module Main where
|
|
|
|
import Control.Logger.Simple
|
|
import Simplex.Messaging.Agent (runSMPAgent)
|
|
import Simplex.Messaging.Agent.Env.SQLite
|
|
import Simplex.Messaging.Client (smpDefaultConfig)
|
|
|
|
cfg :: AgentConfig
|
|
cfg =
|
|
AgentConfig
|
|
{ tcpPort = "5224",
|
|
rsaKeySize = 2048 `div` 8,
|
|
connIdBytes = 12,
|
|
tbqSize = 16,
|
|
dbFile = "smp-agent.db",
|
|
smpCfg = smpDefaultConfig
|
|
}
|
|
|
|
logCfg :: LogConfig
|
|
logCfg = LogConfig {lc_file = Nothing, lc_stderr = True}
|
|
|
|
main :: IO ()
|
|
main = do
|
|
putStrLn $ "SMP agent listening on port " ++ tcpPort (cfg :: AgentConfig)
|
|
setLogLevel LogInfo -- LogError
|
|
withGlobalLogging logCfg $
|
|
runSMPAgent cfg
|