core&ui: add webauthn support (#484)

Co-authored-by: panda <panda_dtdyy@outlook.com>
Co-authored-by: undefined <i@undefined.moe>
This commit is contained in:
pandaandundefined authored and GitHub committed 2023-01-23 17:49:40 +08:00
1 parent 3d3a5480e3
commit d069fe127b
29 files changed
+621 -195

No files matched your search

+8
View File
@@ -0,0 +1,8 @@
import notp from 'notp';
import b32 from 'thirty-two';
export function verifyTFA(secret: string, code?: string) {
if (!code || !code.length) return null;
const bin = b32.decode(secret);
return notp.totp.verify(code.replace(/\W+/g, ''), bin);
}