BlazorSodium 1.2.0
See the version list below for details.
dotnet add package BlazorSodium --version 1.2.0
NuGet\Install-Package BlazorSodium -Version 1.2.0
<PackageReference Include="BlazorSodium" Version="1.2.0" />
paket add BlazorSodium --version 1.2.0
#r "nuget: BlazorSodium, 1.2.0"
// Install BlazorSodium as a Cake Addin #addin nuget:?package=BlazorSodium&version=1.2.0 // Install BlazorSodium as a Cake Tool #tool nuget:?package=BlazorSodium&version=1.2.0
BlazorSodium
BlazorSodium is a simple wrapper over libsodium.js to use in Blazor WASM projects.
This is not compatible with Blazor Server.
Setup
Add to your Program.cs:
builder.Services.AddBlazorSodium();
Initialize the BlazorSodiumService
from any component.
You only need to do this once for the lifecycle of your application.
For example:
public partial class BlazorSodiumComponent : ComponentBase
{
[Inject]
IBlazorSodiumService BlazorSodiumService { get; set; }
protected override async Task OnInitializedAsync()
{
await BlazorSodiumService.InitializeAsync();
}
}
That is the entirety of the setup. Now use the static wrapper methods from anywhere in your application.
Data types
byte[]
as a return value
When a Sodium methods returns byte[]
data, you often need to use Array.CopyTo(Array array, int index)
to copy the data to an initialized array if you intend to use the data outside of the current scope.
Otherwise the byte[]
may be garbage collected and your variable will be null
.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net7.0
- Microsoft.AspNetCore.Components.Web (>= 7.0.4)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on BlazorSodium:
Package | Downloads |
---|---|
AlgorandBlazor_Experimental
Algorand SDK for Blazor (Experimental) |
GitHub repositories
This package is not used by any popular GitHub repositories.