From 4ae61dc4e1dcca6ae24131fcd9acc55124e3c0af Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Fri, 9 Oct 2026 12:16:51 +0200 Subject: feat: let the operator purge a group's chat (MNP 6.1) Signed chat_purge from the Chat settings deletes every stored message; epoch keys and attachments stay. The ack is broadcast so open chat panels empty. Co-Authored-By: Claude Opus 5.5 --- .../meshbay-hub/src/meshbay_hub/static/transport-chat.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'packages/meshbay-hub/src/meshbay_hub/static/transport-chat.js') diff --git a/packages/meshbay-hub/src/meshbay_hub/static/transport-chat.js b/packages/meshbay-hub/src/meshbay_hub/static/transport-chat.js index 96e06d7..9ce07bc 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/transport-chat.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/transport-chat.js @@ -77,6 +77,21 @@ extendTransport(class { return msg; } + /** + * Delete every stored message of this group's chat. Operator only, and + * signed; the subject is the group id. The node broadcasts `chat_purge_ack`, + * which empties every open chat panel, this one included. + */ + async purgeChat(signFn) { + const groupId = this._groupId || ''; + const msg = await this._sendAndWait({ type: 'chat_purge', v: '6.1' }); + if (msg.type === 'error') throw new Error(msg.detail); + if (msg.type === 'admin_challenge') { + return this._authorizeAdminOp(msg, 'chat_purge', groupId, signFn); + } + return msg; + } + /** * A page of chat history, newest first by default. * -- cgit v1.2.3