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
84b8c8417b
revert base64 change ( #1081 )
2024-04-03 09:27:36 +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
Alexander Bondarenko
ee90ea6a69
replace base64-bytestring with base64 ( #1065 )
...
* replace base64-bytestring with base64
* minify
* use bytestring-0.10 compatible fork
PR pending...
* bump base64 fork with text compat
* move compat details to modules
* switch repo
* add back module
* cleanup
* minify
* clean imports
* rename
---------
Co-authored-by: Evgeny Poberezkin <evgeny@poberezkin.com >
2024-03-27 23:35:09 +00: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
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
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
Evgeny Poberezkin
155831ae36
tests: test notification decryption
2024-02-18 09:30:21 +00:00
Evgeny Poberezkin
51be2fea20
agent: test NTF server ( #1000 )
2024-02-17 14:55:40 +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
Alexander Bondarenko
f7cdec2f08
fix: support multiple notification servers in configuration ( #971 )
...
* tests: add trpl-keeps-server check
* add smp server switch check
* add connection test and fix withNtfServer
* Update src/Simplex/Messaging/Agent/NtfSubSupervisor.hs
Co-authored-by: Evgeny Poberezkin <e.poberezkin@me.com >
* use ntfServer from token
* rename
---------
Co-authored-by: Evgeny Poberezkin <e.poberezkin@me.com >
Co-authored-by: Evgeny Poberezkin <evgeny@poberezkin.com >
2024-01-19 19:42:28 +00:00
Alexander Bondarenko
40fa34c2d5
tests: test multiple Ntf servers ( #966 )
...
* tests: add ntf case with multiple Ntf servers
* simplify test
* fix for master
* add server switch test
* add server switch test
* add message test for ntf server switch
2024-01-17 19:47:47 +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
ca527b4d6c
use Builder for batching commands ( #953 )
...
* use Builder for batching commands
* refactor
* refactor
* increase timeout in test
* do not materialize builder
* use concat
* debug test
* debug2
* delays
* more delay, less worker delay
* remove logs
* reduce delay
* tests
* sized builder
* builder
* comment
* remove unsafe
* style
* remove fromIntegral
2024-01-08 22:54:27 +00:00
Evgeny Poberezkin
cf8b9c12ff
remove test dependencies ( #861 )
...
* remove test dependencies
* .hlint.yaml
2023-10-22 10:50:36 +01: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
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
Evgeny Poberezkin
acea477aab
batch subscriptions for ntf server ( #778 )
...
* return updated ConnectionStats from switchConnectionAsync (#777 )
* batch ntf server subscriptions to SMP servers
* refactor
* fix filtering queues in reconnect
* test, remove repeated grouping
* enable all tests
* reduce subscriptions count
---------
Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com >
2023-06-25 08:27:50 +01:00
Evgeny Poberezkin
b1489138ea
xftp: fix file reception on 32 bit platforms ( #708 )
2023-04-06 20:40:52 +01:00
Evgeny Poberezkin
44f0dd39f3
ci: disable 2 tests on linux only, switch to ubuntu 20 and 22 ( #705 )
...
* ci: disable 2 tests on linux only, switch to ubuntu 20 and 22
* fix platform name
* keep ubuntu 22 binaries
* Revert "keep ubuntu 22 binaries"
This reverts commit a1bbb12870 .
* skip 1 more test
* skip 1 more test
* log os
* log os
* unconditionally skip test
* skip 1 more test in CI
* fix tests
2023-04-04 12:19:38 +01:00
Evgeny Poberezkin
6a665a0833
support down migrations ( #696 )
...
* support down migrations
* test
* update
* add down migrations and tests
* get current migrations
* corrections
Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com >
* update tests
---------
Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com >
2023-03-27 12:44:53 +01:00
Evgeny Poberezkin
ddc2da8fe4
xftp: agent API for xftp commands and events ( #684 )
...
* xftp: agent API for xftp commands and events
* fix tests
* fix tests 2
* xftp: update agent send api
* update API to make temp path optional
* revert tmp path changes (fixes send)
---------
Co-authored-by: spacedandy <8711996+spaced4ndy@users.noreply.github.com >
2023-03-13 09:04:23 +00:00
Stanislav Dmitrenko
bccef0ba47
files: server and client spike - basic upload/download ( #591 )
...
* Files: main, env, stats, storeLog
* Better + transport
* Executable
* Env
* Update Client.hs, Server.hs, and 4 more files...
* Answer on request
* Delay
* Temp file
* Bypass cert check
* update package.yml, rename
* update store log
* extend HTTP2 transport
* refactor caStore
* HTTP2 body
* update server stats
* file server/client framework
* verify server commands
* process FNEW command, CLI test works
* simple XFTP server test (fails)
* fix test, refactor
* upload chunk works
* receive file chunk in the client
* remove transport handshake
* typo
Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com >
* fix names
---------
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com >
Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com >
2023-02-13 13:36:02 +00:00
Evgeny Poberezkin
abee1fa70b
Merge branch 'master' into users
2023-01-14 18:43:09 +00:00
Evgeny Poberezkin
701d06ba01
refactor tests to improve errors ( #606 )
...
* refactor tests to improve errors
* fix test descriptions
* fix test
2023-01-14 18:28:37 +00:00
Evgeny Poberezkin
f4ad3a983e
support users in agent to isolate traffic of different users ( #598 )
...
* users table, isolate traffic sessions by users or by queues
* remove extra indices
* corrections
Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com >
Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com >
2023-01-11 17:47:20 +04:00
Evgeny Poberezkin
6fc3b26970
server: time/detect blocked message delivery actions ( #546 )
...
* server: log slow operations
* v3.3.1
* base-64 encode IDs
* fixing test
* log
* log
* revert
* log
* fix
* reduce timeout
Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com >
2022-11-02 20:13:09 +00:00
JRoberts
d9a0e78b04
add optional client data field to ConnectionRequestUri ( #551 )
...
* add optional auxiliary data field to ConnectionRequestUri
* remove import
* fix, test
* fix StrEncoding Char
* data only in sync command, type
* fixing
* queryParamStr
* safeDecodeUtf8
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com >
2022-11-01 13:42:44 +04:00
Evgeny Poberezkin
8d9816809f
simplify queue rotation protocol ( #550 )
...
* simplify queue rotation protocol
* use simplified rotation protocol, update tests
* simplify schema
* delete all connection queues
* refactor
* switch notifications to the new queue, tests
* remove TODO
* refactor
* rfc correction
Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com >
* remove duplicate set active
Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com >
2022-10-31 13:33:28 +04:00
Evgeny Poberezkin
413aad5139
allow passing agent store instead of path and key ( #535 )
2022-09-23 18:45:00 +01:00
JRoberts
b215bd954d
remove token if token replace fails with permanent error ( #511 )
2022-08-31 21:12:44 +04:00
Evgeny Poberezkin
212a9bc4ab
enable/disable connection notifications ( #501 )
...
* enable/disable connection notifications
* filter connections when intializing/disabling subscriptions
* fix
* fix 2
* add delay
* increase test delay
* increase test delay
* fix
* increase test delays
* increase test delays
2022-08-19 15:23:57 +01:00
Evgeny Poberezkin
d810db4eed
send servers in agent events ( #478 )
...
* send servers in agent events
* remove some changes
* command/function to get connection servers
* getConnectionServers return type
2022-07-20 13:56:43 +01:00
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
7a238812b7
ntf server: fix resubscribing to SMP server after it was restarted, test ( #465 )
2022-07-08 14:46:01 +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
5ff80f0688
ntf: test more scenarios of notifications mode change; test token change ( #454 )
2022-07-01 21:46:11 +04:00
Evgeny Poberezkin
85d507d5d3
ntf-server store log ( #435 )
...
* ntf-server store log
* ntf serevr: restore log when server is started, save compacted store log
* log ntf server store changes
* test, store log works
* update ntf-server exe
2022-06-28 17:10:50 +01:00
Evgeny Poberezkin
ba40d75886
verifyNtfToken: change args order ( #434 )
2022-06-27 19:33:36 +01:00
Evgeny Poberezkin
0c7c0d066d
support dev/prod APNS hosts ( #433 )
...
* support dev/prod APNS hosts
* fix test
2022-06-27 19:20:23 +01:00
JRoberts
3d6ad64d62
ntf: registerNtfToken rework, notification modes ( #431 )
...
* check mode for new subscriptions
* check token inside actions
* migration - apple -> apns
* wip
* register logic, modes
* update mode, cron config, verify token changes
* refactor
* fix test
* NTFMODE
* server: delete subscriptions on deleteToken
* refactor markNtfSubscriptionForDeletion
* remove NTFMODE
* remove subscriptions when token is deleted
* refactor
* lint
* test
* check ntfMode
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com >
2022-06-27 21:54:35 +04:00
JRoberts
2809963a2e
ntf: register token with NotificationsMode ( #429 )
2022-06-25 17:34:08 +04:00
JRoberts
a92827c986
ntf: notification server SDEL command; subscription deletion in agent ( #421 )
2022-06-23 17:05:43 +04:00
JRoberts
cd9cb19765
ntf: remove debug output from test
2022-06-21 14:09:05 +04:00
Evgeny Poberezkin
0ab44b1836
get multiple messages when notification is processed ( #411 )
...
* get multiple messages when notification is processed
* change notification property
2022-06-19 13:23:35 +01:00
JRoberts
ec70429106
ntf: getNotificationMessage' ( #406 )
...
* ntf: getNotificationMessage'
* refactor
* ntfTs
* fix parser
* length
* fix test
* fix encryption, test
* remove test focus
* getActiveNtfToken
* rename
* Update src/Simplex/Messaging/Protocol.hs
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com >
* getNtfRcvQueue
* refactor
* don't fail
* Update src/Simplex/Messaging/Notifications/Protocol.hs
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com >
* Update src/Simplex/Messaging/Notifications/Server.hs
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com >
* Update src/Simplex/Messaging/Server.hs
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com >
* import
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com >
2022-06-18 18:21:35 +04:00
JRoberts
8c2227ccce
ntf: fix test ( #405 )
2022-06-16 19:22:21 +04:00