diff --git a/src/Simplex/Chat.hs b/src/Simplex/Chat.hs index 43584287aa..70d0272c55 100644 --- a/src/Simplex/Chat.hs +++ b/src/Simplex/Chat.hs @@ -2544,7 +2544,7 @@ chatCommandP = "/_db export " *> (APIExportArchive <$> jsonP), "/_db import " *> (APIImportArchive <$> jsonP), "/_db delete" $> APIDeleteStorage, - "/_db encryption" *> (APIStorageEncryption <$> jsonP), + "/_db encryption " *> (APIStorageEncryption <$> jsonP), "/db encrypt " *> (APIStorageEncryption . DBEncryptionConfig "" <$> dbKeyP), "/db password " *> (APIStorageEncryption <$> (DBEncryptionConfig <$> dbKeyP <* A.space <*> dbKeyP)), "/db decrypt " *> (APIStorageEncryption . (`DBEncryptionConfig` "") <$> dbKeyP), diff --git a/tests/ChatTests.hs b/tests/ChatTests.hs index 54b01bcfb5..6a6ea4ac74 100644 --- a/tests/ChatTests.hs +++ b/tests/ChatTests.hs @@ -2790,13 +2790,15 @@ testDatabaseEncryption = withTmpFiles $ do alice <## "chat stopped" alice ##> "/db password mykey nextkey" alice <## "ok" - withTestChatOpts testOpts {maintenance = True, dbKey = "nextkey"} "alice" $ \alice -> do + alice ##> "/_db encryption {\"currentKey\":\"nextkey\",\"newKey\":\"anotherkey\"}" + alice <## "ok" + withTestChatOpts testOpts {maintenance = True, dbKey = "anotherkey"} "alice" $ \alice -> do alice ##> "/_start" alice <## "chat started" testChatWorking alice bob alice ##> "/_stop" alice <## "chat stopped" - alice ##> "/db decrypt nextkey" + alice ##> "/db decrypt anotherkey" alice <## "ok" withTestChat "alice" $ \alice -> testChatWorking alice bob