mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 06:21:44 +01:00
Use good rng for generating API keys
This commit is contained in:
parent
691a8d6fd8
commit
153992a458
1 changed files with 3 additions and 1 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Reference in a new issue