TypeScript node:crypto timingSafeEqual function not found
I'm trying to implement Twitch EventSub webhook handler in my Worker based on Twitch example code https://dev.twitch.tv/docs/eventsub/handling-webhook-events/#simple-nodejs-example
It uses
Reading cloudflare docs I understood that I need to use
So I created a new worker project as described here https://developers.cloudflare.com/workers/get-started/guide/#1-create-a-new-worker-project
by running
I then modified
Then I ran
Why? The documenation says that
It uses
crypto library functions createHmac and timingSafeEqualReading cloudflare docs I understood that I need to use
node:crypto and the docs says that both createHmac and timingSafeEqual are supported in https://developers.cloudflare.com/workers/runtime-apis/nodejs/crypto/So I created a new worker project as described here https://developers.cloudflare.com/workers/get-started/guide/#1-create-a-new-worker-project
by running
npm create cloudflare@latest and selecting "Hello World" Worker as template and Yes for TypeScript supportI then modified
src/index.ts (didn't change anything else) for testing purposes with this:Then I ran
npm run start and opened the local worker page, but in console I see this:[wrangler:err] TypeError: timingSafeEqual is not a functionWhy? The documenation says that
timingSafeEqual is supported. Am I missing something?