const { Model } = require('flitter-orm') const speakeasy = require('speakeasy') class MFATokenModel extends Model { static get services() { return [...super.services, 'MFA'] } static get schema() { return { secret: String, otpauth_url: String, } } verify(value) { return speakeasy.totp.verify({ secret: this.secret, encoding: 'base32', token: value, }) } } module.exports = exports = MFATokenModel