mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-10-22 17:31:55 +00:00
use SQLCipher (#981)
* use SQLCipher * pass encryption key via CLI options * update dependencies to use git * add CONTRIBUTING.md * move flag, enable build in sqlcipher branch * update dependencies
This commit is contained in:
1 parent
b4d7afb4c1
commit
02ca7234fb
16 files changed
+115
-26
No files matched your search
+6
-4
@@ -48,6 +48,8 @@ testOpts :: ChatOpts
|
||||
testOpts =
|
||||
ChatOpts
|
||||
{ dbFilePrefix = undefined,
|
||||
dbKey = "",
|
||||
-- dbKey = "this is a pass-phrase to encrypt the database",
|
||||
smpServers = ["smp://LcJUMfVhwD8yxjAiSaDzzGF3-kLG4Uh0Fl_ZIjrRwjI=@localhost:5001"],
|
||||
networkConfig = defaultNetworkConfig,
|
||||
logConnections = False,
|
||||
@@ -101,16 +103,16 @@ testCfgV1 :: ChatConfig
|
||||
testCfgV1 = testCfg {agentConfig = testAgentCfgV1}
|
||||
|
||||
createTestChat :: ChatConfig -> ChatOpts -> String -> Profile -> IO TestCC
|
||||
createTestChat cfg opts dbPrefix profile = do
|
||||
createTestChat cfg opts@ChatOpts {dbKey} dbPrefix profile = do
|
||||
let dbFilePrefix = testDBPrefix <> dbPrefix
|
||||
st <- createStore (dbFilePrefix <> "_chat.db") False
|
||||
st <- createStore (dbFilePrefix <> "_chat.db") dbKey False
|
||||
Right user <- withTransaction st $ \db -> runExceptT $ createUser db profile True
|
||||
startTestChat_ st cfg opts dbFilePrefix user
|
||||
|
||||
startTestChat :: ChatConfig -> ChatOpts -> String -> IO TestCC
|
||||
startTestChat cfg opts dbPrefix = do
|
||||
startTestChat cfg opts@ChatOpts {dbKey} dbPrefix = do
|
||||
let dbFilePrefix = testDBPrefix <> dbPrefix
|
||||
st <- createStore (dbFilePrefix <> "_chat.db") False
|
||||
st <- createStore (dbFilePrefix <> "_chat.db") dbKey False
|
||||
Just user <- find activeUser <$> withTransaction st getUsers
|
||||
startTestChat_ st cfg opts dbFilePrefix user
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ testChatApiNoUser = withTmpFiles $ do
|
||||
testChatApi :: IO ()
|
||||
testChatApi = withTmpFiles $ do
|
||||
let f = chatStoreFile $ testDBPrefix <> "1"
|
||||
st <- createStore f True
|
||||
st <- createStore f "" True
|
||||
Right _ <- withTransaction st $ \db -> runExceptT $ createUser db aliceProfile True
|
||||
cc <- chatInit $ testDBPrefix <> "1"
|
||||
chatSendCmd cc "/u" `shouldReturn` activeUser
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ schemaDumpTest =
|
||||
testVerifySchemaDump :: IO ()
|
||||
testVerifySchemaDump =
|
||||
withTmpFiles $ do
|
||||
void $ createStore testDB False
|
||||
void $ createStore testDB "" False
|
||||
void $ readCreateProcess (shell $ "touch " <> schema) ""
|
||||
savedSchema <- readFile schema
|
||||
savedSchema `deepseq` pure ()
|
||||
|
||||
Reference in new issue
Block a user