@ping-app/ping-openmls-sdk 0.10.1 → 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 +78 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +51 -3
- package/dist/index.d.ts +51 -3
- package/dist/index.js +77 -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-B1GFwNXa.d.cts → types-BOXvsHgp.d.cts} +40 -1
- package/dist/{types-B1GFwNXa.d.ts → types-BOXvsHgp.d.ts} +40 -1
- package/dist/worker.cjs +9 -0
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.js +10 -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 +36 -2
- package/wasm/ping_wasm.js +104 -22
- package/wasm/ping_wasm_bg.wasm +0 -0
- package/wasm/ping_wasm_bg.wasm.d.ts +4 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as Storage, M as MessageEnvelope, i as IncomingMessage } from './types-
|
|
1
|
+
import { S as Storage, M as MessageEnvelope, i as IncomingMessage } from './types-BOXvsHgp.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Wrap a host `Storage` so every namespace carries the per-account scope
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as Storage, M as MessageEnvelope, i as IncomingMessage } from './types-
|
|
1
|
+
import { S as Storage, M as MessageEnvelope, i as IncomingMessage } from './types-BOXvsHgp.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Wrap a host `Storage` so every namespace carries the per-account scope
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as Transport, M as MessageEnvelope, C as ConversationId, U as UserId, D as DiscoveredDevice } from '../types-
|
|
1
|
+
import { T as Transport, M as MessageEnvelope, C as ConversationId, U as UserId, D as DiscoveredDevice } from '../types-BOXvsHgp.cjs';
|
|
2
2
|
|
|
3
3
|
interface WsTransportConfig {
|
|
4
4
|
baseUrl: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as Transport, M as MessageEnvelope, C as ConversationId, U as UserId, D as DiscoveredDevice } from '../types-
|
|
1
|
+
import { T as Transport, M as MessageEnvelope, C as ConversationId, U as UserId, D as DiscoveredDevice } from '../types-BOXvsHgp.js';
|
|
2
2
|
|
|
3
3
|
interface WsTransportConfig {
|
|
4
4
|
baseUrl: string;
|
|
@@ -278,6 +278,35 @@ interface RecoveryBackup {
|
|
|
278
278
|
}[];
|
|
279
279
|
created_at_ms: number;
|
|
280
280
|
}
|
|
281
|
+
/** Why `MessagingClient.checkBackupPhrase` could not complete a check. Every value
|
|
282
|
+
* is a doubt about the CHECK, none is a statement about the phrase:
|
|
283
|
+
* - `invalidPhrase`: not a BIP39 phrase (word count, wordlist or checksum);
|
|
284
|
+
* - `unsupportedVersion`: the blob's version byte is one this build does not know;
|
|
285
|
+
* - `malformed`: not a backup this build can parse (too short, an Argon2 cost
|
|
286
|
+
* outside the accepted range, a payload that disagrees with its preamble);
|
|
287
|
+
* - `undecodable`: the authentication check PASSED (the phrase derived the right
|
|
288
|
+
* key) and this build cannot decode the payload;
|
|
289
|
+
* - `internal`: the check failed inside the SDK (the KDF refused its parameters or
|
|
290
|
+
* failed, a wasm trap, an out-of-memory failure, a worker that did not answer).
|
|
291
|
+
* No reason carries an input: all are safe to log and to persist. */
|
|
292
|
+
type BackupCheckFailure = "invalidPhrase" | "unsupportedVersion" | "malformed" | "undecodable" | "internal";
|
|
293
|
+
/** The answer of `MessagingClient.checkBackupPhrase`: whether a phrase opens a
|
|
294
|
+
* recovery backup, as a code to switch on.
|
|
295
|
+
* - `opens`: the phrase opens the backup.
|
|
296
|
+
* - `authenticationFailed`: PROOF. The backup's own authentication check (the
|
|
297
|
+
* AES-256-GCM tag) failed under the key derived from the phrase: the phrase does
|
|
298
|
+
* not open these exact bytes (wrong words, or bytes that are not what the words
|
|
299
|
+
* sealed). The only answer on which a host may delete a stored phrase.
|
|
300
|
+
* - `couldNotCheck`: DOUBT. Nothing is known about the phrase: delete nothing,
|
|
301
|
+
* claim nothing, ask again later. */
|
|
302
|
+
type BackupPhraseCheck = {
|
|
303
|
+
outcome: "opens";
|
|
304
|
+
} | {
|
|
305
|
+
outcome: "authenticationFailed";
|
|
306
|
+
} | {
|
|
307
|
+
outcome: "couldNotCheck";
|
|
308
|
+
reason: BackupCheckFailure;
|
|
309
|
+
};
|
|
281
310
|
/** An envelope together with the server's log position for it. `serverSeq`
|
|
282
311
|
* 0 means the host does not know the position (a transport that predates
|
|
283
312
|
* positions); the envelope then takes the legacy per-sender path. */
|
|
@@ -285,6 +314,16 @@ interface SequencedEnvelope {
|
|
|
285
314
|
envelope: MessageEnvelope;
|
|
286
315
|
serverSeq: number;
|
|
287
316
|
}
|
|
317
|
+
/** A secret from a conversation's MLS exporter and the MLS epoch it was
|
|
318
|
+
* exported at, from `exportConversationSecretWithEpoch`. The two are one
|
|
319
|
+
* read of one group state: `secret` is the exporter's output at exactly
|
|
320
|
+
* `epoch`. `secret` is secret key material: never log it, persist it only
|
|
321
|
+
* encrypted, and `secret.fill(0)` after use. `epoch` may be logged. */
|
|
322
|
+
interface ExportedSecret {
|
|
323
|
+
/** MLS epoch the secret was exported at. */
|
|
324
|
+
epoch: number;
|
|
325
|
+
secret: Uint8Array;
|
|
326
|
+
}
|
|
288
327
|
/** This device's applied position in one conversation's server log.
|
|
289
328
|
* `anchored` false means `serverSeq` is not a real position yet (a
|
|
290
329
|
* conversation joined through a linking ticket, or a cursor written before
|
|
@@ -532,4 +571,4 @@ interface Transport {
|
|
|
532
571
|
setNextWelcomeRecipients?(conversationId: ConversationId, recipientDeviceIds: DeviceId[]): Promise<void>;
|
|
533
572
|
}
|
|
534
573
|
|
|
535
|
-
export type {
|
|
574
|
+
export type { StrandReason as $, AddMembersReport as A, BackupPhraseCheck as B, ConversationId as C, DiscoveredDevice as D, ExpectedOwner as E, CatchupSnapshotEntry as F, ConversationRemoval as G, HistoryBundle as H, IdentityRotation as I, ConversationUpdate as J, KeyPackageEntry as K, LinkingTicket as L, MessageEnvelope as M, DeviceInfo as N, DeviceRemovalFailure as O, PendingApply as P, HistoryAppEvent as Q, RecoveryBackup as R, Storage as S, Transport as T, UserId as U, Hlc as V, IdentityRotationFailure as W, LogGap as X, MessageKind as Y, OverflowReason as Z, SenderRole as _, DeviceId as a, StrandedConversation as a0, WelcomeFailure as a1, WelcomeFailureReason as a2, ConversationMeta as b, DeviceReauthProof as c, DeviceLinkApproval as d, DeviceLinkPossession as e, CommitInDoubt as f, MemberInfo as g, ConversationPolicy as h, IncomingMessage as i, SequencedEnvelope as j, ApplyBatchResult as k, SyncStepResult as l, LogPosition as m, LogHead as n, CatchupAppEvent as o, CatchupSnapshotView as p, AdmitChatEntry as q, AdmitChatOutcome as r, DeviceRemovalReport as s, ExportedSecret as t, MessageBatchMeta as u, AddMemberStatus as v, AddMemberVerdict as w, BackupCheckFailure as x, BufferOverflow as y, Bytes as z };
|
|
@@ -278,6 +278,35 @@ interface RecoveryBackup {
|
|
|
278
278
|
}[];
|
|
279
279
|
created_at_ms: number;
|
|
280
280
|
}
|
|
281
|
+
/** Why `MessagingClient.checkBackupPhrase` could not complete a check. Every value
|
|
282
|
+
* is a doubt about the CHECK, none is a statement about the phrase:
|
|
283
|
+
* - `invalidPhrase`: not a BIP39 phrase (word count, wordlist or checksum);
|
|
284
|
+
* - `unsupportedVersion`: the blob's version byte is one this build does not know;
|
|
285
|
+
* - `malformed`: not a backup this build can parse (too short, an Argon2 cost
|
|
286
|
+
* outside the accepted range, a payload that disagrees with its preamble);
|
|
287
|
+
* - `undecodable`: the authentication check PASSED (the phrase derived the right
|
|
288
|
+
* key) and this build cannot decode the payload;
|
|
289
|
+
* - `internal`: the check failed inside the SDK (the KDF refused its parameters or
|
|
290
|
+
* failed, a wasm trap, an out-of-memory failure, a worker that did not answer).
|
|
291
|
+
* No reason carries an input: all are safe to log and to persist. */
|
|
292
|
+
type BackupCheckFailure = "invalidPhrase" | "unsupportedVersion" | "malformed" | "undecodable" | "internal";
|
|
293
|
+
/** The answer of `MessagingClient.checkBackupPhrase`: whether a phrase opens a
|
|
294
|
+
* recovery backup, as a code to switch on.
|
|
295
|
+
* - `opens`: the phrase opens the backup.
|
|
296
|
+
* - `authenticationFailed`: PROOF. The backup's own authentication check (the
|
|
297
|
+
* AES-256-GCM tag) failed under the key derived from the phrase: the phrase does
|
|
298
|
+
* not open these exact bytes (wrong words, or bytes that are not what the words
|
|
299
|
+
* sealed). The only answer on which a host may delete a stored phrase.
|
|
300
|
+
* - `couldNotCheck`: DOUBT. Nothing is known about the phrase: delete nothing,
|
|
301
|
+
* claim nothing, ask again later. */
|
|
302
|
+
type BackupPhraseCheck = {
|
|
303
|
+
outcome: "opens";
|
|
304
|
+
} | {
|
|
305
|
+
outcome: "authenticationFailed";
|
|
306
|
+
} | {
|
|
307
|
+
outcome: "couldNotCheck";
|
|
308
|
+
reason: BackupCheckFailure;
|
|
309
|
+
};
|
|
281
310
|
/** An envelope together with the server's log position for it. `serverSeq`
|
|
282
311
|
* 0 means the host does not know the position (a transport that predates
|
|
283
312
|
* positions); the envelope then takes the legacy per-sender path. */
|
|
@@ -285,6 +314,16 @@ interface SequencedEnvelope {
|
|
|
285
314
|
envelope: MessageEnvelope;
|
|
286
315
|
serverSeq: number;
|
|
287
316
|
}
|
|
317
|
+
/** A secret from a conversation's MLS exporter and the MLS epoch it was
|
|
318
|
+
* exported at, from `exportConversationSecretWithEpoch`. The two are one
|
|
319
|
+
* read of one group state: `secret` is the exporter's output at exactly
|
|
320
|
+
* `epoch`. `secret` is secret key material: never log it, persist it only
|
|
321
|
+
* encrypted, and `secret.fill(0)` after use. `epoch` may be logged. */
|
|
322
|
+
interface ExportedSecret {
|
|
323
|
+
/** MLS epoch the secret was exported at. */
|
|
324
|
+
epoch: number;
|
|
325
|
+
secret: Uint8Array;
|
|
326
|
+
}
|
|
288
327
|
/** This device's applied position in one conversation's server log.
|
|
289
328
|
* `anchored` false means `serverSeq` is not a real position yet (a
|
|
290
329
|
* conversation joined through a linking ticket, or a cursor written before
|
|
@@ -532,4 +571,4 @@ interface Transport {
|
|
|
532
571
|
setNextWelcomeRecipients?(conversationId: ConversationId, recipientDeviceIds: DeviceId[]): Promise<void>;
|
|
533
572
|
}
|
|
534
573
|
|
|
535
|
-
export type {
|
|
574
|
+
export type { StrandReason as $, AddMembersReport as A, BackupPhraseCheck as B, ConversationId as C, DiscoveredDevice as D, ExpectedOwner as E, CatchupSnapshotEntry as F, ConversationRemoval as G, HistoryBundle as H, IdentityRotation as I, ConversationUpdate as J, KeyPackageEntry as K, LinkingTicket as L, MessageEnvelope as M, DeviceInfo as N, DeviceRemovalFailure as O, PendingApply as P, HistoryAppEvent as Q, RecoveryBackup as R, Storage as S, Transport as T, UserId as U, Hlc as V, IdentityRotationFailure as W, LogGap as X, MessageKind as Y, OverflowReason as Z, SenderRole as _, DeviceId as a, StrandedConversation as a0, WelcomeFailure as a1, WelcomeFailureReason as a2, ConversationMeta as b, DeviceReauthProof as c, DeviceLinkApproval as d, DeviceLinkPossession as e, CommitInDoubt as f, MemberInfo as g, ConversationPolicy as h, IncomingMessage as i, SequencedEnvelope as j, ApplyBatchResult as k, SyncStepResult as l, LogPosition as m, LogHead as n, CatchupAppEvent as o, CatchupSnapshotView as p, AdmitChatEntry as q, AdmitChatOutcome as r, DeviceRemovalReport as s, ExportedSecret as t, MessageBatchMeta as u, AddMemberStatus as v, AddMemberVerdict as w, BackupCheckFailure as x, BufferOverflow as y, Bytes as z };
|
package/dist/worker.cjs
CHANGED
|
@@ -762,6 +762,13 @@ async function dispatch(msg) {
|
|
|
762
762
|
msg.context,
|
|
763
763
|
msg.length
|
|
764
764
|
);
|
|
765
|
+
case "exportConversationSecretWithEpoch":
|
|
766
|
+
return ensureClient().exportConversationSecretWithEpoch(
|
|
767
|
+
msg.conv,
|
|
768
|
+
msg.label,
|
|
769
|
+
msg.context,
|
|
770
|
+
msg.length
|
|
771
|
+
);
|
|
765
772
|
case "sealLinkingTicket":
|
|
766
773
|
return (0, import_ping_wasm.sealLinkingTicket)(msg.ticket, msg.newDevicePub);
|
|
767
774
|
case "openLinkingTicket":
|
|
@@ -828,6 +835,8 @@ async function dispatch(msg) {
|
|
|
828
835
|
);
|
|
829
836
|
case "decryptBackup":
|
|
830
837
|
return (0, import_ping_wasm.decryptBackup)(msg.blob, msg.mnemonicPhrase);
|
|
838
|
+
case "checkBackupPhrase":
|
|
839
|
+
return (0, import_ping_wasm.checkBackupPhrase)(msg.blob, msg.mnemonicPhrase);
|
|
831
840
|
case "sealHistoryBundle":
|
|
832
841
|
return (0, import_ping_wasm.sealHistoryBundle)(msg.bundle, msg.recipientPub, msg.senderIdentitySecret);
|
|
833
842
|
case "openHistoryBundle":
|