Workers support the Web Crypto standard by default, if I recall correctly the screenshot is from the

Workers support the Web Crypto standard by default, if I recall correctly the screenshot is from the nodejs compat crypto, which does support createHmac and you can enable it in your worker.
You'll need to add compatibility_flags = ['nodejs_compat'] to your wrangler.toml (if you have other flags, append
nodejs_compat
) to enable it, then you will be able to use it like this:

import { createHmac } from 'node:crypto'

function somewhereInYourCode() {
  createHmac('sha256', 'secret')
}
Was this page helpful?