core: use xrcp protocol for desktop/mobile connection (#3305)

* WIP: start working on /connect remote ctrl

OOB is broken, requires fixing simplexmq bits.

* WIP: pull CtrlCryptoHandle from xrcp

* place xrcp stubs

* WIP: start switching to RemoteControl.Client types

* fix http2 sha

* fix sha256map.nix

* fix cabal.project

* update RC test

* WIP: add new remote session

* fix compilation

* simplify

* attach HTTP2 server to TLS

* starting host session in controller (WIP)

* more WIP

* compiles

* compiles2

* wip

* pass startRemote' test

* async to poll for events from host, test to send messages fails

* move xrcp handshake test to simplexmq

* detect session stops

* fix connectRemoteCtrl

* use step type

* app info

* WIP: pairing stores

* plug in hello/appInfo/pairings

* negotiate app version

* update simplexmw, remove KEM secrets from DB

* fix file tests

* tone down http2 shutdown errors

* Add stored session test

* bump simplexmq tag

* update simplexmq

* refactor, fix

* removed unused errors

* rename fields, remove unused file

* rename errors

---------

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
This commit is contained in:
Alexander Bondarenko
2023-11-08 22:13:52 +02:00
committed by GitHub
parent 3839267f88
commit b729144773
18 changed files with 761 additions and 581 deletions
+23 -9
View File
@@ -523,18 +523,32 @@ CREATE TABLE IF NOT EXISTS "received_probes"(
CREATE TABLE remote_hosts(
-- hosts known to a controlling app
remote_host_id INTEGER PRIMARY KEY AUTOINCREMENT,
store_path TEXT NOT NULL, -- file path relative to app store(must not contain "/")
display_name TEXT NOT NULL, -- user-provided name for a remote host
ca_key BLOB NOT NULL, -- private key for signing session certificates
ca_cert BLOB NOT NULL, -- root certificate, whose fingerprint is pinned on a remote
contacted INTEGER NOT NULL DEFAULT 0 -- 0(first time), 1(connected before)
host_device_name TEXT NOT NULL,
store_path TEXT NOT NULL, -- file path for host files relative to app storage(must not contain "/")
-- RCHostPairing
ca_key BLOB NOT NULL, -- private key to sign session certificates
ca_cert BLOB NOT NULL, -- root certificate
id_key BLOB NOT NULL, -- long-term/identity signing key
-- KnownHostPairing
host_fingerprint BLOB NOT NULL, -- pinned remote host CA, set when connected
-- stored host session key
host_dh_pub BLOB NOT NULL, -- session DH key
UNIQUE(host_fingerprint) ON CONFLICT FAIL
);
CREATE TABLE remote_controllers(
-- controllers known to a hosting app
remote_controller_id INTEGER PRIMARY KEY AUTOINCREMENT,
display_name TEXT NOT NULL, -- user-provided name for a remote controller
fingerprint BLOB NOT NULL, -- remote controller CA fingerprint
accepted INTEGER -- NULL(unknown), 0(rejected), 1(confirmed)
remote_ctrl_id INTEGER PRIMARY KEY AUTOINCREMENT,
ctrl_device_name TEXT NOT NULL,
-- RCCtrlPairing
ca_key BLOB NOT NULL, -- CA key
ca_cert BLOB NOT NULL, -- CA certificate for TLS clients
ctrl_fingerprint BLOB NOT NULL, -- remote controller CA, set when connected
id_pub BLOB NOT NULL, -- remote controller long-term/identity key to verify signatures
-- stored session key, commited on connection confirmation
dh_priv_key BLOB NOT NULL, -- session DH key
-- prev session key
prev_dh_priv_key BLOB, -- previous session DH key
UNIQUE(ctrl_fingerprint) ON CONFLICT FAIL
);
CREATE INDEX contact_profiles_index ON contact_profiles(
display_name,