1 import { Secret, TOTP } from 'otpauth'
2 import { WEBSERVER } from '@server/initializers/constants'
4 function isOTPValid (options: {
8 const { token, secret } = options
10 const totp = new TOTP({
16 const delta = totp.validate({
21 if (delta === null) return false
26 function generateOTPSecret (email: string) {
27 const totp = new TOTP({
35 secret: totp.secret.base32,
45 // ---------------------------------------------------------------------------
47 function baseOTPOptions () {
49 issuer: WEBSERVER.HOST,