Commit Graph

48 Commits

Author SHA1 Message Date
Evgeny Poberezkin a6f401041a
SMP protocol v4: batching multiple server commands/responses in a transport block (#470)
* batch server commands in one transport block

* subscribe to multiple queues using batched commands

* agent method to subscribe to multiple queues using batched commands

* refactor

* test for batched subscriptions

* delete part of connections in batched test

* add resubscribeConnections

* remove comment

* update SMP protocol doc
2022-07-17 10:10:38 +01:00
Evgeny Poberezkin 9c1b43791c
SMP v3: encrypt message timestamp and flags together with the body between server and recipient (#457)
* SMP v3: encrypt message timestamp and flags together with the body between server and recipient

* v3 tests

* update protocol doc

* add test for max size message

* delay in notifications test

* simplify v3

* encrypt server message to the recipient when sent

* refactor

* exit on error restoring the messages

* refactor, increase test timeout

* style

* add prints to the test

* remove error from unsafeMaxLenBS

* update protocol

* lint, improve test, change func param
2022-07-05 21:08:05 +01:00
JRoberts ef4d4c9e16
ntf: remove notification subscription (#417) 2022-06-22 20:32:32 +04:00
Evgeny Poberezkin c1348aa54f
SMP connection handshake v2 (#390)
* SMP connection handshake v2

* hadshake v2 [mostly] works

* all tests pass, some race conditions remain

* fix build

* fix race conditions, send CON after all HELLOs in duplexHandshake mode

* add comments

* comment

* add comments
2022-06-09 13:47:07 +01:00
JRoberts c2ec691a46
ntf subscription diagram (#377) 2022-05-31 15:40:43 +04:00
Evgeny Poberezkin d31958855f
ntf server implementation, updated ntf protocol, ntf client based on refactored protocol client, bare-bones SMP agent to manage ntf connections (to connect to ntf server) (#338)
* process ntf server commands

* when subscription is re-created and it was ENDed, resubscribe to SMP

* SMPClientAgent draft

* SMPClientAgent: remove double tracking of subscriptions

* subscriber frame

* PING error now throws error to restart SMPClient for more reliable re-connection (#342)

* increase TCP timeout to 5 sec

* add pragmas and vacuum db (#343)

* vacuum in each connection to enable auto-vacuum (#344)

* update protocol, token verification

* refactor SMPClient to ProtocoClient, to use with notification server protocol

* notification server client, managing notification clients in the agent

* stub for push payload

Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com>
2022-04-02 16:14:19 +01:00
Evgeny Poberezkin f466fa76e5
notifications: protocol, server (#335)
* notifications: protocol

* update protocol to include subscription ID and DH public key

* update protocol, started server

* add notification server subscription DH key

* use the same command type in notifications protocol, protocol parsing, server frame

* remove empty files
2022-03-27 08:36:00 +01:00
Evgeny Poberezkin f060914ab8 notifications server rfc/schema (#332)
* notifications server rfc/schema

* update schema/protocol
2022-03-22 16:53:01 +00:00
Efim Poberezkin ac899a67c4
support TLS 1.3 (#300) 2022-01-18 18:59:02 +04:00
Evgeny Poberezkin bfa4911217
improve message error handling (#286)
* message envelope sizes and protocol doc corrections

* change error handling in message delivery loop
2022-01-12 10:36:22 +00:00
Evgeny Poberezkin 5f20f0124a correction to E2E encrypted (double ratchet) envelope size 2022-01-11 22:08:37 +00:00
Evgeny Poberezkin 657c9b1b37
reduce SMP envelope sizes (#284) 2022-01-11 21:01:21 +00:00
Efim Poberezkin 5e57c5dfd7
rename remaining occurrences of connection alias into connection id (#265) 2022-01-07 15:37:40 +04:00
Evgeny Poberezkin 488398df9f
change message envelopes and encoding, unify message delivery (#252)
* types and encodings for double ratchet integration

* upgrade stack resolver

* type classes for version agreement, encode/decode connection request links and E2E params with versioning

* encode/decode client parameters (version and DH key) in SMP queue URI using query string parameters

* restore support of the current SMP queue URI format

* update AMessage to only send queues in REPLY message (not the full connection request)

* new agent message evnvelopes (tests fail)

* new message envelopes - tests pass

* store fully encrypted messages before sending

* unify message delivery via DB queue (excluding confirmation and invitation)

* remove activateSecuredQueue

* linter hints

* remove comment

* export order

* save rachet-encrypted message, not per-queue encrypted

* delete message after it is accepted by the server, reduce message delivery interval for the tests

Co-authored-by: Efim Poberezkin <8711996+efim-poberezkin@users.noreply.github.com>
2022-01-05 19:52:37 +00:00
Evgeny Poberezkin 4a73a7ecd4
remove public header from all messages, fix envelope sizes (#251)
* fix envelope sizes

* only send sender DH pub key for per-queue E2E with confirmation message
2022-01-03 14:33:30 +00:00
Evgeny Poberezkin 83d085cadc
amend SMP protocol doc (#232)
* amend SMP protocol doc

* Update protocol/simplex-messaging.md

Co-authored-by: Efim Poberezkin <8711996+efim-poberezkin@users.noreply.github.com>

* Update protocol/simplex-messaging.md

Co-authored-by: Efim Poberezkin <8711996+efim-poberezkin@users.noreply.github.com>

* Update protocol/simplex-messaging.md

* Update protocol/simplex-messaging.md

Co-authored-by: Efim Poberezkin <8711996+efim-poberezkin@users.noreply.github.com>
2022-01-02 22:48:01 +00:00
Evgeny Poberezkin f314ff1bb6
add links to overview (#249) 2022-01-01 14:22:43 +00:00
Evgeny Poberezkin 1737686c1e
update overview (#233)
* update overview

* network/framework -> platform

* fix links

* corrections

* corrections

* correction

* correction

* corrections

* update acknowledgements

* remove old overview.md

* update cyptographic primitives, remove acknoledgement

Co-authored-by: Efim Poberezkin <8711996+efim-poberezkin@users.noreply.github.com>
2022-01-01 13:59:03 +00:00
Evgeny Poberezkin 5e29e3698e
binary SMP protocol encoding, split Command type to two types (#245)
* binary SMP protocol encoding (server tests fail)

* use 1 byte for bytestring length when encoding/decoding

* Encoding class, binary tags

* update server tests

* negotiate SMP version in client/server handshake

* add version columns to queues and connections

* split parsing SMP client commands and server responses to different functions

* check uniqueness of protocol tags

* split client commands and server responses/messages to separate types

* update types in SMP client

* remove pattern synonyms for SMP errors

* simplify getHandshake

* update SMP protocol encoding in protocol spec

* encode time as a number of seconds (64-bit integer) since epoch
2022-01-01 13:10:19 +00:00
Evgeny Poberezkin 73cad5a6c4
simple per-queue e2e encryption with NaCl crypto_box (#242)
* simple per-queue e2e encryption with NaCl crypto_box

* add e2e keys and DH secrets to schema

* agree and save shared DH secret per queue (not used yet)

* protocol changes for uniform padding and message part lengths

* correct message structure diagrams

* make per-queue E2E encryption non-optional

* refactor crypto keys

* use NaCl crypto_box for per-queue E2E encryption, remove RSA keys from queues

* remove RSA support

* merge migration with E2E DH keys

* clean up

* remove unused methods

* parsing/serializing agent messages

* remove sender timestamp from DB and code

* clean up

* slean up

* s/SMPConfMsg/SMPConfirmation/

* serializeAgentMessage = serializeClientMessage . agentToClientMsg

* simplify error handling

* update protocol docs
2021-12-29 14:27:10 +00:00
Evgeny Poberezkin f9f1b8f355
new overview (#235) 2021-12-21 07:46:22 +00:00
Evgeny Poberezkin f154f7ee3a
overview doc updates (#216)
* overview changes

* correction

* protocol docs changes

* include reviewer comments in the doc

* encryption scheme for the recipient traffic

* TLS cipher suite
2021-12-20 12:07:31 +00:00
Evgeny Poberezkin 323fb1f03c
remove SMP server signing responses (#226)
* remove SMP server signing responses

* keep only one session ID
2021-12-16 07:15:45 +00:00
Evgeny Poberezkin cf3d0dfdc3
Transaction fields for size, session IDs, refactor (#222)
* add SMP session IDs/tls-unique to transmission

* refactor SMP transmissions: precise transmission types in server & client

* use correct session IDs

* remove TSession
2021-12-15 08:06:34 +00:00
Evgeny Poberezkin f6991539a2 add server signature keys and DH keys for server->recipient msg bodis to SMP commands (server store log and agent tests are skipped) 2021-12-12 12:22:44 +00:00
Evgeny Poberezkin 52eef2d7c7 Merge branch 'master' into v5 2021-12-10 11:52:08 +00:00
Evgeny Poberezkin d5310c1c6f
SimpleX protocols and network overview (#215) 2021-12-06 12:28:11 +00:00
Evgeny Poberezkin 58758e0572 Merge branch 'master' into v5 2021-12-04 21:08:38 +00:00
Evgeny Poberezkin 3e226fc3f2
add CONF/LET for invitations, use REQ/ACPT only with contact connections (#212) 2021-12-04 21:08:02 +00:00
Evgeny Poberezkin b116408ec3 Merge branch 'master' into v5 2021-12-04 18:55:23 +00:00
Evgeny Poberezkin 04c65d98da
support permanent connection link ("contact") in SMP agent protocols (#143)
* open/public queue extension for SMP and SMP agent protocols

* add connection mode - invitation or contact

* use ConnectionMode with REQ and ACPT agent notification/command

* parameterize ConnectionRequest with ConnectionMode

* implement Contact connection mode for permanent connection links

* tests for contact connections
2021-12-04 18:42:08 +00:00
Evgeny Poberezkin 316dc7b320
merge protocol changes from v5 (#211) 2021-12-02 18:42:13 +00:00
Evgeny Poberezkin bebd1e5fb9 simplex URI request 2021-11-29 23:00:26 +00:00
Evgeny Poberezkin db509d0311
update protocol docs (#209)
* update protocol docs

* more protocol corrections

* update connection request syntax

* Update protocol/agent-protocol.md

Co-authored-by: Efim Poberezkin <8711996+efim-poberezkin@users.noreply.github.com>

* Update protocol/agent-protocol.md

Co-authored-by: Efim Poberezkin <8711996+efim-poberezkin@users.noreply.github.com>

* Update protocol/agent-protocol.md

Co-authored-by: Efim Poberezkin <8711996+efim-poberezkin@users.noreply.github.com>

* Update protocol/agent-protocol.md

Co-authored-by: Efim Poberezkin <8711996+efim-poberezkin@users.noreply.github.com>

* Update protocol/simplex-messaging.md

Co-authored-by: Efim Poberezkin <8711996+efim-poberezkin@users.noreply.github.com>

Co-authored-by: Efim Poberezkin <8711996+efim-poberezkin@users.noreply.github.com>
2021-11-28 21:01:34 +00:00
Evgeny Poberezkin 99b3749890
simplify RSA private key types (#207)
* simplify RSA private key types

* remove updateSignKey method
2021-11-28 07:08:47 +00:00
Efim Poberezkin ab875198ed SMP protocol typo 2021-11-27 02:31:15 +10:00
Evgeny Poberezkin f3d79ebcda update SMP protocol to include server signature and encryption keys 2021-11-25 17:24:00 +00:00
Evgeny Poberezkin 01e8c232f0
change syntax for queue URI and connection request (#205)
* change syntax for queue URI and connection request

* separate queue URI into separate section

* correction
2021-11-22 19:08:19 +00:00
Evgeny Poberezkin eb7fcae31b
update transport protocol to use TLS (#204)
* update transport protocol to use TLS

* typos

* s/serverKeyHash/serverIdentity/

Co-authored-by: Efim Poberezkin <8711996+efim-poberezkin@users.noreply.github.com>

* Update protocol/simplex-messaging.md

Co-authored-by: Efim Poberezkin <8711996+efim-poberezkin@users.noreply.github.com>

* corrections

Co-authored-by: Efim Poberezkin <8711996+efim-poberezkin@users.noreply.github.com>
2021-11-22 08:52:39 +00:00
Evgeny Poberezkin 227d83d0e7
SMP commands for notifications (NKEY/NID and NSUB/NMSG) with separate queue ID and key (#199)
* SMP commands for notifications (LSTN, NTFY) with separate queue IDs and keys

* rename Notifier types

* remove notify key and id from NEW and IDS commands (TODO add other commands)

* fix StoreLog serialization

* add commands for managing notifications

* add notification subscribers to server state, add notifier ID and key to store log

* add notifier ID and key to the queue

* refactor END notification to work for both types of subscriptions, deliver message notification (NMSG)

* process NSUB command - subscribe to message notifications

* test for message notifications

* fix SMP client function for NSUB command

* fix parse/serialize NID command

* refactor use ifM

* check duplicate notifier ID only against other notifier IDs

* refactor getQueue

* test notifier ID and key with store log

* Update src/Simplex/Messaging/Client.hs

Co-authored-by: Efim Poberezkin <8711996+efim-poberezkin@users.noreply.github.com>

* Update src/Simplex/Messaging/Server.hs

Co-authored-by: Efim Poberezkin <8711996+efim-poberezkin@users.noreply.github.com>

* store log: s/NOTIFY/NOTIFIER/

Co-authored-by: Efim Poberezkin <8711996+efim-poberezkin@users.noreply.github.com>
2021-11-14 18:52:29 +00:00
Evgeny Poberezkin d973c834a5
update protocols (#190)
Co-authored-by: Efim Poberezkin <8711996+efim-poberezkin@users.noreply.github.com>
2021-09-08 00:25:04 +10:00
Nikita Poberezkin 63532c8b45
simplex-messaging.md reformulation of key pairs handling part (#141) 2021-05-15 16:04:51 +01:00
Evgeny Poberezkin 4b9ebbbab2
move SMP server from agent commands NEW/JOIN to agent config (#129)
* move SMP server from agent commands NEW/JOIN to agent config

* fix SMPServer parser

* update agent protocol - server management

* enable agent test

* agent test with 2 servers

* create reply queue on the configured server

* choose random server

* swap bind
2021-05-06 18:53:34 +01:00
Efim Poberezkin f09c77cd31
docs: correct agent protocol abnf (#128) 2021-05-04 21:48:54 +04:00
Evgeny Poberezkin 377b166d8e
SimplexMQ readme, remove chat client (#125)
* SimplexMQ readme, remove chat client

* link to license

* add roadmap, corrections

* corrections

* strange dot -> colon

* corrections

Co-authored-by: Efim Poberezkin <8711996+efim-poberezkin@users.noreply.github.com>
2021-05-04 07:11:48 +01:00
Evgeny Poberezkin 76e81e1cf0 fix duplex connection diagram link 2021-05-03 10:13:55 +01:00
Evgeny Poberezkin 4ec548f8b8 fix diagram links 2021-05-03 10:12:33 +01:00
Evgeny Poberezkin 8aabb6f0e6 move files to protocol folder 2021-05-03 10:06:16 +01:00