status-go/services/shhext
Andrea Maria Piana cef7f367ab Add topic negotiation
This commit add topic negotiation to the protocol.

On receiving a message from a client with version >= 1, we will generate
a shared key using Diffie-Hellman. We will record also which
installationID has sent us a message.

This key will be passed back to the above layer, which will then use to
start listening to a whisper topic (the `chat` namespace has no
knowledge of whisper).

When sending a message to a set of InstallationIDs, we check whether we
have agreed on a topic with all of them, and if so, we will send on this
separate topic, otherwise we fallback on discovery.

This change is backward compatible, as long as there is no downgrade of
the app on the other side.

A few changes:

* Factored out the DB in a separate namespace as now it is
being used by multiple services (TopicService and EncryptionService).

* Factored out multidevice management in a separate namespace

* Moved all the test to test the whole protoocl rather than just the encryption service

* Moved all the filter management in status-go
2019-06-19 17:38:45 +02:00
..
chat Add topic negotiation 2019-06-19 17:38:45 +02:00
dedup Add confirm messages processed by ID (#1375) 2019-02-19 13:58:42 +01:00
filter Add topic negotiation 2019-06-19 17:38:45 +02:00
mailservers update linter 2019-06-12 13:12:00 +02:00
README.md Implement mailserver canary service. Closes #1086 2018-08-07 17:17:59 +02:00
api.go Add topic negotiation 2019-06-19 17:38:45 +02:00
api_test.go Fix channel subscriber that was blocking sending new requests (#1465) 2019-05-20 11:10:26 +03:00
context.go Execute writes atomically only after request was processed without errors (#1454) 2019-05-06 09:33:19 +03:00
envelopes.go Notify users that envelope was discarded and retry sending it (#1446) 2019-04-30 09:46:12 +03:00
envelopes_test.go Re-send user payload if previously sent envelope wasn't acknowledged (#1386) 2019-03-01 14:36:21 +01:00
history.go Execute writes atomically only after request was processed without errors (#1454) 2019-05-06 09:33:19 +03:00
history_test.go Execute writes atomically only after request was processed without errors (#1454) 2019-05-06 09:33:19 +03:00
mailrequests.go Split shhext.tracker into envelopes and mail monitors 2019-02-22 09:33:46 +02:00
mailrequests_test.go Split shhext.tracker into envelopes and mail monitors 2019-02-22 09:33:46 +02:00
requests.go Notify users that envelope was discarded and retry sending it (#1446) 2019-04-30 09:46:12 +03:00
requests_test.go Prevent frequent requests with same topics 2019-01-18 14:52:33 +02:00
service.go Add topic negotiation 2019-06-19 17:38:45 +02:00
service_test.go Execute writes atomically only after request was processed without errors (#1454) 2019-05-06 09:33:19 +03:00
signal.go Add topic negotiation 2019-06-19 17:38:45 +02:00

README.md

Whisper API Extension

API

shhext_getNewFilterMessages

Accepts the same input as shh_getFilterMessages.

Returns

Returns a list of whisper messages matching the specified filter. Filters out the messages already confirmed received by shhext_confirmMessagesProcessed

Deduplication is made using the whisper envelope content and topic only, so the same content received in different whisper envelopes will be deduplicated.

shhext_confirmMessagesProcessed

Confirms whisper messages received and processed on the client side. These messages won't appear anymore when shhext_getNewFilterMessages is called.

Parameters

Gets a list of whisper envelopes.

shhext_post

Accepts same input as shh_post.

Returns

DATA, 32 Bytes - the envelope hash

shhext_requestMessages

Sends a request for historic messages to a mail server.

Parameters
  1. Object - The message request object:
  • mailServerPeer:URL - Mail servers' enode addess
  • from:QUANTITY - (optional) Lower bound of time range as unix timestamp, default is 24 hours back from now
  • to:QUANTITY- (optional) Upper bound of time range as unix timestamp, default is now
  • topic:DATA, 4 Bytes - Regular whisper topic
  • symKeyID:DATA- ID of a symmetric key to authenticate to mail server, derived from mail server password
Returns

Boolean - returns true if the request was send, otherwise false.

Signals

Sends sent signal once per envelope.

{
  "type": "envelope.sent",
  "event": {
    "hash": "0xea0b93079ed32588628f1cabbbb5ed9e4d50b7571064c2962c3853972db67790"
  }
}

Sends expired signal if envelope dropped from whisper local queue before it was sent to any peer on the network.

{
  "type": "envelope.expired",
  "event": {
    "hash": "0x754f4c12dccb14886f791abfeb77ffb86330d03d5a4ba6f37a8c21281988b69e"
  }
}