diff --git a/src/Simplex/Messaging/Agent/Env/SQLite.hs b/src/Simplex/Messaging/Agent/Env/SQLite.hs index 3a818f250..92ac86c9a 100644 --- a/src/Simplex/Messaging/Agent/Env/SQLite.hs +++ b/src/Simplex/Messaging/Agent/Env/SQLite.hs @@ -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),