core: update remote API commands/events (#3295)

* core: update remote API

* Add session verification event between tls and http2

* roll back char_ '@' parsers

* use more specific parser for verification codes

* cabal.project.local for mac

---------

Co-authored-by: IC Rainbow <aenor.realm@gmail.com>
This commit is contained in:
Evgeny Poberezkin
2023-11-01 19:08:36 +00:00
committed by GitHub
parent b2f9270452
commit 8482dbfd99
8 changed files with 130 additions and 91 deletions

View File

@@ -30,7 +30,7 @@ import Simplex.Chat.Remote.Types
import qualified Simplex.Messaging.Crypto as C
import Simplex.Messaging.Crypto.File (CryptoFileArgs (..))
import Simplex.Messaging.Encoding (smpDecode)
import Simplex.Messaging.Encoding.String (strDecode, strEncode)
import Simplex.Messaging.Encoding.String (strEncode)
import Simplex.Messaging.Transport.Client (TransportHost (..))
import Simplex.Messaging.Transport.Credentials (genCredentials, tlsCredentials)
import Simplex.Messaging.Transport.HTTP2.Client (HTTP2Response (..), closeHTTP2Client, sendRequest)
@@ -408,7 +408,7 @@ startRemote mobile desktop = do
mobile ##> "/set device name Mobile"
mobile <## "ok"
mobile ##> "/start remote ctrl"
mobile ##> "/find remote ctrl"
mobile <## "ok"
mobile <## "remote controller announced"
mobile <## "connection code:"
@@ -416,13 +416,20 @@ startRemote mobile desktop = do
-- The user scans OOB QR code and confirms it matches the announced stuff
fromString annFingerprint `shouldBe` strEncode oobFingerprint
mobile ##> ("/register remote ctrl " <> oobLink)
mobile ##> ("/connect remote ctrl " <> oobLink)
mobile <## "remote controller 1 registered"
mobile ##> "/accept remote ctrl 1"
mobile <## "ok" -- alternative scenario: accepted before controller start
mobile ##> "/confirm remote ctrl 1"
mobile <## "ok"
mobile <## "remote controller 1 connecting to My desktop"
mobile <## "remote controller 1 connected, My desktop"
desktop <## "remote host 1 connected"
-- TODO: rework tls connection prelude
mobile <## "remote controller 1 connected to My desktop"
mobile <## "Compare session code with controller and use:"
verifyCmd <- getTermLine mobile
mobile ##> verifyCmd
mobile <## "ok"
concurrently_
(mobile <## "remote controller 1 session started with My desktop")
(desktop <## "remote host 1 connected")
contactBob :: TestCC -> TestCC -> IO ()
contactBob desktop bob = do