Class SecureKeyManager
- Namespace
- NLightning.Application.NLTG.Managers
- Assembly
- NLightning.Application.NLTG.dll
Manages a securely stored private key using protected memory allocation. This class ensures that the private key remains inaccessible from regular memory and is securely wiped when no longer needed.
public class SecureKeyManager : ISecureKeyManager, IDisposable
- Inheritance
-
SecureKeyManager
- Implements
- Inherited Members
Constructors
SecureKeyManager(byte[], Network, string)
Manages secure key operations for generating and managing cryptographic keys. Provides functionality to safely store, load, and derive secure keys protected in memory.
public SecureKeyManager(byte[] privateKey, Network network, string filePath)
Parameters
privateKey
byte[]The private key to be managed.
network
NetworkThe network associated with the private key.
filePath
stringThe file path for storing the key data.
Fields
PATH
public const string PATH = "m/6425'/0'/0'/0/{0}"
Field Value
Properties
OutputDescriptor
public string OutputDescriptor { get; init; }
Property Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
~SecureKeyManager()
protected ~SecureKeyManager()
FromFilePath(string, Network, string)
public static SecureKeyManager FromFilePath(string filePath, Network expectedNetwork, string password)
Parameters
Returns
FromMnemonic(string, string, Network, string?)
public static SecureKeyManager FromMnemonic(string mnemonic, string passphrase, Network network, string? filePath = null)
Parameters
Returns
GetKeyFilePath(string)
Gets the path for the Key file
public static string GetKeyFilePath(string network)
Parameters
network
string
Returns
GetNextKey(out uint)
public ExtKey GetNextKey(out uint index)
Parameters
index
uint
Returns
- ExtKey
GetNodeKey()
public Key GetNodeKey()
Returns
- Key
GetNodePubKey()
public PubKey GetNodePubKey()
Returns
- PubKey
SaveToFile(string)
public void SaveToFile(string password)
Parameters
password
string
UpdateLastUsedIndexOnFile()
public Task UpdateLastUsedIndexOnFile()