core: enable creation of decryption errors chat items (#2450)

This commit is contained in:
spaced4ndy 2023-05-17 16:13:35 +04:00 committed by GitHub
parent e799e80843
commit b6a4f5f518
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 19 deletions

View File

@ -7,7 +7,7 @@ constraints: zip +disable-bzip2 +disable-zstd
source-repository-package
type: git
location: https://github.com/simplex-chat/simplexmq.git
tag: d693868bc0ce0926f5b890dfced56960c8bcf2ab
tag: 6c6f22051d693e00aaa4c4e6c5b6bff7e9a40b36
source-repository-package
type: git

View File

@ -1,5 +1,5 @@
{
"https://github.com/simplex-chat/simplexmq.git"."d693868bc0ce0926f5b890dfced56960c8bcf2ab" = "1g9p7b7da90ac3zrr0hwk6bjn3x3zrl0yq314f5w4a54zlg785zx";
"https://github.com/simplex-chat/simplexmq.git"."6c6f22051d693e00aaa4c4e6c5b6bff7e9a40b36" = "0mi4p2s5klm2w6za8xljl3yaiva814phhm5n5q36f04a016i6llm";
"https://github.com/simplex-chat/hs-socks.git"."a30cc7a79a08d8108316094f8f2f82a0c5e1ac51" = "0yasvnr7g91k76mjkamvzab2kvlb1g5pspjyjn2fr6v83swjhj38";
"https://github.com/kazu-yamamoto/http2.git"."b5a1b7200cf5bc7044af34ba325284271f6dff25" = "0dqb50j57an64nf4qcf5vcz4xkd1vzvghvf8bk529c1k30r9nfzb";
"https://github.com/simplex-chat/direct-sqlcipher.git"."34309410eb2069b029b8fc1872deb1e0db123294" = "0kwkmhyfsn2lixdlgl15smgr1h5gjk7fky6abzh8rng2h5ymnffd";

View File

@ -2993,21 +2993,17 @@ processAgentMessageConn user@User {userId} corrId agentConnId agentMessage = do
-- TODO add debugging output
_ -> pure ()
-- TODO revert to commented function to enable creation of decryption errors chat items
agentMsgDecryptError :: AgentErrorType -> Maybe (MsgDecryptError, Word32)
agentMsgDecryptError _ = Nothing
-- agentMsgDecryptError :: AgentErrorType -> Maybe (MsgDecryptError, Word32)
-- agentMsgDecryptError = \case
-- AGENT (A_CRYPTO RATCHET_HEADER) -> Just (MDERatchetHeader, 1)
-- AGENT (A_CRYPTO (RATCHET_SKIPPED n)) -> Just (MDETooManySkipped, n)
-- -- we are not treating this as decryption error, as in many cases it happens as the result of duplicate or redundant delivery,
-- -- and we don't have a way to differentiate.
-- -- we could store the hashes of past messages in the agent, or delaying message deletion after ACK
-- -- A_DUPLICATE -> Nothing
-- -- earlier messages may be received in case of redundant delivery, and do not necessarily indicate an error
-- -- AGENT (A_CRYPTO (RATCHET_EARLIER n)) -> Nothing
-- _ -> Nothing
agentMsgDecryptError = \case
AGENT (A_CRYPTO RATCHET_HEADER) -> Just (MDERatchetHeader, 1)
AGENT (A_CRYPTO (RATCHET_SKIPPED n)) -> Just (MDETooManySkipped, n)
-- we are not treating this as decryption error, as in many cases it happens as the result of duplicate or redundant delivery,
-- and we don't have a way to differentiate.
-- we could store the hashes of past messages in the agent, or delaying message deletion after ACK
-- A_DUPLICATE -> Nothing
-- earlier messages may be received in case of redundant delivery, and do not necessarily indicate an error
-- AGENT (A_CRYPTO (RATCHET_EARLIER n)) -> Nothing
_ -> Nothing
mdeUpdatedCI :: (MsgDecryptError, Word32) -> CChatItem c -> Maybe (ChatItem c 'MDRcv, CIContent 'MDRcv)
mdeUpdatedCI (mde', n') (CChatItem _ ci@ChatItem {content = CIRcvDecryptionError mde n})

View File

@ -49,7 +49,7 @@ extra-deps:
# - simplexmq-1.0.0@sha256:34b2004728ae396e3ae449cd090ba7410781e2b3cefc59259915f4ca5daa9ea8,8561
# - ../simplexmq
- github: simplex-chat/simplexmq
commit: d693868bc0ce0926f5b890dfced56960c8bcf2ab
commit: 6c6f22051d693e00aaa4c4e6c5b6bff7e9a40b36
- github: kazu-yamamoto/http2
commit: b5a1b7200cf5bc7044af34ba325284271f6dff25
# - ../direct-sqlcipher

View File

@ -84,7 +84,7 @@ chatDirectTests = do
it "mark contact verified" testMarkContactVerified
it "mark group member verified" testMarkGroupMemberVerified
describe "message errors" $ do
xit "show message decryption error and update count" testMsgDecryptError
it "show message decryption error and update count" testMsgDecryptError
describe "message reactions" $ do
it "set message reactions" testSetMessageReactions

View File

@ -53,7 +53,7 @@ chatGroupTests = do
it "group link member role" testGroupLinkMemberRole
it "leaving and deleting the group joined via link should NOT delete previously existing direct contacts" testGroupLinkLeaveDelete
describe "group message errors" $ do
xit "show message decryption error and update count" testGroupMsgDecryptError
it "show message decryption error and update count" testGroupMsgDecryptError
describe "message reactions" $ do
it "set group message reactions" testSetGroupMessageReactions