@samva/webhooks 0.1.1 → 0.3.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.
- package/AGENTS.md +1 -1
- package/README.md +6 -5
- package/package.json +4 -4
package/AGENTS.md
CHANGED
|
@@ -5,7 +5,7 @@ webhook. Verification requires the untouched request body and the endpoint signi
|
|
|
5
5
|
expose that secret to browser code.
|
|
6
6
|
|
|
7
7
|
Effect applications can import the typed adapter from `@samva/webhooks/effect` and install the
|
|
8
|
-
optional exact peer `effect@4.0.0-
|
|
8
|
+
optional exact peer `effect@4.0.0-rc.111`.
|
|
9
9
|
|
|
10
10
|
Import only package subpaths declared in `package.json`. The delivery, queue, persistence, retry,
|
|
11
11
|
and endpoint-management implementation is not part of this package.
|
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
|
|
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
|
|
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
|
|
22
|
+
const verified = yield * Webhooks.verifyRequest(request, secret);
|
|
22
23
|
```
|
|
23
24
|
|
|
24
|
-
Install the exact optional peer `effect@4.0.0-
|
|
25
|
+
Install the exact optional peer `effect@4.0.0-rc.111` when using that entrypoint.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@samva/webhooks",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Runtime-neutral verification for Samva webhook deliveries",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"samva",
|
|
@@ -58,14 +58,14 @@
|
|
|
58
58
|
"typecheck": "tsgo --noEmit"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@effect/vitest": "4.0.0-
|
|
62
|
-
"effect": "4.0.0-
|
|
61
|
+
"@effect/vitest": "4.0.0-rc.111",
|
|
62
|
+
"effect": "4.0.0-rc.111",
|
|
63
63
|
"tsdown": "^0.22.13",
|
|
64
64
|
"typescript": "^6.0.3",
|
|
65
65
|
"vitest": "^4.1.10"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"effect": "4.0.0-
|
|
68
|
+
"effect": "4.0.0-rc.111"
|
|
69
69
|
},
|
|
70
70
|
"peerDependenciesMeta": {
|
|
71
71
|
"effect": {
|