Glihm.JSInterop.Browser.WebCryptoAPI 1.0.2

dotnet add package Glihm.JSInterop.Browser.WebCryptoAPI --version 1.0.2
                    
NuGet\Install-Package Glihm.JSInterop.Browser.WebCryptoAPI -Version 1.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Glihm.JSInterop.Browser.WebCryptoAPI" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Glihm.JSInterop.Browser.WebCryptoAPI" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Glihm.JSInterop.Browser.WebCryptoAPI" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Glihm.JSInterop.Browser.WebCryptoAPI --version 1.0.2
                    
#r "nuget: Glihm.JSInterop.Browser.WebCryptoAPI, 1.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Glihm.JSInterop.Browser.WebCryptoAPI@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Glihm.JSInterop.Browser.WebCryptoAPI&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Glihm.JSInterop.Browser.WebCryptoAPI&version=1.0.2
                    
Install as a Cake Tool

Glihm.JSInterop.Browser.WebCryptoAPI

A convenient way to use browser cryptography from C#.

Designed for Blazor, simple to use

This library was design to work with Blazor in a very easy way and few configuration. The two main namespaces of the library are:

  • interfaces: low-level C# classes close to the Web Cryptography API interfaces.
  • cryptography: high-level C# classes that are use to abstract the implementation details of the Web Cryptography API.

Caution: at the moment, this library was only tested with Blazor WASM)

With cryptography namespace, you can encrypt data with AES like this:

  1. Inject the AES factory into the app.
// Program.cs

using JSInterop.Browser.WebCryptoAPI.Cryptography.AES;

...

builder.Services.AddWebCryptoAes();
  1. Request the service into any blazor component requiring AES.
// BlazorComponent.razor

@using JSInterop.Browser.WebCryptoAPI.Cryptography.AES
@inject AesFactory _aesFactory

...

private async ValueTask<byte[]?>
EncryptData(byte[] key, byte[] plaintext, byte[] iv)
{
    await using AesGcm? aesGcm = await this._aesFactory.Create<AesGcm>(key);
    if (aesGcm is not null)
    {
        return await aesGcm.Encrypt(plaintext, iv);
    }
}
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  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.  net9.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Glihm.JSInterop.Browser.WebCryptoAPI:

Package Downloads
Broca.ActivityPub.Client.WebCrypto

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 1,419 3/5/2023