diff --git a/BTCPayServer/BTCPayServer.csproj b/BTCPayServer/BTCPayServer.csproj index f5b5653cf..ea32206a0 100644 --- a/BTCPayServer/BTCPayServer.csproj +++ b/BTCPayServer/BTCPayServer.csproj @@ -51,6 +51,7 @@ + @@ -74,7 +75,7 @@ - + diff --git a/BTCPayServer/U2F/U2FService.cs b/BTCPayServer/U2F/U2FService.cs index 4b0c90f3f..e64cd70e6 100644 --- a/BTCPayServer/U2F/U2FService.cs +++ b/BTCPayServer/U2F/U2FService.cs @@ -187,24 +187,26 @@ namespace BTCPayServer.Services.U2F var requests = new List(); - var challenge = global::U2F.Core.Crypto.U2F.GenerateChallenge(); var serverChallenges = new List(); foreach (var registeredDevice in devices) { - serverChallenges.Add(new ServerChallenge - { - appId = appId, - challenge = challenge, - keyHandle = registeredDevice.KeyHandle.ByteArrayToBase64String(), - version = global::U2F.Core.Crypto.U2F.U2FVersion, - }); - + var challenge = global::U2F.Core.Crypto.U2F.StartAuthentication(appId, + new DeviceRegistration(registeredDevice.KeyHandle, registeredDevice.PublicKey, + registeredDevice.AttestationCert, (uint)registeredDevice.Counter)); + serverChallenges.Add(new ServerChallenge() + { + challenge = challenge.Challenge, + appId = challenge.AppId, + version = challenge.Version, + keyHandle = challenge.KeyHandle + }); + requests.Add( new U2FDeviceAuthenticationRequest() { AppId = appId, - Challenge = challenge, + Challenge = challenge.Challenge, KeyHandle = registeredDevice.KeyHandle.ByteArrayToBase64String(), Version = global::U2F.Core.Crypto.U2F.U2FVersion });