mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
Use good rng for generating API keys
This commit is contained in:
@@ -10,6 +10,8 @@ using BTCPayServer.Security;
|
|||||||
using BTCPayServer.Security.APIKeys;
|
using BTCPayServer.Security.APIKeys;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using NBitcoin;
|
||||||
|
using NBitcoin.DataEncoders;
|
||||||
using NSwag.Annotations;
|
using NSwag.Annotations;
|
||||||
|
|
||||||
namespace BTCPayServer.Controllers
|
namespace BTCPayServer.Controllers
|
||||||
@@ -247,7 +249,7 @@ namespace BTCPayServer.Controllers
|
|||||||
{
|
{
|
||||||
var key = new APIKeyData()
|
var key = new APIKeyData()
|
||||||
{
|
{
|
||||||
Id = Guid.NewGuid().ToString().Replace("-", string.Empty, StringComparison.OrdinalIgnoreCase),
|
Id = Encoders.Hex.EncodeData(RandomUtils.GetBytes(20)),
|
||||||
Type = APIKeyType.Permanent,
|
Type = APIKeyType.Permanent,
|
||||||
UserId = _userManager.GetUserId(User),
|
UserId = _userManager.GetUserId(User),
|
||||||
Label = viewModel.Label
|
Label = viewModel.Label
|
||||||
|
|||||||
Reference in New Issue
Block a user