【发布时间】:2022-12-21 16:47:21
【问题描述】:
我可以在 NextJS 中使用 web crypto api 吗?
我试着用
crypto.subtle.digest('SHA-256', data)
但出现错误
ReferenceError: crypto is not defined
【问题讨论】:
我可以在 NextJS 中使用 web crypto api 吗?
我试着用
crypto.subtle.digest('SHA-256', data)
但出现错误
ReferenceError: crypto is not defined
【问题讨论】:
在使用crypto模块之前,只需导入import crypto from "crypto"
这是crypto的例子
【讨论】: