MCPcopy Index your code
hub / github.com/simstudioai/sim / sign

Function sign

apps/sim/lib/data-drains/destinations/webhook.ts:101–104  ·  view source on GitHub ↗

* Stripe-style signature: HMAC-SHA256 over `${unixSeconds}.${body}` rendered as * `t= ,v1= `. Verifiers reject stale timestamps (~5 min skew) * to block replay; we re-sign per attempt so long backoffs don't fall outside * that window.

(body: Buffer, secret: string, timestamp: number)

Source from the content-addressed store, hash-verified

99 * that window.
100 */
101function sign(body: Buffer, secret: string, timestamp: number): string {
102 const hmac = createHmac('sha256', secret).update(`${timestamp}.`).update(body).digest('hex')
103 return `t=${timestamp},${SIGNATURE_VERSION}=${hmac}`
104}
105
106function isRetryableStatus(status: number): boolean {
107 return status === 408 || status === 429 || status >= 500

Callers 1

buildHeadersFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected