@agora-sdk/secure-chat-crypto 0.4.0 → 0.5.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/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/interface.d.ts +77 -1
- package/dist/cjs/interface.js +19 -0
- package/dist/cjs/interface.js.map +1 -1
- package/dist/cjs/mock-crypto.d.ts +4 -3
- package/dist/cjs/mock-crypto.js +54 -9
- package/dist/cjs/mock-crypto.js.map +1 -1
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/interface.d.ts +77 -1
- package/dist/esm/interface.js +17 -1
- package/dist/esm/interface.js.map +1 -1
- package/dist/esm/mock-crypto.d.ts +4 -3
- package/dist/esm/mock-crypto.js +54 -9
- package/dist/esm/mock-crypto.js.map +1 -1
- package/dist/esm/ts-mls/backup.d.ts +30 -0
- package/dist/esm/ts-mls/backup.js +105 -0
- package/dist/esm/ts-mls/backup.js.map +1 -0
- package/dist/esm/ts-mls/crypto.d.ts +24 -3
- package/dist/esm/ts-mls/crypto.js +96 -17
- package/dist/esm/ts-mls/crypto.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export type { SecureChatCrypto, DeviceIdentity, KeyPackageBundle, GroupHandle, TargetedWelcome, CommitResult, PassphraseBackup, } from "./interface.js";
|
|
1
|
+
export type { SecureChatCrypto, DeviceIdentity, KeyPackageBundle, GroupHandle, GroupMemberIdentity, TargetedWelcome, CommitResult, PassphraseBackup, SecureDecryptFailureReason, } from "./interface.js";
|
|
2
|
+
export { SecureChatDecryptError } from "./interface.js";
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SecureChatDecryptError = void 0;
|
|
4
|
+
// Value export (a real Error subclass) so callers can `instanceof` it to fail closed on a rejected message.
|
|
5
|
+
var interface_js_1 = require("./interface.js");
|
|
6
|
+
Object.defineProperty(exports, "SecureChatDecryptError", { enumerable: true, get: function () { return interface_js_1.SecureChatDecryptError; } });
|
|
3
7
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAiBA,4GAA4G;AAC5G,+CAAwD;AAA/C,sHAAA,sBAAsB,OAAA"}
|
package/dist/cjs/interface.d.ts
CHANGED
|
@@ -18,6 +18,14 @@ export interface GroupHandle {
|
|
|
18
18
|
mlsGroupId: Uint8Array;
|
|
19
19
|
epoch: bigint;
|
|
20
20
|
}
|
|
21
|
+
/** One member of a group, as seen in the local MLS roster: a device id + its signature public key.
|
|
22
|
+
* The public key is what a safety number / key-verification fingerprint is derived from. */
|
|
23
|
+
export interface GroupMemberIdentity {
|
|
24
|
+
/** The member device's stable id (the MLS credential identity). */
|
|
25
|
+
deviceId: string;
|
|
26
|
+
/** The member device's MLS signature PUBLIC key (safe to expose; never the private half). */
|
|
27
|
+
signaturePublicKey: Uint8Array;
|
|
28
|
+
}
|
|
21
29
|
/** A Welcome destined for exactly one new-member device (the one whose KeyPackage was used). */
|
|
22
30
|
export interface TargetedWelcome {
|
|
23
31
|
targetDeviceId: string;
|
|
@@ -39,6 +47,34 @@ export interface PassphraseBackup {
|
|
|
39
47
|
nonce: Uint8Array;
|
|
40
48
|
version: number;
|
|
41
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Why an inbound message could not be decrypted/authenticated. Drives fail-closed handling at the
|
|
52
|
+
* caller: a `"replay"` / `"gap-too-large"` / `"unauthenticated"` / `"malformed"` / `"epoch-too-old"`
|
|
53
|
+
* message is a terminal rejection (drop it), whereas a future-epoch message the client hasn't reached
|
|
54
|
+
* yet is NOT one of these — the caller decides that by epoch, not by reason.
|
|
55
|
+
*
|
|
56
|
+
* - `replay` — the sender generation was already consumed (a replayed/duplicated message).
|
|
57
|
+
* - `gap-too-large` — the generation jumped further ahead than the ratchet will skip (possible drop/DoS).
|
|
58
|
+
* - `epoch-too-old` — the message's epoch is older than the retained history; its keys are gone.
|
|
59
|
+
* - `unauthenticated` — signature/authentication failed (forged or corrupted).
|
|
60
|
+
* - `malformed` — the bytes didn't decode as a valid MLS message.
|
|
61
|
+
* - `unknown` — any other decrypt failure.
|
|
62
|
+
*/
|
|
63
|
+
export type SecureDecryptFailureReason = "replay" | "gap-too-large" | "epoch-too-old" | "unauthenticated" | "malformed" | "unknown";
|
|
64
|
+
/**
|
|
65
|
+
* Thrown by {@link SecureChatCrypto.decryptMessage} when a message fails to decrypt/authenticate. The
|
|
66
|
+
* MLS core (its secret-tree ratchet) is the single point that enforces replay/gap rejection; this
|
|
67
|
+
* error simply classifies that failure so the caller can fail closed and surface it. Carries no
|
|
68
|
+
* plaintext or key material.
|
|
69
|
+
*/
|
|
70
|
+
export declare class SecureChatDecryptError extends Error {
|
|
71
|
+
readonly reason: SecureDecryptFailureReason;
|
|
72
|
+
/**
|
|
73
|
+
* @param reason - The {@link SecureDecryptFailureReason} classification.
|
|
74
|
+
* @param message - A non-sensitive, human-readable description (never includes plaintext/keys).
|
|
75
|
+
*/
|
|
76
|
+
constructor(reason: SecureDecryptFailureReason, message: string);
|
|
77
|
+
}
|
|
42
78
|
export interface SecureChatCrypto {
|
|
43
79
|
generateDeviceIdentity(opts: {
|
|
44
80
|
deviceId: string;
|
|
@@ -67,11 +103,33 @@ export interface SecureChatCrypto {
|
|
|
67
103
|
ciphertext: Uint8Array;
|
|
68
104
|
epoch: bigint;
|
|
69
105
|
}>;
|
|
106
|
+
/**
|
|
107
|
+
* Decrypt + authenticate one inbound MLS application message. The MLS core's secret-tree ratchet is
|
|
108
|
+
* the single point that enforces replay/gap rejection (a consumed generation can't be re-derived; a
|
|
109
|
+
* generation too far ahead is refused) — implementations do not hand-roll a parallel counter. Always
|
|
110
|
+
* fails closed: on any failure it throws and returns no plaintext.
|
|
111
|
+
*
|
|
112
|
+
* @param group - The local group handle.
|
|
113
|
+
* @param ciphertext - The MLS PrivateMessage bytes (base64-decoded at the wire boundary).
|
|
114
|
+
* @returns The plaintext, the best-effort sender device id, and the message epoch.
|
|
115
|
+
* @throws {SecureChatDecryptError} On replay, an over-limit generation gap, a too-old epoch, a failed
|
|
116
|
+
* authentication, malformed bytes, or any other decrypt failure (see {@link SecureDecryptFailureReason}).
|
|
117
|
+
*/
|
|
70
118
|
decryptMessage(group: GroupHandle, ciphertext: Uint8Array): Promise<{
|
|
71
119
|
plaintext: Uint8Array;
|
|
72
120
|
senderDeviceId: string;
|
|
73
121
|
epoch: bigint;
|
|
74
122
|
}>;
|
|
123
|
+
/**
|
|
124
|
+
* List the members of a joined group as `{ deviceId, signaturePublicKey }`, read from the local MLS
|
|
125
|
+
* roster. The public keys feed an out-of-band safety-number / key-verification fingerprint (TOFU
|
|
126
|
+
* hardening against a blind server swapping a KeyPackage). Returns public material only.
|
|
127
|
+
*
|
|
128
|
+
* @param group - The local group handle.
|
|
129
|
+
* @returns The group's members (order is implementation-defined; callers that need stability sort).
|
|
130
|
+
* @throws {Error} When the group is unknown (not joined / evicted).
|
|
131
|
+
*/
|
|
132
|
+
exportGroupIdentities(group: GroupHandle): Promise<GroupMemberIdentity[]>;
|
|
75
133
|
processWelcome(welcome: Uint8Array): Promise<GroupHandle>;
|
|
76
134
|
processCommit(group: GroupHandle, commit: Uint8Array): Promise<GroupHandle>;
|
|
77
135
|
processProposal(group: GroupHandle, proposal: Uint8Array): Promise<void>;
|
|
@@ -81,6 +139,24 @@ export interface SecureChatCrypto {
|
|
|
81
139
|
exportDeviceState(): Promise<Uint8Array>;
|
|
82
140
|
/** Restore device identity + private state from {@link exportDeviceState} output. */
|
|
83
141
|
importDeviceState(state: Uint8Array): Promise<DeviceIdentity>;
|
|
142
|
+
/**
|
|
143
|
+
* Seal all local key material (device identity + private keys + every joined group's state) into a
|
|
144
|
+
* passphrase-encrypted blob for upload to the blind server. The real cores use a memory-hard KDF
|
|
145
|
+
* (argon2id) + an AEAD; the server stores the ciphertext verbatim and can never decrypt it.
|
|
146
|
+
*
|
|
147
|
+
* @param passphrase - The user's backup passphrase (never sent to the server).
|
|
148
|
+
* @returns The encrypted backup envelope (base64-encode `blob`/`nonce` at the wire boundary).
|
|
149
|
+
*/
|
|
84
150
|
exportBackup(passphrase: string): Promise<PassphraseBackup>;
|
|
85
|
-
|
|
151
|
+
/**
|
|
152
|
+
* Restore local key material from a {@link exportBackup} envelope, repopulating this instance's
|
|
153
|
+
* device identity and group states. Symmetric with {@link importDeviceState}, it returns the
|
|
154
|
+
* restored identity so a caller can re-assert the device server-side (idempotently) and rehydrate UI.
|
|
155
|
+
*
|
|
156
|
+
* @param passphrase - The user's backup passphrase.
|
|
157
|
+
* @param backup - The encrypted envelope fetched from the server.
|
|
158
|
+
* @returns The restored device identity.
|
|
159
|
+
* @throws {Error} On a wrong passphrase or a corrupt/tampered backup (fails closed — no partial restore).
|
|
160
|
+
*/
|
|
161
|
+
importBackup(passphrase: string, backup: PassphraseBackup): Promise<DeviceIdentity>;
|
|
86
162
|
}
|
package/dist/cjs/interface.js
CHANGED
|
@@ -11,4 +11,23 @@
|
|
|
11
11
|
// its owner. Binary is `Uint8Array` IN MEMORY; the network layer base64-encodes at the wire
|
|
12
12
|
// boundary. MLS epochs are u64 → `bigint`.
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.SecureChatDecryptError = void 0;
|
|
15
|
+
/**
|
|
16
|
+
* Thrown by {@link SecureChatCrypto.decryptMessage} when a message fails to decrypt/authenticate. The
|
|
17
|
+
* MLS core (its secret-tree ratchet) is the single point that enforces replay/gap rejection; this
|
|
18
|
+
* error simply classifies that failure so the caller can fail closed and surface it. Carries no
|
|
19
|
+
* plaintext or key material.
|
|
20
|
+
*/
|
|
21
|
+
class SecureChatDecryptError extends Error {
|
|
22
|
+
/**
|
|
23
|
+
* @param reason - The {@link SecureDecryptFailureReason} classification.
|
|
24
|
+
* @param message - A non-sensitive, human-readable description (never includes plaintext/keys).
|
|
25
|
+
*/
|
|
26
|
+
constructor(reason, message) {
|
|
27
|
+
super(message);
|
|
28
|
+
this.reason = reason;
|
|
29
|
+
this.name = "SecureChatDecryptError";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.SecureChatDecryptError = SecureChatDecryptError;
|
|
14
33
|
//# sourceMappingURL=interface.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src/interface.ts"],"names":[],"mappings":";AAAA,6FAA6F;AAC7F,EAAE;AACF,+FAA+F;AAC/F,6FAA6F;AAC7F,gGAAgG;AAChG,yFAAyF;AACzF,EAAE;AACF,0FAA0F;AAC1F,kGAAkG;AAClG,4FAA4F;AAC5F,2CAA2C"}
|
|
1
|
+
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src/interface.ts"],"names":[],"mappings":";AAAA,6FAA6F;AAC7F,EAAE;AACF,+FAA+F;AAC/F,6FAA6F;AAC7F,gGAAgG;AAChG,yFAAyF;AACzF,EAAE;AACF,0FAA0F;AAC1F,kGAAkG;AAClG,4FAA4F;AAC5F,2CAA2C;;;AA+E3C;;;;;GAKG;AACH,MAAa,sBAAuB,SAAQ,KAAK;IAC/C;;;OAGG;IACH,YACW,MAAkC,EAC3C,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QAHN,WAAM,GAAN,MAAM,CAA4B;QAI3C,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;IACvC,CAAC;CACF;AAZD,wDAYC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SecureChatCrypto, DeviceIdentity, KeyPackageBundle, GroupHandle, CommitResult, PassphraseBackup, TargetedWelcome } from "./interface.js";
|
|
1
|
+
import type { SecureChatCrypto, DeviceIdentity, KeyPackageBundle, GroupHandle, GroupMemberIdentity, CommitResult, PassphraseBackup, TargetedWelcome } from "./interface.js";
|
|
2
2
|
export declare class MockSecureChatCrypto implements SecureChatCrypto {
|
|
3
3
|
private identity?;
|
|
4
4
|
private privateState?;
|
|
@@ -26,7 +26,7 @@ export declare class MockSecureChatCrypto implements SecureChatCrypto {
|
|
|
26
26
|
deviceId: string;
|
|
27
27
|
keyPackage: Uint8Array;
|
|
28
28
|
}): Promise<CommitResult>;
|
|
29
|
-
removeMember(group: GroupHandle,
|
|
29
|
+
removeMember(group: GroupHandle, leafDeviceId: string): Promise<CommitResult>;
|
|
30
30
|
encryptMessage(group: GroupHandle, plaintext: Uint8Array): Promise<{
|
|
31
31
|
ciphertext: Uint8Array;
|
|
32
32
|
epoch: bigint;
|
|
@@ -37,6 +37,7 @@ export declare class MockSecureChatCrypto implements SecureChatCrypto {
|
|
|
37
37
|
epoch: bigint;
|
|
38
38
|
}>;
|
|
39
39
|
processWelcome(welcome: Uint8Array): Promise<GroupHandle>;
|
|
40
|
+
exportGroupIdentities(group: GroupHandle): Promise<GroupMemberIdentity[]>;
|
|
40
41
|
processCommit(group: GroupHandle, commit: Uint8Array): Promise<GroupHandle>;
|
|
41
42
|
processProposal(_group: GroupHandle, _proposal: Uint8Array): Promise<void>;
|
|
42
43
|
exportDeviceState(): Promise<Uint8Array>;
|
|
@@ -44,5 +45,5 @@ export declare class MockSecureChatCrypto implements SecureChatCrypto {
|
|
|
44
45
|
exportGroupState(group: GroupHandle): Promise<Uint8Array>;
|
|
45
46
|
importGroupState(state: Uint8Array): Promise<GroupHandle>;
|
|
46
47
|
exportBackup(passphrase: string): Promise<PassphraseBackup>;
|
|
47
|
-
importBackup(passphrase: string, backup: PassphraseBackup): Promise<
|
|
48
|
+
importBackup(passphrase: string, backup: PassphraseBackup): Promise<DeviceIdentity>;
|
|
48
49
|
}
|
package/dist/cjs/mock-crypto.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MockSecureChatCrypto = void 0;
|
|
4
|
+
const interface_js_1 = require("./interface.js");
|
|
4
5
|
const enc = new TextEncoder();
|
|
5
6
|
const dec = new TextDecoder();
|
|
6
7
|
const BACKUP_MAGIC = "AGORA_MOCK_BACKUP_V1";
|
|
@@ -78,13 +79,15 @@ class MockSecureChatCrypto {
|
|
|
78
79
|
bytesFrom(`grp:${did}:${opts.initialMembers.map((m) => m.deviceId).join(",")}`, 16);
|
|
79
80
|
const idHex = toHex(mlsGroupId);
|
|
80
81
|
const secret = bytesFrom(`secret:${idHex}:${did}`, 32);
|
|
81
|
-
|
|
82
|
+
const members = [did, ...opts.initialMembers.map((m) => m.deviceId)];
|
|
83
|
+
this.groups.set(idHex, { secret, epoch: 0n, members });
|
|
82
84
|
const welcomes = opts.initialMembers.map((m) => ({
|
|
83
85
|
targetDeviceId: m.deviceId,
|
|
84
86
|
payload: jsonBytes({
|
|
85
87
|
groupId: idHex,
|
|
86
88
|
secret: toHex(secret),
|
|
87
89
|
epoch: "0",
|
|
90
|
+
members,
|
|
88
91
|
}),
|
|
89
92
|
}));
|
|
90
93
|
return { group: { mlsGroupId, epoch: 0n }, welcomes };
|
|
@@ -96,6 +99,8 @@ class MockSecureChatCrypto {
|
|
|
96
99
|
throw new Error("mock: unknown group");
|
|
97
100
|
st.epoch += 1n;
|
|
98
101
|
const epoch = st.epoch;
|
|
102
|
+
if (!st.members.includes(newDevice.deviceId))
|
|
103
|
+
st.members.push(newDevice.deviceId);
|
|
99
104
|
return {
|
|
100
105
|
commit: jsonBytes({ type: "commit", groupId: idHex, epoch: epoch.toString() }),
|
|
101
106
|
welcomes: [
|
|
@@ -105,18 +110,20 @@ class MockSecureChatCrypto {
|
|
|
105
110
|
groupId: idHex,
|
|
106
111
|
secret: toHex(st.secret),
|
|
107
112
|
epoch: epoch.toString(),
|
|
113
|
+
members: st.members,
|
|
108
114
|
}),
|
|
109
115
|
},
|
|
110
116
|
],
|
|
111
117
|
epoch,
|
|
112
118
|
};
|
|
113
119
|
}
|
|
114
|
-
async removeMember(group,
|
|
120
|
+
async removeMember(group, leafDeviceId) {
|
|
115
121
|
const idHex = toHex(group.mlsGroupId);
|
|
116
122
|
const st = this.groups.get(idHex);
|
|
117
123
|
if (!st)
|
|
118
124
|
throw new Error("mock: unknown group");
|
|
119
125
|
st.epoch += 1n;
|
|
126
|
+
st.members = st.members.filter((m) => m !== leafDeviceId);
|
|
120
127
|
return {
|
|
121
128
|
commit: jsonBytes({ type: "commit", groupId: idHex, epoch: st.epoch.toString() }),
|
|
122
129
|
welcomes: [],
|
|
@@ -141,7 +148,7 @@ class MockSecureChatCrypto {
|
|
|
141
148
|
const idHex = toHex(group.mlsGroupId);
|
|
142
149
|
const st = this.groups.get(idHex);
|
|
143
150
|
if (!st)
|
|
144
|
-
throw new
|
|
151
|
+
throw new interface_js_1.SecureChatDecryptError("unknown", "mock: unknown group");
|
|
145
152
|
// header = "<deviceId>|<epoch>|" — split on the SECOND pipe.
|
|
146
153
|
let pipes = 0;
|
|
147
154
|
let cut = -1;
|
|
@@ -155,7 +162,7 @@ class MockSecureChatCrypto {
|
|
|
155
162
|
}
|
|
156
163
|
}
|
|
157
164
|
if (cut < 0)
|
|
158
|
-
throw new
|
|
165
|
+
throw new interface_js_1.SecureChatDecryptError("malformed", "mock: malformed ciphertext");
|
|
159
166
|
const [senderDeviceId, epochStr] = dec.decode(ciphertext.slice(0, cut - 1)).split("|");
|
|
160
167
|
const body = ciphertext.slice(cut);
|
|
161
168
|
const ks = keystream(st.secret, body.length);
|
|
@@ -167,9 +174,25 @@ class MockSecureChatCrypto {
|
|
|
167
174
|
}
|
|
168
175
|
async processWelcome(welcome) {
|
|
169
176
|
const w = parseJson(welcome);
|
|
170
|
-
this.groups.set(w.groupId, {
|
|
177
|
+
this.groups.set(w.groupId, {
|
|
178
|
+
secret: fromHex(w.secret),
|
|
179
|
+
epoch: BigInt(w.epoch),
|
|
180
|
+
members: w.members ?? [],
|
|
181
|
+
});
|
|
171
182
|
return { mlsGroupId: fromHex(w.groupId), epoch: BigInt(w.epoch) };
|
|
172
183
|
}
|
|
184
|
+
async exportGroupIdentities(group) {
|
|
185
|
+
const idHex = toHex(group.mlsGroupId);
|
|
186
|
+
const st = this.groups.get(idHex);
|
|
187
|
+
if (!st)
|
|
188
|
+
throw new Error("mock: unknown group");
|
|
189
|
+
// The mock derives each device's signature key deterministically from its id (see
|
|
190
|
+
// generateDeviceIdentity), so the roster of device ids is enough to reconstruct every member's key.
|
|
191
|
+
return st.members.map((deviceId) => ({
|
|
192
|
+
deviceId,
|
|
193
|
+
signaturePublicKey: bytesFrom(`sig:${deviceId}`, 32),
|
|
194
|
+
}));
|
|
195
|
+
}
|
|
173
196
|
async processCommit(group, commit) {
|
|
174
197
|
const c = parseJson(commit);
|
|
175
198
|
const idHex = toHex(group.mlsGroupId);
|
|
@@ -210,11 +233,20 @@ class MockSecureChatCrypto {
|
|
|
210
233
|
const st = this.groups.get(idHex);
|
|
211
234
|
if (!st)
|
|
212
235
|
throw new Error("mock: unknown group");
|
|
213
|
-
return jsonBytes({
|
|
236
|
+
return jsonBytes({
|
|
237
|
+
groupId: idHex,
|
|
238
|
+
secret: toHex(st.secret),
|
|
239
|
+
epoch: st.epoch.toString(),
|
|
240
|
+
members: st.members,
|
|
241
|
+
});
|
|
214
242
|
}
|
|
215
243
|
async importGroupState(state) {
|
|
216
244
|
const s = parseJson(state);
|
|
217
|
-
this.groups.set(s.groupId, {
|
|
245
|
+
this.groups.set(s.groupId, {
|
|
246
|
+
secret: fromHex(s.secret),
|
|
247
|
+
epoch: BigInt(s.epoch),
|
|
248
|
+
members: s.members ?? [],
|
|
249
|
+
});
|
|
218
250
|
return { mlsGroupId: fromHex(s.groupId), epoch: BigInt(s.epoch) };
|
|
219
251
|
}
|
|
220
252
|
async exportBackup(passphrase) {
|
|
@@ -222,11 +254,13 @@ class MockSecureChatCrypto {
|
|
|
222
254
|
id,
|
|
223
255
|
secret: toHex(st.secret),
|
|
224
256
|
epoch: st.epoch.toString(),
|
|
257
|
+
members: st.members,
|
|
225
258
|
}));
|
|
226
259
|
const plain = jsonBytes({
|
|
227
260
|
magic: BACKUP_MAGIC,
|
|
228
261
|
identityPriv: this.privateState ? toHex(this.privateState) : null,
|
|
229
262
|
deviceId: this.identity?.deviceId ?? null,
|
|
263
|
+
ciphersuite: this.identity?.ciphersuite ?? 1,
|
|
230
264
|
groups,
|
|
231
265
|
});
|
|
232
266
|
const salt = bytesFrom(`salt:${passphrase}`, 16);
|
|
@@ -251,14 +285,25 @@ class MockSecureChatCrypto {
|
|
|
251
285
|
catch {
|
|
252
286
|
throw new Error("mock: backup decrypt failed (wrong passphrase?)");
|
|
253
287
|
}
|
|
254
|
-
if (parsed.magic !== BACKUP_MAGIC) {
|
|
288
|
+
if (parsed.magic !== BACKUP_MAGIC || !parsed.deviceId) {
|
|
255
289
|
throw new Error("mock: backup decrypt failed (wrong passphrase?)");
|
|
256
290
|
}
|
|
257
291
|
if (parsed.identityPriv)
|
|
258
292
|
this.privateState = fromHex(parsed.identityPriv);
|
|
259
293
|
for (const g of parsed.groups) {
|
|
260
|
-
this.groups.set(g.id, { secret: fromHex(g.secret), epoch: BigInt(g.epoch) });
|
|
294
|
+
this.groups.set(g.id, { secret: fromHex(g.secret), epoch: BigInt(g.epoch), members: g.members ?? [] });
|
|
261
295
|
}
|
|
296
|
+
// Rebuild the (deterministic) identity so the restored mock is usable, and return it — symmetric
|
|
297
|
+
// with importDeviceState, so the restore flow can re-assert the device server-side.
|
|
298
|
+
const ciphersuite = parsed.ciphersuite ?? 1;
|
|
299
|
+
const identity = {
|
|
300
|
+
deviceId: parsed.deviceId,
|
|
301
|
+
signaturePublicKey: bytesFrom(`sig:${parsed.deviceId}`, 32),
|
|
302
|
+
credential: enc.encode(parsed.deviceId),
|
|
303
|
+
ciphersuite,
|
|
304
|
+
};
|
|
305
|
+
this.identity = identity;
|
|
306
|
+
return identity;
|
|
262
307
|
}
|
|
263
308
|
}
|
|
264
309
|
exports.MockSecureChatCrypto = MockSecureChatCrypto;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock-crypto.js","sourceRoot":"","sources":["../../src/mock-crypto.ts"],"names":[],"mappings":";;;AA0BA,MAAM,GAAG,GAAG,IAAI,WAAW,EAAE,CAAC;AAC9B,MAAM,GAAG,GAAG,IAAI,WAAW,EAAE,CAAC;AAC9B,MAAM,YAAY,GAAG,sBAAsB,CAAC;AAE5C,SAAS,KAAK,CAAC,CAAa;IAC1B,IAAI,CAAC,GAAG,EAAE,CAAC;IACX,KAAK,MAAM,CAAC,IAAI,CAAC;QAAE,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACxD,OAAO,CAAC,CAAC;AACX,CAAC;AACD,SAAS,OAAO,CAAC,CAAS;IACxB,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,GAAG,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACtF,OAAO,GAAG,CAAC;AACb,CAAC;AAED,mGAAmG;AACnG,SAAS,SAAS,CAAC,IAAgB,EAAE,GAAW;IAC9C,IAAI,KAAK,GAAG,UAAU,KAAK,CAAC,CAAC;IAC7B,KAAK,MA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MAAM,QAAQ,GAAmB;YAC/B,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,kBAAkB,EAAE,SAAS,CAAC,OAAO,MAAM,CAAC,QAAQ,EAAE,EAAE,EAAE,CAAC;YAC3D,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;YACvC,WAAW;SACZ,CAAC;QACF,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAnSD,oDAmSC"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export type { SecureChatCrypto, DeviceIdentity, KeyPackageBundle, GroupHandle, TargetedWelcome, CommitResult, PassphraseBackup, } from "./interface.js";
|
|
1
|
+
export type { SecureChatCrypto, DeviceIdentity, KeyPackageBundle, GroupHandle, GroupMemberIdentity, TargetedWelcome, CommitResult, PassphraseBackup, SecureDecryptFailureReason, } from "./interface.js";
|
|
2
|
+
export { SecureChatDecryptError } from "./interface.js";
|
package/dist/esm/index.js
CHANGED
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAiBA,4GAA4G;AAC5G,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/esm/interface.d.ts
CHANGED
|
@@ -18,6 +18,14 @@ export interface GroupHandle {
|
|
|
18
18
|
mlsGroupId: Uint8Array;
|
|
19
19
|
epoch: bigint;
|
|
20
20
|
}
|
|
21
|
+
/** One member of a group, as seen in the local MLS roster: a device id + its signature public key.
|
|
22
|
+
* The public key is what a safety number / key-verification fingerprint is derived from. */
|
|
23
|
+
export interface GroupMemberIdentity {
|
|
24
|
+
/** The member device's stable id (the MLS credential identity). */
|
|
25
|
+
deviceId: string;
|
|
26
|
+
/** The member device's MLS signature PUBLIC key (safe to expose; never the private half). */
|
|
27
|
+
signaturePublicKey: Uint8Array;
|
|
28
|
+
}
|
|
21
29
|
/** A Welcome destined for exactly one new-member device (the one whose KeyPackage was used). */
|
|
22
30
|
export interface TargetedWelcome {
|
|
23
31
|
targetDeviceId: string;
|
|
@@ -39,6 +47,34 @@ export interface PassphraseBackup {
|
|
|
39
47
|
nonce: Uint8Array;
|
|
40
48
|
version: number;
|
|
41
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Why an inbound message could not be decrypted/authenticated. Drives fail-closed handling at the
|
|
52
|
+
* caller: a `"replay"` / `"gap-too-large"` / `"unauthenticated"` / `"malformed"` / `"epoch-too-old"`
|
|
53
|
+
* message is a terminal rejection (drop it), whereas a future-epoch message the client hasn't reached
|
|
54
|
+
* yet is NOT one of these — the caller decides that by epoch, not by reason.
|
|
55
|
+
*
|
|
56
|
+
* - `replay` — the sender generation was already consumed (a replayed/duplicated message).
|
|
57
|
+
* - `gap-too-large` — the generation jumped further ahead than the ratchet will skip (possible drop/DoS).
|
|
58
|
+
* - `epoch-too-old` — the message's epoch is older than the retained history; its keys are gone.
|
|
59
|
+
* - `unauthenticated` — signature/authentication failed (forged or corrupted).
|
|
60
|
+
* - `malformed` — the bytes didn't decode as a valid MLS message.
|
|
61
|
+
* - `unknown` — any other decrypt failure.
|
|
62
|
+
*/
|
|
63
|
+
export type SecureDecryptFailureReason = "replay" | "gap-too-large" | "epoch-too-old" | "unauthenticated" | "malformed" | "unknown";
|
|
64
|
+
/**
|
|
65
|
+
* Thrown by {@link SecureChatCrypto.decryptMessage} when a message fails to decrypt/authenticate. The
|
|
66
|
+
* MLS core (its secret-tree ratchet) is the single point that enforces replay/gap rejection; this
|
|
67
|
+
* error simply classifies that failure so the caller can fail closed and surface it. Carries no
|
|
68
|
+
* plaintext or key material.
|
|
69
|
+
*/
|
|
70
|
+
export declare class SecureChatDecryptError extends Error {
|
|
71
|
+
readonly reason: SecureDecryptFailureReason;
|
|
72
|
+
/**
|
|
73
|
+
* @param reason - The {@link SecureDecryptFailureReason} classification.
|
|
74
|
+
* @param message - A non-sensitive, human-readable description (never includes plaintext/keys).
|
|
75
|
+
*/
|
|
76
|
+
constructor(reason: SecureDecryptFailureReason, message: string);
|
|
77
|
+
}
|
|
42
78
|
export interface SecureChatCrypto {
|
|
43
79
|
generateDeviceIdentity(opts: {
|
|
44
80
|
deviceId: string;
|
|
@@ -67,11 +103,33 @@ export interface SecureChatCrypto {
|
|
|
67
103
|
ciphertext: Uint8Array;
|
|
68
104
|
epoch: bigint;
|
|
69
105
|
}>;
|
|
106
|
+
/**
|
|
107
|
+
* Decrypt + authenticate one inbound MLS application message. The MLS core's secret-tree ratchet is
|
|
108
|
+
* the single point that enforces replay/gap rejection (a consumed generation can't be re-derived; a
|
|
109
|
+
* generation too far ahead is refused) — implementations do not hand-roll a parallel counter. Always
|
|
110
|
+
* fails closed: on any failure it throws and returns no plaintext.
|
|
111
|
+
*
|
|
112
|
+
* @param group - The local group handle.
|
|
113
|
+
* @param ciphertext - The MLS PrivateMessage bytes (base64-decoded at the wire boundary).
|
|
114
|
+
* @returns The plaintext, the best-effort sender device id, and the message epoch.
|
|
115
|
+
* @throws {SecureChatDecryptError} On replay, an over-limit generation gap, a too-old epoch, a failed
|
|
116
|
+
* authentication, malformed bytes, or any other decrypt failure (see {@link SecureDecryptFailureReason}).
|
|
117
|
+
*/
|
|
70
118
|
decryptMessage(group: GroupHandle, ciphertext: Uint8Array): Promise<{
|
|
71
119
|
plaintext: Uint8Array;
|
|
72
120
|
senderDeviceId: string;
|
|
73
121
|
epoch: bigint;
|
|
74
122
|
}>;
|
|
123
|
+
/**
|
|
124
|
+
* List the members of a joined group as `{ deviceId, signaturePublicKey }`, read from the local MLS
|
|
125
|
+
* roster. The public keys feed an out-of-band safety-number / key-verification fingerprint (TOFU
|
|
126
|
+
* hardening against a blind server swapping a KeyPackage). Returns public material only.
|
|
127
|
+
*
|
|
128
|
+
* @param group - The local group handle.
|
|
129
|
+
* @returns The group's members (order is implementation-defined; callers that need stability sort).
|
|
130
|
+
* @throws {Error} When the group is unknown (not joined / evicted).
|
|
131
|
+
*/
|
|
132
|
+
exportGroupIdentities(group: GroupHandle): Promise<GroupMemberIdentity[]>;
|
|
75
133
|
processWelcome(welcome: Uint8Array): Promise<GroupHandle>;
|
|
76
134
|
processCommit(group: GroupHandle, commit: Uint8Array): Promise<GroupHandle>;
|
|
77
135
|
processProposal(group: GroupHandle, proposal: Uint8Array): Promise<void>;
|
|
@@ -81,6 +139,24 @@ export interface SecureChatCrypto {
|
|
|
81
139
|
exportDeviceState(): Promise<Uint8Array>;
|
|
82
140
|
/** Restore device identity + private state from {@link exportDeviceState} output. */
|
|
83
141
|
importDeviceState(state: Uint8Array): Promise<DeviceIdentity>;
|
|
142
|
+
/**
|
|
143
|
+
* Seal all local key material (device identity + private keys + every joined group's state) into a
|
|
144
|
+
* passphrase-encrypted blob for upload to the blind server. The real cores use a memory-hard KDF
|
|
145
|
+
* (argon2id) + an AEAD; the server stores the ciphertext verbatim and can never decrypt it.
|
|
146
|
+
*
|
|
147
|
+
* @param passphrase - The user's backup passphrase (never sent to the server).
|
|
148
|
+
* @returns The encrypted backup envelope (base64-encode `blob`/`nonce` at the wire boundary).
|
|
149
|
+
*/
|
|
84
150
|
exportBackup(passphrase: string): Promise<PassphraseBackup>;
|
|
85
|
-
|
|
151
|
+
/**
|
|
152
|
+
* Restore local key material from a {@link exportBackup} envelope, repopulating this instance's
|
|
153
|
+
* device identity and group states. Symmetric with {@link importDeviceState}, it returns the
|
|
154
|
+
* restored identity so a caller can re-assert the device server-side (idempotently) and rehydrate UI.
|
|
155
|
+
*
|
|
156
|
+
* @param passphrase - The user's backup passphrase.
|
|
157
|
+
* @param backup - The encrypted envelope fetched from the server.
|
|
158
|
+
* @returns The restored device identity.
|
|
159
|
+
* @throws {Error} On a wrong passphrase or a corrupt/tampered backup (fails closed — no partial restore).
|
|
160
|
+
*/
|
|
161
|
+
importBackup(passphrase: string, backup: PassphraseBackup): Promise<DeviceIdentity>;
|
|
86
162
|
}
|
package/dist/esm/interface.js
CHANGED
|
@@ -9,5 +9,21 @@
|
|
|
9
9
|
// (dev)dependency for its integration tests — the server is a CONSUMER of this client crypto, not
|
|
10
10
|
// its owner. Binary is `Uint8Array` IN MEMORY; the network layer base64-encodes at the wire
|
|
11
11
|
// boundary. MLS epochs are u64 → `bigint`.
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Thrown by {@link SecureChatCrypto.decryptMessage} when a message fails to decrypt/authenticate. The
|
|
14
|
+
* MLS core (its secret-tree ratchet) is the single point that enforces replay/gap rejection; this
|
|
15
|
+
* error simply classifies that failure so the caller can fail closed and surface it. Carries no
|
|
16
|
+
* plaintext or key material.
|
|
17
|
+
*/
|
|
18
|
+
export class SecureChatDecryptError extends Error {
|
|
19
|
+
/**
|
|
20
|
+
* @param reason - The {@link SecureDecryptFailureReason} classification.
|
|
21
|
+
* @param message - A non-sensitive, human-readable description (never includes plaintext/keys).
|
|
22
|
+
*/
|
|
23
|
+
constructor(reason, message) {
|
|
24
|
+
super(message);
|
|
25
|
+
this.reason = reason;
|
|
26
|
+
this.name = "SecureChatDecryptError";
|
|
27
|
+
}
|
|
28
|
+
}
|
|
13
29
|
//# sourceMappingURL=interface.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src/interface.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,EAAE;AACF,+FAA+F;AAC/F,6FAA6F;AAC7F,gGAAgG;AAChG,yFAAyF;AACzF,EAAE;AACF,0FAA0F;AAC1F,kGAAkG;AAClG,4FAA4F;AAC5F,2CAA2C"}
|
|
1
|
+
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src/interface.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,EAAE;AACF,+FAA+F;AAC/F,6FAA6F;AAC7F,gGAAgG;AAChG,yFAAyF;AACzF,EAAE;AACF,0FAA0F;AAC1F,kGAAkG;AAClG,4FAA4F;AAC5F,2CAA2C;AA+E3C;;;;;GAKG;AACH,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAC/C;;;OAGG;IACH,YACW,MAAkC,EAC3C,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QAHN,WAAM,GAAN,MAAM,CAA4B;QAI3C,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;IACvC,CAAC;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SecureChatCrypto, DeviceIdentity, KeyPackageBundle, GroupHandle, CommitResult, PassphraseBackup, TargetedWelcome } from "./interface.js";
|
|
1
|
+
import type { SecureChatCrypto, DeviceIdentity, KeyPackageBundle, GroupHandle, GroupMemberIdentity, CommitResult, PassphraseBackup, TargetedWelcome } from "./interface.js";
|
|
2
2
|
export declare class MockSecureChatCrypto implements SecureChatCrypto {
|
|
3
3
|
private identity?;
|
|
4
4
|
private privateState?;
|
|
@@ -26,7 +26,7 @@ export declare class MockSecureChatCrypto implements SecureChatCrypto {
|
|
|
26
26
|
deviceId: string;
|
|
27
27
|
keyPackage: Uint8Array;
|
|
28
28
|
}): Promise<CommitResult>;
|
|
29
|
-
removeMember(group: GroupHandle,
|
|
29
|
+
removeMember(group: GroupHandle, leafDeviceId: string): Promise<CommitResult>;
|
|
30
30
|
encryptMessage(group: GroupHandle, plaintext: Uint8Array): Promise<{
|
|
31
31
|
ciphertext: Uint8Array;
|
|
32
32
|
epoch: bigint;
|
|
@@ -37,6 +37,7 @@ export declare class MockSecureChatCrypto implements SecureChatCrypto {
|
|
|
37
37
|
epoch: bigint;
|
|
38
38
|
}>;
|
|
39
39
|
processWelcome(welcome: Uint8Array): Promise<GroupHandle>;
|
|
40
|
+
exportGroupIdentities(group: GroupHandle): Promise<GroupMemberIdentity[]>;
|
|
40
41
|
processCommit(group: GroupHandle, commit: Uint8Array): Promise<GroupHandle>;
|
|
41
42
|
processProposal(_group: GroupHandle, _proposal: Uint8Array): Promise<void>;
|
|
42
43
|
exportDeviceState(): Promise<Uint8Array>;
|
|
@@ -44,5 +45,5 @@ export declare class MockSecureChatCrypto implements SecureChatCrypto {
|
|
|
44
45
|
exportGroupState(group: GroupHandle): Promise<Uint8Array>;
|
|
45
46
|
importGroupState(state: Uint8Array): Promise<GroupHandle>;
|
|
46
47
|
exportBackup(passphrase: string): Promise<PassphraseBackup>;
|
|
47
|
-
importBackup(passphrase: string, backup: PassphraseBackup): Promise<
|
|
48
|
+
importBackup(passphrase: string, backup: PassphraseBackup): Promise<DeviceIdentity>;
|
|
48
49
|
}
|