Node hosts
A host that is a program rather than a page installs @bitskiff/host-node: the host SDK with the Node
platform and transport in place of the browser ones. Same factory, same handle, same channels.
npm install @bitskiff/host-node
A Node process sends no browser origin, so a publishable key cannot bound it. It opens with the
project's secret key (mrc_sk_...), from the environment and never from source.
import { BitskiffHost, qrTerminal } from '@bitskiff/host-node';
const host = new BitskiffHost(); // the key comes from BITSKIFF_SECRET_KEY
const session = await host.open({ hostResumeWindowMs: 60_000 });
console.log(qrTerminal(session.joinCode.url)); // scannable straight out of the terminal
session.channel('press').on('message', (m) => console.log(m.from.id, m.data));
BitskiffHost reads BITSKIFF_SECRET_KEY when you pass no key, which is why the block above has no key
line at all. An explicit key wins over the environment and is never logged; with neither, open
refuses at the call site rather than reaching the API.
Make the secret key
In the console, beside the publishable key, or from the command line:
npm install -g @bitskiff/cli
bitskiff login
bitskiff keys create --type secret --preset host-only --label node-host
host-only is sessions:open and nothing else—the list for a machine that should be able to do
nothing but open sessions. What is stored is the list, so you can widen it later.
Restarting
A Node host remembers its session: restart the process and it resumes the one it was running, with
its phones still seated if the restart finished inside the host grace. That is what
hostResumeWindowMs: 60_000 above buys—the platform's own default is 10 s, which is a page
reload and not a redeploy. Past it the phones are told the host went offline.
Several hosts on one machine
Each process names the slot it remembers itself in:
import { BitskiffHost } from '@bitskiff/host-node';
const host = new BitskiffHost();
const session = await host.open({ persist: { as: 'front-desk-host' } });
console.log(session.joinCode.code);
persist: { in: 'none' } turns the remembering off instead. Two processes on one slot is refused:
the second open throws rather than taking the first one's session.