mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 06:24:24 +01:00
Add Wallet settings menu, do not rebase keypaths when create the PSBT
This commit is contained in:
29
BTCPayServer/Validation/KeyPathValidator.cs
Normal file
29
BTCPayServer/Validation/KeyPathValidator.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using NBitcoin;
|
||||
|
||||
namespace BTCPayServer.Validation
|
||||
{
|
||||
public class KeyPathValidator : ValidationAttribute
|
||||
{
|
||||
protected override ValidationResult IsValid(object value, ValidationContext validationContext)
|
||||
{
|
||||
var str = value as string;
|
||||
if (string.IsNullOrWhiteSpace(str))
|
||||
{
|
||||
return ValidationResult.Success;
|
||||
}
|
||||
if (KeyPath.TryParse(str, out _))
|
||||
{
|
||||
return ValidationResult.Success;
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ValidationResult("Invalid keypath");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user