UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

20 lines (19 loc) • 597 B
//#region src/shared/device-auth.ts function normalizeDeviceAuthRole(role) { return role.trim(); } function normalizeDeviceAuthScopes(scopes) { if (!Array.isArray(scopes)) return []; const out = /* @__PURE__ */ new Set(); for (const scope of scopes) { const trimmed = scope.trim(); if (trimmed) out.add(trimmed); } if (out.has("operator.admin")) { out.add("operator.read"); out.add("operator.write"); } else if (out.has("operator.write")) out.add("operator.read"); return [...out].toSorted(); } //#endregion export { normalizeDeviceAuthScopes as n, normalizeDeviceAuthRole as t };