Skip to main content

Server authentication

Authentication checks possession of a configured key. It is separate from the website's account UI. For local development, start with a private test credential and replace it before deployment.

CLI providers​

Without authentication options, the CLI does not configure a provider. If several are supplied, precedence is file → parameter → Redis.

An authentication JSON file contains rows [id, key, cid, level]:

[["uno3", "uno3-key", "uno3-cid", 1]]

IDs are at most 8 bytes and CIDs at most 12 bytes. Input keys are hashed with SHA-256, but a file containing input keys is still credential material. A JavaScript auth file can export authInfo containing the same rows.

io-server -l 7777 --auth-file ./auth_file.json
io-client -i uno3 -k uno3-key
# Equivalent combined client credential:
io-client -a uno3.uno3-key

Parameter providers use id.key.cid.level records separated by commas. Command-line secrets may remain in shell history. For supported switches, use the installed CLI's --help and CLI server guide.

Node.js​

import { Server, BohoAuth, FileKeyProvider } from 'iosignal';
const auth = new BohoAuth(new FileKeyProvider('./auth_file.json'));
const server = new Server({ port: 7777, membersOnly: true }, auth);

The relative file path resolves from the process working directory. Available providers include FileKeyProvider, StringKeyProvider, and RedisKeyProvider.

Redis defaults to localhost port 6379 unless configured. The CLI waits up to five seconds, does not automatically reconnect in this startup path, and exits with code 1 on failure. Repository scripts that register sample data and call SAVE are test setup, not a production credential database.

Authentication success does not define application room membership or command permissions. Add those rules in your service or application. See Boho details.