@open-e2ee/signal-protocol-sdk 9.4.0 → 10.0.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/ADAPTERS.md +1 -0
- package/CHANGELOG.md +229 -0
- package/README.md +1 -1
- package/SECURITY.md +4 -4
- package/client/README.md +29 -12
- package/dist/client/client.d.ts +75 -63
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/client.js +207 -179
- package/dist/client/client.js.map +1 -1
- package/dist/client/config.d.ts +18 -3
- package/dist/client/config.d.ts.map +1 -1
- package/dist/client/config.js.map +1 -1
- package/dist/client/constants.d.ts +2 -10
- package/dist/client/constants.d.ts.map +1 -1
- package/dist/client/constants.js +3 -12
- package/dist/client/constants.js.map +1 -1
- package/dist/client/content-adapter.d.ts +8 -0
- package/dist/client/content-adapter.d.ts.map +1 -1
- package/dist/client/content-adapter.js +4 -0
- package/dist/client/content-adapter.js.map +1 -1
- package/dist/client/delivery-status.d.ts +50 -0
- package/dist/client/delivery-status.d.ts.map +1 -0
- package/dist/client/delivery-status.js +121 -0
- package/dist/client/delivery-status.js.map +1 -0
- package/dist/client/event-hooks.d.ts +44 -10
- package/dist/client/event-hooks.d.ts.map +1 -1
- package/dist/client/event-hooks.js +26 -0
- package/dist/client/event-hooks.js.map +1 -1
- package/dist/client/hosted-anonymous-delivery.d.ts +2 -2
- package/dist/client/hosted-anonymous-delivery.d.ts.map +1 -1
- package/dist/client/hosted-anonymous-delivery.js +7 -4
- package/dist/client/hosted-anonymous-delivery.js.map +1 -1
- package/dist/client/hosted-mailbox-subscription.d.ts +39 -6
- package/dist/client/hosted-mailbox-subscription.d.ts.map +1 -1
- package/dist/client/hosted-mailbox-subscription.js +133 -26
- package/dist/client/hosted-mailbox-subscription.js.map +1 -1
- package/dist/client/hosted-push.d.ts +4 -3
- package/dist/client/hosted-push.d.ts.map +1 -1
- package/dist/client/hosted-push.js +18 -6
- package/dist/client/hosted-push.js.map +1 -1
- package/dist/client/hosted-transport.d.ts +26 -6
- package/dist/client/hosted-transport.d.ts.map +1 -1
- package/dist/client/hosted-transport.js +101 -14
- package/dist/client/hosted-transport.js.map +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/messages.d.ts +4 -2
- package/dist/client/messages.d.ts.map +1 -1
- package/dist/client/messages.js +32 -7
- package/dist/client/messages.js.map +1 -1
- package/dist/client/relay-acceptance.d.ts +8 -0
- package/dist/client/relay-acceptance.d.ts.map +1 -1
- package/dist/client/relay-acceptance.js +7 -0
- package/dist/client/relay-acceptance.js.map +1 -1
- package/dist/client/relay-receipt-intake.d.ts +70 -0
- package/dist/client/relay-receipt-intake.d.ts.map +1 -0
- package/dist/client/relay-receipt-intake.js +111 -0
- package/dist/client/relay-receipt-intake.js.map +1 -0
- package/dist/client/relay-receipt-join.d.ts +50 -0
- package/dist/client/relay-receipt-join.d.ts.map +1 -0
- package/dist/client/relay-receipt-join.js +106 -0
- package/dist/client/relay-receipt-join.js.map +1 -0
- package/dist/client/relay-subscription.d.ts +12 -0
- package/dist/client/relay-subscription.d.ts.map +1 -1
- package/dist/client/relay-subscription.js +246 -83
- package/dist/client/relay-subscription.js.map +1 -1
- package/dist/client/retry-family.d.ts +119 -0
- package/dist/client/retry-family.d.ts.map +1 -0
- package/dist/client/retry-family.js +170 -0
- package/dist/client/retry-family.js.map +1 -0
- package/dist/client/retry-request-envelope.d.ts +106 -0
- package/dist/client/retry-request-envelope.d.ts.map +1 -0
- package/dist/client/retry-request-envelope.js +245 -0
- package/dist/client/retry-request-envelope.js.map +1 -0
- package/dist/client/retry.d.ts +63 -22
- package/dist/client/retry.d.ts.map +1 -1
- package/dist/client/retry.js +234 -136
- package/dist/client/retry.js.map +1 -1
- package/dist/client/sealed-sender.d.ts +15 -3
- package/dist/client/sealed-sender.d.ts.map +1 -1
- package/dist/client/sealed-sender.js +22 -3
- package/dist/client/sealed-sender.js.map +1 -1
- package/dist/client/signal-service-cipher.d.ts +64 -1
- package/dist/client/signal-service-cipher.d.ts.map +1 -1
- package/dist/client/signal-service-cipher.js +212 -17
- package/dist/client/signal-service-cipher.js.map +1 -1
- package/dist/client/state.d.ts +7 -60
- package/dist/client/state.d.ts.map +1 -1
- package/dist/client/state.js +8 -86
- package/dist/client/state.js.map +1 -1
- package/dist/client/types.d.ts +11 -3
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client/types.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/protocol/sealed-sender/types.d.ts +1 -1
- package/dist/internal/protocol/sealed-sender/types.js +1 -1
- package/dist/local/store/received-content.d.ts +16 -2
- package/dist/local/store/received-content.d.ts.map +1 -1
- package/dist/local/store/received-content.js +18 -3
- package/dist/local/store/received-content.js.map +1 -1
- package/dist/local/store/reliability.d.ts +291 -2
- package/dist/local/store/reliability.d.ts.map +1 -1
- package/dist/local/store/reliability.js +451 -13
- package/dist/local/store/reliability.js.map +1 -1
- package/dist/remote/relay/index.d.ts +1 -1
- package/dist/remote/relay/index.d.ts.map +1 -1
- package/dist/remote/relay/index.js.map +1 -1
- package/dist/remote/relay/types.d.ts +34 -30
- package/dist/remote/relay/types.d.ts.map +1 -1
- package/dist/types/api.d.ts +43 -22
- package/dist/types/api.d.ts.map +1 -1
- package/docs/ASSURANCE.md +5 -5
- package/docs/DEVIATIONS.md +4 -5
- package/docs/INTERFACES.md +2 -0
- package/package.json +1 -1
|
@@ -1,6 +1,17 @@
|
|
|
1
|
+
import type { Envelope } from '../../remote/relay/types.js';
|
|
1
2
|
import type { SignalProtocolLocalStore } from '../../types/index.js';
|
|
2
3
|
import type { ContentHint } from '../../types/messages.js';
|
|
3
4
|
export declare const RELIABILITY_RECORD_TTL_MS: number;
|
|
5
|
+
/**
|
|
6
|
+
* The lifetime of the retry-request and retry-family records of the
|
|
7
|
+
* requester, and of a fulfilled processed-envelope record. Two bounds set
|
|
8
|
+
* it. A sender refuses a retry request for a message older than
|
|
9
|
+
* `RELIABILITY_RECORD_TTL_MS`, so its last resend post comes at most that
|
|
10
|
+
* long after the failure. The Relay keeps a post for at most
|
|
11
|
+
* `RELIABILITY_RECORD_TTL_MS`, so a resend can arrive up to twice that
|
|
12
|
+
* time after the failure.
|
|
13
|
+
*/
|
|
14
|
+
export declare const RETRY_REQUESTER_RECORD_TTL_MS: number;
|
|
4
15
|
export interface StoredOutgoingDeviceMessage {
|
|
5
16
|
recipientUserId: string;
|
|
6
17
|
recipientDeviceId: number;
|
|
@@ -74,8 +85,286 @@ export declare function reconcileOutgoingDirectDeviceMessages(store: Reliability
|
|
|
74
85
|
export declare function replaceOutgoingDirectDeviceMessage(store: ReliabilityMetadataStore, clientMessageId: string, expected: StoredOutgoingDeviceMessage, replacement: StoredOutgoingDeviceMessage): Promise<StoredOutgoingMessageIntent>;
|
|
75
86
|
export declare function getOutgoingMessageIntent(store: ReliabilityMetadataStore, clientMessageId: string, now?: number): Promise<StoredOutgoingMessageIntent | null>;
|
|
76
87
|
export declare function storeOutgoingMessageIntent(store: ReliabilityMetadataStore, intent: StoredOutgoingMessageIntent, now?: number): Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* The client message IDs of the intents with this client timestamp. More
|
|
90
|
+
* than one intent can have the same timestamp, so the caller matches the
|
|
91
|
+
* recipient.
|
|
92
|
+
*/
|
|
93
|
+
export declare function getSentClientMessageIds(store: ReliabilityMetadataStore, clientTimestamp: number): Promise<string[]>;
|
|
94
|
+
/** A source that tells that a recipient device has a message. */
|
|
95
|
+
export type StoredDeliverySource = 'relay' | 'e2ee';
|
|
96
|
+
/** The delivery of one message to one recipient device. */
|
|
97
|
+
export interface StoredDeviceDelivery {
|
|
98
|
+
/** Each source of the delivery, once, in the order of arrival. */
|
|
99
|
+
sources: StoredDeliverySource[];
|
|
100
|
+
/** The time of the first source, in epoch milliseconds. */
|
|
101
|
+
deliveredAt: number;
|
|
102
|
+
/** The number of leading `sources` that the client announced. */
|
|
103
|
+
announced: number;
|
|
104
|
+
}
|
|
105
|
+
/** The delivery status of one outgoing message, by recipient user and device. */
|
|
106
|
+
export interface StoredDeliveryStatus {
|
|
107
|
+
clientMessageId: string;
|
|
108
|
+
/** The creation time of the intent. The status expires with the intent. */
|
|
109
|
+
createdAt: number;
|
|
110
|
+
devices: Record<string, Record<string, StoredDeviceDelivery>>;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Read and change the delivery status of one outgoing message in one
|
|
114
|
+
* serialized step. The step also reads the outbox intent, so an intent that
|
|
115
|
+
* completes during a receipt is seen by either the receipt or the next
|
|
116
|
+
* step. `update` changes `status` in place. A changed status is written.
|
|
117
|
+
* Resolves to undefined, and changes nothing, when no intent of this client
|
|
118
|
+
* message ID counts.
|
|
119
|
+
*/
|
|
120
|
+
export declare function updateDeliveryStatus<T>(store: ReliabilityMetadataStore, clientMessageId: string, update: (status: StoredDeliveryStatus, intent: StoredOutgoingMessageIntent) => T, now?: number): Promise<T | undefined>;
|
|
77
121
|
export declare function completeOutgoingMessageIntent(store: ReliabilityMetadataStore, clientMessageId: string, result: NonNullable<StoredOutgoingMessageIntent['result']>): Promise<void>;
|
|
78
|
-
|
|
79
|
-
export
|
|
122
|
+
/** The record of one envelope ID that the local device processed. */
|
|
123
|
+
export interface ProcessedEnvelope {
|
|
124
|
+
/** The time of the processing. The record expires from this time. */
|
|
125
|
+
processedAt: number;
|
|
126
|
+
/** The fingerprint of the processed envelope. */
|
|
127
|
+
fingerprint?: string;
|
|
128
|
+
/**
|
|
129
|
+
* True when the application got the content of this failed envelope,
|
|
130
|
+
* from the envelope itself or from a resend. The requester then drops
|
|
131
|
+
* each later member of its retry family.
|
|
132
|
+
*/
|
|
133
|
+
fulfilled?: true;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Get the processed-envelope record of one envelope ID. A record older
|
|
137
|
+
* than `RELIABILITY_RECORD_TTL_MS` does not count. A fulfilled record
|
|
138
|
+
* counts for `RETRY_REQUESTER_RECORD_TTL_MS`.
|
|
139
|
+
*/
|
|
140
|
+
export declare function getProcessedEnvelope(store: ReliabilityMetadataStore, envelopeId: string, now?: number): Promise<ProcessedEnvelope | null>;
|
|
141
|
+
/**
|
|
142
|
+
* Tell whether the local device processed one envelope ID. A record counts
|
|
143
|
+
* for the lifetime that `getProcessedEnvelope` applies.
|
|
144
|
+
*/
|
|
145
|
+
export declare function hasProcessedEnvelope(store: ReliabilityMetadataStore, envelopeId: string, now?: number): Promise<boolean>;
|
|
146
|
+
/**
|
|
147
|
+
* Record that the local device processed one envelope ID. The write keeps
|
|
148
|
+
* the fingerprint and the fulfilled flag of a record that counts, so a
|
|
149
|
+
* later store for the same ID never clears them.
|
|
150
|
+
*
|
|
151
|
+
* @param fulfilled - True when the application got the content of this
|
|
152
|
+
* failed envelope. The processed fact and the fulfilled fact are then
|
|
153
|
+
* one write.
|
|
154
|
+
*/
|
|
155
|
+
export declare function storeProcessedEnvelope(store: ReliabilityMetadataStore, envelopeId: string, processedAt?: number, fingerprint?: string, fulfilled?: true): Promise<void>;
|
|
156
|
+
/**
|
|
157
|
+
* The relay gave a failed envelope ID again with other content after the
|
|
158
|
+
* local device stored a retry request for that ID.
|
|
159
|
+
*/
|
|
160
|
+
export declare class RetryRequestedEnvelopeChangedError extends Error {
|
|
161
|
+
constructor();
|
|
162
|
+
}
|
|
163
|
+
/** Tell whether a value has the shape of a retry ID. */
|
|
164
|
+
export declare function isRetryId(value: unknown): value is string;
|
|
165
|
+
/**
|
|
166
|
+
* The client message ID of the retry request with one retry ID. The first
|
|
167
|
+
* attempt of that request posts under this ID.
|
|
168
|
+
*/
|
|
169
|
+
export declare function retryRequestClientMessageId(retryId: string): string;
|
|
170
|
+
/**
|
|
171
|
+
* The resend ID of the content resend for one retry ID. The first attempt of
|
|
172
|
+
* that resend posts under this ID.
|
|
173
|
+
*/
|
|
174
|
+
export declare function retryResendClientMessageId(retryId: string): string;
|
|
175
|
+
/**
|
|
176
|
+
* The resend ID of the null message for one retry ID. It is not the content
|
|
177
|
+
* resend ID, so a null message never posts content bytes.
|
|
178
|
+
*/
|
|
179
|
+
export declare function retryNullMessageClientMessageId(retryId: string): string;
|
|
180
|
+
/**
|
|
181
|
+
* The client message ID of one attempt of a retry request or a retry resend.
|
|
182
|
+
* Attempt 1 posts under the given ID, and attempt `n` posts under
|
|
183
|
+
* `<id>:<n>`. A resend takes the attempt number of the request that it
|
|
184
|
+
* answers. A new encryption for the same request attempt posts the same
|
|
185
|
+
* ID, and the processed ledger of the requester and the RETRY_CONFLICT
|
|
186
|
+
* answer of the Relay cover the new bytes.
|
|
187
|
+
*/
|
|
188
|
+
export declare function retryAttemptClientMessageId(id: string, attempt: number): string;
|
|
189
|
+
/**
|
|
190
|
+
* The two IDs that a retry request payload carries: the failed envelope and
|
|
191
|
+
* the retry ID of the request record. The resend and the null message IDs
|
|
192
|
+
* derive from the retry ID and from the attempt number of the request
|
|
193
|
+
* envelope that they answer.
|
|
194
|
+
*/
|
|
195
|
+
export interface RetryRequestIds {
|
|
196
|
+
/** The Relay message ID of the envelope that the requester could not decrypt. */
|
|
197
|
+
failedEnvelopeId: string;
|
|
198
|
+
/** The retry ID of the request record. */
|
|
199
|
+
retryId: string;
|
|
200
|
+
}
|
|
201
|
+
/** An envelope ID that one retry ID derives. */
|
|
202
|
+
export interface RetryFamilyMember {
|
|
203
|
+
/** The retry ID: the family key on the wire. */
|
|
204
|
+
retryId: string;
|
|
205
|
+
/** The retry request, the content resend or the null message. */
|
|
206
|
+
kind: 'retry-request' | 'resend' | 'null';
|
|
207
|
+
/** The attempt number of the ID, from 1. */
|
|
208
|
+
attempt: number;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* The retry ID, the kind and the attempt number of an envelope whose ID has
|
|
212
|
+
* the shape of a retry attempt: `<retryId>:retry-request[:n]`,
|
|
213
|
+
* `<retryId>:resend[:n]` or `<retryId>:null[:n]`, with `n` from 2. An ID
|
|
214
|
+
* with no `n` is attempt 1. Undefined for any other ID. Only the family
|
|
215
|
+
* index of the requester tells which failed envelope a retry ID names.
|
|
216
|
+
*/
|
|
217
|
+
export declare function retryFamilyMember(envelopeId: string): RetryFamilyMember | undefined;
|
|
218
|
+
/**
|
|
219
|
+
* The attempt number of the retry request that a resend or a null message
|
|
220
|
+
* answers, from the request envelope ID. The answer carries this number,
|
|
221
|
+
* so the requester can tell which of its attempts the answer is for.
|
|
222
|
+
* Throws when the ID is not a retry request of the retry ID: the requester
|
|
223
|
+
* makes each request envelope ID, so the sender never answers another ID.
|
|
224
|
+
*/
|
|
225
|
+
export declare function retryRequestAttempt(target: Pick<RetryResendTarget, 'retryId' | 'requestEnvelopeId'>): number;
|
|
226
|
+
/** A resend or a null message that answers a retry request of the local device. */
|
|
227
|
+
export interface ResolvedRetryFamilyMember {
|
|
228
|
+
/** The retry ID of the request record. */
|
|
229
|
+
retryId: string;
|
|
230
|
+
/** The ID of the failed envelope that the request record names. */
|
|
231
|
+
failedEnvelopeId: string;
|
|
232
|
+
/** The content resend or the null message. */
|
|
233
|
+
kind: 'resend' | 'null';
|
|
234
|
+
/** The attempt number of the member ID, from 1. */
|
|
235
|
+
attempt: number;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Get the failed envelope ID that the family index gives for one retry ID.
|
|
239
|
+
* A record older than `RETRY_REQUESTER_RECORD_TTL_MS` does not count.
|
|
240
|
+
*/
|
|
241
|
+
export declare function getRetryFamily(store: ReliabilityMetadataStore, retryId: string, now?: number): Promise<string | null>;
|
|
242
|
+
/**
|
|
243
|
+
* Resolve an envelope ID to the request record that it answers. An ID that
|
|
244
|
+
* has the shape of a resend or a null message is a family member only when
|
|
245
|
+
* the family index of the local device holds its retry ID. Any other ID
|
|
246
|
+
* gives undefined, and the envelope is an ordinary envelope.
|
|
247
|
+
*
|
|
248
|
+
* The sender of a member is not bound to the target of the request. The
|
|
249
|
+
* retry ID is a random UUID that only the requester, the Relay and the
|
|
250
|
+
* requested sender see, so another sender cannot name it.
|
|
251
|
+
*/
|
|
252
|
+
export declare function resolveRetryFamilyMember(store: ReliabilityMetadataStore, envelopeId: string, now?: number): Promise<ResolvedRetryFamilyMember | undefined>;
|
|
253
|
+
/**
|
|
254
|
+
* The stored attempt of the retry request for one failed envelope, keyed by
|
|
255
|
+
* the failed envelope ID. A later decrypt failure of that envelope posts
|
|
256
|
+
* this envelope again, so the Relay sees one operation for each attempt. A
|
|
257
|
+
* resend or a null message of the same attempt number that arrives marks
|
|
258
|
+
* the attempt answered. A decrypt failure of a resend or a null message
|
|
259
|
+
* posts the next attempt under the same retry ID when the stored attempt is
|
|
260
|
+
* answered, and posts the stored envelope again when it is not.
|
|
261
|
+
*/
|
|
262
|
+
export interface StoredRetryRequest {
|
|
263
|
+
/** The ID of the envelope that the local device could not decrypt: the key of the record. */
|
|
264
|
+
failedEnvelopeId: string;
|
|
265
|
+
/** The retry ID of the record. Every attempt of the record uses it. */
|
|
266
|
+
retryId: string;
|
|
267
|
+
/** The number of the stored attempt, from 1. It names the client message ID of its post. */
|
|
268
|
+
attempt: number;
|
|
269
|
+
/** The time of the stored attempt. The record expires from this time. */
|
|
270
|
+
requestedAt: number;
|
|
271
|
+
/** The fingerprint of the failed envelope. */
|
|
272
|
+
fingerprint?: string;
|
|
273
|
+
/**
|
|
274
|
+
* True when a resend or a null message of this attempt number arrived.
|
|
275
|
+
* Each new attempt stores false. The member whose decrypt failure created
|
|
276
|
+
* attempt n is of an earlier attempt number, so its redelivery does not
|
|
277
|
+
* answer attempt n, and its post is a replay.
|
|
278
|
+
*/
|
|
279
|
+
answered: boolean;
|
|
280
|
+
/** The request envelope of the stored attempt. */
|
|
281
|
+
envelope: Envelope;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Get the stored retry request for one failed envelope. A record older than
|
|
285
|
+
* `RETRY_REQUESTER_RECORD_TTL_MS` does not count.
|
|
286
|
+
*
|
|
287
|
+
* @throws RetryRequestedEnvelopeChangedError When the stored fingerprint is
|
|
288
|
+
* not the given fingerprint.
|
|
289
|
+
*/
|
|
290
|
+
export declare function getRetryRequest(store: ReliabilityMetadataStore, failedEnvelopeId: string, now?: number, fingerprint?: string): Promise<StoredRetryRequest | null>;
|
|
291
|
+
/**
|
|
292
|
+
* Mark the stored attempt of a retry request answered when a resend or a
|
|
293
|
+
* null message of its retry ID and its attempt number arrives. A member of
|
|
294
|
+
* another attempt number answers nothing. An expired record, a record of
|
|
295
|
+
* another retry ID and an answered attempt stay as they are.
|
|
296
|
+
*
|
|
297
|
+
* @param store - The local store that keeps the request records.
|
|
298
|
+
* @param failedEnvelopeId - The failed envelope of the family.
|
|
299
|
+
* @param retryId - The retry ID of the arriving envelope.
|
|
300
|
+
* @param attempt - The attempt number of the arriving envelope ID.
|
|
301
|
+
* @param now - The current time.
|
|
302
|
+
*/
|
|
303
|
+
export declare function markRetryRequestAnswered(store: ReliabilityMetadataStore, failedEnvelopeId: string, retryId: string, attempt: number, now?: number): Promise<void>;
|
|
304
|
+
/**
|
|
305
|
+
* Record the request envelope of a retry request before its post, and the
|
|
306
|
+
* family index entry from its retry ID to the failed envelope ID. One
|
|
307
|
+
* mutation writes both. The two writes are serialized, not atomic, and the
|
|
308
|
+
* index write comes first. Only a failure between the two writes leaves an
|
|
309
|
+
* index entry with no request record, so the case is practically
|
|
310
|
+
* unreachable. A member of that retry ID then still resolves to the
|
|
311
|
+
* failed envelope. Its decrypt stores the failed envelope processed, and
|
|
312
|
+
* its decrypt failure creates attempt 1 under a new retry ID. A record
|
|
313
|
+
* that a member creates has no fingerprint, so a later failure of the
|
|
314
|
+
* failed envelope with a fingerprint reads as a changed envelope and posts
|
|
315
|
+
* nothing. A later attempt replaces the earlier one in one write, so the
|
|
316
|
+
* record holds an attempt at each point.
|
|
317
|
+
*/
|
|
318
|
+
export declare function storeRetryRequest(store: ReliabilityMetadataStore, request: StoredRetryRequest): Promise<void>;
|
|
319
|
+
/**
|
|
320
|
+
* The retry request that a resend or a null message answers. The sender
|
|
321
|
+
* takes it from the request envelope and its payload.
|
|
322
|
+
*/
|
|
323
|
+
export interface RetryResendTarget {
|
|
324
|
+
/** The retry ID of the requester's record. The answer IDs derive from it. */
|
|
325
|
+
retryId: string;
|
|
326
|
+
/** The ID of the request attempt that the answer goes to. */
|
|
327
|
+
requestEnvelopeId: string;
|
|
328
|
+
/** The ID of the envelope that the requester could not decrypt. */
|
|
329
|
+
failedEnvelopeId: string;
|
|
330
|
+
/** A resend of the content, or the null message of a session reset. */
|
|
331
|
+
kind: 'resend' | 'null';
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* The stored answer to the retry requests for one failed envelope. The
|
|
335
|
+
* record key is the device that gets the answer and the failed envelope
|
|
336
|
+
* ID. The record holds the last encryption: a later post for the same
|
|
337
|
+
* request attempt and kind sends these bytes with this operation epoch
|
|
338
|
+
* again, so the Relay sees one operation.
|
|
339
|
+
*/
|
|
340
|
+
export interface StoredRetryResend extends RetryResendTarget {
|
|
341
|
+
/**
|
|
342
|
+
* The attempt number of the request that the answer goes to, from
|
|
343
|
+
* `retryRequestAttempt`. With the retry ID and the kind, it names the
|
|
344
|
+
* client message ID of the post.
|
|
345
|
+
*/
|
|
346
|
+
attempt: number;
|
|
347
|
+
/** The operation epoch of the stored bytes. The record expires from this time. */
|
|
348
|
+
operationEpochMilliseconds: number;
|
|
349
|
+
transportMode: StoredOutgoingMessageIntent['transportMode'];
|
|
350
|
+
sealedSenderAuth?: {
|
|
351
|
+
type: 'accessKey';
|
|
352
|
+
unidentifiedAccessKey: string;
|
|
353
|
+
};
|
|
354
|
+
contentHint?: ContentHint;
|
|
355
|
+
message: StoredOutgoingDeviceMessage;
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Get the stored answer to one device for one failed envelope. A record
|
|
359
|
+
* older than `RELIABILITY_RECORD_TTL_MS` does not count.
|
|
360
|
+
*/
|
|
361
|
+
export declare function getRetryResend(store: ReliabilityMetadataStore, recipientUserId: string, recipientDeviceId: number, failedEnvelopeId: string, now?: number): Promise<StoredRetryResend | null>;
|
|
362
|
+
/**
|
|
363
|
+
* Record the encrypted bytes of a retry resend before their post. A later
|
|
364
|
+
* encryption replaces the earlier one in one write, so the record holds an
|
|
365
|
+
* encryption at each point. Throws, and writes nothing, when the attempt
|
|
366
|
+
* is not the attempt number of the request envelope.
|
|
367
|
+
*/
|
|
368
|
+
export declare function storeRetryResend(store: ReliabilityMetadataStore, resend: StoredRetryResend): Promise<void>;
|
|
80
369
|
export {};
|
|
81
370
|
//# sourceMappingURL=reliability.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reliability.d.ts","sourceRoot":"","sources":["../../../local/store/reliability.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"reliability.d.ts","sourceRoot":"","sources":["../../../local/store/reliability.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAYxD,eAAO,MAAM,yBAAyB,QAAc,CAAC;AAErD;;;;;;;;GAQG;AACH,eAAO,MAAM,6BAA6B,QAAgC,CAAC;AAE3E,MAAM,WAAW,2BAA2B;IAC1C,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,eAAe,GAAG,YAAY,GAAG,YAAY,CAAC;IAC3D,uBAAuB,CAAC,EAAE,MAAM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