2022-01-11 12:27:57 +00:00
{- # LANGUAGE DataKinds # -}
{- # LANGUAGE DuplicateRecordFields # -}
{- # LANGUAGE OverloadedLists # -}
{- # LANGUAGE OverloadedStrings # -}
2021-07-04 18:42:24 +01:00
module ProtocolTests where
2022-01-17 12:24:55 +00:00
import qualified Data.Aeson as J
2022-01-11 12:27:57 +00:00
import Data.ByteString.Char8 ( ByteString )
2022-03-13 19:34:03 +00:00
import Data.Time.Clock.System ( SystemTime ( .. ) , systemToUTCTime )
2022-01-11 12:27:57 +00:00
import Simplex.Chat.Protocol
import Simplex.Chat.Types
2023-07-21 21:32:28 +01:00
import Simplex.Chat.Types.Preferences
2022-01-11 12:27:57 +00:00
import Simplex.Messaging.Agent.Protocol
import qualified Simplex.Messaging.Crypto as C
import Simplex.Messaging.Crypto.Ratchet
2024-03-05 20:27:00 +04:00
import qualified Simplex.Messaging.Crypto.Ratchet as CR
2022-08-13 11:53:53 +01:00
import Simplex.Messaging.Protocol ( supportedSMPClientVRange )
2024-02-17 16:29:45 +00:00
import Simplex.Messaging.ServiceScheme
2022-06-09 14:52:12 +01:00
import Simplex.Messaging.Version
2022-01-11 12:27:57 +00:00
import Test.Hspec
protocolTests :: Spec
protocolTests = decodeChatMessageTest
srv :: SMPServer
2022-07-06 08:46:04 +01:00
srv = SMPServer " smp.simplex.im " " 5223 " ( C . KeyHash " \ 215 m \ 248 \ 251 " )
2022-01-11 12:27:57 +00:00
queue :: SMPQueueUri
queue =
SMPQueueUri
2022-08-13 11:53:53 +01:00
supportedSMPClientVRange
SMPQueueAddress
{ smpServer = srv ,
senderId = " \ 223 \ 142 z \ 251 " ,
dhPublicKey = " MCowBQYDK2VuAyEAjiswwI3O/NlS8Fk3HJUW870EY2bAwmttMBsvRB9eV3o= "
}
2022-01-11 12:27:57 +00:00
connReqData :: ConnReqUriData
connReqData =
ConnReqUriData
2024-02-17 16:29:45 +00:00
{ crScheme = SSSimplex ,
2024-03-05 20:27:00 +04:00
crAgentVRange = mkVersionRange ( VersionSMPA 1 ) ( VersionSMPA 1 ) ,
2022-11-01 13:26:08 +00:00
crSmpQueues = [ queue ] ,
crClientData = Nothing
2022-01-11 12:27:57 +00:00
}
testDhPubKey :: C . PublicKeyX448
testDhPubKey = " MEIwBQYDK2VvAzkAmKuSYeQ/m0SixPDS8Wq8VBaTS1cW+Lp0n0h4Diu+kUpR+qXx4SDJ32YGEFoGFGSbGPry5Ychr6U= "
2024-03-05 20:27:00 +04:00
testE2ERatchetParams :: RcvE2ERatchetParamsUri 'C . X448
testE2ERatchetParams = E2ERatchetParamsUri ( supportedE2EEncryptVRange CR . PQEncOn ) testDhPubKey testDhPubKey Nothing
2022-01-11 12:27:57 +00:00
testConnReq :: ConnectionRequestUri 'CMInvitation
testConnReq = CRInvitationUri connReqData testE2ERatchetParams
2022-12-14 12:16:11 +00:00
quotedMsg :: QuotedMsg
quotedMsg =
QuotedMsg
2023-09-12 17:36:47 +04:00
( MsgRef ( Just $ SharedMsgId " \ 5 \ 6 \ 7 \ 8 " ) ( systemToUTCTime $ MkSystemTime 1 1 ) True Nothing )
2022-12-14 12:16:11 +00:00
$ MCText " hello there! "
2022-10-14 13:06:33 +01:00
( ==## ) :: MsgEncodingI e => ByteString -> ChatMessage e -> Expectation
2022-03-13 19:34:03 +00:00
s ==## msg = do
2023-12-23 17:07:23 +04:00
case parseChatMessages s of
[ acMsg ] -> case acMsg of
Right ( ACMsg _ msg' ) -> case checkEncoding msg' of
Right msg'' -> msg'' ` shouldBe ` msg
Left e -> expectationFailure $ " checkEncoding error: " <> show e
Left e -> expectationFailure $ " parse error: " <> show e
_ -> expectationFailure " exactly one message expected "
2022-03-13 19:34:03 +00:00
2022-10-14 13:06:33 +01:00
( ##== ) :: MsgEncodingI e => ByteString -> ChatMessage e -> Expectation
2023-12-23 17:07:23 +04:00
s ##== msg = do
2024-03-06 16:02:19 +02:00
let r = encodeChatMessage maxEncodedMsgLength msg
2023-12-23 17:07:23 +04:00
case r of
ECMEncoded encodedBody ->
2024-01-15 10:46:13 +00:00
J . eitherDecodeStrict' encodedBody
2023-12-23 17:07:23 +04:00
` shouldBe ` ( J . eitherDecodeStrict' s :: Either String J . Value )
2024-03-06 16:02:19 +02:00
ECMLarge -> expectationFailure " large message "
2022-03-13 19:34:03 +00:00
2022-10-14 13:06:33 +01:00
( ##==## ) :: MsgEncodingI e => ByteString -> ChatMessage e -> Expectation
2022-03-13 19:34:03 +00:00
s ##==## msg = do
s ##== msg
s ==## msg
2022-10-14 13:06:33 +01:00
( ==# ) :: MsgEncodingI e => ByteString -> ChatMsgEvent e -> Expectation
2023-09-01 19:20:07 +04:00
s ==# msg = s ==## ChatMessage chatInitialVRange Nothing msg
2022-01-11 12:27:57 +00:00
2022-10-14 13:06:33 +01:00
( #== ) :: MsgEncodingI e => ByteString -> ChatMsgEvent e -> Expectation
2023-09-01 19:20:07 +04:00
s #== msg = s ##== ChatMessage chatInitialVRange Nothing msg
2022-01-11 12:27:57 +00:00
2022-10-14 13:06:33 +01:00
( #==# ) :: MsgEncodingI e => ByteString -> ChatMsgEvent e -> Expectation
2022-01-11 12:27:57 +00:00
s #==# msg = do
s #== msg
s ==# msg
2022-11-04 17:05:21 +00:00
testChatPreferences :: Maybe Preferences
2023-05-15 12:28:53 +02:00
testChatPreferences = Just Preferences { voice = Just VoicePreference { allow = FAYes } , fullDelete = Nothing , timedMessages = Nothing , calls = Nothing , reactions = Just ReactionsPreference { allow = FAYes } }
2022-11-04 17:05:21 +00:00
testGroupPreferences :: Maybe GroupPreferences
2023-12-23 17:07:23 +04:00
testGroupPreferences = Just GroupPreferences { timedMessages = Nothing , directMessages = Nothing , reactions = Just ReactionsGroupPreference { enable = FEOn } , voice = Just VoiceGroupPreference { enable = FEOn } , files = Nothing , fullDelete = Nothing , history = Nothing }
2022-11-01 17:32:49 +03:00
2022-01-11 12:27:57 +00:00
testProfile :: Profile
2023-04-27 17:19:21 +04:00
testProfile = Profile { displayName = " alice " , fullName = " Alice " , image = Just ( ImageData " data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII= " ) , contactLink = Nothing , preferences = testChatPreferences }
2022-01-11 12:27:57 +00:00
testGroupProfile :: GroupProfile
2022-12-10 08:27:32 +00:00
testGroupProfile = GroupProfile { displayName = " team " , fullName = " Team " , description = Nothing , image = Nothing , groupPreferences = testGroupPreferences }
2022-01-11 12:27:57 +00:00
decodeChatMessageTest :: Spec
decodeChatMessageTest = describe " Chat message encoding/decoding " $ do
2022-04-06 13:21:06 +04:00
it " x.msg.new simple text " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.msg.new \ " , \ " params \ " :{ \ " content \ " :{ \ " text \ " : \ " hello \ " , \ " type \ " : \ " text \ " }}} "
2022-12-16 07:51:04 +00:00
#==# XMsgNew ( MCSimple ( extMsgContent ( MCText " hello " ) Nothing ) )
2022-12-14 12:16:11 +00:00
it " x.msg.new simple text - timed message TTL " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.msg.new \ " , \ " params \ " :{ \ " content \ " :{ \ " text \ " : \ " hello \ " , \ " type \ " : \ " text \ " }, \ " ttl \ " :3600}} "
2023-09-12 17:36:47 +04:00
#==# XMsgNew ( MCSimple ( ExtMsgContent ( MCText " hello " ) Nothing ( Just 3600 ) Nothing ) )
2022-12-14 12:16:11 +00:00
it " x.msg.new simple text - live message " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.msg.new \ " , \ " params \ " :{ \ " content \ " :{ \ " text \ " : \ " hello \ " , \ " type \ " : \ " text \ " }, \ " live \ " :true}} "
2023-09-12 17:36:47 +04:00
#==# XMsgNew ( MCSimple ( ExtMsgContent ( MCText " hello " ) Nothing Nothing ( Just True ) ) )
2022-04-06 13:21:06 +04:00
it " x.msg.new simple link " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.msg.new \ " , \ " params \ " :{ \ " content \ " :{ \ " text \ " : \ " https://simplex.chat \ " , \ " type \ " : \ " link \ " , \ " preview \ " :{ \ " description \ " : \ " SimpleX Chat \ " , \ " image \ " : \ " data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgA \ " , \ " title \ " : \ " SimpleX Chat \ " , \ " uri \ " : \ " https://simplex.chat \ " }}}} "
2023-03-09 11:01:22 +00:00
#==# XMsgNew ( MCSimple ( extMsgContent ( MCLink " https://simplex.chat " $ LinkPreview { uri = " https://simplex.chat " , title = " SimpleX Chat " , description = " SimpleX Chat " , image = ImageData " data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgA " , content = Nothing } ) Nothing ) )
2022-04-06 13:21:06 +04:00
it " x.msg.new simple image " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.msg.new \ " , \ " params \ " :{ \ " content \ " :{ \ " text \ " : \ " \ " , \ " type \ " : \ " image \ " , \ " image \ " : \ " data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII= \ " }}} "
2022-12-16 07:51:04 +00:00
#==# XMsgNew ( MCSimple ( extMsgContent ( MCImage " " $ ImageData " data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII= " ) Nothing ) )
2022-04-10 13:30:58 +04:00
it " x.msg.new simple image with text " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.msg.new \ " , \ " params \ " :{ \ " content \ " :{ \ " text \ " : \ " here's an image \ " , \ " type \ " : \ " image \ " , \ " image \ " : \ " data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII= \ " }}} "
2022-12-16 07:51:04 +00:00
#==# XMsgNew ( MCSimple ( extMsgContent ( MCImage " here's an image " $ ImageData " data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII= " ) Nothing ) )
2023-09-01 19:20:07 +04:00
it " x.msg.new chat message " $
" { \ " v \ " : \ " 1 \ " , \ " msgId \ " : \ " AQIDBA== \ " , \ " event \ " : \ " x.msg.new \ " , \ " params \ " :{ \ " content \ " :{ \ " text \ " : \ " hello \ " , \ " type \ " : \ " text \ " }}} "
##==## ChatMessage chatInitialVRange ( Just $ SharedMsgId " \ 1 \ 2 \ 3 \ 4 " ) ( XMsgNew ( MCSimple ( extMsgContent ( MCText " hello " ) Nothing ) ) )
it " x.msg.new chat message with chat version range " $
2024-01-15 19:56:11 +04:00
" { \ " v \ " : \ " 1-7 \ " , \ " msgId \ " : \ " AQIDBA== \ " , \ " event \ " : \ " x.msg.new \ " , \ " params \ " :{ \ " content \ " :{ \ " text \ " : \ " hello \ " , \ " type \ " : \ " text \ " }}} "
2024-03-06 16:02:19 +02:00
##==## ChatMessage ( supportedChatVRange PQEncOff ) ( Just $ SharedMsgId " \ 1 \ 2 \ 3 \ 4 " ) ( XMsgNew ( MCSimple ( extMsgContent ( MCText " hello " ) Nothing ) ) )
2022-04-06 13:21:06 +04:00
it " x.msg.new quote " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " msgId \ " : \ " AQIDBA== \ " , \ " event \ " : \ " x.msg.new \ " , \ " params \ " :{ \ " content \ " :{ \ " text \ " : \ " hello to you too \ " , \ " type \ " : \ " text \ " }, \ " quote \ " :{ \ " content \ " :{ \ " text \ " : \ " hello there! \ " , \ " type \ " : \ " text \ " }, \ " msgRef \ " :{ \ " msgId \ " : \ " BQYHCA== \ " , \ " sent \ " :true, \ " sentAt \ " : \ " 1970-01-01T00:00:01.000000001Z \ " }}}} "
2022-03-25 22:23:51 +04:00
##==## ChatMessage
2023-09-01 19:20:07 +04:00
chatInitialVRange
2022-03-25 22:23:51 +04:00
( Just $ SharedMsgId " \ 1 \ 2 \ 3 \ 4 " )
2022-12-16 07:51:04 +00:00
( XMsgNew ( MCQuote quotedMsg ( extMsgContent ( MCText " hello to you too " ) Nothing ) ) )
2022-12-14 12:16:11 +00:00
it " x.msg.new quote - timed message TTL " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " msgId \ " : \ " AQIDBA== \ " , \ " event \ " : \ " x.msg.new \ " , \ " params \ " :{ \ " content \ " :{ \ " text \ " : \ " hello to you too \ " , \ " type \ " : \ " text \ " }, \ " quote \ " :{ \ " content \ " :{ \ " text \ " : \ " hello there! \ " , \ " type \ " : \ " text \ " }, \ " msgRef \ " :{ \ " msgId \ " : \ " BQYHCA== \ " , \ " sent \ " :true, \ " sentAt \ " : \ " 1970-01-01T00:00:01.000000001Z \ " }}, \ " ttl \ " :3600}} "
2022-12-14 12:16:11 +00:00
##==## ChatMessage
2023-09-01 19:20:07 +04:00
chatInitialVRange
2022-12-14 12:16:11 +00:00
( Just $ SharedMsgId " \ 1 \ 2 \ 3 \ 4 " )
2023-09-12 17:36:47 +04:00
( XMsgNew ( MCQuote quotedMsg ( ExtMsgContent ( MCText " hello to you too " ) Nothing ( Just 3600 ) Nothing ) ) )
2022-12-14 12:16:11 +00:00
it " x.msg.new quote - live message " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " msgId \ " : \ " AQIDBA== \ " , \ " event \ " : \ " x.msg.new \ " , \ " params \ " :{ \ " content \ " :{ \ " text \ " : \ " hello to you too \ " , \ " type \ " : \ " text \ " }, \ " quote \ " :{ \ " content \ " :{ \ " text \ " : \ " hello there! \ " , \ " type \ " : \ " text \ " }, \ " msgRef \ " :{ \ " msgId \ " : \ " BQYHCA== \ " , \ " sent \ " :true, \ " sentAt \ " : \ " 1970-01-01T00:00:01.000000001Z \ " }}, \ " live \ " :true}} "
2022-12-14 12:16:11 +00:00
##==## ChatMessage
2023-09-01 19:20:07 +04:00
chatInitialVRange
2022-12-14 12:16:11 +00:00
( Just $ SharedMsgId " \ 1 \ 2 \ 3 \ 4 " )
2023-09-12 17:36:47 +04:00
( XMsgNew ( MCQuote quotedMsg ( ExtMsgContent ( MCText " hello to you too " ) Nothing Nothing ( Just True ) ) ) )
2022-04-06 13:21:06 +04:00
it " x.msg.new forward " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " msgId \ " : \ " AQIDBA== \ " , \ " event \ " : \ " x.msg.new \ " , \ " params \ " :{ \ " content \ " :{ \ " text \ " : \ " hello \ " , \ " type \ " : \ " text \ " }, \ " forward \ " :true}} "
##==## ChatMessage chatInitialVRange ( Just $ SharedMsgId " \ 1 \ 2 \ 3 \ 4 " ) ( XMsgNew $ MCForward ( extMsgContent ( MCText " hello " ) Nothing ) )
2022-12-14 12:16:11 +00:00
it " x.msg.new forward - timed message TTL " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " msgId \ " : \ " AQIDBA== \ " , \ " event \ " : \ " x.msg.new \ " , \ " params \ " :{ \ " content \ " :{ \ " text \ " : \ " hello \ " , \ " type \ " : \ " text \ " }, \ " forward \ " :true, \ " ttl \ " :3600}} "
2023-09-12 17:36:47 +04:00
##==## ChatMessage chatInitialVRange ( Just $ SharedMsgId " \ 1 \ 2 \ 3 \ 4 " ) ( XMsgNew $ MCForward ( ExtMsgContent ( MCText " hello " ) Nothing ( Just 3600 ) Nothing ) )
2022-12-14 12:16:11 +00:00
it " x.msg.new forward - live message " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " msgId \ " : \ " AQIDBA== \ " , \ " event \ " : \ " x.msg.new \ " , \ " params \ " :{ \ " content \ " :{ \ " text \ " : \ " hello \ " , \ " type \ " : \ " text \ " }, \ " forward \ " :true, \ " live \ " :true}} "
2023-09-12 17:36:47 +04:00
##==## ChatMessage chatInitialVRange ( Just $ SharedMsgId " \ 1 \ 2 \ 3 \ 4 " ) ( XMsgNew $ MCForward ( ExtMsgContent ( MCText " hello " ) Nothing Nothing ( Just True ) ) )
2022-04-28 09:40:51 +04:00
it " x.msg.new simple text with file " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.msg.new \ " , \ " params \ " :{ \ " content \ " :{ \ " text \ " : \ " hello \ " , \ " type \ " : \ " text \ " }, \ " file \ " :{ \ " fileSize \ " :12345, \ " fileName \ " : \ " photo.jpg \ " }}} "
2023-03-09 11:01:22 +00:00
#==# XMsgNew ( MCSimple ( extMsgContent ( MCText " hello " ) ( Just FileInvitation { fileName = " photo.jpg " , fileSize = 12345 , fileDigest = Nothing , fileConnReq = Nothing , fileInline = Nothing , fileDescr = Nothing } ) ) )
2022-04-28 09:40:51 +04:00
it " x.msg.new simple file with file " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.msg.new \ " , \ " params \ " :{ \ " content \ " :{ \ " text \ " : \ " \ " , \ " type \ " : \ " file \ " }, \ " file \ " :{ \ " fileSize \ " :12345, \ " fileName \ " : \ " file.txt \ " }}} "
2023-03-09 11:01:22 +00:00
#==# XMsgNew ( MCSimple ( extMsgContent ( MCFile " " ) ( Just FileInvitation { fileName = " file.txt " , fileSize = 12345 , fileDigest = Nothing , fileConnReq = Nothing , fileInline = Nothing , fileDescr = Nothing } ) ) )
2022-04-10 13:30:58 +04:00
it " x.msg.new quote with file " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " msgId \ " : \ " AQIDBA== \ " , \ " event \ " : \ " x.msg.new \ " , \ " params \ " :{ \ " content \ " :{ \ " text \ " : \ " hello to you too \ " , \ " type \ " : \ " text \ " }, \ " quote \ " :{ \ " content \ " :{ \ " text \ " : \ " hello there! \ " , \ " type \ " : \ " text \ " }, \ " msgRef \ " :{ \ " msgId \ " : \ " BQYHCA== \ " , \ " sent \ " :true, \ " sentAt \ " : \ " 1970-01-01T00:00:01.000000001Z \ " }}, \ " file \ " :{ \ " fileSize \ " :12345, \ " fileName \ " : \ " photo.jpg \ " }}} "
2022-04-06 13:21:06 +04:00
##==## ChatMessage
2023-09-01 19:20:07 +04:00
chatInitialVRange
2022-04-06 13:21:06 +04:00
( Just $ SharedMsgId " \ 1 \ 2 \ 3 \ 4 " )
( XMsgNew
( MCQuote
2022-12-14 12:16:11 +00:00
quotedMsg
( extMsgContent
2022-04-06 13:21:06 +04:00
( MCText " hello to you too " )
2023-03-09 11:01:22 +00:00
( Just FileInvitation { fileName = " photo.jpg " , fileSize = 12345 , fileDigest = Nothing , fileConnReq = Nothing , fileInline = Nothing , fileDescr = Nothing } )
2022-04-06 13:21:06 +04:00
)
)
)
2022-04-10 13:30:58 +04:00
it " x.msg.new forward with file " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " msgId \ " : \ " AQIDBA== \ " , \ " event \ " : \ " x.msg.new \ " , \ " params \ " :{ \ " content \ " :{ \ " text \ " : \ " hello \ " , \ " type \ " : \ " text \ " }, \ " forward \ " :true, \ " file \ " :{ \ " fileSize \ " :12345, \ " fileName \ " : \ " photo.jpg \ " }}} "
##==## ChatMessage chatInitialVRange ( Just $ SharedMsgId " \ 1 \ 2 \ 3 \ 4 " ) ( XMsgNew $ MCForward ( extMsgContent ( MCText " hello " ) ( Just FileInvitation { fileName = " photo.jpg " , fileSize = 12345 , fileDigest = Nothing , fileConnReq = Nothing , fileInline = Nothing , fileDescr = Nothing } ) ) )
2022-04-05 10:01:08 +04:00
it " x.msg.update " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.msg.update \ " , \ " params \ " :{ \ " msgId \ " : \ " AQIDBA== \ " , \ " content \ " :{ \ " text \ " : \ " hello \ " , \ " type \ " : \ " text \ " }}} "
2022-12-15 17:29:46 +04:00
#==# XMsgUpdate ( SharedMsgId " \ 1 \ 2 \ 3 \ 4 " ) ( MCText " hello " ) Nothing Nothing
2022-04-05 10:01:08 +04:00
it " x.msg.del " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.msg.del \ " , \ " params \ " :{ \ " msgId \ " : \ " AQIDBA== \ " }} "
2023-02-08 07:08:53 +00:00
#==# XMsgDel ( SharedMsgId " \ 1 \ 2 \ 3 \ 4 " ) Nothing
2022-04-05 10:01:08 +04:00
it " x.msg.deleted " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.msg.deleted \ " , \ " params \ " :{}} "
2022-04-05 10:01:08 +04:00
#==# XMsgDeleted
2022-01-11 12:27:57 +00:00
it " x.file " $
2024-03-05 20:27:00 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.file \ " , \ " params \ " :{ \ " file \ " :{ \ " fileConnReq \ " : \ " simplex:/invitation#/?v=1&smp=smp%3A%2F%2F1234-w%3D%3D%40smp.simplex.im%3A5223%2F3456-w%3D%3D%23%2F%3Fv%3D1-2%26dh%3DMCowBQYDK2VuAyEAjiswwI3O_NlS8Fk3HJUW870EY2bAwmttMBsvRB9eV3o%253D&e2e=v%3D2-3%26x3dh%3DMEIwBQYDK2VvAzkAmKuSYeQ_m0SixPDS8Wq8VBaTS1cW-Lp0n0h4Diu-kUpR-qXx4SDJ32YGEFoGFGSbGPry5Ychr6U%3D%2CMEIwBQYDK2VvAzkAmKuSYeQ_m0SixPDS8Wq8VBaTS1cW-Lp0n0h4Diu-kUpR-qXx4SDJ32YGEFoGFGSbGPry5Ychr6U%3D \ " , \ " fileSize \ " :12345, \ " fileName \ " : \ " photo.jpg \ " }}} "
2023-03-09 11:01:22 +00:00
#==# XFile FileInvitation { fileName = " photo.jpg " , fileSize = 12345 , fileDigest = Nothing , fileConnReq = Just testConnReq , fileInline = Nothing , fileDescr = Nothing }
2022-04-05 10:01:08 +04:00
it " x.file without file invitation " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.file \ " , \ " params \ " :{ \ " file \ " :{ \ " fileSize \ " :12345, \ " fileName \ " : \ " photo.jpg \ " }}} "
2023-03-09 11:01:22 +00:00
#==# XFile FileInvitation { fileName = " photo.jpg " , fileSize = 12345 , fileDigest = Nothing , fileConnReq = Nothing , fileInline = Nothing , fileDescr = Nothing }
2022-04-06 13:21:06 +04:00
it " x.file.acpt " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.file.acpt \ " , \ " params \ " :{ \ " fileName \ " : \ " photo.jpg \ " }} "
2022-04-06 13:21:06 +04:00
#==# XFileAcpt " photo.jpg "
2022-04-05 10:01:08 +04:00
it " x.file.acpt.inv " $
2024-03-05 20:27:00 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.file.acpt.inv \ " , \ " params \ " :{ \ " msgId \ " : \ " AQIDBA== \ " , \ " fileName \ " : \ " photo.jpg \ " , \ " fileConnReq \ " : \ " simplex:/invitation#/?v=1&smp=smp%3A%2F%2F1234-w%3D%3D%40smp.simplex.im%3A5223%2F3456-w%3D%3D%23%2F%3Fv%3D1-2%26dh%3DMCowBQYDK2VuAyEAjiswwI3O_NlS8Fk3HJUW870EY2bAwmttMBsvRB9eV3o%253D&e2e=v%3D2-3%26x3dh%3DMEIwBQYDK2VvAzkAmKuSYeQ_m0SixPDS8Wq8VBaTS1cW-Lp0n0h4Diu-kUpR-qXx4SDJ32YGEFoGFGSbGPry5Ychr6U%3D%2CMEIwBQYDK2VvAzkAmKuSYeQ_m0SixPDS8Wq8VBaTS1cW-Lp0n0h4Diu-kUpR-qXx4SDJ32YGEFoGFGSbGPry5Ychr6U%3D \ " }} "
2022-10-14 13:06:33 +01:00
#==# XFileAcptInv ( SharedMsgId " \ 1 \ 2 \ 3 \ 4 " ) ( Just testConnReq ) " photo.jpg "
it " x.file.acpt.inv " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.file.acpt.inv \ " , \ " params \ " :{ \ " msgId \ " : \ " AQIDBA== \ " , \ " fileName \ " : \ " photo.jpg \ " }} "
2022-10-14 13:06:33 +01:00
#==# XFileAcptInv ( SharedMsgId " \ 1 \ 2 \ 3 \ 4 " ) Nothing " photo.jpg "
2022-05-11 16:18:28 +04:00
it " x.file.cancel " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.file.cancel \ " , \ " params \ " :{ \ " msgId \ " : \ " AQIDBA== \ " }} "
2022-05-11 16:18:28 +04:00
#==# XFileCancel ( SharedMsgId " \ 1 \ 2 \ 3 \ 4 " )
2022-04-06 13:21:06 +04:00
it " x.info " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.info \ " , \ " params \ " :{ \ " profile \ " :{ \ " fullName \ " : \ " Alice \ " , \ " displayName \ " : \ " alice \ " , \ " image \ " : \ " data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII= \ " , \ " preferences \ " :{ \ " reactions \ " :{ \ " allow \ " : \ " yes \ " }, \ " voice \ " :{ \ " allow \ " : \ " yes \ " }}}}} "
2022-04-06 13:21:06 +04:00
#==# XInfo testProfile
it " x.info with empty full name " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.info \ " , \ " params \ " :{ \ " profile \ " :{ \ " fullName \ " : \ " \ " , \ " displayName \ " : \ " alice \ " , \ " preferences \ " :{ \ " reactions \ " :{ \ " allow \ " : \ " yes \ " }, \ " voice \ " :{ \ " allow \ " : \ " yes \ " }}}}} "
2023-04-27 17:19:21 +04:00
#==# XInfo Profile { displayName = " alice " , fullName = " " , image = Nothing , contactLink = Nothing , preferences = testChatPreferences }
2022-02-13 13:19:24 +04:00
it " x.contact with xContactId " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.contact \ " , \ " params \ " :{ \ " contactReqId \ " : \ " AQIDBA== \ " , \ " profile \ " :{ \ " fullName \ " : \ " Alice \ " , \ " displayName \ " : \ " alice \ " , \ " image \ " : \ " data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII= \ " , \ " preferences \ " :{ \ " reactions \ " :{ \ " allow \ " : \ " yes \ " }, \ " voice \ " :{ \ " allow \ " : \ " yes \ " }}}}} "
2022-02-13 13:19:24 +04:00
#==# XContact testProfile ( Just $ XContactId " \ 1 \ 2 \ 3 \ 4 " )
it " x.contact without XContactId " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.contact \ " , \ " params \ " :{ \ " profile \ " :{ \ " fullName \ " : \ " Alice \ " , \ " displayName \ " : \ " alice \ " , \ " image \ " : \ " data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII= \ " , \ " preferences \ " :{ \ " reactions \ " :{ \ " allow \ " : \ " yes \ " }, \ " voice \ " :{ \ " allow \ " : \ " yes \ " }}}}} "
2022-01-11 12:27:57 +00:00
#==# XContact testProfile Nothing
it " x.contact with content null " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.contact \ " , \ " params \ " :{ \ " content \ " :null, \ " profile \ " :{ \ " fullName \ " : \ " Alice \ " , \ " displayName \ " : \ " alice \ " , \ " image \ " : \ " data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII= \ " , \ " preferences \ " :{ \ " reactions \ " :{ \ " allow \ " : \ " yes \ " }, \ " voice \ " :{ \ " allow \ " : \ " yes \ " }}}}} "
2022-01-11 12:27:57 +00:00
==# XContact testProfile Nothing
2022-02-13 13:19:24 +04:00
it " x.contact with content (ignored) " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.contact \ " , \ " params \ " :{ \ " content \ " :{ \ " text \ " : \ " hello \ " , \ " type \ " : \ " text \ " }, \ " profile \ " :{ \ " fullName \ " : \ " Alice \ " , \ " displayName \ " : \ " alice \ " , \ " image \ " : \ " data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII= \ " , \ " preferences \ " :{ \ " reactions \ " :{ \ " allow \ " : \ " yes \ " }, \ " voice \ " :{ \ " allow \ " : \ " yes \ " }}}}} "
2022-02-13 13:19:24 +04:00
==# XContact testProfile Nothing
2022-08-27 19:56:03 +04:00
it " x.grp.inv " $
2024-03-05 20:27:00 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.grp.inv \ " , \ " params \ " :{ \ " groupInvitation \ " :{ \ " connRequest \ " : \ " simplex:/invitation#/?v=1&smp=smp%3A%2F%2F1234-w%3D%3D%40smp.simplex.im%3A5223%2F3456-w%3D%3D%23%2F%3Fv%3D1-2%26dh%3DMCowBQYDK2VuAyEAjiswwI3O_NlS8Fk3HJUW870EY2bAwmttMBsvRB9eV3o%253D&e2e=v%3D2-3%26x3dh%3DMEIwBQYDK2VvAzkAmKuSYeQ_m0SixPDS8Wq8VBaTS1cW-Lp0n0h4Diu-kUpR-qXx4SDJ32YGEFoGFGSbGPry5Ychr6U%3D%2CMEIwBQYDK2VvAzkAmKuSYeQ_m0SixPDS8Wq8VBaTS1cW-Lp0n0h4Diu-kUpR-qXx4SDJ32YGEFoGFGSbGPry5Ychr6U%3D \ " , \ " invitedMember \ " :{ \ " memberRole \ " : \ " member \ " , \ " memberId \ " : \ " BQYHCA== \ " }, \ " groupProfile \ " :{ \ " fullName \ " : \ " Team \ " , \ " displayName \ " : \ " team \ " , \ " groupPreferences \ " :{ \ " reactions \ " :{ \ " enable \ " : \ " on \ " }, \ " voice \ " :{ \ " enable \ " : \ " on \ " }}}, \ " fromMember \ " :{ \ " memberRole \ " : \ " admin \ " , \ " memberId \ " : \ " AQIDBA== \ " }}}} "
2024-03-03 17:51:42 +04:00
#==# XGrpInv GroupInvitation { fromMember = MemberIdRole ( MemberId " \ 1 \ 2 \ 3 \ 4 " ) GRAdmin , invitedMember = MemberIdRole ( MemberId " \ 5 \ 6 \ 7 \ 8 " ) GRMember , connRequest = testConnReq , groupProfile = testGroupProfile , groupLinkId = Nothing , groupSize = Nothing }
2022-11-03 14:46:36 +04:00
it " x.grp.inv with group link id " $
2024-03-05 20:27:00 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.grp.inv \ " , \ " params \ " :{ \ " groupInvitation \ " :{ \ " connRequest \ " : \ " simplex:/invitation#/?v=1&smp=smp%3A%2F%2F1234-w%3D%3D%40smp.simplex.im%3A5223%2F3456-w%3D%3D%23%2F%3Fv%3D1-2%26dh%3DMCowBQYDK2VuAyEAjiswwI3O_NlS8Fk3HJUW870EY2bAwmttMBsvRB9eV3o%253D&e2e=v%3D2-3%26x3dh%3DMEIwBQYDK2VvAzkAmKuSYeQ_m0SixPDS8Wq8VBaTS1cW-Lp0n0h4Diu-kUpR-qXx4SDJ32YGEFoGFGSbGPry5Ychr6U%3D%2CMEIwBQYDK2VvAzkAmKuSYeQ_m0SixPDS8Wq8VBaTS1cW-Lp0n0h4Diu-kUpR-qXx4SDJ32YGEFoGFGSbGPry5Ychr6U%3D \ " , \ " invitedMember \ " :{ \ " memberRole \ " : \ " member \ " , \ " memberId \ " : \ " BQYHCA== \ " }, \ " groupProfile \ " :{ \ " fullName \ " : \ " Team \ " , \ " displayName \ " : \ " team \ " , \ " groupPreferences \ " :{ \ " reactions \ " :{ \ " enable \ " : \ " on \ " }, \ " voice \ " :{ \ " enable \ " : \ " on \ " }}}, \ " fromMember \ " :{ \ " memberRole \ " : \ " admin \ " , \ " memberId \ " : \ " AQIDBA== \ " }, \ " groupLinkId \ " : \ " AQIDBA== \ " }}} "
2024-03-03 17:51:42 +04:00
#==# XGrpInv GroupInvitation { fromMember = MemberIdRole ( MemberId " \ 1 \ 2 \ 3 \ 4 " ) GRAdmin , invitedMember = MemberIdRole ( MemberId " \ 5 \ 6 \ 7 \ 8 " ) GRMember , connRequest = testConnReq , groupProfile = testGroupProfile , groupLinkId = Just $ GroupLinkId " \ 1 \ 2 \ 3 \ 4 " , groupSize = Nothing }
2022-08-18 11:35:31 +04:00
it " x.grp.acpt without incognito profile " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.grp.acpt \ " , \ " params \ " :{ \ " memberId \ " : \ " AQIDBA== \ " }} "
2022-08-27 19:56:03 +04:00
#==# XGrpAcpt ( MemberId " \ 1 \ 2 \ 3 \ 4 " )
2022-01-11 12:27:57 +00:00
it " x.grp.mem.new " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.grp.mem.new \ " , \ " params \ " :{ \ " memberInfo \ " :{ \ " memberRole \ " : \ " admin \ " , \ " memberId \ " : \ " AQIDBA== \ " , \ " profile \ " :{ \ " fullName \ " : \ " Alice \ " , \ " displayName \ " : \ " alice \ " , \ " image \ " : \ " data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII= \ " , \ " preferences \ " :{ \ " reactions \ " :{ \ " allow \ " : \ " yes \ " }, \ " voice \ " :{ \ " allow \ " : \ " yes \ " }}}}}} "
2023-09-05 20:15:50 +04:00
#==# XGrpMemNew MemberInfo { memberId = MemberId " \ 1 \ 2 \ 3 \ 4 " , memberRole = GRAdmin , v = Nothing , profile = testProfile }
it " x.grp.mem.new with member chat version range " $
2024-01-15 19:56:11 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.grp.mem.new \ " , \ " params \ " :{ \ " memberInfo \ " :{ \ " memberRole \ " : \ " admin \ " , \ " memberId \ " : \ " AQIDBA== \ " , \ " v \ " : \ " 1-7 \ " , \ " profile \ " :{ \ " fullName \ " : \ " Alice \ " , \ " displayName \ " : \ " alice \ " , \ " image \ " : \ " data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII= \ " , \ " preferences \ " :{ \ " reactions \ " :{ \ " allow \ " : \ " yes \ " }, \ " voice \ " :{ \ " allow \ " : \ " yes \ " }}}}}} "
2024-03-06 16:02:19 +02:00
#==# XGrpMemNew MemberInfo { memberId = MemberId " \ 1 \ 2 \ 3 \ 4 " , memberRole = GRAdmin , v = Just $ ChatVersionRange $ supportedChatVRange PQEncOff , profile = testProfile }
2022-01-11 12:27:57 +00:00
it " x.grp.mem.intro " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.grp.mem.intro \ " , \ " params \ " :{ \ " memberInfo \ " :{ \ " memberRole \ " : \ " admin \ " , \ " memberId \ " : \ " AQIDBA== \ " , \ " profile \ " :{ \ " fullName \ " : \ " Alice \ " , \ " displayName \ " : \ " alice \ " , \ " image \ " : \ " data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII= \ " , \ " preferences \ " :{ \ " reactions \ " :{ \ " allow \ " : \ " yes \ " }, \ " voice \ " :{ \ " allow \ " : \ " yes \ " }}}}}} "
2024-01-19 17:57:04 +04:00
#==# XGrpMemIntro MemberInfo { memberId = MemberId " \ 1 \ 2 \ 3 \ 4 " , memberRole = GRAdmin , v = Nothing , profile = testProfile } Nothing
2023-09-05 20:15:50 +04:00
it " x.grp.mem.intro with member chat version range " $
2024-01-15 19:56:11 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.grp.mem.intro \ " , \ " params \ " :{ \ " memberInfo \ " :{ \ " memberRole \ " : \ " admin \ " , \ " memberId \ " : \ " AQIDBA== \ " , \ " v \ " : \ " 1-7 \ " , \ " profile \ " :{ \ " fullName \ " : \ " Alice \ " , \ " displayName \ " : \ " alice \ " , \ " image \ " : \ " data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII= \ " , \ " preferences \ " :{ \ " reactions \ " :{ \ " allow \ " : \ " yes \ " }, \ " voice \ " :{ \ " allow \ " : \ " yes \ " }}}}}} "
2024-03-06 16:02:19 +02:00
#==# XGrpMemIntro MemberInfo { memberId = MemberId " \ 1 \ 2 \ 3 \ 4 " , memberRole = GRAdmin , v = Just $ ChatVersionRange $ supportedChatVRange PQEncOff , profile = testProfile } Nothing
2024-01-19 17:57:04 +04:00
it " x.grp.mem.intro with member restrictions " $
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.grp.mem.intro \ " , \ " params \ " :{ \ " memberRestrictions \ " :{ \ " restriction \ " : \ " blocked \ " }, \ " memberInfo \ " :{ \ " memberRole \ " : \ " admin \ " , \ " memberId \ " : \ " AQIDBA== \ " , \ " profile \ " :{ \ " fullName \ " : \ " Alice \ " , \ " displayName \ " : \ " alice \ " , \ " image \ " : \ " data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII= \ " , \ " preferences \ " :{ \ " reactions \ " :{ \ " allow \ " : \ " yes \ " }, \ " voice \ " :{ \ " allow \ " : \ " yes \ " }}}}}} "
#==# XGrpMemIntro MemberInfo { memberId = MemberId " \ 1 \ 2 \ 3 \ 4 " , memberRole = GRAdmin , v = Nothing , profile = testProfile } ( Just MemberRestrictions { restriction = MRSBlocked } )
2022-01-11 12:27:57 +00:00
it " x.grp.mem.inv " $
2024-03-05 20:27:00 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.grp.mem.inv \ " , \ " params \ " :{ \ " memberId \ " : \ " AQIDBA== \ " , \ " memberIntro \ " :{ \ " directConnReq \ " : \ " simplex:/invitation#/?v=1&smp=smp%3A%2F%2F1234-w%3D%3D%40smp.simplex.im%3A5223%2F3456-w%3D%3D%23%2F%3Fv%3D1-2%26dh%3DMCowBQYDK2VuAyEAjiswwI3O_NlS8Fk3HJUW870EY2bAwmttMBsvRB9eV3o%253D&e2e=v%3D2-3%26x3dh%3DMEIwBQYDK2VvAzkAmKuSYeQ_m0SixPDS8Wq8VBaTS1cW-Lp0n0h4Diu-kUpR-qXx4SDJ32YGEFoGFGSbGPry5Ychr6U%3D%2CMEIwBQYDK2VvAzkAmKuSYeQ_m0SixPDS8Wq8VBaTS1cW-Lp0n0h4Diu-kUpR-qXx4SDJ32YGEFoGFGSbGPry5Ychr6U%3D \ " , \ " groupConnReq \ " : \ " simplex:/invitation#/?v=1&smp=smp%3A%2F%2F1234-w%3D%3D%40smp.simplex.im%3A5223%2F3456-w%3D%3D%23%2F%3Fv%3D1-2%26dh%3DMCowBQYDK2VuAyEAjiswwI3O_NlS8Fk3HJUW870EY2bAwmttMBsvRB9eV3o%253D&e2e=v%3D2-3%26x3dh%3DMEIwBQYDK2VvAzkAmKuSYeQ_m0SixPDS8Wq8VBaTS1cW-Lp0n0h4Diu-kUpR-qXx4SDJ32YGEFoGFGSbGPry5Ychr6U%3D%2CMEIwBQYDK2VvAzkAmKuSYeQ_m0SixPDS8Wq8VBaTS1cW-Lp0n0h4Diu-kUpR-qXx4SDJ32YGEFoGFGSbGPry5Ychr6U%3D \ " }}} "
2023-09-05 20:15:50 +04:00
#==# XGrpMemInv ( MemberId " \ 1 \ 2 \ 3 \ 4 " ) IntroInvitation { groupConnReq = testConnReq , directConnReq = Just testConnReq }
it " x.grp.mem.inv w/t directConnReq " $
2024-03-05 20:27:00 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.grp.mem.inv \ " , \ " params \ " :{ \ " memberId \ " : \ " AQIDBA== \ " , \ " memberIntro \ " :{ \ " groupConnReq \ " : \ " simplex:/invitation#/?v=1&smp=smp%3A%2F%2F1234-w%3D%3D%40smp.simplex.im%3A5223%2F3456-w%3D%3D%23%2F%3Fv%3D1-2%26dh%3DMCowBQYDK2VuAyEAjiswwI3O_NlS8Fk3HJUW870EY2bAwmttMBsvRB9eV3o%253D&e2e=v%3D2-3%26x3dh%3DMEIwBQYDK2VvAzkAmKuSYeQ_m0SixPDS8Wq8VBaTS1cW-Lp0n0h4Diu-kUpR-qXx4SDJ32YGEFoGFGSbGPry5Ychr6U%3D%2CMEIwBQYDK2VvAzkAmKuSYeQ_m0SixPDS8Wq8VBaTS1cW-Lp0n0h4Diu-kUpR-qXx4SDJ32YGEFoGFGSbGPry5Ychr6U%3D \ " }}} "
2023-09-05 20:15:50 +04:00
#==# XGrpMemInv ( MemberId " \ 1 \ 2 \ 3 \ 4 " ) IntroInvitation { groupConnReq = testConnReq , directConnReq = Nothing }
2022-01-11 12:27:57 +00:00
it " x.grp.mem.fwd " $
2024-03-05 20:27:00 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.grp.mem.fwd \ " , \ " params \ " :{ \ " memberIntro \ " :{ \ " directConnReq \ " : \ " simplex:/invitation#/?v=1&smp=smp%3A%2F%2F1234-w%3D%3D%40smp.simplex.im%3A5223%2F3456-w%3D%3D%23%2F%3Fv%3D1-2%26dh%3DMCowBQYDK2VuAyEAjiswwI3O_NlS8Fk3HJUW870EY2bAwmttMBsvRB9eV3o%253D&e2e=v%3D2-3%26x3dh%3DMEIwBQYDK2VvAzkAmKuSYeQ_m0SixPDS8Wq8VBaTS1cW-Lp0n0h4Diu-kUpR-qXx4SDJ32YGEFoGFGSbGPry5Ychr6U%3D%2CMEIwBQYDK2VvAzkAmKuSYeQ_m0SixPDS8Wq8VBaTS1cW-Lp0n0h4Diu-kUpR-qXx4SDJ32YGEFoGFGSbGPry5Ychr6U%3D \ " , \ " groupConnReq \ " : \ " simplex:/invitation#/?v=1&smp=smp%3A%2F%2F1234-w%3D%3D%40smp.simplex.im%3A5223%2F3456-w%3D%3D%23%2F%3Fv%3D1-2%26dh%3DMCowBQYDK2VuAyEAjiswwI3O_NlS8Fk3HJUW870EY2bAwmttMBsvRB9eV3o%253D&e2e=v%3D2-3%26x3dh%3DMEIwBQYDK2VvAzkAmKuSYeQ_m0SixPDS8Wq8VBaTS1cW-Lp0n0h4Diu-kUpR-qXx4SDJ32YGEFoGFGSbGPry5Ychr6U%3D%2CMEIwBQYDK2VvAzkAmKuSYeQ_m0SixPDS8Wq8VBaTS1cW-Lp0n0h4Diu-kUpR-qXx4SDJ32YGEFoGFGSbGPry5Ychr6U%3D \ " }, \ " memberInfo \ " :{ \ " memberRole \ " : \ " admin \ " , \ " memberId \ " : \ " AQIDBA== \ " , \ " profile \ " :{ \ " fullName \ " : \ " Alice \ " , \ " displayName \ " : \ " alice \ " , \ " image \ " : \ " data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII= \ " , \ " preferences \ " :{ \ " reactions \ " :{ \ " allow \ " : \ " yes \ " }, \ " voice \ " :{ \ " allow \ " : \ " yes \ " }}}}}} "
2023-09-05 20:15:50 +04:00
#==# XGrpMemFwd MemberInfo { memberId = MemberId " \ 1 \ 2 \ 3 \ 4 " , memberRole = GRAdmin , v = Nothing , profile = testProfile } IntroInvitation { groupConnReq = testConnReq , directConnReq = Just testConnReq }
it " x.grp.mem.fwd with member chat version range and w/t directConnReq " $
2024-03-05 20:27:00 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.grp.mem.fwd \ " , \ " params \ " :{ \ " memberIntro \ " :{ \ " groupConnReq \ " : \ " simplex:/invitation#/?v=1&smp=smp%3A%2F%2F1234-w%3D%3D%40smp.simplex.im%3A5223%2F3456-w%3D%3D%23%2F%3Fv%3D1-2%26dh%3DMCowBQYDK2VuAyEAjiswwI3O_NlS8Fk3HJUW870EY2bAwmttMBsvRB9eV3o%253D&e2e=v%3D2-3%26x3dh%3DMEIwBQYDK2VvAzkAmKuSYeQ_m0SixPDS8Wq8VBaTS1cW-Lp0n0h4Diu-kUpR-qXx4SDJ32YGEFoGFGSbGPry5Ychr6U%3D%2CMEIwBQYDK2VvAzkAmKuSYeQ_m0SixPDS8Wq8VBaTS1cW-Lp0n0h4Diu-kUpR-qXx4SDJ32YGEFoGFGSbGPry5Ychr6U%3D \ " }, \ " memberInfo \ " :{ \ " memberRole \ " : \ " admin \ " , \ " memberId \ " : \ " AQIDBA== \ " , \ " v \ " : \ " 1-7 \ " , \ " profile \ " :{ \ " fullName \ " : \ " Alice \ " , \ " displayName \ " : \ " alice \ " , \ " image \ " : \ " data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII= \ " , \ " preferences \ " :{ \ " reactions \ " :{ \ " allow \ " : \ " yes \ " }, \ " voice \ " :{ \ " allow \ " : \ " yes \ " }}}}}} "
2024-03-06 16:02:19 +02:00
#==# XGrpMemFwd MemberInfo { memberId = MemberId " \ 1 \ 2 \ 3 \ 4 " , memberRole = GRAdmin , v = Just $ ChatVersionRange $ supportedChatVRange PQEncOff , profile = testProfile } IntroInvitation { groupConnReq = testConnReq , directConnReq = Nothing }
2022-01-11 12:27:57 +00:00
it " x.grp.mem.info " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.grp.mem.info \ " , \ " params \ " :{ \ " memberId \ " : \ " AQIDBA== \ " , \ " profile \ " :{ \ " fullName \ " : \ " Alice \ " , \ " displayName \ " : \ " alice \ " , \ " image \ " : \ " data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII= \ " , \ " preferences \ " :{ \ " reactions \ " :{ \ " allow \ " : \ " yes \ " }, \ " voice \ " :{ \ " allow \ " : \ " yes \ " }}}}} "
2022-01-17 12:24:55 +00:00
#==# XGrpMemInfo ( MemberId " \ 1 \ 2 \ 3 \ 4 " ) testProfile
2022-04-06 13:21:06 +04:00
it " x.grp.mem.con " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.grp.mem.con \ " , \ " params \ " :{ \ " memberId \ " : \ " AQIDBA== \ " }} "
2022-04-06 13:21:06 +04:00
#==# XGrpMemCon ( MemberId " \ 1 \ 2 \ 3 \ 4 " )
it " x.grp.mem.con.all " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.grp.mem.con.all \ " , \ " params \ " :{ \ " memberId \ " : \ " AQIDBA== \ " }} "
2022-04-06 13:21:06 +04:00
#==# XGrpMemConAll ( MemberId " \ 1 \ 2 \ 3 \ 4 " )
it " x.grp.mem.del " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.grp.mem.del \ " , \ " params \ " :{ \ " memberId \ " : \ " AQIDBA== \ " }} "
2022-04-06 13:21:06 +04:00
#==# XGrpMemDel ( MemberId " \ 1 \ 2 \ 3 \ 4 " )
it " x.grp.leave " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.grp.leave \ " , \ " params \ " :{}} "
2022-04-06 13:21:06 +04:00
==# XGrpLeave
it " x.grp.del " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.grp.del \ " , \ " params \ " :{}} "
2022-04-06 13:21:06 +04:00
==# XGrpDel
2023-09-16 17:55:48 +04:00
it " x.grp.direct.inv " $
2024-03-05 20:27:00 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.grp.direct.inv \ " , \ " params \ " :{ \ " connReq \ " : \ " simplex:/invitation#/?v=1&smp=smp%3A%2F%2F1234-w%3D%3D%40smp.simplex.im%3A5223%2F3456-w%3D%3D%23%2F%3Fv%3D1-2%26dh%3DMCowBQYDK2VuAyEAjiswwI3O_NlS8Fk3HJUW870EY2bAwmttMBsvRB9eV3o%253D&e2e=v%3D2-3%26x3dh%3DMEIwBQYDK2VvAzkAmKuSYeQ_m0SixPDS8Wq8VBaTS1cW-Lp0n0h4Diu-kUpR-qXx4SDJ32YGEFoGFGSbGPry5Ychr6U%3D%2CMEIwBQYDK2VvAzkAmKuSYeQ_m0SixPDS8Wq8VBaTS1cW-Lp0n0h4Diu-kUpR-qXx4SDJ32YGEFoGFGSbGPry5Ychr6U%3D \ " , \ " content \ " :{ \ " text \ " : \ " hello \ " , \ " type \ " : \ " text \ " }}} "
2023-09-16 17:55:48 +04:00
#==# XGrpDirectInv testConnReq ( Just $ MCText " hello " )
it " x.grp.direct.inv without content " $
2024-03-05 20:27:00 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.grp.direct.inv \ " , \ " params \ " :{ \ " connReq \ " : \ " simplex:/invitation#/?v=1&smp=smp%3A%2F%2F1234-w%3D%3D%40smp.simplex.im%3A5223%2F3456-w%3D%3D%23%2F%3Fv%3D1-2%26dh%3DMCowBQYDK2VuAyEAjiswwI3O_NlS8Fk3HJUW870EY2bAwmttMBsvRB9eV3o%253D&e2e=v%3D2-3%26x3dh%3DMEIwBQYDK2VvAzkAmKuSYeQ_m0SixPDS8Wq8VBaTS1cW-Lp0n0h4Diu-kUpR-qXx4SDJ32YGEFoGFGSbGPry5Ychr6U%3D%2CMEIwBQYDK2VvAzkAmKuSYeQ_m0SixPDS8Wq8VBaTS1cW-Lp0n0h4Diu-kUpR-qXx4SDJ32YGEFoGFGSbGPry5Ychr6U%3D \ " }} "
2023-09-16 17:55:48 +04:00
#==# XGrpDirectInv testConnReq Nothing
2023-11-18 21:52:01 +04:00
-- it "x.grp.msg.forward"
-- $ "{\"v\":\"1\",\"event\":\"x.grp.msg.forward\",\"params\":{\"msgForward\":{\"memberId\":\"AQIDBA==\",\"msg\":\"{\"v\":\"1\",\"event\":\"x.msg.new\",\"params\":{\"content\":{\"text\":\"hello\",\"type\":\"text\"}}}\",\"msgTs\":\"1970-01-01T00:00:01.000000001Z\"}}}"
-- #==# XGrpMsgForward
-- (MemberId "\1\2\3\4")
-- (ChatMessage chatInitialVRange (Just $ SharedMsgId "\1\2\3\4") (XMsgNew (MCSimple (extMsgContent (MCText "hello") Nothing))))
-- (systemToUTCTime $ MkSystemTime 1 1)
2022-04-06 13:21:06 +04:00
it " x.info.probe " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.info.probe \ " , \ " params \ " :{ \ " probe \ " : \ " AQIDBA== \ " }} "
2022-04-06 13:21:06 +04:00
#==# XInfoProbe ( Probe " \ 1 \ 2 \ 3 \ 4 " )
it " x.info.probe.check " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.info.probe.check \ " , \ " params \ " :{ \ " probeHash \ " : \ " AQIDBA== \ " }} "
2022-04-06 13:21:06 +04:00
#==# XInfoProbeCheck ( ProbeHash " \ 1 \ 2 \ 3 \ 4 " )
it " x.info.probe.ok " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.info.probe.ok \ " , \ " params \ " :{ \ " probe \ " : \ " AQIDBA== \ " }} "
2022-04-06 13:21:06 +04:00
#==# XInfoProbeOk ( Probe " \ 1 \ 2 \ 3 \ 4 " )
it " x.ok " $
2023-09-01 19:20:07 +04:00
" { \ " v \ " : \ " 1 \ " , \ " event \ " : \ " x.ok \ " , \ " params \ " :{}} "
2022-04-06 13:21:06 +04:00
==# XOk