@hostwebhook/node 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -231,8 +231,9 @@ var HostWebhook = class {
231
231
  ...options?.headers
232
232
  };
233
233
  if (this.signingSecret) {
234
- const sig = (0, import_crypto2.createHmac)("sha256", this.signingSecret).update(body).digest("hex");
235
- headers["X-Webhook-Signature"] = `sha256=${sig}`;
234
+ const timestamp = Math.floor(Date.now() / 1e3);
235
+ const sig = (0, import_crypto2.createHmac)("sha256", this.signingSecret).update(`${timestamp}.${body}`).digest("hex");
236
+ headers["X-HostWebhook-Signature"] = `t=${timestamp},v1=${sig}`;
236
237
  }
237
238
  const url = `${this.baseUrl}/api/in/${this.token}`;
238
239
  const controller = new AbortController();
package/dist/index.mjs CHANGED
@@ -197,8 +197,9 @@ var HostWebhook = class {
197
197
  ...options?.headers
198
198
  };
199
199
  if (this.signingSecret) {
200
- const sig = createHmac2("sha256", this.signingSecret).update(body).digest("hex");
201
- headers["X-Webhook-Signature"] = `sha256=${sig}`;
200
+ const timestamp = Math.floor(Date.now() / 1e3);
201
+ const sig = createHmac2("sha256", this.signingSecret).update(`${timestamp}.${body}`).digest("hex");
202
+ headers["X-HostWebhook-Signature"] = `t=${timestamp},v1=${sig}`;
202
203
  }
203
204
  const url = `${this.baseUrl}/api/in/${this.token}`;
204
205
  const controller = new AbortController();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostwebhook/node",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Official HostWebhook SDK — verify signatures, parse headers, and send webhooks",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",