dsh-im-ops/plugin-src/host/rpc-authority.mjs
2026-08-16 14:47:16 +08:00

11 lines
446 B
JavaScript

const RPC_AUTHORITIES = new Set(['loopback', 'trusted-host']);
/**
* Resolve the browser authority accepted by an IM management RPC channel.
* The default keeps credential and bot-management operations on loopback.
*/
export function resolveRpcAuthority(value) {
if (value === undefined) return 'loopback';
if (RPC_AUTHORITIES.has(value)) return value;
throw new TypeError('dsh-im rpcAuthority must be "loopback" or "trusted-host"');
}