@open-e2ee/signal-protocol-sdk 13.3.0 → 13.5.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 +436 -0
- package/README.md +1 -1
- package/SECURITY.md +2 -2
- package/dist/client/binary-send.d.ts +28 -0
- package/dist/client/binary-send.d.ts.map +1 -0
- package/dist/client/binary-send.js +26 -0
- package/dist/client/binary-send.js.map +1 -0
- package/dist/client/client.d.ts +47 -6
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/client.js +288 -136
- package/dist/client/client.js.map +1 -1
- package/dist/client/content-adapter.d.ts +18 -0
- package/dist/client/content-adapter.d.ts.map +1 -1
- package/dist/client/content-adapter.js.map +1 -1
- package/dist/client/device-set-reconciliation.d.ts +23 -8
- package/dist/client/device-set-reconciliation.d.ts.map +1 -1
- package/dist/client/device-set-reconciliation.js +25 -11
- package/dist/client/device-set-reconciliation.js.map +1 -1
- package/dist/client/event-hooks.d.ts +88 -8
- package/dist/client/event-hooks.d.ts.map +1 -1
- package/dist/client/event-hooks.js +1 -0
- package/dist/client/event-hooks.js.map +1 -1
- package/dist/client/group-outbox.d.ts +45 -10
- package/dist/client/group-outbox.d.ts.map +1 -1
- package/dist/client/group-outbox.js +246 -154
- package/dist/client/group-outbox.js.map +1 -1
- package/dist/client/group-receive-authorization.d.ts +10 -1
- package/dist/client/group-receive-authorization.d.ts.map +1 -1
- package/dist/client/group-receive-authorization.js.map +1 -1
- package/dist/client/hosted-anonymous-delivery.d.ts +18 -1
- package/dist/client/hosted-anonymous-delivery.d.ts.map +1 -1
- package/dist/client/hosted-anonymous-delivery.js +84 -12
- package/dist/client/hosted-anonymous-delivery.js.map +1 -1
- package/dist/client/hosted-connection.js +1 -1
- package/dist/client/hosted-connection.js.map +1 -1
- package/dist/client/hosted-group-authority.d.ts +6 -2
- package/dist/client/hosted-group-authority.d.ts.map +1 -1
- package/dist/client/hosted-group-authority.js +11 -7
- package/dist/client/hosted-group-authority.js.map +1 -1
- package/dist/client/hosted-groups.d.ts +5 -1
- package/dist/client/hosted-groups.d.ts.map +1 -1
- package/dist/client/hosted-groups.js +8 -4
- package/dist/client/hosted-groups.js.map +1 -1
- package/dist/client/hosted-http-error.d.ts +5 -1
- package/dist/client/hosted-http-error.d.ts.map +1 -1
- package/dist/client/hosted-http-error.js +5 -1
- package/dist/client/hosted-http-error.js.map +1 -1
- package/dist/client/hosted-mailbox-subscription.d.ts +2 -0
- package/dist/client/hosted-mailbox-subscription.d.ts.map +1 -1
- package/dist/client/hosted-mailbox-subscription.js +5 -5
- package/dist/client/hosted-mailbox-subscription.js.map +1 -1
- package/dist/client/hosted-resume-error.d.ts +19 -0
- package/dist/client/hosted-resume-error.d.ts.map +1 -0
- package/dist/client/hosted-resume-error.js +44 -0
- package/dist/client/hosted-resume-error.js.map +1 -0
- package/dist/client/hosted-resume.d.ts +24 -0
- package/dist/client/hosted-resume.d.ts.map +1 -0
- package/dist/client/hosted-resume.js +82 -0
- package/dist/client/hosted-resume.js.map +1 -0
- package/dist/client/hosted-transport.d.ts +11 -1
- package/dist/client/hosted-transport.d.ts.map +1 -1
- package/dist/client/hosted-transport.js +102 -33
- package/dist/client/hosted-transport.js.map +1 -1
- package/dist/client/hosted.d.ts.map +1 -1
- package/dist/client/hosted.js +29 -6
- package/dist/client/hosted.js.map +1 -1
- package/dist/client/index.d.ts +3 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +2 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/receive-queue.d.ts +5 -2
- package/dist/client/receive-queue.d.ts.map +1 -1
- package/dist/client/receive-queue.js +55 -18
- package/dist/client/receive-queue.js.map +1 -1
- package/dist/client/relay-acceptance.d.ts +49 -6
- package/dist/client/relay-acceptance.d.ts.map +1 -1
- package/dist/client/relay-acceptance.js +49 -3
- package/dist/client/relay-acceptance.js.map +1 -1
- package/dist/client/relay-protocol.d.ts +37 -7
- package/dist/client/relay-protocol.d.ts.map +1 -1
- package/dist/client/relay-protocol.js +53 -10
- package/dist/client/relay-protocol.js.map +1 -1
- package/dist/client/retry-family.d.ts +3 -3
- package/dist/client/retry-family.js +1 -1
- package/dist/client/retry-family.js.map +1 -1
- package/dist/client/retry-request-envelope.d.ts +18 -8
- package/dist/client/retry-request-envelope.d.ts.map +1 -1
- package/dist/client/retry-request-envelope.js +57 -29
- package/dist/client/retry-request-envelope.js.map +1 -1
- package/dist/client/retry-request-lifecycle.d.ts +24 -11
- package/dist/client/retry-request-lifecycle.d.ts.map +1 -1
- package/dist/client/retry-request-lifecycle.js +46 -20
- package/dist/client/retry-request-lifecycle.js.map +1 -1
- package/dist/client/retry-terminal-recovery.d.ts +11 -8
- package/dist/client/retry-terminal-recovery.d.ts.map +1 -1
- package/dist/client/retry-terminal-recovery.js +18 -12
- package/dist/client/retry-terminal-recovery.js.map +1 -1
- package/dist/client/retry.d.ts +8 -7
- package/dist/client/retry.d.ts.map +1 -1
- package/dist/client/retry.js +30 -22
- package/dist/client/retry.js.map +1 -1
- package/dist/client/send-deadline.d.ts +308 -0
- package/dist/client/send-deadline.d.ts.map +1 -0
- package/dist/client/send-deadline.js +914 -0
- package/dist/client/send-deadline.js.map +1 -0
- package/dist/client/send-intent-driver.d.ts +116 -0
- package/dist/client/send-intent-driver.d.ts.map +1 -0
- package/dist/client/send-intent-driver.js +373 -0
- package/dist/client/send-intent-driver.js.map +1 -0
- package/dist/client/signal-service-cipher.d.ts +257 -27
- package/dist/client/signal-service-cipher.d.ts.map +1 -1
- package/dist/client/signal-service-cipher.js +1274 -283
- package/dist/client/signal-service-cipher.js.map +1 -1
- package/dist/client/startup-cleanup.d.ts +2 -0
- package/dist/client/startup-cleanup.d.ts.map +1 -0
- package/dist/client/startup-cleanup.js +14 -0
- package/dist/client/startup-cleanup.js.map +1 -0
- package/dist/client/types.d.ts +48 -5
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client/types.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/manager/manager.d.ts +1 -0
- package/dist/internal/manager/manager.d.ts.map +1 -1
- package/dist/internal/manager/manager.js +17 -2
- package/dist/internal/manager/manager.js.map +1 -1
- package/dist/internal/manager/retained-identity.d.ts +2 -0
- package/dist/internal/manager/retained-identity.d.ts.map +1 -0
- package/dist/internal/manager/retained-identity.js +57 -0
- package/dist/internal/manager/retained-identity.js.map +1 -0
- package/dist/local/store/conformance/cases/metadata.d.ts +3 -2
- package/dist/local/store/conformance/cases/metadata.d.ts.map +1 -1
- package/dist/local/store/conformance/cases/metadata.js +153 -2
- package/dist/local/store/conformance/cases/metadata.js.map +1 -1
- package/dist/local/store/key-value/adapter.d.ts +2 -1
- package/dist/local/store/key-value/adapter.d.ts.map +1 -1
- package/dist/local/store/key-value/adapter.js +9 -0
- package/dist/local/store/key-value/adapter.js.map +1 -1
- package/dist/local/store/memory/adapter.d.ts +2 -1
- package/dist/local/store/memory/adapter.d.ts.map +1 -1
- package/dist/local/store/memory/adapter.js +4 -0
- package/dist/local/store/memory/adapter.js.map +1 -1
- package/dist/local/store/metadata-keys.d.ts +13 -0
- package/dist/local/store/metadata-keys.d.ts.map +1 -0
- package/dist/local/store/metadata-keys.js +20 -0
- package/dist/local/store/metadata-keys.js.map +1 -0
- package/dist/local/store/receive-work.d.ts.map +1 -1
- package/dist/local/store/receive-work.js +12 -1
- package/dist/local/store/receive-work.js.map +1 -1
- package/dist/local/store/reliability.d.ts +482 -33
- package/dist/local/store/reliability.d.ts.map +1 -1
- package/dist/local/store/reliability.js +690 -48
- package/dist/local/store/reliability.js.map +1 -1
- package/dist/local/store/sqlite/key-storage/index.d.ts +2 -1
- package/dist/local/store/sqlite/key-storage/index.d.ts.map +1 -1
- package/dist/local/store/sqlite/key-storage/index.js +3 -0
- package/dist/local/store/sqlite/key-storage/index.js.map +1 -1
- package/dist/local/store/sqlite/key-storage/metadata.d.ts +9 -0
- package/dist/local/store/sqlite/key-storage/metadata.d.ts.map +1 -1
- package/dist/local/store/sqlite/key-storage/metadata.js +12 -0
- package/dist/local/store/sqlite/key-storage/metadata.js.map +1 -1
- package/dist/local/store/sqlite/store.d.ts +2 -1
- package/dist/local/store/sqlite/store.d.ts.map +1 -1
- package/dist/local/store/sqlite/store.js +3 -0
- package/dist/local/store/sqlite/store.js.map +1 -1
- package/dist/local/store/web/adapter.d.ts +8 -1
- package/dist/local/store/web/adapter.d.ts.map +1 -1
- package/dist/local/store/web/adapter.js +18 -0
- package/dist/local/store/web/adapter.js.map +1 -1
- package/dist/remote/relay/request-admission.d.ts +49 -0
- package/dist/remote/relay/request-admission.d.ts.map +1 -0
- package/dist/remote/relay/request-admission.js +74 -0
- package/dist/remote/relay/request-admission.js.map +1 -0
- package/dist/types/api.d.ts +77 -0
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/errors.d.ts +144 -1
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/errors.js +146 -1
- package/dist/types/errors.js.map +1 -1
- package/docs/ASSURANCE.md +5 -5
- package/docs/DEVIATIONS.md +34 -4
- package/docs/ERROR_HANDLING.md +134 -7
- package/docs/PACKAGE_SURFACE.md +21 -0
- package/docs/RECIPES.md +3 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,441 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 13.5.0
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- `SendAcceptanceUnknownError`, code `SEND_ACCEPTANCE_UNKNOWN`, from
|
|
8
|
+
`@open-e2ee/signal-protocol-sdk/types`. A direct or group send throws it
|
|
9
|
+
when its posting deadline ends and the Relay acceptance of a device is not
|
|
10
|
+
known. The message might have arrived. It gives `deadlineAt`,
|
|
11
|
+
`acceptedDevices`, `unknownDevices` and `refusedDevices`, and its
|
|
12
|
+
`retryable` is false.
|
|
13
|
+
- `SendNeverAcceptedByRelayError`, code `SEND_NEVER_ACCEPTED`, from the same
|
|
14
|
+
subpath. A direct or group send throws it when the deadline ends and the
|
|
15
|
+
Relay accepted no request for an open device. The call and each replay throw
|
|
16
|
+
it only when the call raised no refusal (a thrown refusal or a refusal in the
|
|
17
|
+
receipt of a shared body) and no refused device has a stored refusal code.
|
|
18
|
+
- `deadlineAt`, `relayRetryable`, `acceptedDevices` and `refusedDevices` on
|
|
19
|
+
send errors.
|
|
20
|
+
- With a store that lists its metadata keys, the SDK now replays each open
|
|
21
|
+
send at start and when the Relay connection returns. It ends each send at
|
|
22
|
+
its posting deadline, or at the next start or connect after it. It posts
|
|
23
|
+
nothing for a send past its deadline.
|
|
24
|
+
- `onSendOutcome` on the client hooks, with `SendOutcomeEvent`. The SDK calls
|
|
25
|
+
it once for each end of a send, from its own replay or from your call. It
|
|
26
|
+
reports `content-required` when the plaintext of an open send is gone. An
|
|
27
|
+
internal send of the SDK, such as a sender key distribution, never reaches
|
|
28
|
+
it. The SDK keeps no content of a sender key distribution, so it does not
|
|
29
|
+
replay one. It ends an open distribution at its deadline, and a retry
|
|
30
|
+
request of the receiver recovers a lost distribution. One exception: an
|
|
31
|
+
open sender key distribution that an earlier SDK version stored carries no
|
|
32
|
+
marker, so the hook gets `content-required` for it once for each client
|
|
33
|
+
run before its deadline, and its end once at its deadline. Ignore an ID
|
|
34
|
+
that your application never sent.
|
|
35
|
+
- The optional method `listMetadataKeys` on `SignalProtocolLocalStore`, with
|
|
36
|
+
`MetadataKeyQuery`. Every built-in store implements it.
|
|
37
|
+
- `resendMessage(clientMessageId)` on the client. After a send ends with
|
|
38
|
+
`SendAcceptanceUnknownError` or `SendNeverAcceptedByRelayError`, it posts
|
|
39
|
+
the message again to each recipient device that the Relay did not accept.
|
|
40
|
+
The resend is a new operation with a fresh operation time and the message
|
|
41
|
+
ID `<clientMessageId>:manual:N`. Its content keeps the original timestamp.
|
|
42
|
+
A resend of a group send posts the content of its send log entry, so each
|
|
43
|
+
copy carries the group context of the original send, not the current one.
|
|
44
|
+
It has its own posting deadline 24 hours after the call, and the SDK replays
|
|
45
|
+
it until then. The Relay can charge the resend as a new message, and the
|
|
46
|
+
message might already have arrived. `onSendOutcome` reports the end of each
|
|
47
|
+
resend once, with `manualResend`. Only a send younger than 30 days takes a
|
|
48
|
+
new resend.
|
|
49
|
+
- `outcome` on `DeviceSetReconciliationError`: `failed` or
|
|
50
|
+
`acceptance-unknown`. With `acceptance-unknown`, the message might have
|
|
51
|
+
arrived. Treat it like `SendAcceptanceUnknownError`.
|
|
52
|
+
- Relay protocol version 2, and its Relay code `DELIVERY_ALREADY_ACCEPTED`.
|
|
53
|
+
The Relay gives the code to a version 2 request, with HTTP status 409,
|
|
54
|
+
`retryable` false and the `details` reason `message-id-held`, when it
|
|
55
|
+
already holds an accepted post under the message ID. It stored nothing
|
|
56
|
+
for the post. A version 1 request gets `RETRY_CONFLICT` for the same case.
|
|
57
|
+
The SDK reads the code as it reads `RETRY_CONFLICT`: on a direct post, a
|
|
58
|
+
sealed direct post, a pre-message and a group shared body, it is an earlier
|
|
59
|
+
acceptance with no receipt, under the same rules. The sealed path keeps the
|
|
60
|
+
code on its error. In the answer to a version 1 request, the code is an
|
|
61
|
+
unknown Relay code.
|
|
62
|
+
|
|
63
|
+
### Changed
|
|
64
|
+
|
|
65
|
+
- A direct send now has a posting deadline: the earlier of 24 hours after the
|
|
66
|
+
SDK first stores it and 24 hours after its timestamp. A replay or a restart
|
|
67
|
+
never moves it. SDK 13.4 had no posting deadline.
|
|
68
|
+
- At or after the deadline, the SDK starts no request for the send. This
|
|
69
|
+
includes a transport repeat and the identified fallback. A request that
|
|
70
|
+
started before the deadline still counts when its answer arrives later.
|
|
71
|
+
- SDK 13.4 posted a direct send whose timestamp was exactly 24 hours old. The
|
|
72
|
+
SDK now stores it, posts nothing and throws `SendNeverAcceptedByRelayError`.
|
|
73
|
+
- SDK 13.4 posted an attachment send whose upload finished after its
|
|
74
|
+
timestamp plus 24 hours. The SDK now posts nothing and throws.
|
|
75
|
+
- SDK 13.4 replayed a stored direct send after 24 hours and posted it again.
|
|
76
|
+
The SDK now posts nothing at or after the deadline, and the replay ends
|
|
77
|
+
with `SendAcceptanceUnknownError` or the failed-end error of the next entry.
|
|
78
|
+
- When a send ends failed and the call that ends it raised a refusal, the
|
|
79
|
+
first such refusal is the error. A thrown refusal keeps its SDK 13.4 class,
|
|
80
|
+
and a refusal in the receipt of a shared body is an `Error` with its `code`.
|
|
81
|
+
Otherwise, the end throws an `Error` with the `code` of the first refused
|
|
82
|
+
device that has a stored code, in the order of the destinations. With no
|
|
83
|
+
such device, it throws `SendNeverAcceptedByRelayError`. A replay of the
|
|
84
|
+
ended send raises no refusal. Each of these errors has `acceptedDevices`,
|
|
85
|
+
`refusedDevices` and `deadlineAt`.
|
|
86
|
+
- Before the deadline, a send error that leaves a device open now has
|
|
87
|
+
`retryable` set to true. In SDK 13.4 that field held only the Relay's hint.
|
|
88
|
+
`relayRetryable` now keeps that hint.
|
|
89
|
+
- SDK 13.4 threw `RETRY_CONFLICT` from a direct send or a sealed direct send
|
|
90
|
+
when the Relay already held bytes under its ID. The SDK now counts that
|
|
91
|
+
answer as an earlier acceptance, and the send goes on. This applies when the
|
|
92
|
+
SDK stored the send from its first post, and no repair replaced the session
|
|
93
|
+
of that device.
|
|
94
|
+
- In other cases, the acceptance of that device is unknown. Before the
|
|
95
|
+
deadline, the send still throws `RETRY_CONFLICT`, now with `retryable` true
|
|
96
|
+
and `deadlineAt`. At the deadline, it throws `SendAcceptanceUnknownError`.
|
|
97
|
+
- Such an answer has no Relay receipt. The send result takes its `messageId`
|
|
98
|
+
from a Relay receipt of another device when one exists. When every accepted
|
|
99
|
+
device gave that answer, `messageId` is the `clientMessageId`.
|
|
100
|
+
- Such an answer raises no `DEVICE_SET_UNCHECKED` report through
|
|
101
|
+
`onRelayProtocolError`, because it has no receipt to check.
|
|
102
|
+
- SDK 13.4 threw `RETRY_CONFLICT` from a group send when a pre-message got it.
|
|
103
|
+
The group send now goes on. A pre-message that counts it as an acceptance
|
|
104
|
+
records the sender-key handoff, as for any acceptance.
|
|
105
|
+
- A pre-message whose session the SDK replaced records no handoff when it
|
|
106
|
+
gets that answer, and the acceptance of its device is unknown. The next
|
|
107
|
+
group send gives the key again. This also holds on a replay.
|
|
108
|
+
- SDK 13.4 threw from an undeclared send when a sync copy failed. When the
|
|
109
|
+
deadline stops a sync copy, the send now returns `syncPending`. A replay of
|
|
110
|
+
that send returns the same result and posts nothing. Other sync failures
|
|
111
|
+
still throw.
|
|
112
|
+
- A replay of a send with `syncPending` posts the pending sync copies only
|
|
113
|
+
before `deadlineAt`. At or after it, the replay posts nothing and returns
|
|
114
|
+
the stored result with `syncPending`.
|
|
115
|
+
- One case differs. When the send has no sync copies yet, the replay reads
|
|
116
|
+
the own device list again. If it finds no other own device, the send
|
|
117
|
+
completes without `syncPending`.
|
|
118
|
+
- A replay of an ended send with the same content throws the stored result
|
|
119
|
+
again and posts nothing. A DataMessage replay takes the stored timestamp.
|
|
120
|
+
- A replay of a direct send now posts only the devices that the Relay did not
|
|
121
|
+
accept. SDK 13.4 posted every device again. A replay also skips the sync
|
|
122
|
+
copies that the Relay accepted.
|
|
123
|
+
- A replay of a DataMessage send now keeps its stored timestamp. SDK 13.4 read
|
|
124
|
+
a new timestamp and refused the replay as a different message.
|
|
125
|
+
- A `RETRY_CONFLICT` answer counts as an earlier acceptance unless the SDK
|
|
126
|
+
replaced the session of that device. A repair that adds a missing device
|
|
127
|
+
after `DEVICE_SET_MISMATCH` replaces nothing, so the added device counts as
|
|
128
|
+
accepted. A device whose session the SDK replaced after `STALE_DEVICE`
|
|
129
|
+
stays unknown, because the Relay can hold a message sealed to the old
|
|
130
|
+
session. This now also holds on a replay of a send that this SDK version
|
|
131
|
+
stored. On a replay of a send that SDK 13.4 stored, a `RETRY_CONFLICT`
|
|
132
|
+
answer stays uncertain.
|
|
133
|
+
- A send or its replay now ends at once, before the deadline, and posts
|
|
134
|
+
nothing, when every open device got `OPERATION_EXPIRED` as the last answer
|
|
135
|
+
in the call or has a refusal that the SDK cannot recover, and throws an `Error` with the stored
|
|
136
|
+
code of the first refused device that has one, in the order of the
|
|
137
|
+
destinations.
|
|
138
|
+
A `STALE_DEVICE` refusal counts only after the SDK repaired the session and
|
|
139
|
+
the Relay refused the repaired post too. A request with no answer, an
|
|
140
|
+
uncertain answer, or a send stored by SDK 13.4 still gives
|
|
141
|
+
`SendAcceptanceUnknownError`.
|
|
142
|
+
- A send that an earlier SDK stored gets its deadline from its stored times.
|
|
143
|
+
The SDK stores that deadline at its next change of the send.
|
|
144
|
+
- A group send now has the same posting deadline as a direct send. SDK 13.4
|
|
145
|
+
posted a group send whose timestamp was exactly 24 hours old, and it
|
|
146
|
+
replayed a stored group send after 24 hours. Both now post nothing at the
|
|
147
|
+
deadline, and the send ends with `SendAcceptanceUnknownError` or the
|
|
148
|
+
failed-end error of the direct send rule. The deadline also stops a pre-message, its
|
|
149
|
+
identified fallback, the shared body and a sync copy.
|
|
150
|
+
- A group send now records the Relay answer of each device: of each
|
|
151
|
+
pre-message, of each device post, and of the shared body for each of its
|
|
152
|
+
destinations. A replay posts only the devices that the Relay did not
|
|
153
|
+
accept. A device that the receipt of the shared body refuses counts as
|
|
154
|
+
refused, as a thrown refusal does, and the end error follows the rule of a
|
|
155
|
+
direct send. A replay of the ended send gives the stored code of the first
|
|
156
|
+
refused device that has one, in the order of the destinations. That code
|
|
157
|
+
can differ from the code of the call.
|
|
158
|
+
- A `RETRY_CONFLICT` answer to the shared body of a group send counts as an
|
|
159
|
+
earlier acceptance of each of its destinations. It raises no
|
|
160
|
+
`DEVICE_SET_UNCHECKED` report through `onRelayProtocolError`. The answer
|
|
161
|
+
has no receipt that can ask for a sync phase, so the send reads the own
|
|
162
|
+
device list once to find the devices that need a sync copy.
|
|
163
|
+
- A `RETRY_CONFLICT` answer to a group device post or pre-message whose
|
|
164
|
+
session the SDK replaced after `STALE_DEVICE` gives acceptance-unknown for
|
|
165
|
+
that device. On a device that a repair only added, or that no repair
|
|
166
|
+
changed, it counts as an earlier acceptance. The call and a replay after a
|
|
167
|
+
restart give the device the same class.
|
|
168
|
+
- SDK 13.4 started a send that ended with `DeviceSetReconciliationError`
|
|
169
|
+
again at 0 restarts when the application called `send()` with the same
|
|
170
|
+
`clientMessageId`. After an end in the recipient phase, the SDK now stores
|
|
171
|
+
the send outcome. That call throws `SendAcceptanceUnknownError` or
|
|
172
|
+
`SendNeverAcceptedByRelayError` and posts nothing. After an end in the sync
|
|
173
|
+
phase, the send keeps its result, and that call posts the sync phase again.
|
|
174
|
+
- An `UPGRADE_REQUIRED` or `DEVICE_REVOKED` answer now ends a send at once as
|
|
175
|
+
failed, or as acceptance-unknown when the acceptance of a device is not
|
|
176
|
+
known. SDK 13.4 threw the answer and left the send open.
|
|
177
|
+
- A recipient now drops a message that carries the same sender device, the
|
|
178
|
+
same content timestamp and the same content as a message it already
|
|
179
|
+
received. The drop also covers a copy under a new message ID, such as a
|
|
180
|
+
manual resend. Two different messages of one sender device in one
|
|
181
|
+
millisecond both deliver. The drop needs the timestamp that the content
|
|
182
|
+
adapter reads from the message. Content with no timestamp, such as raw
|
|
183
|
+
string or byte content, takes no drop key, and a recipient that holds it
|
|
184
|
+
receives the copy again. The recipient records the message with the
|
|
185
|
+
completion of its receive record. When a delivery receipt is due, it
|
|
186
|
+
records the message right after the receipt-due write and again with the
|
|
187
|
+
completion of the receipt. When no receipt is owed, a stop before the
|
|
188
|
+
completion of the receive record runs `onMessageDecrypted` again. When a
|
|
189
|
+
receipt is owed, only a stop before the receipt-due write runs it again.
|
|
190
|
+
The record expires after 60 days.
|
|
191
|
+
- A retry resend no longer encrypts again under the same ID after the Relay
|
|
192
|
+
answers `OPERATION_EXPIRED` to its stored bytes. SDK 13.4 encrypted the
|
|
193
|
+
content again with a fresh operation epoch and posted the new bytes. The SDK
|
|
194
|
+
now posts nothing more under that ID. It records that the acceptance of the
|
|
195
|
+
attempt is unknown.
|
|
196
|
+
- The same applies to a stored null-message answer and to the current
|
|
197
|
+
sender-key distribution that answers a group retry request. SDK 13.4
|
|
198
|
+
encrypted both again under the same ID. For the distribution, the SDK still
|
|
199
|
+
deletes the sender-key handoff of the requester, as SDK 13.4 does, so the
|
|
200
|
+
next group send gives the key again.
|
|
201
|
+
- When the plaintext of that message is gone, the SDK still posts the
|
|
202
|
+
null-message session reset under its own ID, as SDK 13.4 does.
|
|
203
|
+
- The SDK still counts such an answer toward the response limit, and it still
|
|
204
|
+
completes a group resend job as posted, as SDK 13.4 does after its post.
|
|
205
|
+
- A later retry request from the same device has a new attempt and a new ID,
|
|
206
|
+
so it gets a new encryption, as in SDK 13.4.
|
|
207
|
+
- A hosted group fan-out post now repeats once when the Relay answers 503
|
|
208
|
+
`DELIVERY_UNCERTAIN`. The repeat sends the identical request with the same
|
|
209
|
+
`logicalSendId`, as a direct post does. SDK 13.4 threw that error after the
|
|
210
|
+
first answer. A second uncertain answer reaches the caller. No other error
|
|
211
|
+
code starts a repeat.
|
|
212
|
+
- After such a repeat, the group send result has no `duplicate` field,
|
|
213
|
+
because the first request can have stored the fan-out.
|
|
214
|
+
- A send can be stored without its timestamp lookup when a write fails
|
|
215
|
+
between the two. Without the lookup, an E2EE delivery receipt for the
|
|
216
|
+
message gives no delivery event, and a retry request for a group message
|
|
217
|
+
does not find its group. When the SDK stores the same send again, it now
|
|
218
|
+
also stores a missing lookup and changes nothing else in the stored send.
|
|
219
|
+
SDK 13.4 did not. A replay of a stored send does not store it again in this
|
|
220
|
+
release, so a replay does not restore the lookup.
|
|
221
|
+
- Each hosted client now holds its Relay protocol version internally, and
|
|
222
|
+
every Relay request and the mailbox socket of that client send it. SDK 13.4
|
|
223
|
+
read one fixed version for the whole SDK. No option changes it.
|
|
224
|
+
- The default Relay protocol version is now version 2. Each Relay request
|
|
225
|
+
sends `x-open-e2ee-relay-protocol: 2`, and the mailbox socket offers
|
|
226
|
+
`open-e2ee-relay.v2`. SDK 13.4 sent version 1. A Relay that does not serve
|
|
227
|
+
version 2 answers `PROTOCOL_UNSUPPORTED`, and a send keeps the device open
|
|
228
|
+
and retryable until its posting deadline. The SDK does not fall back to
|
|
229
|
+
version 1. The Relay serves version 1 for at least 180 days after the
|
|
230
|
+
publish of this release, and the earliest end date is 2027-04-30.
|
|
231
|
+
See step 19.
|
|
232
|
+
- `HostedRelayUpgradeRequiredError` names the protocol version that the
|
|
233
|
+
client sent, and its constructor takes an optional `version`. Without it,
|
|
234
|
+
the message names version 1, as in SDK 13.4.
|
|
235
|
+
- A retry request now has a posting deadline 24 hours after the first
|
|
236
|
+
failure of its message, and no post of it starts at or after that time. A
|
|
237
|
+
request whose post is due then ends with the new terminal class
|
|
238
|
+
`posting-deadline`. SDK 13.4 posted a replacement request after
|
|
239
|
+
`OPERATION_EXPIRED`. The SDK now ends that request as `posting-deadline`
|
|
240
|
+
with acceptance unknown, because the request might have arrived, and posts
|
|
241
|
+
no replacement. Each `posting-deadline` end resets the session and reports
|
|
242
|
+
one `onRetryTerminal` event. After its posting deadline, a request whose
|
|
243
|
+
post the Relay accepted posts nothing more and waits for its content until
|
|
244
|
+
its 14-day deadline. A request that SDK 13.4 stored gets a posting deadline
|
|
245
|
+
from its first failure, and at most its deadline. SDK 13.4 reads a stored
|
|
246
|
+
`posting-deadline` record as corrupt, so do not downgrade after one exists.
|
|
247
|
+
- A retry request that gets `DELIVERY_ALREADY_ACCEPTED` from a version 2
|
|
248
|
+
Relay reads it as the acceptance of its stored attempt, as it reads
|
|
249
|
+
`RETRY_CONFLICT`. No replacement attempt posts.
|
|
250
|
+
- SDK 13.4 never replayed a send by itself. The application had to call
|
|
251
|
+
`send()` again with the same `clientMessageId`. That call is still safe, and
|
|
252
|
+
the SDK runs it after its own replay of the same send.
|
|
253
|
+
|
|
254
|
+
### Deprecated
|
|
255
|
+
|
|
256
|
+
Each entry names a change in the next major SDK version. Nothing in this
|
|
257
|
+
release changes for these items. The upgrade steps below say what to do now.
|
|
258
|
+
|
|
259
|
+
- Group content with no group context. The next major no longer decides it,
|
|
260
|
+
so content from an SDK 11 sender is not delivered. The denial reason
|
|
261
|
+
`legacy-no-context` then applies to all such content. See step 13.
|
|
262
|
+
- `ReceivedContent`. The next major removes the type and the first-open
|
|
263
|
+
conversion of SDK 11 received-content rows. See step 14.
|
|
264
|
+
- `SignalProtocolContentAdapter`. The next major adds the required method
|
|
265
|
+
`serializeGroupKeySync`, and `ParsedSyncContent.type` gets `groupKeySync`.
|
|
266
|
+
See step 15.
|
|
267
|
+
- The retry terminal class `expired-content`. The next major renames it to
|
|
268
|
+
`request-expired`. See step 16.
|
|
269
|
+
- A repeated send timestamp of one device. The next major makes each send
|
|
270
|
+
timestamp unique per sender device, and refuses a new send that repeats the
|
|
271
|
+
timestamp of a different send of the device with `InvalidSendTimestampError`.
|
|
272
|
+
A retry with the same `clientMessageId` keeps its timestamp. See step 17.
|
|
273
|
+
- `ReceiveWorkRecord.received.contentDigest` and
|
|
274
|
+
`ReceiveWorkRecord.received.senderDeviceId`, the fields of the received
|
|
275
|
+
message key, and the rule that two different messages of one sender device
|
|
276
|
+
with one timestamp both deliver. The next major keys a received message by its
|
|
277
|
+
sender and timestamp only, and drops a later message with the same key.
|
|
278
|
+
See step 18.
|
|
279
|
+
|
|
280
|
+
### Fixed
|
|
281
|
+
|
|
282
|
+
- The SDK reports a Signal Protocol Relay environment mismatch only for HTTP403
|
|
283
|
+
with the `SCOPE_MISMATCH` error code. Other403 responses use the generic
|
|
284
|
+
connection error.
|
|
285
|
+
- When a request envelope comes again, the SDK now gives `storeResendJob`
|
|
286
|
+
the first `createdAt` of the group resend job. SDK 13.4 gave it the time
|
|
287
|
+
of the new delivery. The built-in stores keep the first value, as the
|
|
288
|
+
store contract states, so their one-day end of the job did not move. A
|
|
289
|
+
custom store that stored the given value restarted that day on each
|
|
290
|
+
repeated request, so the job could stay alive past one day.
|
|
291
|
+
- A binary send now has one upload and one serialized attachment message for
|
|
292
|
+
each `clientMessageId`, across lost Relay replies and restarts. This
|
|
293
|
+
applies to direct and group sends. The stored intent keeps the message and
|
|
294
|
+
the digest of the file. A repeat sends the stored message under the stored
|
|
295
|
+
timestamp and uploads nothing. A repeat of a completed send returns the
|
|
296
|
+
stored result, with `storageId`, `aesKey`, `segmentSize`, `digest` and
|
|
297
|
+
`contentType`. SDK 13.4 uploaded the file again on each repeat, and the
|
|
298
|
+
repeat then failed with `A clientMessageId cannot identify two different
|
|
299
|
+
logical sends`.
|
|
300
|
+
- A binary repeat with another file, other pointer metadata, another
|
|
301
|
+
recipient or another explicit `timestamp` now throws that error before any
|
|
302
|
+
upload. The pointer metadata comes from the send options: `mimeType`,
|
|
303
|
+
`caption`, `fileName`, `isViewOnce`, `flags`, `blurHash`, `thumbnail`,
|
|
304
|
+
`width`, `height`, `durationMs`, `waveform`, `clientUuid` and `cdnNumber`.
|
|
305
|
+
A repeat that omits `clientUuid` keeps the stored one. A group recipient in
|
|
306
|
+
place of a direct recipient, or the reverse, is another recipient. A repeat
|
|
307
|
+
of an intent that has no stored attachment message also throws it before
|
|
308
|
+
any upload. This includes a text send and a binary send that SDK 13.4
|
|
309
|
+
stored.
|
|
310
|
+
- A binary send without a caller `timestamp` now reads the SDK clock once,
|
|
311
|
+
before the upload. The attachment message and the stored intent get the
|
|
312
|
+
same timestamp. SDK 13.4 read the clock after the upload, once for the
|
|
313
|
+
message and again for the intent, so the two timestamps could differ.
|
|
314
|
+
|
|
315
|
+
### Limits
|
|
316
|
+
|
|
317
|
+
- A replay or a resend after `SendAcceptanceUnknownError` can add one charged
|
|
318
|
+
unit within 24 hours, when the Relay no longer holds its record of the first
|
|
319
|
+
acceptance.
|
|
320
|
+
|
|
321
|
+
#### Upgrade steps
|
|
322
|
+
|
|
323
|
+
1. Catch `SendAcceptanceUnknownError`. Tell the user that the message might
|
|
324
|
+
already have arrived, and do not replay the send.
|
|
325
|
+
2. Catch `SendNeverAcceptedByRelayError`, and also any send error with
|
|
326
|
+
`refusedDevices`. Tell the user which devices did not get the message.
|
|
327
|
+
3. For another send error, read `deadlineAt`. With a store that implements
|
|
328
|
+
`listMetadataKeys`, the SDK replays the send until then and reports its end
|
|
329
|
+
once through `onSendOutcome`. Do not build your own replay loop. Without
|
|
330
|
+
that method, replay with the same `clientMessageId` before `deadlineAt`, as
|
|
331
|
+
step 11 says. A call of `send()` with the same `clientMessageId` is safe.
|
|
332
|
+
4. Code written for SDK 13.4 compiles unchanged. Check any code that reads
|
|
333
|
+
`retryable` on a send error, and any code that sends with a timestamp
|
|
334
|
+
close to 24 hours old.
|
|
335
|
+
5. A custom metadata store needs no change to keep working. The new record and
|
|
336
|
+
intent fields travel inside the stored JSON value. A store that also
|
|
337
|
+
implements the optional `listMetadataKeys` gets the automatic send driver.
|
|
338
|
+
See step 11.
|
|
339
|
+
6. A direct send that first stores a message now resolves on `RETRY_CONFLICT`
|
|
340
|
+
when no repair changed it. Other `RETRY_CONFLICT` errors now carry
|
|
341
|
+
`retryable` and `deadlineAt`, so follow step 3 for them.
|
|
342
|
+
7. Code that reads `messageId` from a send result must accept the
|
|
343
|
+
`clientMessageId` in that field. That occurs only when every accepted
|
|
344
|
+
device answered `RETRY_CONFLICT`.
|
|
345
|
+
8. A device that downgrades to SDK 13.4 ignores the new record fields. It
|
|
346
|
+
can then encrypt one expired retry-resend attempt again, as SDK 13.4 does.
|
|
347
|
+
9. Handle the new `posting-deadline` class in `onRetryTerminal`. The session
|
|
348
|
+
resets, and the request might have arrived. Do not downgrade below this
|
|
349
|
+
release after it ends a retry request as `posting-deadline`: an older SDK
|
|
350
|
+
reads that record as corrupt. A 13.4 record that is due, already past
|
|
351
|
+
its derived posting deadline, and not yet past its deadline ends right
|
|
352
|
+
after the upgrade as `posting-deadline`, with a session reset.
|
|
353
|
+
10. Handle `SendAcceptanceUnknownError` and `SendNeverAcceptedByRelayError` on
|
|
354
|
+
group sends too.
|
|
355
|
+
11. A custom metadata store can implement the optional `listMetadataKeys` to
|
|
356
|
+
get the automatic send driver. Run the store conformance suite to check it.
|
|
357
|
+
The suite skips its listing cases on a store without the method. Without
|
|
358
|
+
the method, the SDK does not replay open sends by itself, and it logs one
|
|
359
|
+
line at each client start. Replay with the same `clientMessageId` before
|
|
360
|
+
`deadlineAt`. `onSendOutcome` still reports each end of a send that your
|
|
361
|
+
application posts.
|
|
362
|
+
12. Read `outcome` on `DeviceSetReconciliationError`. When it is set, a call
|
|
363
|
+
of `send()` with the same `clientMessageId` posts nothing and throws the
|
|
364
|
+
error of the stored end. To post a message again after a send end, call
|
|
365
|
+
`resendMessage`. The Relay can charge the resend as a new message. Only a
|
|
366
|
+
send younger than 30 days takes a new resend. At or after 30 days,
|
|
367
|
+
`resendMessage` throws `Only a send younger than 30 days takes a manual
|
|
368
|
+
resend` and posts nothing. The receive queue drops the copy when the
|
|
369
|
+
content adapter reads a timestamp from the content. The
|
|
370
|
+
recipient records the message with the completion of its receive record,
|
|
371
|
+
or, when a receipt is due, right after the receipt-due write and again
|
|
372
|
+
with the completion of the receipt. The caller-origin receive path gives
|
|
373
|
+
every decrypted message to the caller, and a caller that keeps its own
|
|
374
|
+
records removes a copy itself. A recipient on an SDK version before this
|
|
375
|
+
release does not drop the resend copy, so it can show the message twice.
|
|
376
|
+
13. Move every client that sends to a managed group to SDK 12.0.0 or later
|
|
377
|
+
before the next major. SDK 12.0.0 and later put the group context in group
|
|
378
|
+
content. The next major no longer decides group content that has no group
|
|
379
|
+
context, so content from an SDK 11 sender is not delivered.
|
|
380
|
+
14. Open each durable store once on SDK 13.x before the next major. The open
|
|
381
|
+
converts the SDK 11 received-content rows to receive records. The next
|
|
382
|
+
major does not read or convert them. Stop using the `ReceivedContent` type,
|
|
383
|
+
and use `ReceiveWorkRecord`.
|
|
384
|
+
15. If you implement `SignalProtocolContentAdapter` yourself, plan to add the
|
|
385
|
+
method `serializeGroupKeySync` in the next major. If you switch on
|
|
386
|
+
`ParsedSyncContent.type`, plan to handle `'groupKeySync'`. An adapter that
|
|
387
|
+
spreads the result of `createDefaultSignalProtocolContentAdapter()` into
|
|
388
|
+
itself gets the default method. Upgrade every own device of one account in
|
|
389
|
+
one release. An own device on an older SDK version gives the raw group key
|
|
390
|
+
sync to `onMessageDecrypted`.
|
|
391
|
+
16. Prepare `onRetryTerminal` for the rename of `expired-content` to
|
|
392
|
+
`request-expired` in the next major. On 13.x, `RetryTerminalClass` does not
|
|
393
|
+
hold `request-expired`, so a `case 'request-expired':` does not compile.
|
|
394
|
+
Keep the `expired-content` branch, and give every exhaustive switch on the
|
|
395
|
+
class a default branch that does not throw. Add the `request-expired` case
|
|
396
|
+
when you upgrade to the major. Do not confuse it with the delivery error
|
|
397
|
+
cause `request-ended`.
|
|
398
|
+
17. Give each send of one device its own timestamp. The next major makes the
|
|
399
|
+
timestamp unique per sender device. A new send with a timestamp that a
|
|
400
|
+
different send of the device used throws `InvalidSendTimestampError`. A
|
|
401
|
+
retry with the same `clientMessageId` keeps its timestamp. For a
|
|
402
|
+
`DataMessage` send, match delivery receipts with the returned
|
|
403
|
+
`SendResult.clientTimestamp`. For other content, keep the
|
|
404
|
+
`SendOptions.timestamp` that you supply.
|
|
405
|
+
18. Do not rely on two messages of one sender with one timestamp both
|
|
406
|
+
delivering. Two different messages of one sender device with one timestamp
|
|
407
|
+
both deliver in 13.x. In the next major, a recipient keeps the first such
|
|
408
|
+
message and drops a later one with no notice, also when another device of
|
|
409
|
+
the sender sent it. A custom store that checks or stores
|
|
410
|
+
`ReceiveWorkRecord.received` must accept a key with no `contentDigest` and
|
|
411
|
+
no `senderDeviceId`.
|
|
412
|
+
19. This release sends Relay protocol version 2. The Relay serves version 1
|
|
413
|
+
for at least 180 days after the publish of this release, and the earliest
|
|
414
|
+
end date is 2027-04-30. After that date, the Relay can stop
|
|
415
|
+
serving version 1, and SDK 13.4 and earlier stop. From SDK 10.1.0, an
|
|
416
|
+
HTTP call then throws `HostedRelayUpgradeRequiredError`, and the mailbox
|
|
417
|
+
subscription stops with the connection reason `upgrade-required`. Move
|
|
418
|
+
every client to this release or later before that date.
|
|
419
|
+
|
|
420
|
+
## 13.4.0
|
|
421
|
+
|
|
422
|
+
### Added
|
|
423
|
+
|
|
424
|
+
- `resumeHostedSignalProtocolClient()` from the root and `client` exports.
|
|
425
|
+
It requires the permanent identity keys, device key and scoped session already
|
|
426
|
+
held by the open store. It renews the device token and runs normal prekey
|
|
427
|
+
maintenance and client startup. It never requests an assertion or falls back
|
|
428
|
+
to registration, recovery or linking.
|
|
429
|
+
- `HostedRelayResumeError` reports a strict resume refusal with a code and phase.
|
|
430
|
+
When startup cleanup has not completed, `cleanupPending` keeps the actual
|
|
431
|
+
client stop handle. `retryCleanup()` retries that stop, without retrying resume
|
|
432
|
+
or closing the caller's store. The original failure remains the cause.
|
|
433
|
+
|
|
434
|
+
### Documentation
|
|
435
|
+
|
|
436
|
+
- The hosted identity recipe now links to the supported account suspension
|
|
437
|
+
procedure.
|
|
438
|
+
|
|
3
439
|
## 13.3.0
|
|
4
440
|
|
|
5
441
|
### Added
|
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.
|
|
42
|
+
Version `13.5.x`. Public APIs and persisted formats follow semantic versioning.
|
|
43
43
|
|
|
44
44
|
## Install
|
|
45
45
|
|
package/SECURITY.md
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The binary attachment of a send. The intent of a binary send stores it, so
|
|
3
|
+
* a repeat of the send reuses its one upload and its one serialized message.
|
|
4
|
+
*
|
|
5
|
+
* A binary send uploads the file and then sends a serialized attachment
|
|
6
|
+
* message that points to the upload. The intent keeps that message and the
|
|
7
|
+
* digest of the file. A send that repeats a stored `clientMessageId` with the
|
|
8
|
+
* same file sends the stored message again under the stored timestamp, and
|
|
9
|
+
* uploads nothing.
|
|
10
|
+
*
|
|
11
|
+
* The client marks the options of a new binary send with the attachment, and
|
|
12
|
+
* the direct and group intent builders copy the mark into the intent. The mark
|
|
13
|
+
* has a symbol key that no package subpath exports, and the client sets it
|
|
14
|
+
* after it spreads the application's options, so an application cannot set it.
|
|
15
|
+
*/
|
|
16
|
+
import type { StoredOutgoingMessageIntent } from '../local/store/reliability.js';
|
|
17
|
+
/** The key of the binary attachment mark. No package subpath exports it. */
|
|
18
|
+
export declare const SEND_BINARY_ATTACHMENT: unique symbol;
|
|
19
|
+
/** The options of a send, with the mark of its binary attachment. */
|
|
20
|
+
export interface SendBinaryAttachment {
|
|
21
|
+
readonly [SEND_BINARY_ATTACHMENT]?: NonNullable<StoredOutgoingMessageIntent['binaryAttachment']>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The `binaryAttachment` field of a new intent: the mark of the options, or
|
|
25
|
+
* no field when the options have no mark.
|
|
26
|
+
*/
|
|
27
|
+
export declare function intentBinaryAttachment(options: object): Pick<StoredOutgoingMessageIntent, 'binaryAttachment'>;
|
|
28
|
+
//# sourceMappingURL=binary-send.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary-send.d.ts","sourceRoot":"","sources":["../../client/binary-send.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAE9E,4EAA4E;AAC5E,eAAO,MAAM,sBAAsB,EAAE,OAAO,MAAuC,CAAC;AAEpF,qEAAqE;AACrE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,CAAC,sBAAsB,CAAC,CAAC,EAAE,WAAW,CAAC,2BAA2B,CAAC,kBAAkB,CAAC,CAAC,CAAC;CAClG;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,GACd,IAAI,CAAC,2BAA2B,EAAE,kBAAkB,CAAC,CAGvD"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The binary attachment of a send. The intent of a binary send stores it, so
|
|
3
|
+
* a repeat of the send reuses its one upload and its one serialized message.
|
|
4
|
+
*
|
|
5
|
+
* A binary send uploads the file and then sends a serialized attachment
|
|
6
|
+
* message that points to the upload. The intent keeps that message and the
|
|
7
|
+
* digest of the file. A send that repeats a stored `clientMessageId` with the
|
|
8
|
+
* same file sends the stored message again under the stored timestamp, and
|
|
9
|
+
* uploads nothing.
|
|
10
|
+
*
|
|
11
|
+
* The client marks the options of a new binary send with the attachment, and
|
|
12
|
+
* the direct and group intent builders copy the mark into the intent. The mark
|
|
13
|
+
* has a symbol key that no package subpath exports, and the client sets it
|
|
14
|
+
* after it spreads the application's options, so an application cannot set it.
|
|
15
|
+
*/
|
|
16
|
+
/** The key of the binary attachment mark. No package subpath exports it. */
|
|
17
|
+
export const SEND_BINARY_ATTACHMENT = Symbol('sendBinaryAttachment');
|
|
18
|
+
/**
|
|
19
|
+
* The `binaryAttachment` field of a new intent: the mark of the options, or
|
|
20
|
+
* no field when the options have no mark.
|
|
21
|
+
*/
|
|
22
|
+
export function intentBinaryAttachment(options) {
|
|
23
|
+
const binaryAttachment = options[SEND_BINARY_ATTACHMENT];
|
|
24
|
+
return binaryAttachment ? { binaryAttachment } : {};
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=binary-send.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary-send.js","sourceRoot":"","sources":["../../client/binary-send.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,4EAA4E;AAC5E,MAAM,CAAC,MAAM,sBAAsB,GAAkB,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAOpF;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,OAAe;IAEf,MAAM,gBAAgB,GAAI,OAAgC,CAAC,sBAAsB,CAAC,CAAC;IACnF,OAAO,gBAAgB,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACtD,CAAC"}
|
package/dist/client/client.d.ts
CHANGED
|
@@ -77,6 +77,7 @@ export {};
|
|
|
77
77
|
* @category Primary API
|
|
78
78
|
*/
|
|
79
79
|
export declare class DefaultSignalProtocolClient implements SignalProtocolClient {
|
|
80
|
+
#private;
|
|
80
81
|
private readonly manager;
|
|
81
82
|
private readonly _storage;
|
|
82
83
|
private readonly relay?;
|
|
@@ -190,6 +191,17 @@ export declare class DefaultSignalProtocolClient implements SignalProtocolClient
|
|
|
190
191
|
private readonly resendJobs;
|
|
191
192
|
/** Ends the subscription of the resend job driver to relay connection states. */
|
|
192
193
|
private resendJobsOnConnect;
|
|
194
|
+
/**
|
|
195
|
+
* Replays the open sends of the outbox, and ends each at its posting
|
|
196
|
+
* deadline. It starts with the retry request scheduler, at each relay
|
|
197
|
+
* transition to connected, and at the earliest deadline of an open send,
|
|
198
|
+
* and stop() stops it. Each pass is relay work, so its hooks run through
|
|
199
|
+
* that work. A replay runs the send path of an application call, so it
|
|
200
|
+
* takes the intent lock of the send.
|
|
201
|
+
*/
|
|
202
|
+
private readonly sendIntents;
|
|
203
|
+
/** Ends the subscription of the send driver to relay connection states. */
|
|
204
|
+
private sendDriverOnConnect;
|
|
193
205
|
/**
|
|
194
206
|
* The stop() in progress. It is set before a step of stop() runs, so a
|
|
195
207
|
* stop() call that overlaps it, also from a step, waits for it, and a
|
|
@@ -297,9 +309,9 @@ export declare class DefaultSignalProtocolClient implements SignalProtocolClient
|
|
|
297
309
|
private waitForStopReceiptSends;
|
|
298
310
|
/**
|
|
299
311
|
* The session reset steps of a retry request that ended as
|
|
300
|
-
* `expired-content`. Their session hooks run through
|
|
301
|
-
* and its stop signal stops their lock waits and relay
|
|
302
|
-
* none without a relay.
|
|
312
|
+
* `expired-content` or `posting-deadline`. Their session hooks run through
|
|
313
|
+
* the given context, and its stop signal stops their lock waits and relay
|
|
314
|
+
* requests. There are none without a relay.
|
|
303
315
|
*/
|
|
304
316
|
private retryTerminalReset;
|
|
305
317
|
/**
|
|
@@ -931,6 +943,25 @@ export declare class DefaultSignalProtocolClient implements SignalProtocolClient
|
|
|
931
943
|
*
|
|
932
944
|
* The client normalizes all inputs to Uint8Array before they reach the cipher layer.
|
|
933
945
|
*
|
|
946
|
+
* A direct or group send has a posting deadline: the earlier of 24 hours
|
|
947
|
+
* after the SDK first stores the send and 24 hours after its timestamp. A
|
|
948
|
+
* replay with the same `clientMessageId` or a restart never moves it. At or
|
|
949
|
+
* after the deadline, the SDK starts no relay request for the send. A
|
|
950
|
+
* request that started before it still counts when its answer arrives
|
|
951
|
+
* later. When the deadline ends with a device of unknown acceptance, the
|
|
952
|
+
* send throws `SendAcceptanceUnknownError`. Otherwise the send ends failed:
|
|
953
|
+
* when the call raised a refusal (a thrown refusal or a refusal in the
|
|
954
|
+
* receipt of a shared body), it throws the first such refusal. Otherwise it
|
|
955
|
+
* throws an `Error` with the stored code of the first refused device that
|
|
956
|
+
* has one, in the order of the destinations. Otherwise it throws
|
|
957
|
+
* `SendNeverAcceptedByRelayError` with code `SEND_NEVER_ACCEPTED`. A send
|
|
958
|
+
* error before the deadline gives `deadlineAt`, and `retryable` is true
|
|
959
|
+
* when a replay can still post the send.
|
|
960
|
+
*
|
|
961
|
+
* A backdated `timestamp` shortens the deadline. A send with a timestamp
|
|
962
|
+
* 23 hours old has at most 1 hour to post. A send with a timestamp 24 hours
|
|
963
|
+
* old posts nothing and throws `SendNeverAcceptedByRelayError`.
|
|
964
|
+
*
|
|
934
965
|
* @param recipientId - User ID or group ID (groups use the package group ID prefix)
|
|
935
966
|
* @param content - DataMessageInput, string, or Uint8Array to encrypt and send
|
|
936
967
|
* @param options - Optional send options (isBinary for blob encryption, etc.)
|
|
@@ -957,10 +988,18 @@ export declare class DefaultSignalProtocolClient implements SignalProtocolClient
|
|
|
957
988
|
/**
|
|
958
989
|
* Send with session callbacks whose hooks run through the given context.
|
|
959
990
|
* The stop signal of relay work ends a wait for the recipient's lock.
|
|
991
|
+
*
|
|
992
|
+
* The send driver gives a driven `report`: the end write of the send then
|
|
993
|
+
* marks the intent, and the driver reports the end. For an application
|
|
994
|
+
* call, the end write or the completion write of this call records the end
|
|
995
|
+
* in memory, and `onSendOutcome` runs once before the call returns or
|
|
996
|
+
* throws.
|
|
960
997
|
*/
|
|
961
998
|
private sendWithContext;
|
|
962
999
|
/** Send under a logical-send identifier that the caller already chose. */
|
|
963
1000
|
private sendIdentified;
|
|
1001
|
+
/** @see SignalProtocolClient.resendMessage */
|
|
1002
|
+
resendMessage(clientMessageId: string): Promise<SendResult>;
|
|
964
1003
|
/** @see SignalProtocolClient.forgetSentContent */
|
|
965
1004
|
forgetSentContent(clientMessageId: string): Promise<boolean>;
|
|
966
1005
|
/** @see SignalProtocolClient.getPendingRecipients */
|
|
@@ -1066,9 +1105,11 @@ export declare class DefaultSignalProtocolClient implements SignalProtocolClient
|
|
|
1066
1105
|
*/
|
|
1067
1106
|
private startRetryRequests;
|
|
1068
1107
|
/**
|
|
1069
|
-
* Start the retry request scheduler
|
|
1070
|
-
* pass in the background. Each relay transition to
|
|
1071
|
-
* resend jobs again until stop().
|
|
1108
|
+
* Start the retry request scheduler, the resend job driver and the send
|
|
1109
|
+
* driver, each with a pass in the background. Each relay transition to
|
|
1110
|
+
* connected runs the resend jobs and the send driver again until stop().
|
|
1111
|
+
* On a store with no `listMetadataKeys`, the send driver logs one line and
|
|
1112
|
+
* stays disabled, with no subscription.
|
|
1072
1113
|
*/
|
|
1073
1114
|
private startRetryLifecycle;
|
|
1074
1115
|
/**
|