@open-e2ee/signal-protocol-sdk 13.1.0 → 13.2.0

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,59 @@
1
1
  # Changelog
2
2
 
3
+ ## 13.2.0
4
+
5
+ ### Added
6
+
7
+ - `HostedRelayWakeResult` has an optional `retainedWork` field. It copies the
8
+ Relay report of the wake pull. True means that the Relay keeps a message
9
+ after the page, or a Relay receipt that the page did not carry, so run
10
+ another `pullHostedRelayAfterWake()` pass. False means that the page carried
11
+ all retained work. A Relay that does not report it gives no field. Then the
12
+ retained work is unknown, so do not read an absent field as false.
13
+
14
+ ### Fixed
15
+
16
+ - A hosted mailbox subscription now acknowledges each recovery pull page in
17
+ one HTTP request, also while the socket is live, and waits for the response.
18
+ When the page was full, with 100 messages or 32 Relay receipts, and the
19
+ Relay removed work or issued a cursor, the next page follows at once. It
20
+ does not wait for a timer. So a backlog of Relay receipts drains on the same
21
+ socket, with no reconnect. A socket frame never starts a pull.
22
+ - A lost acknowledgment request or a lost acknowledgment response now starts
23
+ one pull from the mailbox head after a wait. The wait starts at 2 seconds
24
+ and doubles after each further loss, up to 64 seconds. An acknowledgment
25
+ whose requests all succeed starts it at 2 seconds again. A pull that is
26
+ requested while the acknowledgment fails waits for that head pull. So a
27
+ lasting acknowledgment failure backs off. A replayed Relay receipt is not
28
+ handed off again.
29
+ - A subscription now keeps at most 132 Relay receipts in memory while a
30
+ receipt listener is slow. One batch takes at most 32 receipts. When the
31
+ queue of 100 items is full, the rest stay in the Relay, and the subscription
32
+ pulls them when the queue is empty, with no wait.
33
+ - A pull page now decodes the optional `failedEntries` list of the Relay. It
34
+ holds each retained message that the Relay read and could not serve. The
35
+ subscription never acknowledges such a message. It pulls again from the
36
+ mailbox head after the failed-work wait, which starts at 2 seconds and
37
+ doubles up to 64 seconds. A page pulled with a cursor does not start that
38
+ wait again, so a long backlog does not cut the wait short. A page with a
39
+ `failedEntries` value that is not a list of entries is refused. A page that
40
+ holds only failed entries keeps its `nextCursor`, so the subscription and
41
+ `pullHostedRelayAfterWake()` continue past it with the cursor. The
42
+ subscription pulls such cursor pages to their end before the pull from the
43
+ head. It does not continue on a `nextCursor` that equals the cursor of the
44
+ pull.
45
+ - A recovery pull page whose `retainedWork` is true now continues at once
46
+ when the Relay removed work or issued a cursor, also when the page is not
47
+ full. A page without `retainedWork` uses the full-page rule.
48
+ - A subscription now keeps at most one HTTP acknowledgment in flight, and a
49
+ pull waits for its response. When a socket burst ends and a pull follows,
50
+ the Relay receipts of the burst are acknowledged over HTTP before the pull.
51
+ So the pull page does not offer those receipts again, and the next pages
52
+ follow.
53
+ - A pull that a subscription requests while a pull fails now waits for the
54
+ retry schedule of the failed pull. It does not run at once after the
55
+ failure.
56
+
3
57
  ## 13.1.0
4
58
 
5
59
  ### Added
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  OpenE2EE Signal Protocol SDK (@open-e2ee/signal-protocol-sdk)
2
2
 
3
- Copyright (c) 2026 OpenE2EE LLC
3
+ Copyright (c) 2026 OpenE2EE, Inc.
4
4
 
5
5
  This software is dual-licensed under either of
6
6
 
package/LICENSE-MIT CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 OpenE2EE LLC
3
+ Copyright (c) 2026 OpenE2EE, Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/NOTICE CHANGED
@@ -1,6 +1,6 @@
1
1
  OpenE2EE (`@open-e2ee/signal-protocol-sdk`)
2
2
 
3
- Copyright (c) 2026 OpenE2EE LLC and contributors
3
+ Copyright (c) 2026 OpenE2EE, Inc. and contributors
4
4
 
5
5
  This is an independently maintained OpenE2EE project. It implements its own
6
6
  versioned messaging profile using public Signal Protocol specifications,
package/README.md CHANGED
@@ -39,7 +39,7 @@ The relay never needs message plaintext or device private keys.
39
39
 
40
40
  The OpenE2EE Signal Protocol SDK implements a versioned profile of the published Signal Protocol specifications. It is not affiliated with Signal Messenger and is **not wire-compatible with Signal Messenger or libsignal**. Messages, identities, and safety numbers do not interoperate. See the [notice](./NOTICE) and [documented deviations](./docs/DEVIATIONS.md).
41
41
 
42
- Version `13.1.x`. Public APIs and persisted formats follow semantic versioning.
42
+ Version `13.2.x`. Public APIs and persisted formats follow semantic versioning.
43
43
 
44
44
  ## Install
45
45
 
package/SECURITY.md CHANGED
@@ -7,8 +7,8 @@ backports.
7
7
 
8
8
  | Version | Supported |
9
9
  | -------- | ------------------ |
10
- | 13.1.x | :white_check_mark: |
11
- | < 13.1.0 | :x: |
10
+ | 13.2.x | :white_check_mark: |
11
+ | < 13.2.0 | :x: |
12
12
 
13
13
  ## Reporting a Vulnerability
14
14
 
@@ -39,11 +39,29 @@ export interface MailboxPage {
39
39
  * empty. A pull with it starts after that message.
40
40
  */
41
41
  readonly nextCursor?: string;
42
+ /**
43
+ * True when the Relay keeps work after the page. Absent when the Relay does
44
+ * not report it, so the retained work after the page is unknown.
45
+ */
46
+ readonly retainedWork?: boolean;
47
+ /**
48
+ * Each retained message that the page read and the Relay could not serve.
49
+ * The page omits it, and it stays in the mailbox. Absent when the Relay does
50
+ * not report it.
51
+ */
52
+ readonly failedEntries?: readonly {
53
+ readonly messageId: string;
54
+ readonly reason: string;
55
+ }[];
42
56
  }
43
57
  /** The Relay's answer to one HTTP acknowledgment. */
44
58
  export interface MailboxAcknowledgment {
45
59
  /** The acknowledged message ids whose delivery receipt the Relay owns. */
46
60
  readonly receipted: readonly string[];
61
+ /** The number of messages that the Relay removed for this request. */
62
+ readonly acknowledged: number;
63
+ /** The number of Relay receipts that the Relay removed for this request. */
64
+ readonly receiptsAcknowledged: number;
47
65
  }
48
66
  interface MailboxSubscription {
49
67
  /**
@@ -70,8 +88,8 @@ interface MailboxSubscription {
70
88
  */
71
89
  pull(cursor?: string): Promise<MailboxPage>;
72
90
  /**
73
- * Acknowledges messages and Relay receipts over HTTP when queued socket
74
- * acknowledgments lose their socket.
91
+ * Acknowledges messages and Relay receipts over HTTP: the work of a pull
92
+ * page, and queued socket acknowledgments that lose their socket.
75
93
  */
76
94
  acknowledge(messageIds: readonly string[], receiptIds: readonly string[]): Promise<MailboxAcknowledgment>;
77
95
  receive(envelope: Envelope): void | Promise<void>;
@@ -109,10 +127,18 @@ interface MailboxSubscription {
109
127
  export interface MailboxSubscriptionHandle {
110
128
  readonly unsubscribe: Unsubscribe;
111
129
  /**
112
- * Queues a socket acknowledgment and returns true while a socket is live.
113
- * Queued ids leave in one frame when the delivered frames are drained.
130
+ * Queues an acknowledgment and returns true while a socket is live or the
131
+ * batch of a pull page runs. Queued socket ids leave in one frame when the
132
+ * delivered frames are drained. The ids of a pull page leave in the HTTP
133
+ * acknowledgment of the page.
114
134
  */
115
135
  acknowledge(messageId: string): boolean;
136
+ /**
137
+ * Runs `send`, one HTTP acknowledgment for this subscription, after the
138
+ * HTTP acknowledgment in flight settles. So at most one is in flight.
139
+ * Resolves or rejects as `send` does.
140
+ */
141
+ acknowledgeOverHttp<T>(send: () => Promise<T>): Promise<T>;
116
142
  /**
117
143
  * Sends one presence request frame on the live socket and resolves with the
118
144
  * `result` of its answer. It rejects with a `HostedRelayPresenceError`: the
@@ -136,6 +162,12 @@ export interface MailboxSubscriptionHandle {
136
162
  * the cursor, and the next pull starts at the head again. The recovery pull
137
163
  * for failed work also starts at the head, so it offers the failed message
138
164
  * again.
165
+ *
166
+ * A pull page is acknowledged in one HTTP request after its batch, also while
167
+ * a socket is live. A full page pulls the next page at once after that
168
+ * response, when the Relay removed work or the page issued a cursor. A socket
169
+ * frame never starts a pull. One batch holds at most one frame of Relay
170
+ * receipts, so the batch and the queue hold at most 132 receipts.
139
171
  */
140
172
  export declare function subscribeHostedMailbox(options: MailboxSubscription): MailboxSubscriptionHandle;
141
173
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"hosted-mailbox-subscription.d.ts","sourceRoot":"","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