aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-cli/src/meshbay_cli/client
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-10-15 02:22:05 +0200
committerChristophe Besson <cbesson@gmail.com>2026-10-15 02:22:05 +0200
commitadda9613fad48a68239e2dbd93321818a835c286 (patch)
tree8835fd2ac3e203d3f3110bc45617c79eb982cd0d /packages/meshbay-cli/src/meshbay_cli/client
parent419af660eeb8a4403e37a63c54a15586d04d5a8e (diff)
downloadmeshbay-adda9613fad48a68239e2dbd93321818a835c286.tar.gz
feat(cli): chat --follow
chat GROUP --follow prints the last messages, then each one the node pushes, until Ctrl+C (exit 130). The connection is pinged every half minute; one that closes, fails or stops answering is opened again, and what was said meanwhile is read from the history. Each message is printed once, by its (device, nonce) pair, which the node stores once. With --json, one object per line. The man page lists it, with an example, and its FILES now names the device keys kept for the Tier 2 check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-cli/src/meshbay_cli/client')
-rw-r--r--packages/meshbay-cli/src/meshbay_cli/client/chat.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/packages/meshbay-cli/src/meshbay_cli/client/chat.py b/packages/meshbay-cli/src/meshbay_cli/client/chat.py
index 60629e2..22a99ef 100644
--- a/packages/meshbay-cli/src/meshbay_cli/client/chat.py
+++ b/packages/meshbay-cli/src/meshbay_cli/client/chat.py
@@ -48,6 +48,9 @@ class Message:
text: str
unreadable: str = "" # why it could not be read: signature, epoch, ...
trust: str = "" # roster.RosterCheck's verdict on the signing device
+ # Which message this is, wherever it was read from — history or a push,
+ # which carries no id: the node stores a (device, nonce) pair only once.
+ key: str = ""
class ChatKeys:
@@ -100,6 +103,7 @@ async def open_row(row: dict, keys: ChatKeys, group_id: str,
if not (device and nonce and ct and sig):
msg.unreadable = "envelope"
return msg
+ msg.key = f"{b64(bytes(device))}:{b64(bytes(nonce))}"
if not verify(group_id, epoch, bytes(device), bytes(nonce), bytes(ct), bytes(sig)):
msg.unreadable = "signature"
return msg