UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

18 lines (17 loc) • 704 B
import { m as normalizeTrimmedStringList } from "./string-normalization-DLmfYZXI.mjs"; //#region src/shared/device-auth.ts /** Normalize a device-auth role id without changing its case or namespace. */ function normalizeDeviceAuthRole(e) { return e.trim(); } /** Normalize device-auth scopes, dedupe/sort them, and include implied operator scopes. */ function normalizeDeviceAuthScopes(e) { const t = new Set(normalizeTrimmedStringList(e)); if (t.has("operator.admin")) { t.add("operator.read"); t.add("operator.write"); } else if (t.has("operator.write")) t.add("operator.read"); return [...t].toSorted(); } //#endregion export { normalizeDeviceAuthScopes as n, normalizeDeviceAuthRole as t };