@ping-app/ping-openmls-sdk 0.10.2 → 0.10.3
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.cjs +50 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -3
- package/dist/index.d.ts +35 -3
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -1
- package/dist/notification-preview.d.cts +1 -1
- package/dist/notification-preview.d.ts +1 -1
- package/dist/storage/indexeddb.d.cts +1 -1
- package/dist/storage/indexeddb.d.ts +1 -1
- package/dist/transport/websocket.d.cts +1 -1
- package/dist/transport/websocket.d.ts +1 -1
- package/dist/{types-gAmJFSC-.d.cts → types-BOXvsHgp.d.cts} +30 -1
- package/dist/{types-gAmJFSC-.d.ts → types-BOXvsHgp.d.ts} +30 -1
- package/dist/worker.cjs +2 -0
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.js +3 -0
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
- package/wasm/package.json +1 -1
- package/wasm/ping_wasm.d.ts +20 -2
- package/wasm/ping_wasm.js +60 -22
- package/wasm/ping_wasm_bg.wasm +0 -0
- package/wasm/ping_wasm_bg.wasm.d.ts +3 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as MessageEnvelope, S as Storage, T as Transport, E as ExpectedOwner, C as ConversationId, K as KeyPackageEntry, A as AddMembersReport, a as DeviceId, U as UserId, b as ConversationMeta, L as LinkingTicket, c as DeviceReauthProof, d as DeviceLinkApproval, e as DeviceLinkPossession, I as IdentityRotation, f as CommitInDoubt, g as MemberInfo, h as ConversationPolicy, i as IncomingMessage, j as SequencedEnvelope, k as ApplyBatchResult, l as SyncStepResult, m as LogPosition, n as LogHead, P as PendingApply, o as CatchupAppEvent, p as CatchupSnapshotView, R as RecoveryBackup, H as HistoryBundle, q as AdmitChatEntry, r as AdmitChatOutcome, s as DeviceRemovalReport, t as ExportedSecret, u as MessageBatchMeta } from './types-
|
|
2
|
-
export { v as AddMemberStatus, w as AddMemberVerdict,
|
|
1
|
+
import { M as MessageEnvelope, S as Storage, T as Transport, E as ExpectedOwner, C as ConversationId, K as KeyPackageEntry, A as AddMembersReport, a as DeviceId, U as UserId, b as ConversationMeta, L as LinkingTicket, c as DeviceReauthProof, d as DeviceLinkApproval, e as DeviceLinkPossession, I as IdentityRotation, f as CommitInDoubt, g as MemberInfo, h as ConversationPolicy, i as IncomingMessage, j as SequencedEnvelope, k as ApplyBatchResult, l as SyncStepResult, m as LogPosition, n as LogHead, P as PendingApply, o as CatchupAppEvent, p as CatchupSnapshotView, R as RecoveryBackup, B as BackupPhraseCheck, H as HistoryBundle, q as AdmitChatEntry, r as AdmitChatOutcome, s as DeviceRemovalReport, t as ExportedSecret, u as MessageBatchMeta } from './types-BOXvsHgp.cjs';
|
|
2
|
+
export { v as AddMemberStatus, w as AddMemberVerdict, x as BackupCheckFailure, y as BufferOverflow, z as Bytes, F as CatchupSnapshotEntry, G as ConversationRemoval, J as ConversationUpdate, N as DeviceInfo, O as DeviceRemovalFailure, D as DiscoveredDevice, Q as HistoryAppEvent, V as Hlc, W as IdentityRotationFailure, X as LogGap, Y as MessageKind, Z as OverflowReason, _ as SenderRole, $ as StrandReason, a0 as StrandedConversation, a1 as WelcomeFailure, a2 as WelcomeFailureReason } from './types-BOXvsHgp.cjs';
|
|
3
3
|
export { IndexedDbStorage } from './storage/indexeddb.cjs';
|
|
4
4
|
export { WebSocketTransport } from './transport/websocket.cjs';
|
|
5
5
|
export { MAX_PREVIEW_PREREQUISITES, NotificationPreviewOptions, NotificationPreviewSession, openNotificationPreview } from './notification-preview.cjs';
|
|
@@ -950,6 +950,27 @@ declare class MessagingClient {
|
|
|
950
950
|
/** Decrypt a recovery blob from `GET /v1/recovery/blobs`. Throws on wrong mnemonic or a
|
|
951
951
|
* tampered blob. The returned `identity_export` is the secret seed for `init`. */
|
|
952
952
|
static decryptBackup(blob: Uint8Array, mnemonicPhrase: string): Promise<RecoveryBackup>;
|
|
953
|
+
/**
|
|
954
|
+
* Whether `mnemonicPhrase` opens `blob` (a recovery backup as the server returned
|
|
955
|
+
* it), with THREE answers to switch on:
|
|
956
|
+
*
|
|
957
|
+
* - `{ outcome: "opens" }`;
|
|
958
|
+
* - `{ outcome: "authenticationFailed" }`: PROOF. The backup's own authentication
|
|
959
|
+
* check failed under the key derived from the phrase, so the phrase does not open
|
|
960
|
+
* these exact bytes (wrong words, or bytes that are not what the words sealed: an
|
|
961
|
+
* AEAD cannot tell a changed or shortened ciphertext from wrong words, so hand in
|
|
962
|
+
* the complete bytes). The only answer on which to delete a stored phrase;
|
|
963
|
+
* - `{ outcome: "couldNotCheck", reason }`: DOUBT. A phrase that is not a phrase, a
|
|
964
|
+
* version or a format this build cannot read, a payload it cannot decode, a
|
|
965
|
+
* failure inside the SDK. Delete nothing, claim nothing, ask again later.
|
|
966
|
+
*
|
|
967
|
+
* `decryptBackup` rejects with one message for the last two alike; it is unchanged.
|
|
968
|
+
* This call NEVER rejects: a wasm trap, an out-of-memory failure and a one-shot
|
|
969
|
+
* worker that could not be created or did not answer are `couldNotCheck` with
|
|
970
|
+
* `reason: "internal"`. It resolves nothing of the backup: the decrypted identity
|
|
971
|
+
* is wiped inside the SDK. One Argon2id derivation, on a one-shot worker.
|
|
972
|
+
*/
|
|
973
|
+
static checkBackupPhrase(blob: Uint8Array, mnemonicPhrase: string): Promise<BackupPhraseCheck>;
|
|
953
974
|
/** Seal+sign a `HistoryBundle` for a recipient device. `recipientPub` (X25519, 32B) is the
|
|
954
975
|
* recipient's ephemeral pubkey from the linking QR; `senderIdentitySecret` (Ed25519 seed,
|
|
955
976
|
* 32B) is this account's identity key. Returns the blob to POST to /v1/history-transfers. */
|
|
@@ -1159,6 +1180,17 @@ declare class MessagingClient {
|
|
|
1159
1180
|
private callTransportMethod;
|
|
1160
1181
|
private handleWorker;
|
|
1161
1182
|
}
|
|
1183
|
+
/**
|
|
1184
|
+
* Read a `{ outcome, reason? }` answer of the SDK's backup phrase check (the wasm
|
|
1185
|
+
* `checkBackupPhrase`, the React Native bridge) as a {@link BackupPhraseCheck}.
|
|
1186
|
+
*
|
|
1187
|
+
* The rule: ONLY the exact code `"authenticationFailed"` is proof that the phrase
|
|
1188
|
+
* does not open the backup, and only the exact code `"opens"` says that it does.
|
|
1189
|
+
* Everything else is a doubt: a value that is not such an object, an outcome this
|
|
1190
|
+
* build does not know, and a `couldNotCheck` whose reason it does not know (read as
|
|
1191
|
+
* `"internal"`). Nothing but the codes is carried over.
|
|
1192
|
+
*/
|
|
1193
|
+
declare function backupPhraseCheckFromWire(raw: unknown): BackupPhraseCheck;
|
|
1162
1194
|
/** A stateless SDK call ran on a one-shot worker that failed before it could answer:
|
|
1163
1195
|
* the worker could not be created (`spawn`), the request could not be posted (`post`),
|
|
1164
1196
|
* the worker script failed to load, import or run (`error`), or its reply could not be
|
|
@@ -1242,4 +1274,4 @@ declare function emulateSendBatch(transport: Pick<Transport, "send">, envelopes:
|
|
|
1242
1274
|
* server error code rides along for diagnostics. */
|
|
1243
1275
|
declare function describeTransportError(e: unknown): string;
|
|
1244
1276
|
|
|
1245
|
-
export { AddMembersReport, AdmitChatEntry, AdmitChatOutcome, ApplyBatchResult, BATCH_PARTIAL_PREFIX, 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, DeviceId, DeviceLinkApproval, DeviceLinkPossession, DeviceReauthProof, DeviceRemovalReport, EphemeralWorkerError, ExpectedOwner, ExportedSecret, HPKE_PQ_ENC_BYTES, HPKE_PQ_PUBLIC_KEY_BYTES, HistoryBundle, IdentityRotation, IncomingMessage, KeyPackageEntry, LinkingTicket, LogHead, LogPosition, MemberInfo, MessageBatchMeta, MessageEnvelope, MessagingClient, MessagingClientClosedError, NOT_PERMITTED_PREFIX, NotPermittedError, PING_WIRE_CONTRACT_HEADER, PING_WIRE_CONTRACT_HEADER_VALUE, PING_WIRE_CONTRACT_VERSION, PendingApply, RecoveryBackup, SENDER_MISMATCH_PREFIX, SenderMismatchError, SequencedEnvelope, Storage, SyncStepResult, Transport, UserId, ValidationError, WIRE_VERSION_MIN_ACCEPTED, describeTransportError, emulateSendBatch, isNotPermittedError, isSenderMismatchError, negotiates, notPermittedRule, validate, verifyApplicationContentHash };
|
|
1277
|
+
export { AddMembersReport, AdmitChatEntry, AdmitChatOutcome, 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, DeviceId, DeviceLinkApproval, DeviceLinkPossession, DeviceReauthProof, DeviceRemovalReport, EphemeralWorkerError, ExpectedOwner, ExportedSecret, HPKE_PQ_ENC_BYTES, HPKE_PQ_PUBLIC_KEY_BYTES, HistoryBundle, IdentityRotation, IncomingMessage, KeyPackageEntry, LinkingTicket, LogHead, LogPosition, MemberInfo, MessageBatchMeta, MessageEnvelope, MessagingClient, MessagingClientClosedError, NOT_PERMITTED_PREFIX, NotPermittedError, PING_WIRE_CONTRACT_HEADER, PING_WIRE_CONTRACT_HEADER_VALUE, PING_WIRE_CONTRACT_VERSION, PendingApply, RecoveryBackup, SENDER_MISMATCH_PREFIX, SenderMismatchError, SequencedEnvelope, Storage, SyncStepResult, Transport, UserId, ValidationError, WIRE_VERSION_MIN_ACCEPTED, backupPhraseCheckFromWire, describeTransportError, emulateSendBatch, isNotPermittedError, isSenderMismatchError, negotiates, notPermittedRule, validate, verifyApplicationContentHash };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as MessageEnvelope, S as Storage, T as Transport, E as ExpectedOwner, C as ConversationId, K as KeyPackageEntry, A as AddMembersReport, a as DeviceId, U as UserId, b as ConversationMeta, L as LinkingTicket, c as DeviceReauthProof, d as DeviceLinkApproval, e as DeviceLinkPossession, I as IdentityRotation, f as CommitInDoubt, g as MemberInfo, h as ConversationPolicy, i as IncomingMessage, j as SequencedEnvelope, k as ApplyBatchResult, l as SyncStepResult, m as LogPosition, n as LogHead, P as PendingApply, o as CatchupAppEvent, p as CatchupSnapshotView, R as RecoveryBackup, H as HistoryBundle, q as AdmitChatEntry, r as AdmitChatOutcome, s as DeviceRemovalReport, t as ExportedSecret, u as MessageBatchMeta } from './types-
|
|
2
|
-
export { v as AddMemberStatus, w as AddMemberVerdict,
|
|
1
|
+
import { M as MessageEnvelope, S as Storage, T as Transport, E as ExpectedOwner, C as ConversationId, K as KeyPackageEntry, A as AddMembersReport, a as DeviceId, U as UserId, b as ConversationMeta, L as LinkingTicket, c as DeviceReauthProof, d as DeviceLinkApproval, e as DeviceLinkPossession, I as IdentityRotation, f as CommitInDoubt, g as MemberInfo, h as ConversationPolicy, i as IncomingMessage, j as SequencedEnvelope, k as ApplyBatchResult, l as SyncStepResult, m as LogPosition, n as LogHead, P as PendingApply, o as CatchupAppEvent, p as CatchupSnapshotView, R as RecoveryBackup, B as BackupPhraseCheck, H as HistoryBundle, q as AdmitChatEntry, r as AdmitChatOutcome, s as DeviceRemovalReport, t as ExportedSecret, u as MessageBatchMeta } from './types-BOXvsHgp.js';
|
|
2
|
+
export { v as AddMemberStatus, w as AddMemberVerdict, x as BackupCheckFailure, y as BufferOverflow, z as Bytes, F as CatchupSnapshotEntry, G as ConversationRemoval, J as ConversationUpdate, N as DeviceInfo, O as DeviceRemovalFailure, D as DiscoveredDevice, Q as HistoryAppEvent, V as Hlc, W as IdentityRotationFailure, X as LogGap, Y as MessageKind, Z as OverflowReason, _ as SenderRole, $ as StrandReason, a0 as StrandedConversation, a1 as WelcomeFailure, a2 as WelcomeFailureReason } from './types-BOXvsHgp.js';
|
|
3
3
|
export { IndexedDbStorage } from './storage/indexeddb.js';
|
|
4
4
|
export { WebSocketTransport } from './transport/websocket.js';
|
|
5
5
|
export { MAX_PREVIEW_PREREQUISITES, NotificationPreviewOptions, NotificationPreviewSession, openNotificationPreview } from './notification-preview.js';
|
|
@@ -950,6 +950,27 @@ declare class MessagingClient {
|
|
|
950
950
|
/** Decrypt a recovery blob from `GET /v1/recovery/blobs`. Throws on wrong mnemonic or a
|
|
951
951
|
* tampered blob. The returned `identity_export` is the secret seed for `init`. */
|
|
952
952
|
static decryptBackup(blob: Uint8Array, mnemonicPhrase: string): Promise<RecoveryBackup>;
|
|
953
|
+
/**
|
|
954
|
+
* Whether `mnemonicPhrase` opens `blob` (a recovery backup as the server returned
|
|
955
|
+
* it), with THREE answers to switch on:
|
|
956
|
+
*
|
|
957
|
+
* - `{ outcome: "opens" }`;
|
|
958
|
+
* - `{ outcome: "authenticationFailed" }`: PROOF. The backup's own authentication
|
|
959
|
+
* check failed under the key derived from the phrase, so the phrase does not open
|
|
960
|
+
* these exact bytes (wrong words, or bytes that are not what the words sealed: an
|
|
961
|
+
* AEAD cannot tell a changed or shortened ciphertext from wrong words, so hand in
|
|
962
|
+
* the complete bytes). The only answer on which to delete a stored phrase;
|
|
963
|
+
* - `{ outcome: "couldNotCheck", reason }`: DOUBT. A phrase that is not a phrase, a
|
|
964
|
+
* version or a format this build cannot read, a payload it cannot decode, a
|
|
965
|
+
* failure inside the SDK. Delete nothing, claim nothing, ask again later.
|
|
966
|
+
*
|
|
967
|
+
* `decryptBackup` rejects with one message for the last two alike; it is unchanged.
|
|
968
|
+
* This call NEVER rejects: a wasm trap, an out-of-memory failure and a one-shot
|
|
969
|
+
* worker that could not be created or did not answer are `couldNotCheck` with
|
|
970
|
+
* `reason: "internal"`. It resolves nothing of the backup: the decrypted identity
|
|
971
|
+
* is wiped inside the SDK. One Argon2id derivation, on a one-shot worker.
|
|
972
|
+
*/
|
|
973
|
+
static checkBackupPhrase(blob: Uint8Array, mnemonicPhrase: string): Promise<BackupPhraseCheck>;
|
|
953
974
|
/** Seal+sign a `HistoryBundle` for a recipient device. `recipientPub` (X25519, 32B) is the
|
|
954
975
|
* recipient's ephemeral pubkey from the linking QR; `senderIdentitySecret` (Ed25519 seed,
|
|
955
976
|
* 32B) is this account's identity key. Returns the blob to POST to /v1/history-transfers. */
|
|
@@ -1159,6 +1180,17 @@ declare class MessagingClient {
|
|
|
1159
1180
|
private callTransportMethod;
|
|
1160
1181
|
private handleWorker;
|
|
1161
1182
|
}
|
|
1183
|
+
/**
|
|
1184
|
+
* Read a `{ outcome, reason? }` answer of the SDK's backup phrase check (the wasm
|
|
1185
|
+
* `checkBackupPhrase`, the React Native bridge) as a {@link BackupPhraseCheck}.
|
|
1186
|
+
*
|
|
1187
|
+
* The rule: ONLY the exact code `"authenticationFailed"` is proof that the phrase
|
|
1188
|
+
* does not open the backup, and only the exact code `"opens"` says that it does.
|
|
1189
|
+
* Everything else is a doubt: a value that is not such an object, an outcome this
|
|
1190
|
+
* build does not know, and a `couldNotCheck` whose reason it does not know (read as
|
|
1191
|
+
* `"internal"`). Nothing but the codes is carried over.
|
|
1192
|
+
*/
|
|
1193
|
+
declare function backupPhraseCheckFromWire(raw: unknown): BackupPhraseCheck;
|
|
1162
1194
|
/** A stateless SDK call ran on a one-shot worker that failed before it could answer:
|
|
1163
1195
|
* the worker could not be created (`spawn`), the request could not be posted (`post`),
|
|
1164
1196
|
* the worker script failed to load, import or run (`error`), or its reply could not be
|
|
@@ -1242,4 +1274,4 @@ declare function emulateSendBatch(transport: Pick<Transport, "send">, envelopes:
|
|
|
1242
1274
|
* server error code rides along for diagnostics. */
|
|
1243
1275
|
declare function describeTransportError(e: unknown): string;
|
|
1244
1276
|
|
|
1245
|
-
export { AddMembersReport, AdmitChatEntry, AdmitChatOutcome, ApplyBatchResult, BATCH_PARTIAL_PREFIX, 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, DeviceId, DeviceLinkApproval, DeviceLinkPossession, DeviceReauthProof, DeviceRemovalReport, EphemeralWorkerError, ExpectedOwner, ExportedSecret, HPKE_PQ_ENC_BYTES, HPKE_PQ_PUBLIC_KEY_BYTES, HistoryBundle, IdentityRotation, IncomingMessage, KeyPackageEntry, LinkingTicket, LogHead, LogPosition, MemberInfo, MessageBatchMeta, MessageEnvelope, MessagingClient, MessagingClientClosedError, NOT_PERMITTED_PREFIX, NotPermittedError, PING_WIRE_CONTRACT_HEADER, PING_WIRE_CONTRACT_HEADER_VALUE, PING_WIRE_CONTRACT_VERSION, PendingApply, RecoveryBackup, SENDER_MISMATCH_PREFIX, SenderMismatchError, SequencedEnvelope, Storage, SyncStepResult, Transport, UserId, ValidationError, WIRE_VERSION_MIN_ACCEPTED, describeTransportError, emulateSendBatch, isNotPermittedError, isSenderMismatchError, negotiates, notPermittedRule, validate, verifyApplicationContentHash };
|
|
1277
|
+
export { AddMembersReport, AdmitChatEntry, AdmitChatOutcome, 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, DeviceId, DeviceLinkApproval, DeviceLinkPossession, DeviceReauthProof, DeviceRemovalReport, EphemeralWorkerError, ExpectedOwner, ExportedSecret, HPKE_PQ_ENC_BYTES, HPKE_PQ_PUBLIC_KEY_BYTES, HistoryBundle, IdentityRotation, IncomingMessage, KeyPackageEntry, LinkingTicket, LogHead, LogPosition, MemberInfo, MessageBatchMeta, MessageEnvelope, MessagingClient, MessagingClientClosedError, NOT_PERMITTED_PREFIX, NotPermittedError, PING_WIRE_CONTRACT_HEADER, PING_WIRE_CONTRACT_HEADER_VALUE, PING_WIRE_CONTRACT_VERSION, PendingApply, RecoveryBackup, SENDER_MISMATCH_PREFIX, SenderMismatchError, SequencedEnvelope, Storage, SyncStepResult, Transport, UserId, ValidationError, WIRE_VERSION_MIN_ACCEPTED, backupPhraseCheckFromWire, describeTransportError, emulateSendBatch, isNotPermittedError, isSenderMismatchError, negotiates, notPermittedRule, validate, verifyApplicationContentHash };
|
package/dist/index.js
CHANGED
|
@@ -2070,6 +2070,40 @@ var MessagingClient = class _MessagingClient {
|
|
|
2070
2070
|
mnemonicPhrase
|
|
2071
2071
|
});
|
|
2072
2072
|
}
|
|
2073
|
+
/**
|
|
2074
|
+
* Whether `mnemonicPhrase` opens `blob` (a recovery backup as the server returned
|
|
2075
|
+
* it), with THREE answers to switch on:
|
|
2076
|
+
*
|
|
2077
|
+
* - `{ outcome: "opens" }`;
|
|
2078
|
+
* - `{ outcome: "authenticationFailed" }`: PROOF. The backup's own authentication
|
|
2079
|
+
* check failed under the key derived from the phrase, so the phrase does not open
|
|
2080
|
+
* these exact bytes (wrong words, or bytes that are not what the words sealed: an
|
|
2081
|
+
* AEAD cannot tell a changed or shortened ciphertext from wrong words, so hand in
|
|
2082
|
+
* the complete bytes). The only answer on which to delete a stored phrase;
|
|
2083
|
+
* - `{ outcome: "couldNotCheck", reason }`: DOUBT. A phrase that is not a phrase, a
|
|
2084
|
+
* version or a format this build cannot read, a payload it cannot decode, a
|
|
2085
|
+
* failure inside the SDK. Delete nothing, claim nothing, ask again later.
|
|
2086
|
+
*
|
|
2087
|
+
* `decryptBackup` rejects with one message for the last two alike; it is unchanged.
|
|
2088
|
+
* This call NEVER rejects: a wasm trap, an out-of-memory failure and a one-shot
|
|
2089
|
+
* worker that could not be created or did not answer are `couldNotCheck` with
|
|
2090
|
+
* `reason: "internal"`. It resolves nothing of the backup: the decrypted identity
|
|
2091
|
+
* is wiped inside the SDK. One Argon2id derivation, on a one-shot worker.
|
|
2092
|
+
*/
|
|
2093
|
+
static async checkBackupPhrase(blob, mnemonicPhrase) {
|
|
2094
|
+
try {
|
|
2095
|
+
return backupPhraseCheckFromWire(
|
|
2096
|
+
await _MessagingClient.ephemeralWorkerCall({
|
|
2097
|
+
kind: "checkBackupPhrase",
|
|
2098
|
+
id: 1,
|
|
2099
|
+
blob,
|
|
2100
|
+
mnemonicPhrase
|
|
2101
|
+
})
|
|
2102
|
+
);
|
|
2103
|
+
} catch {
|
|
2104
|
+
return { outcome: "couldNotCheck", reason: "internal" };
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
2073
2107
|
// ------------------------ Peer-assisted history transfer ------------------------
|
|
2074
2108
|
// Authenticated (sign-then-encrypt) device-to-device history used by linking and
|
|
2075
2109
|
// post-recovery peer re-add. Confidential to the recipient's ephemeral X25519 key AND
|
|
@@ -2635,6 +2669,20 @@ var MessagingClient = class _MessagingClient {
|
|
|
2635
2669
|
}
|
|
2636
2670
|
}
|
|
2637
2671
|
};
|
|
2672
|
+
var BACKUP_CHECK_FAILURES = [
|
|
2673
|
+
"invalidPhrase",
|
|
2674
|
+
"unsupportedVersion",
|
|
2675
|
+
"malformed",
|
|
2676
|
+
"undecodable",
|
|
2677
|
+
"internal"
|
|
2678
|
+
];
|
|
2679
|
+
function backupPhraseCheckFromWire(raw) {
|
|
2680
|
+
const rec = raw !== null && typeof raw === "object" ? raw : {};
|
|
2681
|
+
if (rec.outcome === "opens") return { outcome: "opens" };
|
|
2682
|
+
if (rec.outcome === "authenticationFailed") return { outcome: "authenticationFailed" };
|
|
2683
|
+
const reason = rec.outcome === "couldNotCheck" ? BACKUP_CHECK_FAILURES.find((known) => known === rec.reason) : void 0;
|
|
2684
|
+
return { outcome: "couldNotCheck", reason: reason ?? "internal" };
|
|
2685
|
+
}
|
|
2638
2686
|
var EphemeralWorkerError = class extends Error {
|
|
2639
2687
|
reason;
|
|
2640
2688
|
constructor(reason) {
|
|
@@ -2752,6 +2800,7 @@ export {
|
|
|
2752
2800
|
ValidationError,
|
|
2753
2801
|
WIRE_VERSION_MIN_ACCEPTED,
|
|
2754
2802
|
WebSocketTransport,
|
|
2803
|
+
backupPhraseCheckFromWire,
|
|
2755
2804
|
describeTransportError,
|
|
2756
2805
|
emulateSendBatch,
|
|
2757
2806
|
isNotPermittedError,
|