Skip to content

Commit 664dd1c

Browse files
Samyouldecanus
andauthored
Update/waku replace (#114)
Introduces Waku in to the relevant places in the specs. * First draft changes to 1-client.md * initial waku replace work on 2-account.md * Rename 3-whisper-usage to waku There may be broken links after this change * Initial update for 3-waku-usage.md * Adjustment to use WHISPER concurrently with WAKU * Converting 'moving away from whisper' section to `why use waku` * Added clarification about Open Whisper Systems X3DH usage * Updated transport privacy, include both whisper and waku * Updated 1-client, language supports concurrent whisper and waku * Updated 2-account.md to be whisper/waku concurrent * Reverted 3-whisper-usage changes, added 9-waku-usage * Complete revert of 3-whisper-usage * revert 3-whisper-usage.md * Fix to 3-whisper-usage.md links * Update docs/stable/1-client.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Removal of personal pronouns from 1-client.md * Update to 5-secure-transport.md * Implemented combined 'whispe/ waku relayer' role * Addressed ambiguous and stale links in 6-payloads * Updated 6-payloads * Fix broken / stale links in 7-group-chat.md * Fixed stale link 8-eips * link fix and todo resolved for 1-client.md * Added 10-waku-mailserver document * Added gitignore * Minor tweaks and fixes * Added Whisper / Waku briding section to 3-whisper-usage * Updated 10-waku-mailserver * Updated 9-waku-usage.md * Made changes to keep Mailserver term consistent * Removed some redundant comments * Removed seemingly vistigual '???' * Including large payload PoW See https://github.com/status-im/status-go/blob/7b6af0a7ccb8e39eeb2ab71ccca9841d75d57416/protocol/message_processor.go#L25-L35 * Changed 'mail server' to 'Mailserver' * Added details about status-options * Implemented final changes before review * Tpyo fix * Removed incorrect reference to topic-interest * removed .gitignore, defer to global_gitignore * Addressing feedback * Revert draft/7 link fix Readdressed in GH-120 * Reverted link fixes for stable/5 Addressing in GH-120 * Revert tpyo fix Addressed in GH-119 * Reverted stable/6 link fixes Addressed in GH-120 * Missed a minor link change * Revert link fix in stable/1 Addressed in GH-120 * Revert tpyo fix in stable/1 Addressed in GH-119 * Revert stable/1 link fix Addressed in GH-120 * Revert stable/2 link fix Addressed in GH-120 * Revert link fix to stable/2 * Revert stable/3 link fixes Addressed in GH-120 * Revert adding missing topic link Addressed in GH-120 * Revert stable/4 link fix Addressed in GH-120 * Revert stable/5 link fix Addressed in GH-120 * Revert stable/8 link fix Addressed in GH-120 * Partial revert of stable/1 node roles * Resolved whispermail reference query See GH-125 * Added changelog and version bump ... Added my name where appropriate and addressed some minor issues * Added consistent capitalisation to 'Whisper' * Resolved jRPC call issue for waku * Updated spelling * Addressing minor feedback issues * Update docs/stable/10-waku-mailserver.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> * Update docs/stable/10-waku-mailserver.md Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com> Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com>
1 parent c22a9e8 commit 664dd1c

File tree

9 files changed

+716
-128
lines changed

9 files changed

+716
-128
lines changed

docs/stable/1-client.md

Lines changed: 77 additions & 53 deletions
Large diffs are not rendered by default.

docs/stable/10-waku-mailserver.md

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
---
2+
permalink: /spec/10
3+
parent: Stable specs
4+
title: 10/WAKU-MAILSERVER
5+
---
6+
7+
# 10/WAKU-MAILSERVER
8+
9+
> Version: 0.1
10+
>
11+
> Status: Stable
12+
>
13+
> Authors: Adam Babik <adam@status.im>, Oskar Thorén <oskar@status.im>, Samuel Hawksby-Robinson <samuel@status.im> (alphabetical order)
14+
15+
- [Status Waku Mailserver Specification](#10waku-mailserver)
16+
- [Abstract](#abstract)
17+
- [`Mailserver`](#mailserver)
18+
- [Archiving messages](#archiving-messages)
19+
- [Requesting messages](#requesting-messages)
20+
- [Receiving historic messages](#receiving-historic-messages)
21+
- [Security considerations](#security-considerations)
22+
- [Confidentiality](#confidentiality)
23+
- [Altruistic and centralized operator risk](#altruistic-and-centralized-operator-risk)
24+
- [Privacy concerns](#privacy-concerns)
25+
- [Denial-of-service](#denial-of-service)
26+
- [Changelog](#changelog)
27+
- [Version 0.1](#version-01)
28+
29+
## Abstract
30+
31+
Being mostly offline is an intrinsic property of mobile clients. They need to save network transfer and battery consumption to avoid spending too much money or constant charging. Waku protocol, on the other hand, is an online protocol. Messages are available in the Waku network only for short period of time calculate in seconds.
32+
33+
Waku Mailserver is a specification that allows messages to be stored permanently and to allows the stored messages to be delivered to requesting client nodes, regardless if the messages are not available in the network due to the message TTL expiring.
34+
35+
## `Mailserver`
36+
37+
From the network perspective, a `Mailserver` is just like any other Waku node. The only difference is that a `Mailserver` has the capability of archiving messages and delivering them to its peers on-demand.
38+
39+
It is important to notice that a `Mailserver` will only handle requests from its direct peers and exchanged packets between a `Mailserver` and a peer are p2p messages.
40+
41+
### Archiving messages
42+
43+
A node which wants to provide `Mailserver` functionality MUST store envelopes from
44+
incoming message packets (Waku packet-code `0x01`). The envelopes can be stored in any
45+
format, however they MUST be serialized and deserialized to the Waku envelope format.
46+
47+
A `Mailserver` SHOULD store envelopes for all topics to be generally useful for any peer, however for specific use cases it MAY store envelopes for a subset of topics.
48+
49+
### Requesting messages
50+
51+
In order to request historic messages, a node MUST send a packet P2P Request (`0x7e`) to a peer providing `Mailserver` functionality. This packet requires one argument which MUST be a Waku envelope.
52+
53+
In the Waku envelope's payload section, there MUST be RLP-encoded information about the details of the request:
54+
55+
```
56+
[ Lower, Upper, Bloom, Limit, Cursor ]
57+
```
58+
59+
`Lower`: 4-byte wide unsigned integer (UNIX time in seconds; oldest requested envelope's creation time)
60+
`Upper`: 4-byte wide unsigned integer (UNIX time in seconds; newest requested envelope's creation time)
61+
`Bloom`: 64-byte wide array of Waku topics encoded in a bloom filter to filter envelopes
62+
`Limit`: 4-byte wide unsigned integer limiting the number of returned envelopes
63+
`Cursor`: an array of a cursor returned from the previous request (optional)
64+
65+
The `Cursor` field SHOULD be filled in if a number of envelopes between `Lower` and `Upper` is greater than `Limit` so that the requester can send another request using the obtained `Cursor` value. What exactly is in the `Cursor` is up to the implementation. The requester SHOULD NOT use a `Cursor` obtained from one `Mailserver` in a request to another `Mailserver` because the format or the result MAY be different.
66+
67+
The envelope MUST be encrypted with a symmetric key agreed between the requester and the `Mailserver`.
68+
69+
### Receiving historic messages
70+
71+
Historic messages MUST be sent to a peer as a packet with a P2P Message code (`0x7f`) followed by an array of Waku envelopes.
72+
73+
In order to receive historic messages from a `Mailserver`, a node MUST trust the selected `Mailserver`, that is allow to receive packets with the P2P Message code. By default, such packets are discarded.
74+
75+
Received envelopes MUST be passed through the Waku envelope pipelines so that they are picked up by registered filters and passed to subscribers.
76+
77+
For a requester, to know that all messages have been sent by a `Mailserver`, it SHOULD handle P2P Request Complete code (`0x7d`). This code is followed by the following parameters:
78+
79+
```
80+
[ RequestID, LastEnvelopeHash, Cursor ]
81+
```
82+
83+
- `RequestID`: 32-byte wide array with a Keccak-256 hash of the envelope containing the original request
84+
- `LastEnvelopeHash`: 32-byte wide array with a Keccak-256 hash of the last sent envelope for the request
85+
- `Cursor`: an array of a cursor returned from the previous request (optional)
86+
87+
If `Cursor` is not empty, it means that not all messages were sent due to the set `Limit` in the request. One or more consecutive requests MAY be sent with `Cursor` field filled in order to receive the rest of the messages.
88+
89+
## Security considerations
90+
91+
### Confidentiality
92+
93+
All Waku envelopes are encrypted. A `Mailserver` node can not inspect their contents.
94+
95+
### Altruistic and centralized operator risk
96+
97+
In order to be useful, a `Mailserver` SHOULD be online most of time. That means
98+
users either have to be a bit tech-savvy to run their own node, or rely on someone
99+
else to run it for them.
100+
101+
Currently one of Status's legal entities provides `Mailservers` in an altruistic manner, but this is
102+
suboptimal from a decentralization, continuance and risk point of view. Coming
103+
up with a better system for this is ongoing research.
104+
105+
A Status client SHOULD allow the `Mailserver` selection to be customizable.
106+
107+
### Privacy concerns
108+
109+
In order to use a `Mailserver`, a given node needs to connect to it directly,
110+
i.e. add the `Mailserver` as its peer and mark it as trusted. This means that the
111+
`Mailserver` is able to send direct p2p messages to the node instead of
112+
broadcasting them. Effectively, it will have access to the bloom filter of
113+
topics that the user is interested in, when it is online as well as many
114+
metadata like IP address.
115+
116+
### Denial-of-service
117+
118+
Since a `Mailserver` is delivering expired envelopes and has a direct TCP connection with the recipient, the recipient is vulnerable to DoS attacks from a malicious `Mailserver` node.
119+
120+
## Changelog
121+
122+
### Version 0.1
123+
124+
Released `TODO`
125+
126+
- Created document
127+
- Forked from [4-whisper-mailserver](4-whisper-mailserver.md)
128+
- Change to keep `Mailserver` term consistent
129+
- Replaced Whisper references with Waku

docs/stable/2-account.md

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ title: 2/ACCOUNT
66

77
# 2/ACCOUNT
88

9-
> Version: 0.2
9+
> Version: 0.3
1010
>
1111
> Status: Stable
1212
>
13-
> Authors: Corey Petty <corey@status.im>, Oskar Thorén <oskar@status.im> (alphabetical order)
13+
> Authors: Corey Petty <corey@status.im>, Oskar Thorén <oskar@status.im>, Samuel Hawksby-Robinson <samuel@status.im> (alphabetical order)
1414
1515
## Abstract
1616

@@ -38,16 +38,18 @@ In this specification we explain what Status account is, and how trust is establ
3838
- [Bundles](#bundles)
3939
- [Contact Verification](#contact-verification)
4040
- [Identicon](#identicon)
41-
- [3 word pseudonym / whisper key fingerprint](#3-word-pseudonym--whisper-key-fingerprint)
41+
- [3 word pseudonym / Whisper/Waku key fingerprint](#3-word-pseudonym--whisperwaku-key-fingerprint)
4242
- [ENS name](#ens-name)
4343
- [Security Considerations](#security-considerations)
44+
- [Changelog](#changelog)
45+
- [Version 0.3](#version-03)
4446

4547
<!-- markdown-toc end -->
4648

4749
## Introduction
4850

4951
The core concept of an account in Status is a set of cryptographic keypairs. Namely, the combination of the following:
50-
1. a whisper chat identity keypair
52+
1. a Whisper/Waku chat identity keypair
5153
1. a set of cryptocurrency wallet keypairs
5254

5355
Everything else associated with the contact is either verified or derived from the above items, including:
@@ -60,18 +62,18 @@ Everything else associated with the contact is either verified or derived from t
6062
### Public/Private Keypairs
6163
- An ECDSA (secp256k1 curve) public/private keypair MUST be generated via a [BIP43](https://github.com/bitcoin/bips/blob/master/bip-0043.mediawiki) derived path from a [BIP39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki) mnemonic seed phrase.
6264
- The default paths are defined as such:
63-
- Whisper Chat Key (`IK`): `m/43'/60'/1581'/0'/0` (post Multiaccount integration)
65+
- Whisper/Waku Chat Key (`IK`): `m/43'/60'/1581'/0'/0` (post Multiaccount integration)
6466
- following [EIP1581](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1581.md)
6567
<!-- WE CURRENTLY DO NOT IMPLEMENT ENCRYPTION KEY, FOR FUTURE - C.P. -->
6668
<!-- - DB encryption Key (`DBK`): `m/43'/60'/1581'/1'/0` (post Multiaccount integration)
6769
- following [EIP1581](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1581.md) -->
6870
- Status Wallet paths: `m/44'/60'/0'/0/i` starting at `i=0`
6971
- following [BIP44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki)
70-
- NOTE: this (`i=0`) is also the current (and only) path for Whisper key before Multiaccount integration
72+
- NOTE: this (`i=0`) is also the current (and only) path for Whisper/Waku key before Multiaccount integration
7173

7274
### X3DH Prekey bundle creation
73-
- Status follows the X3DH prekey bundle scheme that Open Whisper Systems outlines [in their documentation](https://signal.org/docs/specifications/x3dh/#the-x3dh-protocol) with the following exceptions:
74-
- Because there are no central servers, we do not publish one-time keys `OPK` or perform DH including them.
75+
- Status follows the X3DH prekey bundle scheme that [Open Whisper Systems](https://en.wikipedia.org/wiki/Signal_Messenger#2013%E2%80%932018:_Open_Whisper_Systems) (not to be confused with the Whisper sub-protocol) outlines [in their documentation](https://signal.org/docs/specifications/x3dh/#the-x3dh-protocol) with the following exceptions:
76+
- Status does not publish one-time keys `OPK` or perform DH including them, because there are no central servers in the Status implementation.
7577
- A client MUST create X3DH prekey bundles, each defined by the following items:
7678
- Identity Key: `IK`
7779
- Signed prekey: `SPK`
@@ -84,14 +86,14 @@ Everything else associated with the contact is either verified or derived from t
8486

8587
### X3DH Prekey bundles
8688
- A client SHOULD regenerate a new X3DH prekey bundle every 24 hours. This MAY be done in a lazy way, such that a client that does not come online past this time period does not regenerate or broadcast bundles.
87-
- The current bundle SHOULD be broadcast on a whisper topic specific to his Identity Key, `{IK}-contact-code`, intermittently. This MAY be done every 6 hours.
89+
- The current bundle SHOULD be broadcast on a Whisper/Waku topic specific to his Identity Key, `{IK}-contact-code`, intermittently. This MAY be done every 6 hours.
8890
- A bundle SHOULD accompany every message sent.
8991
- TODO: retrieval of long-time offline users bundle via `{IK}-contact-code`
9092

9193
## Optional Account additions
9294

9395
### ENS Username
94-
- A user MAY register a public username on the Ethereum Name System (ENS). This username is a user-chosen subdomain of the `stateofus.eth` ENS registration that maps to their whisper identity key (`IK`).
96+
- A user MAY register a public username on the Ethereum Name System (ENS). This username is a user-chosen subdomain of the `stateofus.eth` ENS registration that maps to their Whisper/Waku identity key (`IK`).
9597

9698
<!-- ### User Profile Picture
9799
- An account MAY edit the `IK` generated identicon with a chosen picture. This picture will become part of the publicly broadcast profile of the account. -->
@@ -105,11 +107,11 @@ Everything else associated with the contact is either verified or derived from t
105107

106108
### Terms Glossary
107109

108-
| term | description |
109-
| ---- | ----------- |
110-
| privkey | ECDSA secp256k1 private key |
111-
| pubkey | ECDSA secp256k1 public key |
112-
| whisper key | pubkey for chat with HD derivation path m/43'/60'/1581'/0'/0 |
110+
| term | description |
111+
| ---------------- | ----------- |
112+
| privkey | ECDSA secp256k1 private key |
113+
| pubkey | ECDSA secp256k1 public key |
114+
| Whisper/Waku key | pubkey for chat with HD derivation path m/43'/60'/1581'/0'/0 |
113115

114116

115117
### Contact Discovery
@@ -133,8 +135,8 @@ This can be done in the following ways:
133135
1. public key via public channel listening
134136
- `status-react/src/status_im/contact_code/core.cljs`
135137
1. contact codes
136-
2. decentralized storage (not implemented)
137-
3. whisper
138+
1. decentralized storage (not implemented)
139+
1. Whisper/Waku
138140

139141
### Initial Key Exchange
140142

@@ -148,24 +150,24 @@ This can be done in the following ways:
148150
Signature // Prekey signature
149151
Timestamp // When the bundle was lasted created locally
150152
```
151-
- include BundleContainer???
153+
- include BundleContainer
152154
- a new bundle SHOULD be created at least every 12 hours
153155
- a bundle is only generated when it is used
154-
- a bundle SHOULD be distributed on the contact code channel. This is the whisper topic `{IK}-contact-code`, where `IK` is the hex encoded public key of the user, prefixed with `0x`. The channel is encrypted in the same way public chats are encrypted.
156+
- a bundle SHOULD be distributed on the contact code channel. This is the Whisper and Waku topic `{IK}-contact-code`, where `IK` is the hex encoded public key of the user, prefixed with `0x`. The channel is encrypted in the same way public chats are encrypted.
155157

156158
### Contact Verification
157159

158160
Once you have the information of a contact, the following can be used to verify that the key material is as it should be.
159161

160162
#### Identicon
161-
A low-poly identicon is deterministically generated from the whisper chat public key. This can then be compared out of band to ensure the receiver's public key is the one you have locally.
163+
A low-poly identicon is deterministically generated from the Whisper/Waku chat public key. This can then be compared out of band to ensure the receiver's public key is the one you have locally.
162164

163-
#### 3 word pseudonym / whisper key fingerprint
164-
Status generates a deterministic 3-word random pseudonym from the whisper chat public key. This pseudonym acts as a human readable fingerprint to the whisper chat public key. This name also shows when viewing a contact's public profile and in the chat UI.
165+
#### 3 word pseudonym / Whisper/Waku key fingerprint
166+
Status generates a deterministic 3-word random pseudonym from the Whisper/Waku chat public key. This pseudonym acts as a human readable fingerprint to the Whisper/Waku chat public key. This name also shows when viewing a contact's public profile and in the chat UI.
165167
- implementation: [gfycat](https://github.com/status-im/status-react/tree/develop/src/status_im/utils/gfycat)
166168

167169
#### ENS name
168-
Status offers the ability to register a mapping of a human readable subdomain of `stateofus.eth` to their whisper chat public key. This registration is purchased (currently by staking 10 SNT) and stored on the Ethereum mainnet blockchain for public lookup.
170+
Status offers the ability to register a mapping of a human readable subdomain of `stateofus.eth` to their Whisper/Waku chat public key. This registration is purchased (currently by staking 10 SNT) and stored on the Ethereum mainnet blockchain for public lookup.
169171

170172
<!-- TODO: Elaborate on security implications -->
171173

@@ -183,7 +185,7 @@ possible connections
183185
- public chat
184186
- client - mailserver (statusd + ???)
185187
- a mailserver identifies itself by an [enode address](https://github.com/ethereum/wiki/wiki/enode-url-format)
186-
- client - whisper node (statusd)
188+
- client - Whisper/Waku node (statusd)
187189
- a node identifies itself by an enode address
188190
- client - bootnode (go-ethereum)
189191
- a bootnode identifies itself by
@@ -217,3 +219,13 @@ All messages sent are encrypted with the public key of the destination and signe
217219
## Security Considerations
218220

219221
-
222+
223+
## Changelog
224+
225+
### Version 0.3
226+
227+
Released `TODO`
228+
229+
- Added language to include Waku in all relevant places
230+
- Change to keep `Mailserver` term consistent
231+
- Added clarification to Open Whisper Systems

0 commit comments

Comments
 (0)