UNPKG

@s4e/jsentinel

Version:

Script integrity and clipboard tamper detection for browsers.

2 lines (1 loc) 734 B
import{_ as e}from"./index-hwEiSUPx.js";function o(o,n){const t=t=>e(this,void 0,void 0,function*(){try{const e=yield fetch(o,{method:"POST",headers:{Authorization:`Splunk ${n}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!e.ok)try{const o=yield e.text();console.error("Splunk HEC Error:",o)}catch(e){console.error("Splunk HEC Error (no body):",(null==e?void 0:e.message)||e)}}catch(e){console.error("Splunk connection error:",(null==e?void 0:e.message)||e)}}),r=e=>{const o=e,n={time:Math.floor(Date.now()/1e3),host:location.hostname,source:"jsentinel",event:o.detail};t({event:n})};return window.addEventListener("jsentinel",r),()=>{window.removeEventListener("jsentinel",r)}}export{o as installSplunkForwarder};