Add iOS smoke test at createAgentStore

This commit is contained in:
IC Rainbow
2023-10-29 16:21:09 +02:00
parent 0dd52aea18
commit 18496c3269
+16 -1
View File
@@ -30,6 +30,10 @@ module Simplex.Messaging.Agent.Env.SQLite
)
where
-- iOS FunPtr smoke test
import Simplex.Messaging.Crypto.SNTRUP761.Bindings
import Simplex.Messaging.Crypto.SNTRUP761.Bindings.RNG
import Control.Monad.Except
import Control.Monad.IO.Unlift
import Control.Monad.Reader
@@ -195,7 +199,18 @@ newSMPAgentEnv config@AgentConfig {initialClientId} store = do
pure Env {config, store, idsDrg, clientCounter, randomServer, ntfSupervisor, xftpAgent}
createAgentStore :: FilePath -> String -> MigrationConfirmation -> IO (Either MigrationError SQLiteStore)
createAgentStore dbFilePath dbKey = createSQLiteStore dbFilePath dbKey Migrations.app
createAgentStore dbFilePath dbKey cfg = do
withHaskellRNG $ \rng -> do
(pk, sk) <- sntrup761KeypairWith rng
(c, k) <- sntrup761EncWith rng pk
k' <- sntrup761Dec c sk
if k /= k' then
fail "sntrup761 smoke test failed"
else
putStrLn "sntrup761 smoke test passed"
createSQLiteStore dbFilePath dbKey Migrations.app cfg
data NtfSupervisor = NtfSupervisor
{ ntfTkn :: TVar (Maybe NtfToken),