【发布时间】:2019-05-31 08:16:19
【问题描述】:
我在我的密码应用程序中实现argon2。
try {
if (await argon2.verify("<big long hash>", "password")) {
// password match
} else {
// password did not match
}
} catch (err) {
// internal failure
}
但出现错误SyntaxError: await 仅在异步函数中有效。 如何使用异步功能?
【问题讨论】:
-
您只能在异步函数中等待异步函数。例如
async function verifyPassword(password){ if(await argon2.verify("<big long hash>", "password")){/*...*/} }
标签: node.js npm visual-studio-code argon2-ffi