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
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
before use crypto
module, just import import crypto from "crypto"
here are example for crypto
For me, it worked when I used import * as
import * as crypto from 'crypto';
You can use it with
const crypto = require('crypto');
or also by using
import crypto from "crypto"