@ping-app/ping-openmls-sdk 0.10.3 → 0.10.5
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/README.md +13 -10
- package/dist/index.cjs +1359 -274
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +968 -146
- package/dist/index.d.ts +968 -146
- package/dist/index.js +1319 -271
- package/dist/index.js.map +1 -1
- package/dist/notification-preview.cjs +1 -3
- package/dist/notification-preview.cjs.map +1 -1
- package/dist/notification-preview.d.cts +1 -8
- package/dist/notification-preview.d.ts +1 -8
- package/dist/notification-preview.js +1 -3
- package/dist/notification-preview.js.map +1 -1
- package/dist/storage/indexeddb.cjs +4 -3
- package/dist/storage/indexeddb.cjs.map +1 -1
- package/dist/storage/indexeddb.d.cts +1 -1
- package/dist/storage/indexeddb.d.ts +1 -1
- package/dist/storage/indexeddb.js +4 -3
- package/dist/storage/indexeddb.js.map +1 -1
- package/dist/transport/websocket.d.cts +1 -1
- package/dist/transport/websocket.d.ts +1 -1
- package/dist/{types-BOXvsHgp.d.cts → types-omhvRjtq.d.cts} +314 -45
- package/dist/{types-BOXvsHgp.d.ts → types-omhvRjtq.d.ts} +314 -45
- package/dist/worker.cjs +685 -70
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.js +714 -81
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
- package/wasm/package.json +1 -1
- package/wasm/ping_wasm.d.ts +524 -115
- package/wasm/ping_wasm.js +1369 -342
- package/wasm/ping_wasm_bg.wasm +0 -0
- package/wasm/ping_wasm_bg.wasm.d.ts +73 -21
|
@@ -115,7 +115,7 @@ interface DeviceReauthProof {
|
|
|
115
115
|
}
|
|
116
116
|
/** Link verification v2: an approving device's signed consent to ONE new device on
|
|
117
117
|
* ONE server link session (`POST /v1/auth/link/sessions`). Produced by
|
|
118
|
-
* `MessagingClient.
|
|
118
|
+
* `MessagingClient.signDeviceLinkApprovalFor`. Not secret, but none of it belongs in a
|
|
119
119
|
* log line. */
|
|
120
120
|
interface DeviceLinkApproval {
|
|
121
121
|
/** SHA-256 of the approving device's public key (32 bytes). */
|
|
@@ -133,15 +133,44 @@ interface DeviceLinkPossession {
|
|
|
133
133
|
/** Ed25519 signature over the SDK-built possession message (64 bytes). */
|
|
134
134
|
signature: Uint8Array;
|
|
135
135
|
}
|
|
136
|
-
|
|
136
|
+
/**
|
|
137
|
+
* The linking ticket, version 3 (the device link under the root design):
|
|
138
|
+
* the account named by its root public key, the NEW device's version 2
|
|
139
|
+
* credential (its last link signed by the approving device's own key), the
|
|
140
|
+
* root's sealing key statement, the DeviceGroup Welcome and the catch-up
|
|
141
|
+
* snapshot. No account key signs it.
|
|
142
|
+
*/
|
|
143
|
+
interface LinkingTicketV3 {
|
|
137
144
|
v: number;
|
|
138
145
|
user_id: UserId;
|
|
139
|
-
|
|
146
|
+
root_pubkey: Bytes;
|
|
140
147
|
new_device_id: DeviceId;
|
|
141
|
-
|
|
148
|
+
credential: Bytes;
|
|
149
|
+
sealing_statement: {
|
|
150
|
+
generation: number;
|
|
151
|
+
public_key: Bytes;
|
|
152
|
+
signature: Bytes;
|
|
153
|
+
};
|
|
142
154
|
device_group_welcome: Bytes;
|
|
155
|
+
/** The DeviceGroup's log head at the Add: the new device anchors its
|
|
156
|
+
* DeviceGroup cursor there when it joins. No host step. */
|
|
157
|
+
device_group_head: number;
|
|
143
158
|
catchup_snapshot: Bytes;
|
|
144
159
|
}
|
|
160
|
+
/** The two account values of the link-auth envelope, version 6.
|
|
161
|
+
* `generationSecret` is a SECRET (32 bytes): it goes into the envelope the
|
|
162
|
+
* host seals with `sealLinkAuthFor`, and nowhere else. */
|
|
163
|
+
interface LinkGeneration {
|
|
164
|
+
generation: number;
|
|
165
|
+
generationSecret: Bytes;
|
|
166
|
+
}
|
|
167
|
+
/** What a completed link made. Public values. */
|
|
168
|
+
interface LinkedDevice {
|
|
169
|
+
userId: Bytes;
|
|
170
|
+
deviceId: Bytes;
|
|
171
|
+
generation: number;
|
|
172
|
+
depth: number;
|
|
173
|
+
}
|
|
145
174
|
interface DiscoveredDevice {
|
|
146
175
|
device_id: DeviceId;
|
|
147
176
|
key_package: Bytes;
|
|
@@ -168,28 +197,6 @@ interface AdmitChatOutcome {
|
|
|
168
197
|
/** Set when `status === "failed"`. The underlying transport / MLS error. */
|
|
169
198
|
error?: string;
|
|
170
199
|
}
|
|
171
|
-
/** One conversation `rotateIdentity` could not rotate, with the error that
|
|
172
|
-
* stopped it. Kept for type compatibility: `rotateIdentity` is retired and
|
|
173
|
-
* always rejects. */
|
|
174
|
-
interface IdentityRotationFailure {
|
|
175
|
-
conversationId: ConversationId;
|
|
176
|
-
/** The underlying transport / MLS error. */
|
|
177
|
-
error: string;
|
|
178
|
-
}
|
|
179
|
-
/** Result of `rotateIdentity`. Kept for type compatibility: `rotateIdentity`
|
|
180
|
-
* is retired and always rejects, so no call returns one. */
|
|
181
|
-
interface IdentityRotation {
|
|
182
|
-
/** The account id this client now presents in every new leaf, KeyPackage
|
|
183
|
-
* and linking ticket. Equal to `userId()` after the call. */
|
|
184
|
-
newUserId: UserId;
|
|
185
|
-
/** The fresh DeviceGroup created for the new identity, with this device as
|
|
186
|
-
* its sole member. The host re-registers DeviceGroup membership for it. */
|
|
187
|
-
deviceGroupId: ConversationId;
|
|
188
|
-
/** Conversations whose rotation Commit the server accepted. */
|
|
189
|
-
rotated: ConversationId[];
|
|
190
|
-
/** Conversations that keep their old leaf credential, with the error. */
|
|
191
|
-
failed: IdentityRotationFailure[];
|
|
192
|
-
}
|
|
193
200
|
/** One conversation where a removed device still holds its leaf, or that this
|
|
194
201
|
* device could not check, after `removeDeviceEverywhere` or
|
|
195
202
|
* `removeOwnDevicesExcept`. */
|
|
@@ -251,8 +258,38 @@ interface HistoryAppEvent {
|
|
|
251
258
|
* produced by a pre-`author` sender — replay falls back to the bundle sender id. */
|
|
252
259
|
author?: string;
|
|
253
260
|
}
|
|
261
|
+
/** A device's signed statement of its history delivery key: what it posts at
|
|
262
|
+
* every start, and what a sender is handed by the server. `device_id` is 32
|
|
263
|
+
* bytes, `public_key` 1216 (X-Wing), `signature` 64. `counter` is not a time. */
|
|
264
|
+
interface HistoryDeliveryKeyStatement {
|
|
265
|
+
device_id: Bytes;
|
|
266
|
+
counter: number;
|
|
267
|
+
public_key: Bytes;
|
|
268
|
+
signature: Bytes;
|
|
269
|
+
}
|
|
270
|
+
/** Whether history goes to a device of this account by itself (`automatic`),
|
|
271
|
+
* only after the person confirms on THIS device (`ask`), or not at all
|
|
272
|
+
* (`refused`: it is not a verified leaf of this account's DeviceGroup at the
|
|
273
|
+
* account's current generation; ship nothing, ask nothing, do not retry in a
|
|
274
|
+
* loop). */
|
|
275
|
+
type HistoryShipDecision = "automatic" | "ask" | "refused";
|
|
276
|
+
/** What opening a history transfer gave: the verified bundle, or
|
|
277
|
+
* `not_yet_member` (the sender is another account's device and this device
|
|
278
|
+
* does not hold the conversation yet: leave the transfer at the server and
|
|
279
|
+
* open it again after the join). */
|
|
280
|
+
interface OpenedHistory {
|
|
281
|
+
bundle?: HistoryBundle;
|
|
282
|
+
not_yet_member: boolean;
|
|
283
|
+
/** With a bundle (ruling V177): the id to hand to `confirmHistoryImport` AFTER the
|
|
284
|
+
* host's own store holds the bundle's events (49 bytes; an identifier, not a
|
|
285
|
+
* secret). Until that call the same transfer opens again as often as it is
|
|
286
|
+
* delivered. */
|
|
287
|
+
import_id?: Uint8Array;
|
|
288
|
+
}
|
|
254
289
|
/** A conversation's decrypted history shipped device-to-device (linking / peer re-add).
|
|
255
|
-
*
|
|
290
|
+
* Signed by the sender's device key and sealed by `sealHistoryBundleV3` (or
|
|
291
|
+
* `sealLinkHistoryBundle`), opened and verified by `openHistoryBundleV3`
|
|
292
|
+
* (or `openLinkHistoryBundle`). At most 256 events. */
|
|
256
293
|
interface HistoryBundle {
|
|
257
294
|
v: number;
|
|
258
295
|
sender_device_id: Bytes;
|
|
@@ -262,22 +299,6 @@ interface HistoryBundle {
|
|
|
262
299
|
window_end_ms: number;
|
|
263
300
|
events: HistoryAppEvent[];
|
|
264
301
|
}
|
|
265
|
-
/** Decrypted recovery backup returned by `MessagingClient.decryptBackup`. `identity_export`
|
|
266
|
-
* is the secret Ed25519 seed — pass it straight into `init({ identityExport })`. */
|
|
267
|
-
interface RecoveryBackup {
|
|
268
|
-
v: number;
|
|
269
|
-
account_id: Bytes;
|
|
270
|
-
identity_export: Bytes;
|
|
271
|
-
device_group_snapshot: Bytes;
|
|
272
|
-
/** External-conversation MLS state embedded in the backup. Empty unless the
|
|
273
|
-
* backup was written with conversations included. Import each via
|
|
274
|
-
* `importStateSnapshot` after restore to bring the chat + history back. */
|
|
275
|
-
conversation_snapshots: {
|
|
276
|
-
conversation_id: Bytes;
|
|
277
|
-
group_state_bytes: Bytes;
|
|
278
|
-
}[];
|
|
279
|
-
created_at_ms: number;
|
|
280
|
-
}
|
|
281
302
|
/** Why `MessagingClient.checkBackupPhrase` could not complete a check. Every value
|
|
282
303
|
* is a doubt about the CHECK, none is a statement about the phrase:
|
|
283
304
|
* - `invalidPhrase`: not a BIP39 phrase (word count, wordlist or checksum);
|
|
@@ -342,6 +363,11 @@ interface LogHead {
|
|
|
342
363
|
conversationId: ConversationId;
|
|
343
364
|
headServerSeq: number;
|
|
344
365
|
headEpoch: number;
|
|
366
|
+
/** The delivery service says a sealed GroupInfo is WANTED for this
|
|
367
|
+
* conversation (a device of a member account waits to let itself in):
|
|
368
|
+
* a member device at the head's epoch publishes one by itself, once per
|
|
369
|
+
* conversation per epoch. Absent reads as `false`. */
|
|
370
|
+
sealedGroupInfoWanted?: boolean;
|
|
345
371
|
}
|
|
346
372
|
/** A hole between what this device has applied and a live frame the SDK
|
|
347
373
|
* holds: the rows from `appliedServerSeq + 1` to `firstBufferedServerSeq - 1`
|
|
@@ -412,6 +438,47 @@ interface StrandedConversation {
|
|
|
412
438
|
* reported and the fill re-fetches them) or `retainedFrames` (page the
|
|
413
439
|
* conversation to its end once it is held again). */
|
|
414
440
|
type OverflowReason = "heldFrames" | "retainedFrames";
|
|
441
|
+
/** Why a position of a conversation's log was not applied on this device.
|
|
442
|
+
* `refusedCommit`: a Commit this device refused (what was sealed after it is
|
|
443
|
+
* unreadable here until the device is re-admitted); `cannotDecrypt`: sealed
|
|
444
|
+
* for an epoch this device does not hold; `notHeld`: the device did not hold
|
|
445
|
+
* the conversation; `invalid`: refused for what it is; `internal`: the
|
|
446
|
+
* device's own store failed. */
|
|
447
|
+
type HoleReason = "refusedCommit" | "cannotDecrypt" | "notHeld" | "invalid" | "internal"
|
|
448
|
+
/** Before my return (ruling V406 (b)): the range between what any device
|
|
449
|
+
* of the account last acknowledged and this device's own entry by an
|
|
450
|
+
* external Commit. Never handed to it; no content hashes. Fill it from
|
|
451
|
+
* the members' history hand-over or show the gap, then `resolveLogHole`. */
|
|
452
|
+
| "beforeReturn";
|
|
453
|
+
/** A range of a conversation's log this device did not apply: positions, a
|
|
454
|
+
* reason and the content hashes the envelopes named (at most 64). Never any
|
|
455
|
+
* content. `kept: true`: the SDK still holds those rows durably and tries
|
|
456
|
+
* them again by itself; `false`: recorded for good, until `resolveLogHole`. */
|
|
457
|
+
interface LogHole {
|
|
458
|
+
conversationId: ConversationId;
|
|
459
|
+
fromServerSeq: number;
|
|
460
|
+
toServerSeq: number;
|
|
461
|
+
reason: HoleReason;
|
|
462
|
+
contentHashes: Uint8Array[];
|
|
463
|
+
kept: boolean;
|
|
464
|
+
}
|
|
465
|
+
/** A position that is safe to acknowledge to the delivery service: stored by
|
|
466
|
+
* the call that reported it, with every row at or below it applied, kept
|
|
467
|
+
* durably, or a recorded hole. */
|
|
468
|
+
interface LogAck {
|
|
469
|
+
conversationId: ConversationId;
|
|
470
|
+
serverSeq: number;
|
|
471
|
+
}
|
|
472
|
+
/** Where a batch or a page stopped applying a conversation's rows because the
|
|
473
|
+
* SDK's pending-apply journal is full (the journal never drops a message the
|
|
474
|
+
* host has not confirmed). `serverSeq`: the first log position NOT applied (0
|
|
475
|
+
* when the row was handed without a position). `rows`: how many rows of the
|
|
476
|
+
* conversation the call left unapplied. */
|
|
477
|
+
interface JournalFullAt {
|
|
478
|
+
conversationId: ConversationId;
|
|
479
|
+
serverSeq: number;
|
|
480
|
+
rows: number;
|
|
481
|
+
}
|
|
415
482
|
interface BufferOverflow {
|
|
416
483
|
conversationId: ConversationId;
|
|
417
484
|
reason: OverflowReason;
|
|
@@ -428,7 +495,11 @@ type AddMemberStatus = "added" | "alreadyMember" | "duplicateEntry" | "malformed
|
|
|
428
495
|
* group's policy records an owner, this account is neither the owner nor
|
|
429
496
|
* an admin, and the entry is not one of its own devices. Nothing is sent
|
|
430
497
|
* for it; show "only an admin can do this". */
|
|
431
|
-
| "notPermitted"
|
|
498
|
+
| "notPermitted"
|
|
499
|
+
/** Its device credential verifies at an older generation than this device
|
|
500
|
+
* knows for its account (2026-11-25). Nothing is sent for it; claim a
|
|
501
|
+
* fresh KeyPackage of that device and ask again. */
|
|
502
|
+
| "staleGeneration";
|
|
432
503
|
interface AddMemberVerdict {
|
|
433
504
|
deviceId: DeviceId;
|
|
434
505
|
status: AddMemberStatus;
|
|
@@ -448,6 +519,23 @@ interface CommitInDoubt {
|
|
|
448
519
|
attempts: number;
|
|
449
520
|
nextAttemptAtMs: number;
|
|
450
521
|
}
|
|
522
|
+
/** A device that entered a conversation by its own act (an external Commit
|
|
523
|
+
* this device merged). The ONLY source of the line "rejoined on a new
|
|
524
|
+
* device": no message announces a self-admission, so the joiner can neither
|
|
525
|
+
* forge the line nor leave it out. Do not log the ids. */
|
|
526
|
+
interface SelfAdmission {
|
|
527
|
+
conversationId: ConversationId;
|
|
528
|
+
/** The verified account identity of the joiner's leaf. */
|
|
529
|
+
identity: UserId;
|
|
530
|
+
deviceId: DeviceId;
|
|
531
|
+
/** The same device put its leaf back. */
|
|
532
|
+
replacedOwnLeaf: boolean;
|
|
533
|
+
/** The account is this client's own: a sibling device entered (read the
|
|
534
|
+
* sessions list for the new-device alert). */
|
|
535
|
+
ownAccount: boolean;
|
|
536
|
+
/** The MLS epoch the Commit was processed in. */
|
|
537
|
+
epoch: number;
|
|
538
|
+
}
|
|
451
539
|
/** Outcome of `processSequencedBatch`. `messages` are the decrypted
|
|
452
540
|
* application messages in apply order. */
|
|
453
541
|
interface ApplyBatchResult {
|
|
@@ -479,6 +567,32 @@ interface ApplyBatchResult {
|
|
|
479
567
|
proposalsPending: ConversationId[];
|
|
480
568
|
/** Frames the bounded buffers could not keep. */
|
|
481
569
|
overflow: BufferOverflow[];
|
|
570
|
+
/** Devices that entered by an external Commit this device merged, each
|
|
571
|
+
* reported once (with the batch that processed the Commit, or with the
|
|
572
|
+
* next result when an internal catch-up did). Empty for every other
|
|
573
|
+
* Commit and for a refused one. */
|
|
574
|
+
selfAdmissions: SelfAdmission[];
|
|
575
|
+
/** Positions recorded as holes since the last result that carried this
|
|
576
|
+
* field (all with `kept: false`). `logHoles` lists every hole. */
|
|
577
|
+
holes: LogHole[];
|
|
578
|
+
/** The positions this call STORED, per conversation: the ONLY positions a
|
|
579
|
+
* host may acknowledge to the delivery service from this result. A frame
|
|
580
|
+
* held ahead of a gap and a row whose checkpoint failed are never at or
|
|
581
|
+
* below one. */
|
|
582
|
+
acks: LogAck[];
|
|
583
|
+
/** Conversations in which this call left rows UNAPPLIED because the
|
|
584
|
+
* pending-apply journal is full. Nothing of those rows was taken: the
|
|
585
|
+
* position did not move for them, they are in no `acks` entry, they are
|
|
586
|
+
* neither kept nor holes. Save the messages handed over, call
|
|
587
|
+
* `confirmApplied`, then hand the rows again (the same batch, or the
|
|
588
|
+
* conversation's next page). Empty in every other case. */
|
|
589
|
+
journalFull: JournalFullAt[];
|
|
590
|
+
/** THE ACCOUNT'S STATE PART IS OWED A WRITE (2026-11-27): the anchor record
|
|
591
|
+
* changed (a join, a leave, a change of a group's owner or admins). Said
|
|
592
|
+
* once, with the batch at which the SDK saw it; the host calls
|
|
593
|
+
* `refreshStateBackup` at its next allowed write and stores the part.
|
|
594
|
+
* Present (and `true`) only on the batch that says it. */
|
|
595
|
+
stateBackupOwed?: boolean;
|
|
482
596
|
}
|
|
483
597
|
/** Outcome of one page of `syncConversationStep`. */
|
|
484
598
|
interface SyncStepResult {
|
|
@@ -497,6 +611,15 @@ interface SyncStepResult {
|
|
|
497
611
|
stranded: StrandedConversation[];
|
|
498
612
|
proposalsPending: ConversationId[];
|
|
499
613
|
overflow: BufferOverflow[];
|
|
614
|
+
/** As `ApplyBatchResult.selfAdmissions`. */
|
|
615
|
+
selfAdmissions: SelfAdmission[];
|
|
616
|
+
/** As `ApplyBatchResult.holes`. */
|
|
617
|
+
holes: LogHole[];
|
|
618
|
+
/** As `ApplyBatchResult.acks`. */
|
|
619
|
+
acks: LogAck[];
|
|
620
|
+
/** As `ApplyBatchResult.journalFull`. A page that stopped for the journal
|
|
621
|
+
* and moved no position answers `hasMore: false`. */
|
|
622
|
+
journalFull: JournalFullAt[];
|
|
500
623
|
}
|
|
501
624
|
/** Where a batch delivered to `onMessageBatch` came from: a live socket
|
|
502
625
|
* batch, or a page of the server log (a gap fill, or the whole-account
|
|
@@ -569,6 +692,152 @@ interface Transport {
|
|
|
569
692
|
* Welcome send. Hosts that route Welcomes differently (or don't need
|
|
570
693
|
* per-recipient routing) may leave this unimplemented. */
|
|
571
694
|
setNextWelcomeRecipients?(conversationId: ConversationId, recipientDeviceIds: DeviceId[]): Promise<void>;
|
|
695
|
+
/** Optional (self-admission). Post ONE external Commit. Reject with an
|
|
696
|
+
* error carrying a numeric `status` for a definite refusal, and with an
|
|
697
|
+
* error whose `epochOccupied` property is `true` when the delivery
|
|
698
|
+
* service answers that the epoch has moved. On ANY post (`send`,
|
|
699
|
+
* `sendBatch`, this one) reject with an error whose `staleGeneration`
|
|
700
|
+
* property is `true` when the service answers `409 stale_generation`:
|
|
701
|
+
* the SDK undoes the pending Commit and rejects the call with its
|
|
702
|
+
* stale verdict (`isStaleGenerationError`). A host that leaves the four
|
|
703
|
+
* self-admission methods unimplemented makes no self-admission. */
|
|
704
|
+
sendExternalCommit?(envelope: MessageEnvelope): Promise<void>;
|
|
705
|
+
/** Optional. What the delivery service states of up to 500 conversations
|
|
706
|
+
* of this device's ACCOUNT, in ONE request: at most one row per
|
|
707
|
+
* conversation asked for; no row reads as "nothing published".
|
|
708
|
+
* `unusable` (ruling V461; at most 64, each one of `conversations`, empty
|
|
709
|
+
* when the device names none): the conversations whose served
|
|
710
|
+
* publication this device could not use. Send them as
|
|
711
|
+
* `unopened_conversation_ids` of the same request; the delivery service
|
|
712
|
+
* then asks an online member device to publish. A host that ignores the
|
|
713
|
+
* argument behaves as before. */
|
|
714
|
+
fetchSelfAdmissionStates?(conversations: ConversationId[], unusable?: ConversationId[]): Promise<SelfAdmissionState[]>;
|
|
715
|
+
/** Optional. The sealed GroupInfos of up to 64 conversations in ONE
|
|
716
|
+
* request, each with THIS account's wrap; as many as fit in 2 MiB. */
|
|
717
|
+
fetchSealedGroupInfos?(conversations: ConversationId[]): Promise<SealedGroupInfoRow[]>;
|
|
718
|
+
/** Optional. External Commits of several conversations in ONE post: one
|
|
719
|
+
* answer per envelope, in the order given. Left unimplemented (or
|
|
720
|
+
* answering `null`), the SDK posts them one at a time through
|
|
721
|
+
* `sendExternalCommit`. */
|
|
722
|
+
sendExternalCommits?(envelopes: MessageEnvelope[]): Promise<(ExternalCommitAnswer | ExternalCommitPosted)[] | null>;
|
|
723
|
+
/** Optional (the publishing half of self-admission, ruling V320). The SDK
|
|
724
|
+
* calls the two methods BY ITSELF at the end of a batch; a host that
|
|
725
|
+
* leaves them unimplemented publishes nothing. The sealing-key
|
|
726
|
+
* statements of up to 64 member ACCOUNTS of ONE conversation in ONE
|
|
727
|
+
* request, as the server holds them (an account with no statement has no
|
|
728
|
+
* row). `conversation` (ruling S243) is the conversation the publication
|
|
729
|
+
* is for: send it as `conversation_id` of the request. `null`: no
|
|
730
|
+
* route. */
|
|
731
|
+
fetchSealingStatements?(accounts: UserId[], conversation: ConversationId): Promise<SealingStatementRow[] | null>;
|
|
732
|
+
/** Optional. Store the sealed GroupInfo of ONE conversation at ONE epoch
|
|
733
|
+
* with one wrap per member account, in ONE request. Resolve `true` ONLY
|
|
734
|
+
* when the service stored it (anything else reads as "no route" and the
|
|
735
|
+
* SDK asks nothing more in this session). Reject with an error whose
|
|
736
|
+
* `epochOccupied` property is `true` when the conversation is past that
|
|
737
|
+
* epoch, with a numeric `status` for a definite refusal, with anything
|
|
738
|
+
* else for "no answer" (the SDK offers it again with a later batch). */
|
|
739
|
+
publishSealedGroupInfo?(publication: SealedGroupInfoUpload): Promise<boolean>;
|
|
740
|
+
}
|
|
741
|
+
/** One account's sealing-key statement as the server holds it. Public
|
|
742
|
+
* values; nothing is trusted until the SDK has verified the statement
|
|
743
|
+
* under the root key of that account's leaf. */
|
|
744
|
+
interface SealingStatementRow {
|
|
745
|
+
userId: UserId;
|
|
746
|
+
generation?: number;
|
|
747
|
+
publicKey: Uint8Array;
|
|
748
|
+
signature: Uint8Array;
|
|
749
|
+
}
|
|
750
|
+
/** One member account's wrap of a publication's content key. */
|
|
751
|
+
interface SealedGroupInfoWrap {
|
|
752
|
+
userId: UserId;
|
|
753
|
+
wrap: Uint8Array;
|
|
754
|
+
}
|
|
755
|
+
/** What the SDK uploads for one conversation at one epoch. Sealed bytes:
|
|
756
|
+
* never a log value. */
|
|
757
|
+
interface SealedGroupInfoUpload {
|
|
758
|
+
conversationId: ConversationId;
|
|
759
|
+
epoch: number;
|
|
760
|
+
blob: Uint8Array;
|
|
761
|
+
wraps: SealedGroupInfoWrap[];
|
|
762
|
+
}
|
|
763
|
+
/** Why a self-admission did not happen now and may later. Never shown to a
|
|
764
|
+
* person: the host waits (for `notPublished` and `unanchored`: until the
|
|
765
|
+
* account event of a publication arrives). `anchorsWithheld` (the owner's
|
|
766
|
+
* decision OD33): this device restored its account and the anchor record it
|
|
767
|
+
* was owed did not open; it does not let itself in unanchored and comes back
|
|
768
|
+
* when a member adds it. */
|
|
769
|
+
type SelfAdmitWait = "markerMissing" | "proposalsPending" | "unanchored" | "notPublished" | "anchorsWithheld";
|
|
770
|
+
/** Why an entry point did not run the join, or why the join was refused. A
|
|
771
|
+
* name only. `notCompiled`: this build holds no self-admission and nothing
|
|
772
|
+
* was touched. `anchorRecord`: the record this device holds does not read. */
|
|
773
|
+
type SelfAdmitRefusal = "notCompiled" | "anchorRecord" | "tooManyRecipients" | "sealed" | "transport" | "transportRejected" | "engine" | "staleGeneration";
|
|
774
|
+
/** What a self-admission did. `unanchored`: the device held no anchor entry
|
|
775
|
+
* for the conversation, so nothing checked who built the tree it entered;
|
|
776
|
+
* kept for the record, no host shows anything for it. */
|
|
777
|
+
type SelfAdmitResult = {
|
|
778
|
+
kind: "joined";
|
|
779
|
+
epoch: number;
|
|
780
|
+
replacedOwnLeaf: boolean;
|
|
781
|
+
replayed: IncomingMessage[];
|
|
782
|
+
unanchored: boolean;
|
|
783
|
+
/** The range of the conversation's log the device could not read
|
|
784
|
+
* before its return, as a typed hole (`beforeReturn`), already
|
|
785
|
+
* recorded (`logHoles` lists it until `resolveLogHole`). Absent when
|
|
786
|
+
* the range is empty or the transport stated no position for the
|
|
787
|
+
* Commit (ruling V406 (b)). */
|
|
788
|
+
beforeReturn?: LogHole;
|
|
789
|
+
} | {
|
|
790
|
+
kind: "alreadyHeld";
|
|
791
|
+
} | {
|
|
792
|
+
kind: "stale";
|
|
793
|
+
currentEpoch?: number;
|
|
794
|
+
} | {
|
|
795
|
+
kind: "notYet";
|
|
796
|
+
reason: SelfAdmitWait;
|
|
797
|
+
} | {
|
|
798
|
+
kind: "refused";
|
|
799
|
+
refusal: SelfAdmitRefusal;
|
|
800
|
+
};
|
|
801
|
+
interface SelfAdmitManyEntry {
|
|
802
|
+
conversationId: ConversationId;
|
|
803
|
+
result: SelfAdmitResult;
|
|
804
|
+
}
|
|
805
|
+
/** What the delivery service returned for one conversation: the sealed
|
|
806
|
+
* blob, THIS account's wrap, the number of wraps of the publication and,
|
|
807
|
+
* when the service says so, the conversation's current epoch. Sealed
|
|
808
|
+
* bytes: never a log value. */
|
|
809
|
+
interface FetchedSealedGroupInfo {
|
|
810
|
+
blob: Uint8Array;
|
|
811
|
+
wrap: Uint8Array;
|
|
812
|
+
wrapCount: number;
|
|
813
|
+
currentEpoch?: number;
|
|
814
|
+
}
|
|
815
|
+
/** What the delivery service states of one conversation to a device of a
|
|
816
|
+
* member account that does not hold it. */
|
|
817
|
+
interface SelfAdmissionState {
|
|
818
|
+
conversationId: ConversationId;
|
|
819
|
+
currentEpoch: number;
|
|
820
|
+
/** The epoch of the sealed GroupInfo held with a wrap for this account. */
|
|
821
|
+
publishedEpoch?: number;
|
|
822
|
+
/** The server's `acknowledged_seq` (ruling V406 (b)): the highest log
|
|
823
|
+
* position any device of this account acknowledged there. It sizes the
|
|
824
|
+
* hole "before my return"; leave it out when the service states none. */
|
|
825
|
+
acknowledgedSeq?: number;
|
|
826
|
+
}
|
|
827
|
+
interface SealedGroupInfoRow extends FetchedSealedGroupInfo {
|
|
828
|
+
conversationId: ConversationId;
|
|
829
|
+
}
|
|
830
|
+
/** The delivery service's answer to ONE external Commit of a batched post.
|
|
831
|
+
* `accepted` ONLY when it took that Commit. */
|
|
832
|
+
type ExternalCommitAnswer = "accepted" | "epochOccupied" | "rejected" | "unanswered" | "staleGeneration";
|
|
833
|
+
/** RULINGS V406 AND V408: one answer of `sendExternalCommits` together with
|
|
834
|
+
* the position (`server_seq`) the delivery service gave an accepted Commit.
|
|
835
|
+
* With it the join leaves its conversation anchored at that position (the
|
|
836
|
+
* ordinary resume carries it, no page request a conversation) and states
|
|
837
|
+
* the range before it as a typed hole. */
|
|
838
|
+
interface ExternalCommitPosted {
|
|
839
|
+
answer: ExternalCommitAnswer;
|
|
840
|
+
serverSeq?: number;
|
|
572
841
|
}
|
|
573
842
|
|
|
574
|
-
export type {
|
|
843
|
+
export type { ExternalCommitAnswer as $, AddMembersReport as A, BackupPhraseCheck as B, ConversationId as C, DiscoveredDevice as D, ExpectedOwner as E, FetchedSealedGroupInfo as F, MessageBatchMeta as G, HistoryDeliveryKeyStatement as H, IncomingMessage as I, AddMemberStatus as J, KeyPackageEntry as K, LinkingTicketV3 as L, MessageEnvelope as M, AddMemberVerdict as N, OpenedHistory as O, PendingApply as P, BackupCheckFailure as Q, BufferOverflow as R, Storage as S, Transport as T, UserId as U, Bytes as V, CatchupSnapshotEntry as W, ConversationRemoval as X, ConversationUpdate as Y, DeviceInfo as Z, DeviceRemovalFailure as _, DeviceId as a, ExternalCommitPosted as a0, HistoryAppEvent as a1, Hlc as a2, HoleReason as a3, JournalFullAt as a4, LogAck as a5, LogGap as a6, MessageKind as a7, OverflowReason as a8, SealedGroupInfoRow as a9, SealedGroupInfoUpload as aa, SealedGroupInfoWrap as ab, SealingStatementRow as ac, SelfAdmission as ad, SelfAdmissionState as ae, SelfAdmitRefusal as af, SelfAdmitWait as ag, SenderRole as ah, StrandReason as ai, StrandedConversation as aj, WelcomeFailure as ak, WelcomeFailureReason as al, ConversationMeta as b, DeviceReauthProof as c, DeviceLinkApproval as d, DeviceLinkPossession as e, CommitInDoubt as f, MemberInfo as g, ConversationPolicy as h, SelfAdmitResult as i, SelfAdmitManyEntry as j, SequencedEnvelope as k, ApplyBatchResult as l, SyncStepResult as m, LogPosition as n, LogHole as o, LogHead as p, CatchupSnapshotView as q, CatchupAppEvent as r, LinkGeneration as s, LinkedDevice as t, HistoryBundle as u, HistoryShipDecision as v, AdmitChatEntry as w, AdmitChatOutcome as x, DeviceRemovalReport as y, ExportedSecret as z };
|