Evgeny Poberezkin
b741b65700
use online status in network information ( #1094 )
...
* use online status in network information
* test
* refactor
* flip condition
* fix
2024-04-12 22:22:24 +01:00
spaced4ndy
3b1dd6dff9
agent: notify about available quota ( #1087 )
...
* agent: notify about available quota
* rename
---------
Co-authored-by: Evgeny Poberezkin <evgeny@poberezkin.com >
2024-04-11 09:38:12 +01:00
Evgeny Poberezkin
2e44ec5083
fix message expiration test ( #1092 )
2024-04-11 08:52:15 +01:00
Evgeny Poberezkin
8fa9ed6317
wait for user network availability ( #1085 )
...
* ghc-options
* wait for user network availability
* test
* update
* comment
* refactor
* slow config
* line
* waitForUserNetwork in xftp and ntf workers
* refactor
* refactor with registerDelay
---------
Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com >
2024-04-10 21:50:05 +01:00
Evgeny Poberezkin
1219446996
dispose agent instances, fix tests, ( #1089 )
...
* dispose agent instances in tests
* fix quota test
* tests: fix tests with -threaded (#1088 )
* fix some tests
* match RTS opts with apps
* less verbose rts stats
* enable sqlite extended error codes
* clean up
* unfocus
* remove extendedErrorCode
It's actually setExtendedResultCodes, which isn't yet available.
* diff
---------
Co-authored-by: Evgeny Poberezkin <evgeny@poberezkin.com >
* fix switch test
* fix
---------
Co-authored-by: Alexander Bondarenko <486682+dpwiz@users.noreply.github.com >
2024-04-10 19:34:02 +01:00
Evgeny Poberezkin
6ded721daa
remove monad typeclasses to reduce overhead ( #1077 )
...
* remove monad typeclasses to reduce overhead
* remove unliftIO
* StrictData
* inline
* optional agent port
* avoid MonadUnliftIO instance (#1078 )
* avoid MonadUnliftIO instance
* simpler liftError'
* rename
* narrow down instance
* revert
---------
Co-authored-by: Evgeny Poberezkin <evgeny@poberezkin.com >
* logServer
---------
Co-authored-by: Alexander Bondarenko <486682+dpwiz@users.noreply.github.com >
2024-03-31 20:50:35 +01:00
Evgeny Poberezkin
b32259d048
notify about critical error on agent crash ( #1062 )
...
* notify about critical error on agent crash
* waitUntilActive
* disposeAgent
* fix
2024-03-21 14:54:57 +00:00
Evgeny Poberezkin
851ed2d02e
pqdr: more tests, pass e2e version to rcEncrypt from config ( #1040 )
...
* pqdr: more tests, pass e2e version to rcEncrypt from config
* fix
2024-03-10 13:29:03 +00:00
Alexander Bondarenko
8cdd49b912
core: restore Eq instances ( #1038 )
...
* core: restore Eq instances
* remove duplicates from tests
2024-03-08 13:43:33 +00:00
Evgeny Poberezkin
8ff4c628b5
pqdr: make envelope sizes dependent on version, test enabling PQ ( #1035 )
2024-03-08 08:28:15 +00:00
Evgeny Poberezkin
07fa75ec49
pqdr: agent api to confirm PQ encryption support during connection handshake, fix incorrect PQ support ( #1032 )
...
* pqdr: agent api to confirm PQ encryption support during connection handshake
* fix CONF, tests
* fix REQ, tests
* remove unused
2024-03-07 08:35:40 +00:00
Evgeny Poberezkin
4ffb6a348a
pqdr: use different newtypes for supporting and enabling PQ encryption in connections ( #1031 )
...
* pqdr: use different newtypes for supporting and enabling PQ encryption in connections
* rename field, fix test
* refactor
2024-03-06 21:28:03 +00:00
Evgeny Poberezkin
b050cf5027
double ratchet versioning for post-quantum encryption ( #1025 )
...
* correctly parse new Ratchet fields when omitted
* rfc: migrating connection versions to pqdr
* update rfc
* WIP (dont commit)
* rename versions
* update ratchet version based on PQ encryption feature flag
* remove duplicate function
* synchronize ratchet, fix tests, refactor
* comments
* test
* pattern
2024-03-05 17:07:15 +00:00
Evgeny Poberezkin
ba1bfaa5aa
Merge branch 'master' into pq
2024-03-04 20:13:01 +00:00
Evgeny Poberezkin
dd2bd11584
parameterize version scopes with phantom types ( #1026 )
...
* parameterize version scopes with phantom types
* move Version to another module
* parens
2024-03-04 19:06:51 +00:00
Evgeny Poberezkin
e06e22328f
agent: quantum-resistant double ratchet encryption ( #939 )
...
* doc
* diff
* ratchet header
* types
* ratchet step with PQ KEM, message header with KEM
* comment
* update types, remove Eq instances, store KEM keys to database
* pqx3dh
* PQ double ratchet test
* pqdr tests pass
* fix most tests
* refactor
* allow KEM proposals from both sides
* test names
* agent API parameters to use PQ KEM
* initialize ratchet state for enabling KEM
* fix/test KEM state machine to support disabling/enabling via messages
* more tests
* diff
* diff2
* refactor
* refactor
* refactor
* refactor
* remove Maybe
* rename
* add PQ encryption status to CON, MID and MSG events and sendMessage API results
* different PQ parameter when creating connection
* rename/reorganize types for PQ encryption modes
* rename
* fix testWaitDeliveryTimeout
* rename
* rename2
* ghc8107
* rename
* increase timeouts for concurrent send/receive test
* enable all tests
---------
Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com >
2024-03-03 19:40:49 +00:00
spaced4ndy
30fd4065d9
rename delete waiting delivery tests ( #1022 )
2024-03-03 12:56:54 +04:00
spaced4ndy
294d7ec8dd
agent: delay connection deletion to finish delivery of pending messages ( #1015 )
...
* agent: delay connection deletion to finish delivery of pending messages (wip)
* fixes, test
* notify, test
* add tests
* comment
* add test
* timeout
* test timeout
* up
* more tests
* rename
---------
Co-authored-by: Evgeny Poberezkin <evgeny@poberezkin.com >
2024-02-29 18:08:58 +00:00
Evgeny Poberezkin
abf956d425
fix tests for new protocol versions ( #998 )
...
* fix basic auth tests
* fix batching and syntax tests
* fix test matrix
2024-02-16 20:21:15 +00:00
Evgeny Poberezkin
c179073260
remove support for old versions ( #990 )
...
* remove support for old versions (WIP)
* fix
* updates
* use version var
2024-02-16 13:28:50 +00:00
Evgeny Poberezkin
416f1b1721
smp: command authorization ( #982 )
...
* smp: command authorization
* fix encoding, most tests
* remove old tests
* authorize via crypto_box
* extract authenticator to Crypto module
* make TransmissionAuth Maybe
* rfc
* support authenticators in NTF protocol, test matrix (no backwards compatibility yet from new clients to old servers)
* fix/add tests, add version config to "small" agent
* separate client and server versions for SMP protocol
* test batching SMP v7
* do not send session ID in each transmission
* refactor auth verification in the server, split tests
* server "warm up" fixes timing test
* uncomment SUB timing test
* comments, disable two timing tests
* rename version
* increase auth timing test failure threshold
* use different algorithms to authorize snd/rcv commands, use random correlation ID
* transport: fetch and store server certificate (#985 )
* THandleParams (WIP, does not compile)
* transport: fetch and store server certificate
* smp: add getOnlinePubKey example to smpClientHandshake
* add server certs and sign authPub
* cleanup
* update
* style
* load server certs from test fixtures
* sign ntf authPubKey
* fix onServerCertificate
* increase delay before sending messages
* require certificate with key in SMP server handshake
---------
Co-authored-by: Evgeny Poberezkin <evgeny@poberezkin.com >
* remove dhSecret from THandle
* remove v8, merge all changes to one version
* parameterize THandle
* rfc: transmission ecnryption
* Revert "parameterize THandle"
This reverts commit 75adfc94fb .
* use batch syntax for ntf server commands
* separate encodeTransmission when there is no key
* typo
Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com >
* rename
* diff
---------
Co-authored-by: Alexander Bondarenko <486682+dpwiz@users.noreply.github.com >
Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com >
2024-02-16 11:45:54 +00:00
Evgeny Poberezkin
baf2c47065
agent: expire messages failed after quota exceeded after 7 days, and expire multiple messages at once ( #973 )
...
* agent: expire messages failed after quota exceeded after 7 days, and expire multiple messages at once
* fix, test
* refactor
* catch in loop
2024-01-19 17:21:25 +00:00
Alexander Bondarenko
eb41abfb8f
tests: fix random order in async commands case ( #969 )
2024-01-17 11:48:41 +00:00
Evgeny Poberezkin
b547f34cc0
Revert "Revert "agent: do not create user record in new databases ( #957 )" ( #963 )" ( #964 )
...
* Revert "Revert "agent: do not create user record in new databases (#957 )" (#963 )"
This reverts commit aee9088417 .
* tests
* remove logging
2024-01-17 11:01:04 +00:00
Evgeny Poberezkin
00c4ff4a21
agent: fix race condition in subscription worker (results in stuck delivery), better error handling in batch operations ( #962 )
...
* debugging test: join connection when reply queue creation fails
* more logs
* more logs
* more logs, fixed bug
* cleanup
* catch all errors
* simplify
* comment
* remove client ID counter
2024-01-16 10:29:35 +00:00
Evgeny Poberezkin
aee9088417
Revert "agent: do not create user record in new databases ( #957 )" ( #963 )
...
This reverts commit 9b9a0bd0df .
2024-01-14 22:28:28 +00:00
Alexander Bondarenko
68f5e189a6
smp: check for progress when resubscribing ( #956 )
...
* smp: check for progress when resubscribing
* add allowClose to reconnectServer to distinguish entry points
* resolve error todo
* make reconnect async per-session
* remove allowClose
* deregister reconnecter when it finishes
* signal/react more work explicitly
* fix restart condition
* wait for reconnecter to finish
* remove redundant reconnect locks
* rename getClientVar for expanded scope
* formatting
* remove withPending
* move pending check to tryReconnectSMPClient loop
* combine pending check and slot release transactions
* actually reserve the slot for async
* simplify
* refactor
* refactor
* use removeClientVar
* rename
* refactor
* test
* reduce MonadError scope
---------
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com >
2024-01-12 19:29:18 +00:00
Evgeny Poberezkin
9b9a0bd0df
agent: do not create user record in new databases ( #957 )
...
* agent: do not create user record in new databases
* update
2024-01-12 16:57:57 +00:00
Evgeny Poberezkin
577e3cf14d
agent: add server msg IDs to agent logs, disable 2 tests ( #934 )
...
* agent: race when using agent via TCP
* remove logs
* enable tests
* comments
* use different databases for different clients
* enable all tests
2023-12-26 17:50:39 +00:00
Evgeny Poberezkin
7ddeca50e4
agent: mark work items failed ( #931 )
...
* agent: mark work items failed (WIP)
* add tests, created_at
* getWorkItem for snd and rcv files
* fix
* tests
* fix
* tests
* test
* tests
* rename
* fix,refactor
* add indexes
* update schema
* do not try to get more work when resuming an existing worker
---------
Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com >
2023-12-26 17:00:42 +04:00
Evgeny Poberezkin
2489333c87
agent: use DB to queue async commands and messages ( #929 )
...
* agent: use DB to queue async commands and messages
* fix message delivery, async commands dont work
* fix async commands
* remove comment
* rename
* comment
* balance agent operation
* empty lines
* balance another agent operation
* diff
* worker
* qAddress
* fix incorrect queue ID in v1
* types for queues
* fix test
* update index
2023-12-23 12:59:53 +00:00
Evgeny Poberezkin
1c2604f6a3
agent: background mode for agent NSE ( #924 )
2023-12-22 08:59:07 +00:00
Alexander Bondarenko
7c27357eb2
server: stop inactive clients without subscriptions, additional monitoring via control port ( #901 )
...
* fix thread labelling points
* add subscription thread labels
* add explicit sections for sockets/sessions/disconnects
* adjust label threads wrt. next blocking op
* WIP: emit event on server finish
So the event log wouldn't be cut short giving
false impression of unterminated sessions.
* add handshake timeout
* hack server socket stats
* trace closeTLS exceptions
* fix build
* clean up disconnectTransport
* make disconnectTransport terminating
Thus, participating in racyAny_ around it.
* trach snd/rcv time separately, log clients as CSV
* add direct client counting/stats
* add csv dump for socket threads
* guard socket threads dump from older GHC
* cut socket thread listing into socket-threads command
* store client creation time for stats
* wrap tls setup in timeout and labels
* server: expire clients without subscriptions
* fix check for subscriptions
* remove excess tracing
* move hardcoded timeouts to configs
* cleanup
* fix tests
* wrap direct queue waits in timeout
* rewrite old TCP wrappers with their SocketState variants
* add testInactiveWithSubs
---------
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com >
2023-12-19 15:50:45 +00:00
Evgeny Poberezkin
560dc55312
agent: notify about polled message processing (for iOS notifications) ( #908 )
...
* agent: notify about polled message processing (for iOS notifications)
* optionally keep key and support re-opening database
* exports
* test that cannot reopen when created with keepKey: false
* set max number of messages to receive for a notification to 3
2023-12-11 13:03:53 +00:00
Evgeny Poberezkin
248144f3de
do not use previous KEM shared secret in multicast packets and in host HELLO ( #888 )
...
* do not use previous KEM shared secret in multicast packets and in host HELLO
* simplify
2023-11-08 12:06:10 +00:00
Evgeny Poberezkin
cf8b9c12ff
remove test dependencies ( #861 )
...
* remove test dependencies
* .hlint.yaml
2023-10-22 10:50:36 +01:00
Evgeny Poberezkin
9d12d76078
add fourmolu ( #868 )
...
* add fourmolu
* linebreak
* simplify
* comment
2023-10-22 09:20:14 +01:00
spaced4ndy
80905c0822
test concurrent send and receipts ( #866 )
2023-10-19 20:08:58 +04:00
Evgeny Poberezkin
887ccbcf6c
Merge branch 'master' into master-ghc9
2023-09-10 18:00:33 +01:00
Evgeny Poberezkin
84ce037867
extend SMP protocol to allow creating new queues without subscriptions ( #839 )
...
* Trace auto-subs flag
* Replace Bools with SubscriptionMode
* Handle SMOnlyCreate
* Wire remaining todos
* Update tests and fix
* Bump protocol level
* Apply suggestions from code review
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com >
* Scrub needs_sub from agent DB
* Scrub a few more needSubs from the agent api
* change API, fix test
* agent: do not subscribe to queue when creating reply queue
* fix encoding
* WIP: SMOnlyCreate test
* Add SM guard for confirmQueue
Allows the test case to pump the allowConnection
reply without getting PROHIBITED.
* Remove tracing
* add noMessages, remove unnecessary getConnectionMessage from test
* add sending messages to the test
---------
Co-authored-by: IC Rainbow <aenor.realm@gmail.com >
Co-authored-by: Alexander Bondarenko <486682+dpwiz@users.noreply.github.com >
2023-09-10 17:07:19 +01:00
Moritz Angermann
002f36dde0
5.4.0.0: use ghc 9.6.2 ( #791 )
...
* Add 9.6 compat
* compile with GHC9.6.2: dependencies, imports, code
* refactor typeclasses
* refactor record dot
* update cabal version
* update github actions
* update direct-sqlcipher
* 5.4.0.0
* update cabal.project
---------
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com >
2023-08-24 20:22:02 +01:00
Evgeny Poberezkin
b001b748db
agent: rename functions, remove unused code, stabilize tests ( #830 )
...
* agent: rename functions, stabilize tests
* test pattern match
2023-08-24 19:52:58 +01:00
Evgeny Poberezkin
b329eb9a86
agent: fix async JOIN ( #827 )
...
* agent: fix async JOIN
* refactor
2023-08-20 18:45:16 +01:00
Evgeny Poberezkin
58cb2855d2
agent: delivery receipts ( #752 )
...
* rfc: delivery receipts
* update doc
* update rfc
* implementation plan, types, schema
* migration, update types
* update types
* rename migration
* export MsgReceiptStatus, JSON encoding
* update rfc, schema
* correction
Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com >
* skeleton of the implementation
* more implementation (some tests fail)
* more code, 1 test fails
* fix encoding
* refactor
* refactor
* test, fix
* only send receipts in v3+, test
* flip condition
Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com >
* flip condition
Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com >
* agent version 4 required to send receipts
* fix test
---------
Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com >
2023-07-13 22:33:48 +01:00
spaced4ndy
f2657f9c0b
add crypto error to RSYNC event ( #794 )
2023-07-05 18:14:51 +04:00
spaced4ndy
0e1562deae
increase connection agent version according to received messages; add version and flags to connection stats, bump currentSMPAgentVersion ( #789 )
2023-06-30 20:19:10 +04:00
spaced4ndy
8be2505fa0
ratchet re-synchronization ( #774 )
...
* ratchet re-synchronization rfc wip
* additions
* additions, types
* fix tests
* re-sync implementation wip
* re-sync implementation 1st rev.
* test wip
* test passes
* doc
* wording
* improve doc schema
* single agreed state
* refactor (1 state variable)
* allowed -> required
* prohibit enqueue
* enqueue
* send via multiple queues
* test with server offline
* clarify errors
* rename
* more tests
* refactor
* rename AgentRKey
* rename AM_CONN_RATCHET_KEY
* more tests
* rename
* write encoded AgentRatchetInfo to AgentRatchetKey info
* move withConnLock
* refactor qDuplex
* re-create ratchet on receiving second key
* invert condition
* refactor
* simplify
---------
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com >
2023-06-30 14:17:08 +04:00
spaced4ndy
a000419bd7
restore confirmation after client restart ( #783 )
2023-06-29 10:10:34 +04:00
spaced4ndy
c8a8e2c297
differentiate agent INACTIVE error, treat as temporary ( #784 )
2023-06-29 10:00:53 +04:00
Evgeny Poberezkin
4a927d1ae2
ntf server: better batching and logging ( #780 )
...
* ntf server: better batching and logging
* reduce batch delay for ntf server
* comments
* 5.1.3, ntf 1.4.2
* more logging
* more logging
* split large batches, more logging
* remove some logs
2023-06-26 20:14:35 +01:00