openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 984 B
JavaScript
import{l as emitTrustedSecurityEvent}from"./diagnostic-events-BYBrlAdF.mjs";import{r as sha256HexPrefixCore}from"./node-crypto-DPk8agfR.mjs";import"./crypto-digest-T8X5EZni.mjs";
//!src/gateway/server-methods/device-management-security.ts
function hashDeviceSecurityId(e){const t=e?.trim();if(!t)return;return`sha256:${sha256HexPrefixCore(t,12)}`}function emitDeviceManagementSecurityEvent(e){emitTrustedSecurityEvent({category:`auth`,action:e.action,outcome:e.outcome,severity:e.severity,actor:{kind:`operator`,...e.authz.callerDeviceId?{deviceIdHash:hashDeviceSecurityId(e.authz.callerDeviceId)}:{},role:e.authz.isAdminCaller?`admin`:`operator`},target:{kind:`device`,...e.targetDeviceId?{idHash:hashDeviceSecurityId(e.targetDeviceId)}:{}},policy:{id:e.policyId,decision:e.decision,...e.reason?{reason:e.reason}:{}},control:{id:e.controlId,family:`auth`},...e.reason?{reason:e.reason}:{},...e.attributes?{attributes:e.attributes}:{}})}export{emitDeviceManagementSecurityEvent as t};