1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-16 23:27:30 -05:00

u2f db updates

This commit is contained in:
Kyle Spearrin
2018-07-21 08:44:21 -04:00
parent f7fb99a726
commit 941792bdd8
6 changed files with 83 additions and 3 deletions

View File

@ -10,6 +10,7 @@ using System.Linq;
using U2fLib = U2F.Core.Crypto.U2F;
using U2F.Core.Models;
using U2F.Core.Exceptions;
using System;
namespace Bit.Core.Identity
{
@ -80,7 +81,8 @@ namespace Bit.Core.Identity
Challenge = auth.Challenge,
KeyHandle = auth.KeyHandle,
Version = auth.Version,
UserId = user.Id
UserId = user.Id,
CreationDate = DateTime.UtcNow
});
challenges.Add(new

View File

@ -281,13 +281,14 @@ namespace Bit.Core.Services
public async Task<U2fRegistration> StartU2fRegistrationAsync(User user)
{
await _u2fRepository.DeleteManyByUserIdAsync(user.Id);
var reg = U2fLib.StartRegistration(Utilities.CoreHelpers.U2fAppIdUrl(_globalSettings));
var reg = U2fLib.StartRegistration(CoreHelpers.U2fAppIdUrl(_globalSettings));
await _u2fRepository.CreateAsync(new U2f
{
AppId = reg.AppId,
Challenge = reg.Challenge,
Version = reg.Version,
UserId = user.Id
UserId = user.Id,
CreationDate = DateTime.UtcNow
});
return new U2fRegistration