aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/messaging.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-03-05 23:01:15 -0800
committerAdam Soltys <[email protected]>2026-03-05 23:01:15 -0800
commit3b18232d52957dbd1a5a0c12891020d2a6e3295e (patch)
treeebb2d2673b89e71b0eaaa0ab829cab0d707ce3ee /src/lib/messaging.ts
parent7471599082e053cabea19df25c867c654cb7445c (diff)
downloadcoinos-ui-3b18232d52957dbd1a5a0c12891020d2a6e3295e.tar.gz
coinos-ui-3b18232d52957dbd1a5a0c12891020d2a6e3295e.zip
messaging fixes
Diffstat (limited to 'src/lib/messaging.ts')
-rw-r--r--src/lib/messaging.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/messaging.ts b/src/lib/messaging.ts
index fdb03f90..c4d4b211 100644
--- a/src/lib/messaging.ts
+++ b/src/lib/messaging.ts
@@ -33,22 +33,27 @@ async function checkMlsSupport(pubkey: string): Promise<boolean> {
if (mlsSupportCache.has(pubkey)) return mlsSupportCache.get(pubkey)!;
try {
const supported = await recipientSupportsMls(pubkey);
+ console.log("[messaging] MLS support for", pubkey.slice(0, 12) + "…:", supported);
mlsSupportCache.set(pubkey, supported);
return supported;
- } catch {
+ } catch (e) {
+ console.warn("[messaging] MLS support check failed:", e);
return false;
}
}
/** Send a message — MLS if both parties support it, NIP-17 otherwise. */
export const send = async (message: string, user: any, recipient: any, expiryDays?: number) => {
+ console.log("[messaging] send to", recipient.pubkey?.slice(0, 12) + "…", { self: user.pubkey === recipient.pubkey, expiry: !!expiryDays });
if (user.pubkey !== recipient.pubkey && !expiryDays) {
try {
const peerSupports = await checkMlsSupport(recipient.pubkey);
if (peerSupports) {
+ console.log("[messaging] → MLS path");
await sendMlsMessage(user, recipient.pubkey, message);
return;
}
+ console.log("[messaging] → NIP-17 fallback (no MLS support)");
} catch (e) {
console.warn("[messaging] MLS send failed, falling back to NIP-17:", e);
}