@agora-sdk/secure-chat-core 0.7.0 → 0.8.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/content/builders.d.ts +40 -0
- package/dist/cjs/content/builders.js +85 -0
- package/dist/cjs/content/builders.js.map +1 -0
- package/dist/cjs/content/cbor.d.ts +48 -0
- package/dist/cjs/content/cbor.js +298 -0
- package/dist/cjs/content/cbor.js.map +1 -0
- package/dist/cjs/content/frame.d.ts +24 -0
- package/dist/cjs/content/frame.js +39 -0
- package/dist/cjs/content/frame.js.map +1 -0
- package/dist/cjs/content/mimi-content.d.ts +194 -0
- package/dist/cjs/content/mimi-content.js +289 -0
- package/dist/cjs/content/mimi-content.js.map +1 -0
- package/dist/cjs/hooks/message-fold.d.ts +91 -0
- package/dist/cjs/hooks/message-fold.js +218 -0
- package/dist/cjs/hooks/message-fold.js.map +1 -0
- package/dist/cjs/hooks/useSecureMessages.d.ts +30 -18
- package/dist/cjs/hooks/useSecureMessages.js +190 -238
- package/dist/cjs/hooks/useSecureMessages.js.map +1 -1
- package/dist/cjs/index.d.ts +7 -0
- package/dist/cjs/index.js +27 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/persistence/repository.d.ts +11 -11
- package/dist/cjs/persistence/repository.js +19 -19
- package/dist/cjs/persistence/repository.js.map +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/content/builders.d.ts +40 -0
- package/dist/esm/content/builders.js +77 -0
- package/dist/esm/content/builders.js.map +1 -0
- package/dist/esm/content/cbor.d.ts +48 -0
- package/dist/esm/content/cbor.js +292 -0
- package/dist/esm/content/cbor.js.map +1 -0
- package/dist/esm/content/frame.d.ts +24 -0
- package/dist/esm/content/frame.js +34 -0
- package/dist/esm/content/frame.js.map +1 -0
- package/dist/esm/content/mimi-content.d.ts +194 -0
- package/dist/esm/content/mimi-content.js +283 -0
- package/dist/esm/content/mimi-content.js.map +1 -0
- package/dist/esm/hooks/message-fold.d.ts +91 -0
- package/dist/esm/hooks/message-fold.js +214 -0
- package/dist/esm/hooks/message-fold.js.map +1 -0
- package/dist/esm/hooks/useSecureMessages.d.ts +30 -18
- package/dist/esm/hooks/useSecureMessages.js +192 -240
- package/dist/esm/hooks/useSecureMessages.js.map +1 -1
- package/dist/esm/index.d.ts +7 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/persistence/repository.d.ts +11 -11
- package/dist/esm/persistence/repository.js +19 -19
- package/dist/esm/persistence/repository.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +3 -2
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// useSecureMessages — load, decrypt, send, and live-receive messages in a secure conversation.
|
|
2
|
+
// useSecureMessages — load, decrypt, send, and live-receive MIMI-content messages in a secure conversation.
|
|
3
3
|
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
4
|
+
// Content is the IETF MimiContent format (CBOR) inside a [kind][payload] routing frame inside the
|
|
5
|
+
// size-bucket padding frame — all ABOVE the unchanged SecureChatCrypto seam (which still exchanges
|
|
6
|
+
// Uint8Array). The hook owns message-list STATE (dedup, ordering, decrypt-once, write-through) keyed by
|
|
7
|
+
// server messageId; a MessageFold collapses reaction/edit/delete/un-react messages onto their target by
|
|
8
|
+
// MIMI content-hash. The durable source of truth stays REST; realtime is a notification optimization.
|
|
8
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
10
|
exports.useSecureMessages = useSecureMessages;
|
|
10
11
|
const react_1 = require("react");
|
|
@@ -13,36 +14,48 @@ const base64_js_1 = require("../util/base64.js");
|
|
|
13
14
|
const padding_js_1 = require("../util/padding.js");
|
|
14
15
|
const debug_js_1 = require("../util/debug.js");
|
|
15
16
|
const secure_chat_context_js_1 = require("../context/secure-chat-context.js");
|
|
17
|
+
const frame_js_1 = require("../content/frame.js");
|
|
18
|
+
const mimi_content_js_1 = require("../content/mimi-content.js");
|
|
19
|
+
const builders_js_1 = require("../content/builders.js");
|
|
20
|
+
const message_fold_js_1 = require("./message-fold.js");
|
|
16
21
|
const log = (0, debug_js_1.createDebugLogger)("messages");
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return
|
|
38
|
-
|
|
22
|
+
const REJECT_MALFORMED = { status: "rejected", rejectedReason: "malformed" };
|
|
23
|
+
/** Decode a content-frame to a typed outcome. Pure; fails closed on any framing/schema error. */
|
|
24
|
+
function decodeFrame(frameBytes, model, senderDeviceId) {
|
|
25
|
+
let unf;
|
|
26
|
+
try {
|
|
27
|
+
unf = (0, frame_js_1.unframe)(frameBytes);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return REJECT_MALFORMED;
|
|
31
|
+
}
|
|
32
|
+
// kind 1 = IUC control (reserved; out of scope here): authenticate + hide, never render, never error.
|
|
33
|
+
if (unf.kind === frame_js_1.ContentKind.IucControl)
|
|
34
|
+
return { status: "ok", control: true };
|
|
35
|
+
if (unf.kind !== frame_js_1.ContentKind.Mimi)
|
|
36
|
+
return REJECT_MALFORMED;
|
|
37
|
+
let mimi;
|
|
38
|
+
try {
|
|
39
|
+
mimi = (0, mimi_content_js_1.decodeMimiContent)(unf.payload);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return REJECT_MALFORMED;
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
status: "ok",
|
|
46
|
+
control: false,
|
|
47
|
+
decoded: {
|
|
48
|
+
messageId: model.id,
|
|
49
|
+
createdAt: model.createdAt,
|
|
50
|
+
senderDeviceId,
|
|
51
|
+
contentHash: (0, mimi_content_js_1.contentHash)(mimi),
|
|
52
|
+
mimi,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
39
55
|
}
|
|
56
|
+
const cmpStr = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
|
|
40
57
|
/**
|
|
41
|
-
* Load, decrypt, send, and live-receive messages in one secure conversation.
|
|
42
|
-
*
|
|
43
|
-
* Auto-resolves the MLS group handle (via `resolveGroup`) and the sender device id (from the
|
|
44
|
-
* persisted device) unless overridden in `options`. Joins the conversation socket room for live
|
|
45
|
-
* `secure:message` events.
|
|
58
|
+
* Load, decrypt, send, and live-receive MIMI-content messages in one secure conversation.
|
|
46
59
|
*
|
|
47
60
|
* @param conversationId - The conversation to read and send within.
|
|
48
61
|
* @param options - {@link UseSecureMessagesOptions}.
|
|
@@ -50,82 +63,54 @@ function preferResolved(existing, incoming) {
|
|
|
50
63
|
*
|
|
51
64
|
* @example
|
|
52
65
|
* ```tsx
|
|
53
|
-
* const { messages, sendMessage } = useSecureMessages(conversationId);
|
|
66
|
+
* const { messages, sendMessage, react } = useSecureMessages(conversationId);
|
|
54
67
|
* await sendMessage("hello 💜");
|
|
68
|
+
* await react(messages[0].contentHash!, "👍");
|
|
55
69
|
* ```
|
|
56
70
|
*/
|
|
57
71
|
function useSecureMessages(conversationId, options = {}) {
|
|
58
72
|
const { rest, crypto, socket, repo, resolveGroup, persistGroupState, getGroupVersion, subscribeGroupChange, padding, } = (0, secure_chat_context_js_1.useSecureChat)();
|
|
59
|
-
const [messages, setMessages] = (0, react_1.useState)([]);
|
|
60
73
|
const [before, setBefore] = (0, react_1.useState)(undefined);
|
|
61
74
|
const [hasMore, setHasMore] = (0, react_1.useState)(true);
|
|
62
75
|
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
63
76
|
const [error, setError] = (0, react_1.useState)(null);
|
|
64
77
|
const [group, setGroup] = (0, react_1.useState)(options.group ?? null);
|
|
65
78
|
const [senderDeviceId, setSenderDeviceId] = (0, react_1.useState)(options.senderDeviceId);
|
|
66
|
-
// Bumps when THIS conversation's group handle advances (a join or a processed Commit, driven by
|
|
67
|
-
// useSecureHandshakes calling rememberGroup). Feeds the group-resolve effect's deps so we re-resolve
|
|
68
|
-
// the now-current handle and flush buffered (plaintext:null) rows.
|
|
69
79
|
const [groupVersion, setGroupVersion] = (0, react_1.useState)(0);
|
|
70
|
-
//
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
//
|
|
75
|
-
|
|
76
|
-
|
|
80
|
+
// Rendered state lives in refs (the fold mutates target rows in place); `bump` forces a re-derive.
|
|
81
|
+
const byIdRef = (0, react_1.useRef)(new Map());
|
|
82
|
+
const foldRef = (0, react_1.useRef)(new message_fold_js_1.MessageFold());
|
|
83
|
+
// Decrypt-once cache by id: MLS application keys are single-use, so the one decrypt that succeeds is
|
|
84
|
+
// the only one that ever will. Survives StrictMode double-invokes and multi-effect decrypts.
|
|
85
|
+
const okCache = (0, react_1.useRef)(new Map());
|
|
86
|
+
const [version, bump] = (0, react_1.useReducer)((x) => x + 1, 0);
|
|
77
87
|
const groupRef = (0, react_1.useRef)(group);
|
|
78
88
|
groupRef.current = group;
|
|
79
|
-
// Decrypt-once cache, by message id — the in-memory tier of a TWO-tier store. MLS application keys
|
|
80
|
-
// are SINGLE-USE (forward secrecy): the one decrypt that succeeds consumes the key, so any later
|
|
81
|
-
// attempt fails (`"Desired gen in the past"`). The hook decrypts the same message from several
|
|
82
|
-
// effects (load, retry, live echo) and React StrictMode double-invokes them — so without this cache
|
|
83
|
-
// the key could be consumed on a run whose `ok` result is then discarded, leaving the message
|
|
84
|
-
// permanently un-decryptable. This cache covers within-session repeats; `decrypt` ALSO write-throughs
|
|
85
|
-
// each `ok` to the durable plaintext store (repo.saveMessagePlaintext) so history survives reload
|
|
86
|
-
// without ever replaying the consumed ratchet. Only `ok` is cached (terminal); `pending`/`rejected`
|
|
87
|
-
// stay retryable. Ids are globally-unique server uuids, so this never needs clearing per-conversation.
|
|
88
|
-
const okCache = (0, react_1.useRef)(new Map());
|
|
89
|
-
// Subscribe to provider group-change signals; only a change to OUR conversation's version updates
|
|
90
|
-
// state (React bails on an unchanged primitive), so unrelated conversations don't re-resolve us.
|
|
91
89
|
(0, react_1.useEffect)(() => {
|
|
92
90
|
return subscribeGroupChange(() => setGroupVersion(getGroupVersion(conversationId)));
|
|
93
91
|
}, [subscribeGroupChange, getGroupVersion, conversationId]);
|
|
94
|
-
// Resolve the group handle: explicit override, else persisted state.
|
|
92
|
+
// Resolve the group handle: explicit override, else persisted state. (Same as before.)
|
|
95
93
|
(0, react_1.useEffect)(() => {
|
|
96
94
|
if (options.group) {
|
|
97
95
|
setGroup(options.group);
|
|
98
96
|
return;
|
|
99
97
|
}
|
|
100
|
-
// Clear any stale handle from the previous conversation before re-resolving, so live messages
|
|
101
|
-
// for the new conversation never decrypt against the old group during the async window.
|
|
102
98
|
setGroup(null);
|
|
103
99
|
let alive = true;
|
|
104
100
|
resolveGroup(conversationId)
|
|
105
101
|
.then((g) => {
|
|
106
|
-
if (alive)
|
|
102
|
+
if (alive)
|
|
107
103
|
setGroup(g);
|
|
108
|
-
log.debug("group handle set in messages hook", {
|
|
109
|
-
conversationId,
|
|
110
|
-
resolved: !!g,
|
|
111
|
-
epoch: g?.epoch?.toString(),
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
104
|
})
|
|
115
|
-
.catch((
|
|
105
|
+
.catch(() => {
|
|
116
106
|
if (alive)
|
|
117
107
|
setGroup(null);
|
|
118
|
-
log.debug("group resolve failed in messages hook", {
|
|
119
|
-
conversationId,
|
|
120
|
-
error: err instanceof Error ? err.message : String(err),
|
|
121
|
-
});
|
|
122
108
|
});
|
|
123
109
|
return () => {
|
|
124
110
|
alive = false;
|
|
125
111
|
};
|
|
126
|
-
// `groupVersion` re-runs this when a Commit/join advances the handle → flushes buffered rows.
|
|
127
112
|
}, [options.group, conversationId, resolveGroup, groupVersion]);
|
|
128
|
-
// Resolve the sender device id: explicit override, else persisted device row.
|
|
113
|
+
// Resolve the sender device id: explicit override, else persisted device row. (Same as before.)
|
|
129
114
|
(0, react_1.useEffect)(() => {
|
|
130
115
|
if (options.senderDeviceId) {
|
|
131
116
|
setSenderDeviceId(options.senderDeviceId);
|
|
@@ -146,132 +131,127 @@ function useSecureMessages(conversationId, options = {}) {
|
|
|
146
131
|
alive = false;
|
|
147
132
|
};
|
|
148
133
|
}, [options.senderDeviceId, repo]);
|
|
134
|
+
// Decrypt one message to a typed outcome. Two short-circuits BEFORE the single-use ratchet: the
|
|
135
|
+
// in-memory okCache and the durable content-frame store. A store/cache hit re-decodes locally and
|
|
136
|
+
// NEVER touches the ratchet (re-decrypting a consumed key throws "Desired gen in the past").
|
|
149
137
|
const decrypt = (0, react_1.useCallback)(async (model) => {
|
|
150
|
-
// Decrypt-once (in-memory tier): a message decoded earlier this session is returned from cache —
|
|
151
|
-
// never re-run the MLS decrypt (its single-use key is already consumed; a second attempt fails).
|
|
152
138
|
const cached = okCache.current.get(model.id);
|
|
153
139
|
if (cached)
|
|
154
140
|
return cached;
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
return
|
|
164
|
-
}
|
|
165
|
-
// Read the LIVE group via the ref (not a stale closure): a load that finishes after the group
|
|
166
|
-
// resolved must decrypt with the now-current handle, not the null it captured when it started.
|
|
167
|
-
const group = groupRef.current;
|
|
168
|
-
// No handle yet (still resolving) → retryable once it arrives.
|
|
169
|
-
if (!group) {
|
|
170
|
-
log.trace("decrypt deferred — no group handle yet", { messageId: model.id, epoch: model.epoch });
|
|
171
|
-
return { model, plaintext: null, status: "pending" };
|
|
141
|
+
const storedFrame = await repo.loadMessageContent(conversationId, model.id);
|
|
142
|
+
if (storedFrame !== null) {
|
|
143
|
+
// The frame was already authenticated when first decrypted (and write-through only happens on an
|
|
144
|
+
// `ok` decrypt). The server-reported senderDeviceId is just a render label here; coalesce its
|
|
145
|
+
// possible null to "" so the fold's DecodedContentMessage stays a plain string.
|
|
146
|
+
const outcome = decodeFrame(storedFrame, model, model.senderDeviceId ?? "");
|
|
147
|
+
if (outcome.status === "ok")
|
|
148
|
+
okCache.current.set(model.id, outcome);
|
|
149
|
+
return outcome;
|
|
172
150
|
}
|
|
151
|
+
const grp = groupRef.current;
|
|
152
|
+
if (!grp)
|
|
153
|
+
return { status: "pending" };
|
|
173
154
|
let plaintext;
|
|
155
|
+
let sender;
|
|
174
156
|
try {
|
|
175
|
-
({ plaintext } = await crypto.decryptMessage(
|
|
157
|
+
({ plaintext, senderDeviceId: sender } = await crypto.decryptMessage(grp, (0, base64_js_1.fromBase64)(model.ciphertext)));
|
|
176
158
|
}
|
|
177
159
|
catch (err) {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
// at an epoch we HAVE reached is a terminal rejection — the MLS core refused it (replay,
|
|
181
|
-
// over-window gap, bad auth, malformed, too-old epoch). Fail closed: never show it as text and
|
|
182
|
-
// never silently retry it forever (the old behavior masked replays/forgeries as "pending").
|
|
183
|
-
if (BigInt(model.epoch) > group.epoch) {
|
|
184
|
-
log.debug("decrypt buffered — message epoch ahead of ours", {
|
|
185
|
-
messageId: model.id,
|
|
186
|
-
messageEpoch: model.epoch,
|
|
187
|
-
groupEpoch: group.epoch.toString(),
|
|
188
|
-
});
|
|
189
|
-
return { model, plaintext: null, status: "pending" };
|
|
190
|
-
}
|
|
160
|
+
if (BigInt(model.epoch) > grp.epoch)
|
|
161
|
+
return { status: "pending" }; // epoch ahead → buffer
|
|
191
162
|
const rejectedReason = err instanceof secure_chat_crypto_1.SecureChatDecryptError ? err.reason : "unknown";
|
|
192
|
-
|
|
193
|
-
messageId: model.id,
|
|
194
|
-
messageEpoch: model.epoch,
|
|
195
|
-
groupEpoch: group.epoch.toString(),
|
|
196
|
-
rejectedReason,
|
|
197
|
-
});
|
|
198
|
-
return { model, plaintext: null, status: "rejected", rejectedReason };
|
|
163
|
+
return { status: "rejected", rejectedReason };
|
|
199
164
|
}
|
|
200
|
-
|
|
201
|
-
// size-bucket padding frame (see util/padding). A bad frame here is NOT a decrypt failure — it's a
|
|
202
|
-
// framing/version mismatch from an authenticated sender — so fail closed as "malformed" rather
|
|
203
|
-
// than rendering raw padded bytes as text.
|
|
204
|
-
let text;
|
|
165
|
+
let frameBytes;
|
|
205
166
|
try {
|
|
206
|
-
|
|
167
|
+
frameBytes = (0, padding_js_1.unpadPlaintext)(plaintext); // authenticated sender, bad padding ⇒ malformed (fail closed)
|
|
207
168
|
}
|
|
208
169
|
catch {
|
|
209
|
-
return
|
|
170
|
+
return REJECT_MALFORMED;
|
|
210
171
|
}
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
return
|
|
172
|
+
const outcome = decodeFrame(frameBytes, model, sender);
|
|
173
|
+
if (outcome.status === "ok") {
|
|
174
|
+
okCache.current.set(model.id, outcome);
|
|
175
|
+
// Write-through the raw content-frame bytes (re-decoded + re-folded on reload), then persist the
|
|
176
|
+
// advanced RECEIVE ratchet (decrypt moved the generation in memory; a reload must not rewind it).
|
|
177
|
+
await repo.saveMessageContent(conversationId, model.id, frameBytes);
|
|
178
|
+
await persistGroupState(conversationId, grp);
|
|
179
|
+
}
|
|
180
|
+
return outcome;
|
|
220
181
|
}, [crypto, repo, conversationId, persistGroupState]);
|
|
182
|
+
// Fold one outcome into rendered state. `ok` is terminal (never downgraded — forward secrecy).
|
|
183
|
+
const ingest = (0, react_1.useCallback)((model, outcome) => {
|
|
184
|
+
const entries = byIdRef.current;
|
|
185
|
+
const prev = entries.get(model.id);
|
|
186
|
+
if (prev?.status === "ok")
|
|
187
|
+
return;
|
|
188
|
+
if (outcome.status === "ok") {
|
|
189
|
+
if (outcome.control) {
|
|
190
|
+
entries.set(model.id, { model, status: "ok", renderable: false });
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
const { renderable } = foldRef.current.apply(outcome.decoded);
|
|
194
|
+
entries.set(model.id, { model, status: "ok", renderable, decoded: outcome.decoded });
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
else if (outcome.status === "pending") {
|
|
198
|
+
if (!prev)
|
|
199
|
+
entries.set(model.id, { model, status: "pending", renderable: false });
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
if (!prev || prev.status === "pending")
|
|
203
|
+
entries.set(model.id, { model, status: "rejected", renderable: false, rejectedReason: outcome.rejectedReason });
|
|
204
|
+
}
|
|
205
|
+
bump();
|
|
206
|
+
}, []);
|
|
207
|
+
// Derive the rendered list: only renderable (post/reply) rows + non-ok rows, newest-first. Mutation
|
|
208
|
+
// and control rows are folded/hidden. Recomputed on every `bump` (fold mutates rows in place).
|
|
209
|
+
const messages = (0, react_1.useMemo)(() => {
|
|
210
|
+
const rows = [];
|
|
211
|
+
for (const e of byIdRef.current.values()) {
|
|
212
|
+
if (e.status === "ok") {
|
|
213
|
+
if (!e.renderable)
|
|
214
|
+
continue;
|
|
215
|
+
rows.push({
|
|
216
|
+
model: e.model,
|
|
217
|
+
content: foldRef.current.getContent(e.model.id),
|
|
218
|
+
mimi: e.decoded?.mimi ?? null,
|
|
219
|
+
contentHash: e.decoded?.contentHash ?? null,
|
|
220
|
+
status: "ok",
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
rows.push({ model: e.model, content: null, mimi: null, contentHash: null, status: e.status, rejectedReason: e.rejectedReason });
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
rows.sort((a, b) => cmpStr(b.model.createdAt, a.model.createdAt) || cmpStr(b.model.id, a.model.id));
|
|
228
|
+
return rows;
|
|
229
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
230
|
+
}, [version]);
|
|
221
231
|
const load = (0, react_1.useCallback)(async (reset) => {
|
|
222
232
|
setLoading(true);
|
|
223
233
|
setError(null);
|
|
224
234
|
try {
|
|
225
|
-
const page = await rest.listMessages(conversationId, {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
235
|
+
const page = await rest.listMessages(conversationId, { before: reset ? undefined : before, limit: 40 });
|
|
236
|
+
if (reset) {
|
|
237
|
+
byIdRef.current.clear();
|
|
238
|
+
foldRef.current.reset();
|
|
239
|
+
}
|
|
230
240
|
const oldest = page.messages[page.messages.length - 1];
|
|
231
241
|
setBefore(oldest ? oldest.createdAt : before);
|
|
232
242
|
setHasMore(page.hasMore);
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
// forward-secrecy reasoning as the live path). `reset` replaces wholesale.
|
|
238
|
-
setMessages((prev) => {
|
|
239
|
-
if (reset)
|
|
240
|
-
return decrypted;
|
|
241
|
-
const indexById = new Map(prev.map((p, idx) => [p.model.id, idx]));
|
|
242
|
-
const next = prev.slice();
|
|
243
|
-
const appended = [];
|
|
244
|
-
for (const m of decrypted) {
|
|
245
|
-
const idx = indexById.get(m.model.id);
|
|
246
|
-
if (idx === undefined)
|
|
247
|
-
appended.push(m);
|
|
248
|
-
else
|
|
249
|
-
next[idx] = preferResolved(next[idx], m);
|
|
250
|
-
}
|
|
251
|
-
return [...next, ...appended];
|
|
252
|
-
});
|
|
253
|
-
log.debug("loaded message page", {
|
|
254
|
-
conversationId,
|
|
255
|
-
reset,
|
|
256
|
-
before: reset ? undefined : before,
|
|
257
|
-
count: decrypted.length,
|
|
258
|
-
hasMore: page.hasMore,
|
|
259
|
-
ok: decrypted.filter((m) => m.status === "ok").length,
|
|
260
|
-
pending: decrypted.filter((m) => m.status === "pending").length,
|
|
261
|
-
rejected: decrypted.filter((m) => m.status === "rejected").length,
|
|
262
|
-
});
|
|
243
|
+
for (const model of page.messages)
|
|
244
|
+
ingest(model, await decrypt(model));
|
|
245
|
+
bump();
|
|
246
|
+
log.debug("loaded message page", { conversationId, reset, count: page.messages.length, hasMore: page.hasMore });
|
|
263
247
|
}
|
|
264
248
|
catch (err) {
|
|
265
|
-
log.debug("load message page failed", {
|
|
266
|
-
conversationId,
|
|
267
|
-
error: err instanceof Error ? err.message : String(err),
|
|
268
|
-
});
|
|
269
249
|
setError(err);
|
|
270
250
|
}
|
|
271
251
|
finally {
|
|
272
252
|
setLoading(false);
|
|
273
253
|
}
|
|
274
|
-
}, [rest, conversationId, before, decrypt]);
|
|
254
|
+
}, [rest, conversationId, before, decrypt, ingest]);
|
|
275
255
|
const refresh = (0, react_1.useCallback)(async () => {
|
|
276
256
|
setBefore(undefined);
|
|
277
257
|
await load(true);
|
|
@@ -281,103 +261,75 @@ function useSecureMessages(conversationId, options = {}) {
|
|
|
281
261
|
return;
|
|
282
262
|
await load(false);
|
|
283
263
|
}, [hasMore, loading, load]);
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
// provider): the crypto layer tags the sender from the restored device identity, so after a
|
|
287
|
-
// reload the first send must wait for useSecureDevice's importDeviceState to complete.
|
|
264
|
+
// Shared send: encode → frame → pad → encrypt → persist ratchet → POST → persist content → optimistic.
|
|
265
|
+
const sendContent = (0, react_1.useCallback)(async (mimi) => {
|
|
288
266
|
if (!group)
|
|
289
267
|
throw new Error("Cannot send: no MLS group handle for this conversation.");
|
|
290
268
|
if (!senderDeviceId)
|
|
291
269
|
throw new Error("Cannot send: senderDeviceId is required.");
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
// The send ratchet just advanced in memory. Persist NOW — BEFORE the network send — because the
|
|
296
|
-
// ratchet moved regardless of whether the send succeeds. If we skipped this, a reload would
|
|
297
|
-
// re-import the last-committed state, rewind the send ratchet to a consumed generation, and the
|
|
298
|
-
// peer would reject our next message as a replay (the exact bug this fixes). A failed network
|
|
299
|
-
// send instead leaves at most a one-generation forward gap, which the peer tolerates within its
|
|
300
|
-
// key-retention window — fail-safe-forward, never a replay.
|
|
270
|
+
const frame = (0, frame_js_1.frameContent)(frame_js_1.ContentKind.Mimi, (0, mimi_content_js_1.encodeMimiContent)(mimi));
|
|
271
|
+
const { ciphertext, epoch } = await crypto.encryptMessage(group, (0, padding_js_1.padPlaintext)(frame, padding));
|
|
272
|
+
// Persist the advanced SEND ratchet BEFORE the network send (it moved regardless of success).
|
|
301
273
|
await persistGroupState(conversationId, group);
|
|
302
274
|
const sent = await rest.sendMessage(conversationId, {
|
|
303
275
|
ciphertext: (0, base64_js_1.toBase64)(ciphertext),
|
|
304
276
|
epoch: epoch.toString(),
|
|
305
277
|
senderDeviceId,
|
|
306
278
|
});
|
|
307
|
-
|
|
308
|
-
//
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
...prev.filter((p) => p.model.id !== sent.id),
|
|
325
|
-
]);
|
|
326
|
-
}, [crypto, rest, repo, conversationId, group, senderDeviceId, padding, persistGroupState]);
|
|
279
|
+
await repo.saveMessageContent(conversationId, sent.id, frame);
|
|
280
|
+
// Optimistic: we can't decrypt our own MLS message, so seed the decoded content directly and cache
|
|
281
|
+
// it so the server echo short-circuits (no rejected flicker).
|
|
282
|
+
const decoded = {
|
|
283
|
+
messageId: sent.id, createdAt: sent.createdAt, senderDeviceId, contentHash: (0, mimi_content_js_1.contentHash)(mimi), mimi,
|
|
284
|
+
};
|
|
285
|
+
const outcome = { status: "ok", control: false, decoded };
|
|
286
|
+
okCache.current.set(sent.id, outcome);
|
|
287
|
+
ingest(sent, outcome);
|
|
288
|
+
log.debug("sent content", { conversationId, messageId: sent.id, epoch: epoch.toString() });
|
|
289
|
+
}, [crypto, rest, repo, conversationId, group, senderDeviceId, padding, persistGroupState, ingest]);
|
|
290
|
+
const sendMessage = (0, react_1.useCallback)((text) => sendContent((0, builders_js_1.buildPost)(text)), [sendContent]);
|
|
291
|
+
const reply = (0, react_1.useCallback)((t, text) => sendContent((0, builders_js_1.buildReply)(text, t)), [sendContent]);
|
|
292
|
+
const react = (0, react_1.useCallback)((t, token) => sendContent((0, builders_js_1.buildReaction)(t, token)), [sendContent]);
|
|
293
|
+
const editMessage = (0, react_1.useCallback)((t, text) => sendContent((0, builders_js_1.buildEdit)(t, text)), [sendContent]);
|
|
294
|
+
const deleteMessage = (0, react_1.useCallback)((t) => sendContent((0, builders_js_1.buildDelete)(t)), [sendContent]);
|
|
295
|
+
const unreact = (0, react_1.useCallback)((reactionHash) => sendContent((0, builders_js_1.buildUnreact)(reactionHash)), [sendContent]);
|
|
327
296
|
(0, react_1.useEffect)(() => {
|
|
328
297
|
refresh();
|
|
329
298
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
330
299
|
}, [conversationId]);
|
|
331
|
-
//
|
|
332
|
-
// resolveGroup is still in flight (those rows come back `pending`); a Commit/join also advances the
|
|
333
|
-
// epoch, letting previously-ahead rows decrypt. Retry ONLY `pending` rows — never `rejected` ones, so
|
|
334
|
-
// a replay/forgery the core already refused isn't retried on every epoch bump. `ok` rows are kept.
|
|
300
|
+
// Retry buffered (pending) rows when the group handle advances.
|
|
335
301
|
(0, react_1.useEffect)(() => {
|
|
336
302
|
if (!group)
|
|
337
303
|
return;
|
|
338
|
-
|
|
304
|
+
const pendingModels = [...byIdRef.current.values()].filter((e) => e.status === "pending").map((e) => e.model);
|
|
305
|
+
if (pendingModels.length === 0)
|
|
339
306
|
return;
|
|
340
307
|
let alive = true;
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
308
|
+
(async () => {
|
|
309
|
+
for (const m of pendingModels) {
|
|
310
|
+
const outcome = await decrypt(m);
|
|
311
|
+
if (!alive)
|
|
312
|
+
return;
|
|
313
|
+
ingest(m, outcome);
|
|
314
|
+
}
|
|
315
|
+
})();
|
|
345
316
|
return () => {
|
|
346
317
|
alive = false;
|
|
347
318
|
};
|
|
348
|
-
}, [group, decrypt]);
|
|
349
|
-
// Live receive: join the conversation room and decrypt inbound ciphertext.
|
|
319
|
+
}, [group, decrypt, ingest]);
|
|
320
|
+
// Live receive: join the conversation room and decrypt+ingest inbound ciphertext.
|
|
350
321
|
(0, react_1.useEffect)(() => {
|
|
351
322
|
socket.joinConversation(conversationId);
|
|
352
323
|
const off = socket.on("secure:message", (model) => {
|
|
353
324
|
if (model.conversationId !== conversationId)
|
|
354
325
|
return;
|
|
355
|
-
decrypt(model).then((
|
|
356
|
-
const i = prev.findIndex((p) => p.model.id === m.model.id);
|
|
357
|
-
if (i === -1) {
|
|
358
|
-
log.debug("live message received", {
|
|
359
|
-
conversationId,
|
|
360
|
-
messageId: m.model.id,
|
|
361
|
-
status: m.status,
|
|
362
|
-
});
|
|
363
|
-
return [m, ...prev];
|
|
364
|
-
}
|
|
365
|
-
// Already present (e.g. loaded as `pending` before the group resolved): keep the more-resolved
|
|
366
|
-
// copy in place — NEVER drop this `ok` for a stale `pending`. The decrypt above consumed the
|
|
367
|
-
// single-use MLS key, so this may be the only successful decode the message ever gets.
|
|
368
|
-
const merged = preferResolved(prev[i], m);
|
|
369
|
-
if (merged === prev[i]) {
|
|
370
|
-
log.trace("live message deduped (kept existing)", { messageId: m.model.id, status: prev[i].status });
|
|
371
|
-
return prev;
|
|
372
|
-
}
|
|
373
|
-
log.debug("live message upgraded", { conversationId, messageId: m.model.id, status: merged.status });
|
|
374
|
-
const next = prev.slice();
|
|
375
|
-
next[i] = merged;
|
|
376
|
-
return next;
|
|
377
|
-
}));
|
|
326
|
+
decrypt(model).then((outcome) => ingest(model, outcome));
|
|
378
327
|
});
|
|
379
328
|
return off;
|
|
380
|
-
}, [socket, conversationId, decrypt]);
|
|
381
|
-
return {
|
|
329
|
+
}, [socket, conversationId, decrypt, ingest]);
|
|
330
|
+
return {
|
|
331
|
+
messages, loading, hasMore, error, loadMore, refresh,
|
|
332
|
+
sendMessage, reply, react, editMessage, deleteMessage, unreact,
|
|
333
|
+
};
|
|
382
334
|
}
|
|
383
335
|
//# sourceMappingURL=useSecureMessages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSecureMessages.js","sourceRoot":"","sources":["../../../src/hooks/useSecureMessages.tsx"],"names":[],"mappings":";AAAA,+FAA+F;AAC/F,EAAE;AACF,mGAAmG;AACnG,oGAAoG;AACpG,6FAA6F;AAC7F,6CAA6C;;AA0G7C,8CAkWC;AA1cD,iCAAiE;AAEjE,sEAIuC;AACvC,iDAAmF;AACnF,mDAAkE;AAClE,+CAAqD;AACrD,8EAAkE;AAElE,MAAM,GAAG,GAAG,IAAA,4BAAiB,EAAC,UAAU,CAAC,CAAC;AAkD1C;;;;;;;;;;;;;;;GAeG;AACH,SAAS,cAAc,CACrB,QAAgC,EAChC,QAAgC;IAEhC,IAAI,QAAQ,CAAC,MAAM,KAAK,IAAI;QAAE,OAAO,QAAQ,CAAC,CAAC,uCAAuC;IACtF,IAAI,QAAQ,CAAC,MAAM,KAAK,IAAI;QAAE,OAAO,QAAQ,CAAC,CAAC,gCAAgC;IAC/E,OAAO,QAAQ,CAAC,CAAC,kFAAkF;AACrG,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,iBAAiB,CAC/B,cAAsB,EACtB,UAAoC,EAAE;IAEtC,MAAM,EACJ,IAAI,EACJ,MAAM,EACN,MAAM,EACN,IAAI,EACJ,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,OAAO,GACR,GAAG,IAAA,sCAAa,GAAE,CAAC;IAEpB,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAA2B,EAAE,CAAC,CAAC;IACvE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAqB,SAAS,CAAC,CAAC;IACpE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,G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