mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 22:25:28 +01:00
* Editorconfig: Add space_before_self_closing setting This was a difference between the way dotnet-format and Rider format code. See https://www.jetbrains.com/help/rider/EditorConfig_Index.html * Editorconfig: Keep 4 spaces indentation for Swagger JSON files They are all formatted that way, let's keep it like that. * Apply dotnet-format, mostly white-space related changes
46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
using System;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using NBitcoin;
|
|
|
|
namespace BTCPayServer.Models.WalletViewModels
|
|
{
|
|
public class SignWithSeedViewModel
|
|
{
|
|
public SigningContextModel SigningContext { get; set; } = new SigningContextModel();
|
|
|
|
[Required]
|
|
[Display(Name = "BIP39 Seed (12/24 word mnemonic phrase) or HD private key (xprv...)")]
|
|
public string SeedOrKey { get; set; }
|
|
|
|
[Display(Name = "Optional seed passphrase")]
|
|
public string Passphrase { get; set; }
|
|
|
|
public string BackUrl { get; set; }
|
|
public string ReturnUrl { get; set; }
|
|
|
|
public ExtKey GetExtKey(Network network)
|
|
{
|
|
ExtKey extKey = null;
|
|
try
|
|
{
|
|
var mnemonic = new Mnemonic(SeedOrKey);
|
|
extKey = mnemonic.DeriveExtKey(Passphrase);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
}
|
|
|
|
if (extKey == null)
|
|
{
|
|
try
|
|
{
|
|
extKey = ExtKey.Parse(SeedOrKey, network);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
}
|
|
}
|
|
return extKey;
|
|
}
|
|
}
|
|
}
|