eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
1 lines • 1.08 kB
JavaScript
import{verifySlackRequest as verifySlackRequest$1}from"#compiled/@chat-adapter/slack/webhook.js";async function verifySlackRequest(t,n){if(n.webhookVerifier===void 0&&!n.signingSecret)throw Error(`slackChannel: missing signing secret. Pass credentials.signingSecret, set SLACK_SIGNING_SECRET, or supply credentials.webhookVerifier.`);try{return await verifySlackRequest$1(t,n)}catch(e){throw normalizeSlackWebhookError(e)}}function normalizeSlackWebhookError(e){let t=e instanceof Error?e.message:String(e);return t.includes(`verifier rejected`)?Error(`slackChannel: inbound webhook verifier rejected the request.`):t.includes(`signature headers`)?Error(`slackChannel: inbound request missing Slack signature headers.`):t.includes(`timestamp is invalid`)?Error(`slackChannel: inbound request has malformed timestamp.`):t.includes(`timestamp is too old`)?Error(`slackChannel: inbound request timestamp outside allowed skew.`):t.includes(`signature is invalid`)?Error(`slackChannel: inbound request signature mismatch.`):e instanceof Error?e:Error(t)}export{verifySlackRequest};