@ping-app/ping-openmls-sdk 0.10.6 → 0.10.7

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/dist/index.d.cts CHANGED
@@ -13,12 +13,15 @@ interface SealingStatement {
13
13
  /**
14
14
  * What a call that MADE a device answers: the public values the host registers
15
15
  * with the server, and the device key for the host's protected store.
16
+ * `devicePublicKey` is the device's public key (32 bytes; `deviceId` is its
17
+ * SHA-256): the value a host registers, so no host derives it from the secret.
16
18
  * `deviceSigningSecretKey` is a secret: keep it where a device key is kept
17
19
  * today, pass it to `MessagingClient.initFromDeviceRecord`, never log it.
18
20
  */
19
21
  interface NewAccountDevice {
20
22
  userId: Uint8Array;
21
23
  deviceId: Uint8Array;
24
+ devicePublicKey: Uint8Array;
22
25
  generation: number;
23
26
  statement: SealingStatement;
24
27
  deviceSigningSecretKey: Uint8Array;
@@ -49,6 +52,12 @@ interface AccountBackupParts {
49
52
  }
50
53
  /** `present`, `absent`, or `mismatch` (the pending root is LOST: copy B6). */
51
54
  type PendingRootStatus = "present" | "absent" | "mismatch";
55
+ /** What `discardPendingRoot` answers. `deleted`: the slot's pending root was
56
+ * deleted. `nothing-there`: the slot holds none. The other three are
57
+ * REFUSALS that deleted nothing: the slot's store holds a device record (the
58
+ * root may be an account's pinned root), a rotation record, or a begun link.
59
+ * Treat a value you do not know as a refusal. */
60
+ type PendingRootDiscard = "deleted" | "nothing-there" | "device-record-held" | "rotation-record-held" | "link-begun";
52
61
  /** What `POST /v1/account/generation/start` answered, as the host parsed it
53
62
  * (the account identity contract, 12.3). Public values, and the server's
54
63
  * word: the SDK believes it only as far as the root's signature goes. */
@@ -299,6 +308,14 @@ declare class AccountSetup {
299
308
  slot: string;
300
309
  fingerprint: Uint8Array;
301
310
  }): Promise<void>;
311
+ /** "Start over" on an account that was started on this device and never
312
+ * finished (rulings V1201, V1277): deletes the pending root of ONE slot and
313
+ * nothing else, or refuses with a typed answer (see `PendingRootDiscard`).
314
+ * THE HOST'S DUTY, which the SDK cannot check: the person chose it, the
315
+ * slot's stored account is the account signed in now, this sign-in's fresh
316
+ * answer is exactly `none_pinned`, and the slot's SDK store is emptied in
317
+ * the same erase. Never call it from a sweep. */
318
+ discardPendingRoot(slot: string): Promise<PendingRootDiscard>;
302
319
  /** Step 3 of a restore: the root part opens with the phrase to the PINNED
303
320
  * root; `hostState` is there when the root part's secret opens the state
304
321
  * part. Writes nothing. */
@@ -1248,6 +1265,14 @@ declare class MessagingClient {
1248
1265
  * an interactive call behind all of them. Resolves when every conversation
1249
1266
  * held at the start of the pass (plus any joined while it ran) has been
1250
1267
  * paged, with the decrypted application messages in apply order.
1268
+ *
1269
+ * Rejects with `StoreMovedError` when the client failed closed: before the
1270
+ * pass (it then asks nothing of the server), inside one of its steps (no
1271
+ * later conversation is asked; the pages before it were delivered), or
1272
+ * during its last step. A client that failed closed before or during the
1273
+ * pass never resolves at all, with an empty list or with any other. The
1274
+ * host drops the client and starts a new one on the same store, which
1275
+ * hands what was stored (`pendingApplies`).
1251
1276
  */
1252
1277
  syncConversations(): Promise<IncomingMessage[]>;
1253
1278
  /**
@@ -1936,14 +1961,18 @@ declare class SenderMismatchError extends Error {
1936
1961
  /** True when `e` is the typed sender refusal and no other failure. Accepts
1937
1962
  * the rejection itself, any object with a `message`, or the text. */
1938
1963
  declare function isSenderMismatchError(e: unknown): boolean;
1939
- /** How the rejection of a call reads when another writer wrote this client's
1940
- * MLS store since the client loaded it (the core's `Error::StoreMoved`). No
1941
- * other failure starts this way. Kept in lockstep with the core's display
1942
- * (`stringify` in `core/ping-wasm/src/lib.rs`, pinned by
1943
- * `ping-core/tests/release_after_durable.rs`). Raised by the file-backed
1944
- * store of the native builds only: the web SDK's stores have no writer
1945
- * claim yet, so a browser never sees it today; the class exists so the API
1946
- * is the same on every platform. */
1964
+ /** How the rejection of a call reads when this client can store nothing more
1965
+ * (the core's `Error::StoreMoved`). No other failure starts this way. Kept
1966
+ * in lockstep with the core's display (`stringify` in
1967
+ * `core/ping-wasm/src/lib.rs`, pinned by
1968
+ * `ping-core/tests/release_after_durable.rs`). Two causes. Another writer
1969
+ * wrote the client's MLS store since the client loaded it: raised by the
1970
+ * file-backed store of the native builds only (the web SDK's stores have no
1971
+ * writer claim yet). And THE CLIENT FAILED CLOSED, which a browser does
1972
+ * see: a run of rows could not store its message secrets, or a panic inside
1973
+ * the wasm closed the instance (every client of that Worker). The calls
1974
+ * that store, seal, send or acknowledge then reject with this text, and so
1975
+ * does `syncConversations()`. */
1947
1976
  declare const STORE_MOVED_PREFIX = "store moved: ";
1948
1977
  /** The stale-writer failure. Nothing was written and nothing was released (a
1949
1978
  * message being sent did not leave). The client is stale: drop it,
@@ -2150,4 +2179,4 @@ declare function emulateSendBatch(transport: Pick<Transport, "send">, envelopes:
2150
2179
  * server error code rides along for diagnostics. */
2151
2180
  declare function describeTransportError(e: unknown): string;
2152
2181
 
2153
- export { type AccountBackupParts, AccountSetup, AccountSetupClosedError, type AccountSetupConfig, AddMembersReport, AdmitChatEntry, AdmitChatOutcome, type AdoptedGeneration, ApplyBatchResult, BATCH_PARTIAL_PREFIX, BackupPhraseCheck, CONTENT_TYPE_CBOR, CONTENT_TYPE_CBOR_LEGACY_V1, CONTENT_TYPE_JSON, CONTENT_TYPE_JSON_LEGACY_V1, CatchupAppEvent, CatchupSnapshotView, type ClientConfig, CommitInDoubt, type Conversation, ConversationId, ConversationMeta, ConversationPolicy, DEVICE_GROUP_BEHIND_PREFIX, DeviceGroupBehindError, DeviceId, DeviceLinkApproval, type DeviceLinkBegun, type DeviceLinkClientConfig, DeviceLinkPossession, DeviceReauthProof, type DeviceRecordClientConfig, DeviceRemovalReport, type DeviceStartCheck, EphemeralWorkerError, ExpectedOwner, ExportedSecret, FetchedSealedGroupInfo, HISTORY_REFUSED_PREFIX, HPKE_PQ_ENC_BYTES, HPKE_PQ_PUBLIC_KEY_BYTES, HistoryBundle, HistoryDeliveryKeyStatement, type HistoryRefusalReason, HistoryRefusedError, HistoryShipDecision, IncomingMessage, JOURNAL_FULL_PREFIX, JournalFullError, KeyPackageEntry, LINK_ADD_REFUSED_PREFIX, LINK_CHAIN_TOO_DEEP_PREFIX, LINK_COMMITMENT_MISMATCH_PREFIX, LinkAddRefusedError, LinkChainTooDeepError, type LinkCommitment, LinkCommitmentMismatchError, type LinkExpected, LinkGeneration, LinkedDevice, LinkingTicketV3, LogHead, LogHole, LogPosition, MemberInfo, MessageBatchMeta, MessageEnvelope, MessagingClient, MessagingClientClosedError, NOT_PERMITTED_PREFIX, type NewAccountDevice, NotPermittedError, OpenedHistory, PING_WIRE_CONTRACT_HEADER, PING_WIRE_CONTRACT_HEADER_VALUE, PING_WIRE_CONTRACT_VERSION, PendingApply, type PendingRootStatus, type PendingRotation, type PreparedDeviceKey, READ_ONLY_PREFIX, ReadOnlyError, type RestoreJoined, type RestoreOpened, type RotationAnswer, type RotationBuild, type RotationBuilt, type RotationKeptRefusal, type RotationOutcome, type RotationPhase, type RotationPlan, type RotationRecordState, type RotationRequest, type RotationStart, type RotationStartDevice, SENDER_MISMATCH_PREFIX, STALE_GENERATION_PREFIX, STORE_MOVED_PREFIX, type SealingStatement, SelfAdmitManyEntry, SelfAdmitResult, SenderMismatchError, SequencedEnvelope, StaleGenerationError, type StateOpened, type StateRefreshed, Storage, StoreMovedError, SyncStepResult, Transport, UserId, ValidationError, type VerifiedLinkHandshakeInfo, WELCOME_MISLABELED_PREFIX, WELCOME_WAITS_PREFIX, WIRE_VERSION_MIN_ACCEPTED, WelcomeMislabeledError, WelcomeWaitsError, accountRefusalCode, backupPhraseCheckFromWire, describeTransportError, emulateSendBatch, isDeviceGroupBehindError, isHistoryRefusedError, isJournalFullError, isLinkAddRefusedError, isLinkChainTooDeepError, isLinkCommitmentMismatchError, isNotPermittedError, isReadOnlyError, isSenderMismatchError, isStaleGenerationError, isStoreMovedError, isWelcomeMislabeledError, isWelcomeWaitsError, negotiates, notPermittedRule, validate, verifyApplicationContentHash };
2182
+ export { type AccountBackupParts, AccountSetup, AccountSetupClosedError, type AccountSetupConfig, AddMembersReport, AdmitChatEntry, AdmitChatOutcome, type AdoptedGeneration, ApplyBatchResult, BATCH_PARTIAL_PREFIX, BackupPhraseCheck, CONTENT_TYPE_CBOR, CONTENT_TYPE_CBOR_LEGACY_V1, CONTENT_TYPE_JSON, CONTENT_TYPE_JSON_LEGACY_V1, CatchupAppEvent, CatchupSnapshotView, type ClientConfig, CommitInDoubt, type Conversation, ConversationId, ConversationMeta, ConversationPolicy, DEVICE_GROUP_BEHIND_PREFIX, DeviceGroupBehindError, DeviceId, DeviceLinkApproval, type DeviceLinkBegun, type DeviceLinkClientConfig, DeviceLinkPossession, DeviceReauthProof, type DeviceRecordClientConfig, DeviceRemovalReport, type DeviceStartCheck, EphemeralWorkerError, ExpectedOwner, ExportedSecret, FetchedSealedGroupInfo, HISTORY_REFUSED_PREFIX, HPKE_PQ_ENC_BYTES, HPKE_PQ_PUBLIC_KEY_BYTES, HistoryBundle, HistoryDeliveryKeyStatement, type HistoryRefusalReason, HistoryRefusedError, HistoryShipDecision, IncomingMessage, JOURNAL_FULL_PREFIX, JournalFullError, KeyPackageEntry, LINK_ADD_REFUSED_PREFIX, LINK_CHAIN_TOO_DEEP_PREFIX, LINK_COMMITMENT_MISMATCH_PREFIX, LinkAddRefusedError, LinkChainTooDeepError, type LinkCommitment, LinkCommitmentMismatchError, type LinkExpected, LinkGeneration, LinkedDevice, LinkingTicketV3, LogHead, LogHole, LogPosition, MemberInfo, MessageBatchMeta, MessageEnvelope, MessagingClient, MessagingClientClosedError, NOT_PERMITTED_PREFIX, type NewAccountDevice, NotPermittedError, OpenedHistory, PING_WIRE_CONTRACT_HEADER, PING_WIRE_CONTRACT_HEADER_VALUE, PING_WIRE_CONTRACT_VERSION, PendingApply, type PendingRootDiscard, type PendingRootStatus, type PendingRotation, type PreparedDeviceKey, READ_ONLY_PREFIX, ReadOnlyError, type RestoreJoined, type RestoreOpened, type RotationAnswer, type RotationBuild, type RotationBuilt, type RotationKeptRefusal, type RotationOutcome, type RotationPhase, type RotationPlan, type RotationRecordState, type RotationRequest, type RotationStart, type RotationStartDevice, SENDER_MISMATCH_PREFIX, STALE_GENERATION_PREFIX, STORE_MOVED_PREFIX, type SealingStatement, SelfAdmitManyEntry, SelfAdmitResult, SenderMismatchError, SequencedEnvelope, StaleGenerationError, type StateOpened, type StateRefreshed, Storage, StoreMovedError, SyncStepResult, Transport, UserId, ValidationError, type VerifiedLinkHandshakeInfo, WELCOME_MISLABELED_PREFIX, WELCOME_WAITS_PREFIX, WIRE_VERSION_MIN_ACCEPTED, WelcomeMislabeledError, WelcomeWaitsError, accountRefusalCode, backupPhraseCheckFromWire, describeTransportError, emulateSendBatch, isDeviceGroupBehindError, isHistoryRefusedError, isJournalFullError, isLinkAddRefusedError, isLinkChainTooDeepError, isLinkCommitmentMismatchError, isNotPermittedError, isReadOnlyError, isSenderMismatchError, isStaleGenerationError, isStoreMovedError, isWelcomeMislabeledError, isWelcomeWaitsError, negotiates, notPermittedRule, validate, verifyApplicationContentHash };
package/dist/index.d.ts CHANGED
@@ -13,12 +13,15 @@ interface SealingStatement {
13
13
  /**
14
14
  * What a call that MADE a device answers: the public values the host registers
15
15
  * with the server, and the device key for the host's protected store.
16
+ * `devicePublicKey` is the device's public key (32 bytes; `deviceId` is its
17
+ * SHA-256): the value a host registers, so no host derives it from the secret.
16
18
  * `deviceSigningSecretKey` is a secret: keep it where a device key is kept
17
19
  * today, pass it to `MessagingClient.initFromDeviceRecord`, never log it.
18
20
  */
19
21
  interface NewAccountDevice {
20
22
  userId: Uint8Array;
21
23
  deviceId: Uint8Array;
24
+ devicePublicKey: Uint8Array;
22
25
  generation: number;
23
26
  statement: SealingStatement;
24
27
  deviceSigningSecretKey: Uint8Array;
@@ -49,6 +52,12 @@ interface AccountBackupParts {
49
52
  }
50
53
  /** `present`, `absent`, or `mismatch` (the pending root is LOST: copy B6). */
51
54
  type PendingRootStatus = "present" | "absent" | "mismatch";
55
+ /** What `discardPendingRoot` answers. `deleted`: the slot's pending root was
56
+ * deleted. `nothing-there`: the slot holds none. The other three are
57
+ * REFUSALS that deleted nothing: the slot's store holds a device record (the
58
+ * root may be an account's pinned root), a rotation record, or a begun link.
59
+ * Treat a value you do not know as a refusal. */
60
+ type PendingRootDiscard = "deleted" | "nothing-there" | "device-record-held" | "rotation-record-held" | "link-begun";
52
61
  /** What `POST /v1/account/generation/start` answered, as the host parsed it
53
62
  * (the account identity contract, 12.3). Public values, and the server's
54
63
  * word: the SDK believes it only as far as the root's signature goes. */
@@ -299,6 +308,14 @@ declare class AccountSetup {
299
308
  slot: string;
300
309
  fingerprint: Uint8Array;
301
310
  }): Promise<void>;
311
+ /** "Start over" on an account that was started on this device and never
312
+ * finished (rulings V1201, V1277): deletes the pending root of ONE slot and
313
+ * nothing else, or refuses with a typed answer (see `PendingRootDiscard`).
314
+ * THE HOST'S DUTY, which the SDK cannot check: the person chose it, the
315
+ * slot's stored account is the account signed in now, this sign-in's fresh
316
+ * answer is exactly `none_pinned`, and the slot's SDK store is emptied in
317
+ * the same erase. Never call it from a sweep. */
318
+ discardPendingRoot(slot: string): Promise<PendingRootDiscard>;
302
319
  /** Step 3 of a restore: the root part opens with the phrase to the PINNED
303
320
  * root; `hostState` is there when the root part's secret opens the state
304
321
  * part. Writes nothing. */
@@ -1248,6 +1265,14 @@ declare class MessagingClient {
1248
1265
  * an interactive call behind all of them. Resolves when every conversation
1249
1266
  * held at the start of the pass (plus any joined while it ran) has been
1250
1267
  * paged, with the decrypted application messages in apply order.
1268
+ *
1269
+ * Rejects with `StoreMovedError` when the client failed closed: before the
1270
+ * pass (it then asks nothing of the server), inside one of its steps (no
1271
+ * later conversation is asked; the pages before it were delivered), or
1272
+ * during its last step. A client that failed closed before or during the
1273
+ * pass never resolves at all, with an empty list or with any other. The
1274
+ * host drops the client and starts a new one on the same store, which
1275
+ * hands what was stored (`pendingApplies`).
1251
1276
  */
1252
1277
  syncConversations(): Promise<IncomingMessage[]>;
1253
1278
  /**
@@ -1936,14 +1961,18 @@ declare class SenderMismatchError extends Error {
1936
1961
  /** True when `e` is the typed sender refusal and no other failure. Accepts
1937
1962
  * the rejection itself, any object with a `message`, or the text. */
1938
1963
  declare function isSenderMismatchError(e: unknown): boolean;
1939
- /** How the rejection of a call reads when another writer wrote this client's
1940
- * MLS store since the client loaded it (the core's `Error::StoreMoved`). No
1941
- * other failure starts this way. Kept in lockstep with the core's display
1942
- * (`stringify` in `core/ping-wasm/src/lib.rs`, pinned by
1943
- * `ping-core/tests/release_after_durable.rs`). Raised by the file-backed
1944
- * store of the native builds only: the web SDK's stores have no writer
1945
- * claim yet, so a browser never sees it today; the class exists so the API
1946
- * is the same on every platform. */
1964
+ /** How the rejection of a call reads when this client can store nothing more
1965
+ * (the core's `Error::StoreMoved`). No other failure starts this way. Kept
1966
+ * in lockstep with the core's display (`stringify` in
1967
+ * `core/ping-wasm/src/lib.rs`, pinned by
1968
+ * `ping-core/tests/release_after_durable.rs`). Two causes. Another writer
1969
+ * wrote the client's MLS store since the client loaded it: raised by the
1970
+ * file-backed store of the native builds only (the web SDK's stores have no
1971
+ * writer claim yet). And THE CLIENT FAILED CLOSED, which a browser does
1972
+ * see: a run of rows could not store its message secrets, or a panic inside
1973
+ * the wasm closed the instance (every client of that Worker). The calls
1974
+ * that store, seal, send or acknowledge then reject with this text, and so
1975
+ * does `syncConversations()`. */
1947
1976
  declare const STORE_MOVED_PREFIX = "store moved: ";
1948
1977
  /** The stale-writer failure. Nothing was written and nothing was released (a
1949
1978
  * message being sent did not leave). The client is stale: drop it,
@@ -2150,4 +2179,4 @@ declare function emulateSendBatch(transport: Pick<Transport, "send">, envelopes:
2150
2179
  * server error code rides along for diagnostics. */
2151
2180
  declare function describeTransportError(e: unknown): string;
2152
2181
 
2153
- export { type AccountBackupParts, AccountSetup, AccountSetupClosedError, type AccountSetupConfig, AddMembersReport, AdmitChatEntry, AdmitChatOutcome, type AdoptedGeneration, ApplyBatchResult, BATCH_PARTIAL_PREFIX, BackupPhraseCheck, CONTENT_TYPE_CBOR, CONTENT_TYPE_CBOR_LEGACY_V1, CONTENT_TYPE_JSON, CONTENT_TYPE_JSON_LEGACY_V1, CatchupAppEvent, CatchupSnapshotView, type ClientConfig, CommitInDoubt, type Conversation, ConversationId, ConversationMeta, ConversationPolicy, DEVICE_GROUP_BEHIND_PREFIX, DeviceGroupBehindError, DeviceId, DeviceLinkApproval, type DeviceLinkBegun, type DeviceLinkClientConfig, DeviceLinkPossession, DeviceReauthProof, type DeviceRecordClientConfig, DeviceRemovalReport, type DeviceStartCheck, EphemeralWorkerError, ExpectedOwner, ExportedSecret, FetchedSealedGroupInfo, HISTORY_REFUSED_PREFIX, HPKE_PQ_ENC_BYTES, HPKE_PQ_PUBLIC_KEY_BYTES, HistoryBundle, HistoryDeliveryKeyStatement, type HistoryRefusalReason, HistoryRefusedError, HistoryShipDecision, IncomingMessage, JOURNAL_FULL_PREFIX, JournalFullError, KeyPackageEntry, LINK_ADD_REFUSED_PREFIX, LINK_CHAIN_TOO_DEEP_PREFIX, LINK_COMMITMENT_MISMATCH_PREFIX, LinkAddRefusedError, LinkChainTooDeepError, type LinkCommitment, LinkCommitmentMismatchError, type LinkExpected, LinkGeneration, LinkedDevice, LinkingTicketV3, LogHead, LogHole, LogPosition, MemberInfo, MessageBatchMeta, MessageEnvelope, MessagingClient, MessagingClientClosedError, NOT_PERMITTED_PREFIX, type NewAccountDevice, NotPermittedError, OpenedHistory, PING_WIRE_CONTRACT_HEADER, PING_WIRE_CONTRACT_HEADER_VALUE, PING_WIRE_CONTRACT_VERSION, PendingApply, type PendingRootStatus, type PendingRotation, type PreparedDeviceKey, READ_ONLY_PREFIX, ReadOnlyError, type RestoreJoined, type RestoreOpened, type RotationAnswer, type RotationBuild, type RotationBuilt, type RotationKeptRefusal, type RotationOutcome, type RotationPhase, type RotationPlan, type RotationRecordState, type RotationRequest, type RotationStart, type RotationStartDevice, SENDER_MISMATCH_PREFIX, STALE_GENERATION_PREFIX, STORE_MOVED_PREFIX, type SealingStatement, SelfAdmitManyEntry, SelfAdmitResult, SenderMismatchError, SequencedEnvelope, StaleGenerationError, type StateOpened, type StateRefreshed, Storage, StoreMovedError, SyncStepResult, Transport, UserId, ValidationError, type VerifiedLinkHandshakeInfo, WELCOME_MISLABELED_PREFIX, WELCOME_WAITS_PREFIX, WIRE_VERSION_MIN_ACCEPTED, WelcomeMislabeledError, WelcomeWaitsError, accountRefusalCode, backupPhraseCheckFromWire, describeTransportError, emulateSendBatch, isDeviceGroupBehindError, isHistoryRefusedError, isJournalFullError, isLinkAddRefusedError, isLinkChainTooDeepError, isLinkCommitmentMismatchError, isNotPermittedError, isReadOnlyError, isSenderMismatchError, isStaleGenerationError, isStoreMovedError, isWelcomeMislabeledError, isWelcomeWaitsError, negotiates, notPermittedRule, validate, verifyApplicationContentHash };
2182
+ export { type AccountBackupParts, AccountSetup, AccountSetupClosedError, type AccountSetupConfig, AddMembersReport, AdmitChatEntry, AdmitChatOutcome, type AdoptedGeneration, ApplyBatchResult, BATCH_PARTIAL_PREFIX, BackupPhraseCheck, CONTENT_TYPE_CBOR, CONTENT_TYPE_CBOR_LEGACY_V1, CONTENT_TYPE_JSON, CONTENT_TYPE_JSON_LEGACY_V1, CatchupAppEvent, CatchupSnapshotView, type ClientConfig, CommitInDoubt, type Conversation, ConversationId, ConversationMeta, ConversationPolicy, DEVICE_GROUP_BEHIND_PREFIX, DeviceGroupBehindError, DeviceId, DeviceLinkApproval, type DeviceLinkBegun, type DeviceLinkClientConfig, DeviceLinkPossession, DeviceReauthProof, type DeviceRecordClientConfig, DeviceRemovalReport, type DeviceStartCheck, EphemeralWorkerError, ExpectedOwner, ExportedSecret, FetchedSealedGroupInfo, HISTORY_REFUSED_PREFIX, HPKE_PQ_ENC_BYTES, HPKE_PQ_PUBLIC_KEY_BYTES, HistoryBundle, HistoryDeliveryKeyStatement, type HistoryRefusalReason, HistoryRefusedError, HistoryShipDecision, IncomingMessage, JOURNAL_FULL_PREFIX, JournalFullError, KeyPackageEntry, LINK_ADD_REFUSED_PREFIX, LINK_CHAIN_TOO_DEEP_PREFIX, LINK_COMMITMENT_MISMATCH_PREFIX, LinkAddRefusedError, LinkChainTooDeepError, type LinkCommitment, LinkCommitmentMismatchError, type LinkExpected, LinkGeneration, LinkedDevice, LinkingTicketV3, LogHead, LogHole, LogPosition, MemberInfo, MessageBatchMeta, MessageEnvelope, MessagingClient, MessagingClientClosedError, NOT_PERMITTED_PREFIX, type NewAccountDevice, NotPermittedError, OpenedHistory, PING_WIRE_CONTRACT_HEADER, PING_WIRE_CONTRACT_HEADER_VALUE, PING_WIRE_CONTRACT_VERSION, PendingApply, type PendingRootDiscard, type PendingRootStatus, type PendingRotation, type PreparedDeviceKey, READ_ONLY_PREFIX, ReadOnlyError, type RestoreJoined, type RestoreOpened, type RotationAnswer, type RotationBuild, type RotationBuilt, type RotationKeptRefusal, type RotationOutcome, type RotationPhase, type RotationPlan, type RotationRecordState, type RotationRequest, type RotationStart, type RotationStartDevice, SENDER_MISMATCH_PREFIX, STALE_GENERATION_PREFIX, STORE_MOVED_PREFIX, type SealingStatement, SelfAdmitManyEntry, SelfAdmitResult, SenderMismatchError, SequencedEnvelope, StaleGenerationError, type StateOpened, type StateRefreshed, Storage, StoreMovedError, SyncStepResult, Transport, UserId, ValidationError, type VerifiedLinkHandshakeInfo, WELCOME_MISLABELED_PREFIX, WELCOME_WAITS_PREFIX, WIRE_VERSION_MIN_ACCEPTED, WelcomeMislabeledError, WelcomeWaitsError, accountRefusalCode, backupPhraseCheckFromWire, describeTransportError, emulateSendBatch, isDeviceGroupBehindError, isHistoryRefusedError, isJournalFullError, isLinkAddRefusedError, isLinkChainTooDeepError, isLinkCommitmentMismatchError, isNotPermittedError, isReadOnlyError, isSenderMismatchError, isStaleGenerationError, isStoreMovedError, isWelcomeMislabeledError, isWelcomeWaitsError, negotiates, notPermittedRule, validate, verifyApplicationContentHash };
package/dist/index.js CHANGED
@@ -828,6 +828,21 @@ var AccountSetup = class _AccountSetup {
828
828
  storageFeatures: storageFeaturesOf(this.storage)
829
829
  });
830
830
  }
831
+ /** "Start over" on an account that was started on this device and never
832
+ * finished (rulings V1201, V1277): deletes the pending root of ONE slot and
833
+ * nothing else, or refuses with a typed answer (see `PendingRootDiscard`).
834
+ * THE HOST'S DUTY, which the SDK cannot check: the person chose it, the
835
+ * slot's stored account is the account signed in now, this sign-in's fresh
836
+ * answer is exactly `none_pinned`, and the slot's SDK store is emptied in
837
+ * the same erase. Never call it from a sweep. */
838
+ discardPendingRoot(slot) {
839
+ return this.call({
840
+ kind: "discardPendingRoot",
841
+ id: this.nextId++,
842
+ slot,
843
+ storageFeatures: storageFeaturesOf(this.storage)
844
+ });
845
+ }
831
846
  // ---- The restore as a rotation (the account identity contract, sections
832
847
  // 3.9, 3.13, 13.1). None of these needs a client or a session: the backup
833
848
  // is opened and the whole `rotation` object is built before the device
@@ -2355,6 +2370,14 @@ var MessagingClient = class _MessagingClient {
2355
2370
  * an interactive call behind all of them. Resolves when every conversation
2356
2371
  * held at the start of the pass (plus any joined while it ran) has been
2357
2372
  * paged, with the decrypted application messages in apply order.
2373
+ *
2374
+ * Rejects with `StoreMovedError` when the client failed closed: before the
2375
+ * pass (it then asks nothing of the server), inside one of its steps (no
2376
+ * later conversation is asked; the pages before it were delivered), or
2377
+ * during its last step. A client that failed closed before or during the
2378
+ * pass never resolves at all, with an empty list or with any other. The
2379
+ * host drops the client and starts a new one on the same store, which
2380
+ * hands what was stored (`pendingApplies`).
2358
2381
  */
2359
2382
  async syncConversations() {
2360
2383
  return await this.call({