7.8 KiB
name, overview, todos, isProject
| name | overview | todos | isProject | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Secure Chat Addon Plan | Cursor plan document for the BackOne Secure Chat addon: a minimal text-only UI addon bundled as `backone-addon-secure-chat`, using WebHub WebSocket signaling (same network/auth as backone-cli) with auto-resolved install paths. |
|
false |
Secure Chat Addon Plan
Purpose
Add a Secure Chat BackOne addon (secure-chat) as a separate installable package (backone-addon-secure-chat). It provides a minimal text-only chat UI modeled on addons/chat, sharing the same BackOne core network and auth token as backone-cli, but without attachments or connection-bar chrome.
This document is the Cursor plan reference for the addon (implementation is largely in place).
Architecture
flowchart LR
subgraph ui [SecureChatUI]
A["addons/secure-chat/frontend/index.js"]
end
subgraph shell [AppShell]
B["addon-loader.js"]
C["main.js nav"]
D["webhub-client.js"]
end
subgraph signaling [WebHubSidecar]
E["backone-webhub :9994"]
end
subgraph core [BackOneCore]
F["backone / backone-cli"]
end
A -->|subscribe chat_message| D
A -->|send chat_message| D
D <-->|WebSocket authtoken| E
B -->|dynamic import| A
C -->|mount| A
F -->|peers networks status| A
Key design choices (current codebase):
| Aspect | Secure Chat | Chat P2P |
|---|---|---|
| Signaling | WebHub chat_message via BackOneWebHubClient |
Same |
| UI | Text-only, no file input | Text + attachments |
| Connection bar | Omitted | BackOneCommLayout bar |
| Message storage | In-memory session only | In-memory session only |
| Dependencies | comms-core, webhub |
comms-core, webhub |
| Nav order | First (secure-chat) |
Second (chat) |
Note: An earlier design used a dedicated HTTP route
POST/GET /controller/comms/network/{nwid}/secure-chatinAddonHost.cpp. The current implementation uses WebHub instead (aligned with voice/video/chat signaling). No separate C++ comms route is required for secure-chat today.
Source layout
addons/secure-chat/
├── addon.json # manifest (id, requires, frontend, backend metadata)
└── frontend/
└── index.js # window.BackOneAddons['secure-chat'] factory
Manifest — addons/secure-chat/addon.json
id:"secure-chat"name:"Secure Chat"requires:["comms-core", "webhub"]frontend.entry:/app/addons/secure-chat/index.jsfrontend.navLabel:"Secure Chat"backend.websocketEvents:["secure_chat_message"](declared; uses sharedchat_messageover WebHub at runtime)
Frontend — addons/secure-chat/frontend/index.js
Minimal UI pattern (from chat reference):
- Keep:
comm-split-layout,BackOnePeerPicker,BackOneNetworkSession,escapeHtml, message meta/time styling,BackOneAuth/ core session - Omit: file attachment input,
BackOneCommLayoutconnection bar, persisted localStorage history
Send path:
BackOneWebHubClient.send({
type: 'chat_message',
networkId,
targetId: selectedPeer.peerId,
senderName: name,
body
});
Receive path: BackOneWebHubClient.subscribe('chat_message', handler) — filters by networkId and selected peer.
Runtime registration flow
backoneservice loads addons from/usr/lib/backone/addons/viaservice/AddonHost.cppaddons/updater/rebuild-addon-manifest.shwrites$BACKONE_HOME/app/addons/manifest.json- App shell
app-shell/dist/addon-loader.jsfetches manifest andimport()s eachfrontend.entry app-shell/dist/main.jsbuilds nav (navOrder: ['secure-chat', 'chat', 'video', 'voice']) and callsmount(panel)app-shell/dist/main.jsconnectsBackOneWebHubClienton init; WebHub sidecar started bybackone-webhub.service
Bundling and packaging
Make install — make/install-addons.mk
| Target | Installs to (Linux defaults) |
|---|---|
install-addon-secure-chat |
addon.json → /usr/lib/backone/addons/secure-chat/ |
index.js → /var/lib/backone/app/addons/secure-chat/ |
Install paths auto-resolve from pkg/common/platform-paths.sh via pkg/common/resolve-install-path.sh:
- Empty
DESTDIR→ live system paths (same defaults asbackone-cli/ updater) DESTDIR=/tmp/stage→ packaging staging prefix
Debian — debian/control
- Package:
backone-addon-secure-chat - Depends:
backone,backone-addon-comms-core,backone-addon-webhub,backone-app-shell - Rules:
debian/rules→install-addon-secure-chat - Metadata:
debian/backone-addon-secure-chat/DEBIAN/
macOS / Windows
pkg/mac/build-addon-pkgs.sh—backone-addon-secure-chatpkg/windows/build-addon-packages.ps1—backone-addon-secure-chat
Version bump
ci/scripts/bump_version.shincludessecure-chatin addon version loop
Install and deploy
Live install (no DESTDIR):
sudo make install-addon-secure-chat
sudo make install-addon-manifest # or: sudo backone-updater rebuild-manifest
sudo systemctl restart backone
sudo systemctl restart backone-webhub # if webhub not running
Package staging:
make install-addon-secure-chat DESTDIR=/tmp/backone-stage
make install-addon-manifest DESTDIR=/tmp/backone-stage
Debian package:
sudo dpkg -i backone-addon-secure-chat_*.deb
sudo backone-updater rebuild-manifest
sudo systemctl restart backone backone-webhub
Test checklist
- Web UI shows Secure Chat nav tab (first in order)
- Join a BackOne network (same as
backone-cli join) - Select a peer, send text — message appears locally
- Peer receives
chat_messageover WebHub (if second client connected) - Regular Chat P2P addon still works (attachments, connection bar)
backone-addon-secure-chatabsent → empty-state hint mentions package namemanifest.jsonlistssecure-chatafter install + rebuild-manifest
Scope boundaries
In scope
- New
secure-chataddon source +backone-addon-secure-chatpackage - Minimal UI (chat reference, text-only)
- WebHub real-time signaling
- Make / Debian / macOS / Windows bundle entries
- Auto-resolved install paths via
platform-paths.sh
Out of scope
- Client-side E2E encryption (Web Crypto)
- Postgres / file-backed message persistence
- Dedicated
/controller/comms/.../secure-chatHTTP API (superseded by WebHub) - Changes to voice/video addons
Known gap (optional follow-up)
debian/backone-addon-secure-chat/DEBIAN/control binary metadata lists backone-addon-comms-core + backone-app-shell but omits backone-addon-webhub; source debian/control includes webhub. Align binary Depends with source control for consistent dpkg dependency resolution.