Using Web Crypto API in NextJS, but getting error 'crypto is not defined'

Viewed 1621

Can I use web crypto api in NextJS?

I tried to use

crypto.subtle.digest('SHA-256', data)

but getting an error

ReferenceError: crypto is not defined
1 Answers

before use crypto module, just import import crypto from "crypto"

here are example for crypto

Related