Class SecretStorageService
- Namespace
- NLightning.Infrastructure.Protocol.Services
- Assembly
- NLightning.Infrastructure.dll
Provides efficient storage of per-commitment secrets
public class SecretStorageService : ISecretStorageService, IDisposable
- Inheritance
-
SecretStorageService
- Implements
- Inherited Members
Methods
DeriveOldSecret(ulong)
Derives an old secret from a known higher-level secret
public Secret DeriveOldSecret(ulong index)
Parameters
index
ulongThe index of the secret
Returns
Exceptions
- InvalidOperationException
Thrown when the secret cannot be derived
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
~SecretStorageService()
protected ~SecretStorageService()
GetBasepointPrivateKey(uint, BasepointType)
Retrieves the private key associated with the specified basepoint type and key index
public PrivKey GetBasepointPrivateKey(uint keyIndex, BasepointType type)
Parameters
keyIndex
uintThe index of the key to retrieve
type
BasepointTypeThe basepoint type for which the private key is required
Returns
- PrivKey
The private key associated with the specified basepoint type and key index
Exceptions
- InvalidOperationException
Thrown when the basepoint private key is not stored
GetPerCommitmentSeed()
Retrieves the per-commitment seed
public Secret GetPerCommitmentSeed()
Returns
- Secret
The per-commitment seed as a Secret
Exceptions
- InvalidOperationException
Thrown when the per-commitment seed is not stored
InsertSecret(Secret, ulong)
Inserts a new secret and verifies it against existing secrets
public bool InsertSecret(Secret secret, ulong index)
Parameters
Returns
- bool
True if the secret was inserted successfully, false otherwise
LoadFromIndex(uint)
Loads secrets from persistent storage using the specified index
public void LoadFromIndex(uint index)
Parameters
index
uintThe index of the secrets to load
StoreBasepointPrivateKey(BasepointType, PrivKey)
Stores the private key for the specified basepoint type securely
public void StoreBasepointPrivateKey(BasepointType type, PrivKey privKey)
Parameters
type
BasepointTypeThe type of basepoint associated with the private key
privKey
PrivKeyThe private key to store securely
StorePerCommitmentSeed(Secret)
Stores the per-commitment seed securely
public void StorePerCommitmentSeed(Secret secret)
Parameters
secret
SecretThe per-commitment secret to store