mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
Removing LND seed information from walletunlock.json
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BTCPayServer.Models.ServerViewModels
|
||||
@@ -14,6 +16,29 @@ namespace BTCPayServer.Models.ServerViewModels
|
||||
|
||||
public List<string> Seed { get; set; }
|
||||
|
||||
|
||||
public async Task<bool> RemoveSeedAndWrite(string lndSeedFilePath)
|
||||
{
|
||||
var removedDate = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ssZ", CultureInfo.InvariantCulture);
|
||||
var seedFile = new LndSeedFile
|
||||
{
|
||||
wallet_password = WalletPassword,
|
||||
cipher_seed_mnemonic = new List<string> { $"Seed removed on {removedDate}" }
|
||||
};
|
||||
var json = JsonConvert.SerializeObject(seedFile);
|
||||
try
|
||||
{
|
||||
await File.WriteAllTextAsync(lndSeedFilePath, json);
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// file access exception and such
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static LndSeedBackupViewModel Parse(string lndSeedFilePath)
|
||||
{
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user