@droponair/sdk-js 0.32.0 → 0.32.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.32.1
4
+
5
+ ### Fixed
6
+
7
+ - **A sender reported an error for every message it sent.** A message is echoed
8
+ back to every device of the sender, including the one that sent it, and what it
9
+ carries is encrypted for the recipients. The sending device tried to decrypt it,
10
+ which cannot work, and reported the failure each time. Such an echo is now
11
+ recognised and skipped. Nothing was lost before; the error was always wrong,
12
+ and an error that is always wrong hides the ones that are not.
13
+
14
+ - **Reconnecting could stop for good.** A reconnect attempt that failed before a
15
+ socket existed, typically fetching a token with no network, emitted
16
+ `RECONNECT_FAILED` and scheduled nothing further, so the client stayed offline.
17
+ It now schedules the next attempt while reconnecting is still wanted.
18
+
3
19
  ## 0.32.0
4
20
 
5
21
  ### Added
@@ -56,6 +56,12 @@ class MessagingClient {
56
56
  this.reconnectTimer = null;
57
57
  this.connectWebSocket().catch(() => {
58
58
  this.emitEvent({ type: 'ERROR', reason: 'RECONNECT_FAILED' });
59
+ // An attempt that fails before a socket exists, typically the token exchange
60
+ // with no network, has no close event to schedule the next one. Without this
61
+ // the first such failure ended reconnecting for good.
62
+ if (this.shouldReconnect) {
63
+ this.scheduleReconnect();
64
+ }
59
65
  });
60
66
  }, delay);
61
67
  }
@@ -2138,7 +2144,17 @@ class MessagingClient {
2138
2144
  });
2139
2145
  }
2140
2146
  else {
2141
- // Legacy single-payload path
2147
+ // Legacy single-payload path.
2148
+ //
2149
+ // Our own message, sent back so our other devices can show it. This client
2150
+ // is the one that sent it and already has it, and what it carries is
2151
+ // encrypted for the recipient, not for us. Trying anyway fails, and a
2152
+ // failure that happens on every single message teaches people to ignore
2153
+ // the ones that matter. A client with something to read here finds it in
2154
+ // the per-device payloads above.
2155
+ if (envelope.fromUserId === this.currentUserId) {
2156
+ return;
2157
+ }
2142
2158
  const sharedKey = await this.getPeerSharedKey(envelope.fromUserId);
2143
2159
  plaintext = await this.cryptoService.decrypt(envelope.encryptedPayload, sharedKey, {
2144
2160
  messageId: envelope.messageId,
package/dist/version.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  * MINOR, additive feature (e.g. multi-device payloads, new call event type)
8
8
  * PATCH, bug-fix / perf improvement with no wire or API change
9
9
  */
10
- export declare const SDK_VERSION = "0.32.0";
10
+ export declare const SDK_VERSION = "0.32.1";
11
11
  /**
12
12
  * Binary encrypted-payload format version.
13
13
  * Included as the first byte of every encrypted payload so receivers can
package/dist/version.js CHANGED
@@ -10,7 +10,7 @@ exports.PROTOCOL_VERSION = exports.PAYLOAD_FORMAT_VERSION = exports.SDK_VERSION
10
10
  * MINOR, additive feature (e.g. multi-device payloads, new call event type)
11
11
  * PATCH, bug-fix / perf improvement with no wire or API change
12
12
  */
13
- exports.SDK_VERSION = '0.32.0';
13
+ exports.SDK_VERSION = '0.32.1';
14
14
  /**
15
15
  * Binary encrypted-payload format version.
16
16
  * Included as the first byte of every encrypted payload so receivers can
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@droponair/sdk-js",
3
- "version": "0.32.0",
3
+ "version": "0.32.1",
4
4
  "description": "End-to-end encrypted messaging, voice and video calling SDK. The relay never sees your keys or message content.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",