@samva/webhooks 0.1.1 → 0.2.0

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.
Files changed (2) hide show
  1. package/README.md +5 -4
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -6,19 +6,20 @@ Crypto-compatible runtimes.
6
6
  ```ts
7
7
  import { verifyRequest } from "@samva/webhooks";
8
8
 
9
- const event = await verifyRequest(request, process.env.SAMVA_WEBHOOK_SECRET!);
9
+ const verified = await verifyRequest(request, process.env.SAMVA_WEBHOOK_SECRET!);
10
+ await persistAndHandleOnce(verified.id, verified.event);
10
11
  ```
11
12
 
12
13
  Verification reads the exact request body, validates the Standard Webhooks signature and replay
13
- window, and returns the verified event envelope. Preserve the raw request body and keep the signing
14
- secret on the server.
14
+ window, and returns `{ id, event }`. `verified.id` matches the `webhook-id` header. Preserve the raw
15
+ request body and keep the signing secret on the server.
15
16
 
16
17
  Effect applications can use the optional Effect entrypoint:
17
18
 
18
19
  ```ts
19
20
  import * as Webhooks from "@samva/webhooks/effect";
20
21
 
21
- const event = yield * Webhooks.verifyRequest(request, secret);
22
+ const verified = yield * Webhooks.verifyRequest(request, secret);
22
23
  ```
23
24
 
24
25
  Install the exact optional peer `effect@4.0.0-beta.102` when using that entrypoint.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@samva/webhooks",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Runtime-neutral verification for Samva webhook deliveries",
5
5
  "keywords": [
6
6
  "samva",