NLightning.Infrastructure
1.0.3
dotnet add package NLightning.Infrastructure --version 1.0.3
NuGet\Install-Package NLightning.Infrastructure -Version 1.0.3
<PackageReference Include="NLightning.Infrastructure" Version="1.0.3" />
<PackageVersion Include="NLightning.Infrastructure" Version="1.0.3" />
<PackageReference Include="NLightning.Infrastructure" />
paket add NLightning.Infrastructure --version 1.0.3
#r "nuget: NLightning.Infrastructure, 1.0.3"
#:package NLightning.Infrastructure@1.0.3
#addin nuget:?package=NLightning.Infrastructure&version=1.0.3
#tool nuget:?package=NLightning.Infrastructure&version=1.0.3
NLightning.Infrastructure
NLightning.Infrastructure is a core component of the NLightning ecosystem, providing essential infrastructure services for Lightning Network implementations in .NET. This library serves as a bridge between the application and domain layers and external dependencies.
Features
- Cross-platform cryptographic operations with support for:
- Native environments (AOT/Native) using BouncyCastle and Argon2
- Server/desktop environments using
libsodium - Blazor WebAssembly using JavaScript interop and
libsodium.js
- Bitcoin and Lightning Network integration via NBitcoin
- DNS resolution capabilities
- Comprehensive logging support
Available Packages
We've decided to have 2 packages, one for desktop/server development, and one for Blazor WebAssembly development.
The reason behind this is that for a Blazor app running fully on the browser we don't have access to native libsodium.
Installation
Install the package from NuGet:
# For the "standard" version of the package run
dotnet add package NLightning.Infrastructure
# For the Blazor WebAssembly version run
dotnet add package NLightning.Infrastructure.Blazor
Configuration
NLightning.Infrastructure automatically adapts to your build environment:
- For AOT/Native builds, it uses BouncyCastle and Argon2
- For standard .NET applications, it uses libsodium
- For Blazor WebAssembly, it provides JavaScript interoperability
Blazor WebAssembly Setup
When using in a Blazor WebAssembly project, you need to initialize the crypto provider:
using NLightning.Infrastructure.Crypto.Providers.JS;
// Initialize before starting the app
await BlazorCryptoProvider.InitializeBlazorCryptoProviderAsync();
await builder.Build().RunAsync();
Usage
NLightning.Infrastructure is primarily used by other NLightning components, but you can also use it directly for:
// Crypto operations, networking, and other infrastructure services
// Detailed documentation coming soon
Dependencies
- NBitcoin and NBitcoin.Secp256k1 for Bitcoin operations
- Cryptographic libraries (BouncyCastle, Argon2, or libsodium depending on environment)
- DnsClient for DNS resolution
- Microsoft.Extensions.Logging for logging infrastructure
Related Projects
- NLightning.Application
- NLightning.Common
- NLightning.Domain
- NLightning.Bolt11
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- DnsClient (>= 1.8.0)
- libsodium (>= 1.0.20.1)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.5)
- Microsoft.Extensions.Options (>= 9.0.5)
- NLightning.Domain (>= 1.1.2)
-
net9.0
- DnsClient (>= 1.8.0)
- libsodium (>= 1.0.20.1)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.5)
- Microsoft.Extensions.Options (>= 9.0.5)
- NLightning.Domain (>= 1.1.2)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on NLightning.Infrastructure:
| Package | Downloads |
|---|---|
|
NLightning.Bolt11
A Bitcoin Lightning Invoice Decoder/Encoder implemented in C# |
|
|
NLightning.Infrastructure.Bitcoin
Bitcoin Infrastructure Library for NLightning |
GitHub repositories
This package is not used by any popular GitHub repositories.
Fixed an error on `SodiumJsCryptoProvider` where Blazor apps whould be unable to call `Sha256.GetHashAndReset`.