1
0
mirror of https://github.com/bitwarden/server synced 2025-12-15 07:43:54 +00:00

Replace OtpSharp with Otp.NET for net core support

This commit is contained in:
Kyle Spearrin
2017-01-13 21:34:54 -05:00
parent 77e54f7c12
commit 1b30a27990
3 changed files with 6 additions and 8 deletions

View File

@@ -1,10 +1,9 @@
using System;
using System.Threading.Tasks;
using Base32;
using Microsoft.AspNetCore.Identity;
using Bit.Core.Domains;
using Bit.Core.Enums;
using OtpSharp;
using OtpNet;
namespace Bit.Core.Identity
{
@@ -32,7 +31,7 @@ namespace Bit.Core.Identity
public Task<bool> ValidateAsync(string purpose, string token, UserManager<User> manager, User user)
{
var otp = new Totp(Base32Encoder.Decode(user.AuthenticatorKey));
var otp = new Totp(Base32Encoding.ToBytes(user.AuthenticatorKey));
long timeStepMatched;
var valid = otp.VerifyTotp(token, out timeStepMatched, new VerificationWindow(2, 2));