Table of Contents

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 ulong

The index of the secret

Returns

Secret

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 uint

The index of the key to retrieve

type BasepointType

The 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

secret Secret

The secret to insert

index ulong

The index of the secret

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 uint

The 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 BasepointType

The type of basepoint associated with the private key

privKey PrivKey

The private key to store securely

StorePerCommitmentSeed(Secret)

Stores the per-commitment seed securely

public void StorePerCommitmentSeed(Secret secret)

Parameters

secret Secret

The per-commitment secret to store