Skip to content

Commit 433eb44

Browse files
committed
feat(webhooks): use toBase64 for webhook key in verification
1 parent 13c716e commit 433eb44

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/resources/webhooks.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
import { APIResource } from '../core/resource';
4+
import { toBase64 } from '../internal/utils';
45
import * as FilesAPI from './files/files';
56
import { Webhook } from 'standardwebhooks';
67

@@ -16,7 +17,7 @@ export class Webhooks extends APIResource {
1617
if (headers !== undefined) {
1718
const keyStr: string | null = key === undefined ? this._client.webhookSecret : key;
1819
if (keyStr === null) throw new Error('Webhook key must not be null in order to unwrap');
19-
const wh = new Webhook(keyStr);
20+
const wh = new Webhook(toBase64(keyStr));
2021
wh.verify(body, headers);
2122
}
2223
return JSON.parse(body) as UnwrapWebhookEvent;

0 commit comments

Comments
 (0)