Skip to content

Commit 9e50659

Browse files
committed
Fix webhook verification
1 parent a4b4bcf commit 9e50659

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

.fern/metadata.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
}
1717
},
1818
"extraDependencies": {
19-
"fast-json-stable-stringify": "^2.1.0"
19+
"fast-json-stable-stringify": "^2.1.0",
20+
"zod": "^4"
2021
},
2122
"extraDevDependencies": {
2223
"@dotenvx/dotenvx": "^1.49.0",
2324
"react": "^19.1.1",
2425
"react-dom": "^19.1.1",
2526
"tsconfig-paths": "^4.2.0",
26-
"ts-node": "^10.5.0",
27-
"zod": "^4"
27+
"ts-node": "^10.5.0"
2828
},
2929
"extraPeerDependencies": {
3030
"react": "^18 || ^19",

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
"tsn": "ts-node -r tsconfig-paths/register"
4545
},
4646
"dependencies": {
47-
"fast-json-stable-stringify": "^2.1.0"
47+
"fast-json-stable-stringify": "^2.1.0",
48+
"zod": "^4"
4849
},
4950
"peerDependencies": {
5051
"react": "^18 || ^19",
@@ -62,8 +63,7 @@
6263
"react": "^19.1.1",
6364
"react-dom": "^19.1.1",
6465
"tsconfig-paths": "^4.2.0",
65-
"ts-node": "^10.5.0",
66-
"zod": "^4"
66+
"ts-node": "^10.5.0"
6767
},
6868
"browser": {
6969
"fs": false,

src/wrapper/lib/webhooks.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export async function verifyWebhookEventSignature(
8181
}
8282

8383
const signature = createWebhookSignature({
84-
payload: event.data.payload,
84+
body: event.data, // NOTE: We need to encrypt the entire body, not just the payload
8585
timestamp: evt.timestamp,
8686
secret: cfg.secret,
8787
});
@@ -102,15 +102,15 @@ export async function verifyWebhookEventSignature(
102102
* Creates a webhook signature for the given payload, timestamp, and secret.
103103
*/
104104
export function createWebhookSignature({
105-
payload,
105+
body,
106106
timestamp,
107107
secret,
108108
}: {
109-
payload: unknown;
109+
body: unknown;
110110
timestamp: string;
111111
secret: string;
112112
}): string {
113-
const dump = stringify(payload);
113+
const dump = stringify(body);
114114
const message = `${timestamp}.${dump}`;
115115

116116
const hmac = createHmac("sha256", secret);

0 commit comments

Comments
 (0)