This commit is contained in:
syuilo 2023-02-22 14:53:36 +09:00
parent a6fb6150a3
commit 72d4ad4c45
1 changed files with 2 additions and 2 deletions

View File

@ -1,7 +1,7 @@
import { randomBytes } from 'node:crypto'; import { randomBytes } from 'node:crypto';
import { Inject, Injectable } from '@nestjs/common'; import { Inject, Injectable } from '@nestjs/common';
import bcrypt from 'bcryptjs'; import bcrypt from 'bcryptjs';
import * as OTPAuth from "otpauth"; import * as OTPAuth from 'otpauth';
import { IsNull } from 'typeorm'; import { IsNull } from 'typeorm';
import { DI } from '@/di-symbols.js'; import { DI } from '@/di-symbols.js';
import type { UserSecurityKeysRepository, SigninsRepository, UserProfilesRepository, AttestationChallengesRepository, UsersRepository } from '@/models/index.js'; import type { UserSecurityKeysRepository, SigninsRepository, UserProfilesRepository, AttestationChallengesRepository, UsersRepository } from '@/models/index.js';
@ -156,7 +156,7 @@ export class SigninApiService {
} }
const delta = OTPAuth.TOTP.validate({ const delta = OTPAuth.TOTP.validate({
secret: OTPAuth.Secret.fromBase32(profile.twoFactorSecret), secret: OTPAuth.Secret.fromBase32(profile.twoFactorSecret!),
digits: 6, digits: 6,
token, token,
window: 1, window: 1,