BlazorPRF.Noble.Crypto
0.3.0-pre
Prefix Reserved
dotnet add package BlazorPRF.Noble.Crypto --version 0.3.0-pre
NuGet\Install-Package BlazorPRF.Noble.Crypto -Version 0.3.0-pre
<PackageReference Include="BlazorPRF.Noble.Crypto" Version="0.3.0-pre" />
<PackageVersion Include="BlazorPRF.Noble.Crypto" Version="0.3.0-pre" />
<PackageReference Include="BlazorPRF.Noble.Crypto" />
paket add BlazorPRF.Noble.Crypto --version 0.3.0-pre
#r "nuget: BlazorPRF.Noble.Crypto, 0.3.0-pre"
#:package BlazorPRF.Noble.Crypto@0.3.0-pre
#addin nuget:?package=BlazorPRF.Noble.Crypto&version=0.3.0-pre&prerelease
#tool nuget:?package=BlazorPRF.Noble.Crypto&version=0.3.0-pre&prerelease
BlazorPRF
PRF-based deterministic encryption for Blazor WebAssembly using the WebAuthn PRF extension.
Security Disclaimer
This is an experimental project and has NOT been audited for security vulnerabilities.
While BlazorPRF uses established, well-reviewed cryptographic libraries (Noble.js and BouncyCastle for WASM, browser-native SubtleCrypto), the integration and implementation have not undergone professional security review.
Do NOT use this in production systems handling sensitive data without a thorough security audit.
The cryptographic primitives used (X25519, ChaCha20-Poly1305, AES-GCM, Ed25519, HKDF) are industry-standard, but correct implementation is critical for security.
Overview
BlazorPRF enables client-side encryption in Blazor WebAssembly applications using biometric authentication. Keys are derived deterministically from the WebAuthn PRF (Pseudo-Random Function) extension output, meaning the same passkey always produces the same encryption keys.
Key Features
- Biometric Key Derivation: Use your fingerprint, Face ID, or security key to derive encryption keys
- Deterministic Keys: Same passkey + salt = same keys across all synced devices
- Client-Side Encryption: All cryptography happens in the browser - keys never leave the client
- Symmetric Encryption: Encrypt data for yourself using ChaCha20-Poly1305 or AES-GCM
- Asymmetric Encryption: Share your public key; others can encrypt messages only you can decrypt (ECIES with X25519)
- Digital Signatures: Sign and verify messages with Ed25519 for authentication and integrity
- Identity Verification: Establish trust through dual-signed invites (like PGP "full trust")
- Secure Key Storage: Keys cached in JS, cryptographically zeroed on disposal
Packages
Crypto Providers (choose one)
| Package | Crypto Library | Description |
|---|---|---|
| BlazorPRF.Noble.Crypto | Noble.js + SubtleCrypto | X25519, Ed25519, ChaCha20-Poly1305, AES-GCM. Keys cached in JS. |
| BlazorPRF.BC.Crypto | BouncyCastle | Full BouncyCastle crypto stack for WASM. |
UI Components (matches your crypto provider)
| Package | Description |
|---|---|
| BlazorPRF.Noble.UI | MudBlazor UI components + services for Noble.Crypto |
| BlazorPRF.BC.UI | MudBlazor UI components + services for BC.Crypto |
Standalone Libraries
| Package | Description |
|---|---|
| BlazorPRF.Wasm.Crypto | Simple WebAuthn PRF library. Keys never leave JS - salt-based lookup with AES-GCM and Ed25519. |
| BlazorPRF.Server.Crypto | Server-side crypto using BouncyCastle for .NET backends. |
Choosing a Crypto Provider
Noble.Crypto (recommended):
└─ Uses Noble.js - audited, lightweight JavaScript crypto
└─ Hardware-accelerated AES-GCM via SubtleCrypto
BC.Crypto (alternative):
└─ Uses BouncyCastle - full-featured .NET crypto library
└─ All crypto runs in WASM (no JS interop for crypto ops)
Simple use case (just encrypt/sign):
└─ Use BlazorPRF.Wasm.Crypto (standalone, minimal dependencies)
Quick Start
1. Install the packages
# Noble flavor (recommended)
dotnet add package BlazorPRF.Noble.UI
dotnet add package BlazorPRF.Noble.Crypto
# OR BC flavor
dotnet add package BlazorPRF.BC.UI
dotnet add package BlazorPRF.BC.Crypto
2. Configure services
// Program.cs
builder.Services.AddBlazorPrfUI(builder.Configuration);
// Add crypto provider (matches your UI package)
builder.Services.AddNobleCrypto(); // For Noble flavor
// builder.Services.AddBcCrypto(); // For BC flavor
3. Add configuration
// appsettings.json
{
"BlazorPRF": {
"RpName": "Your App Name",
"TimeoutMs": 60000,
"AuthenticatorAttachment": "Platform",
"KeyCache": {
"Strategy": "Timed",
"TtlMinutes": 15
}
}
}
Key Caching Strategies
| Strategy | Description |
|---|---|
None |
Keys derived fresh for each operation (most secure) |
Session |
Keys cached until page refresh |
Timed |
Keys cached with configurable TTL (recommended) |
Cryptographic Primitives
- Key Derivation: HKDF-SHA256 from WebAuthn PRF output
- Symmetric Encryption: ChaCha20-Poly1305 or AES-256-GCM (AEAD)
- Asymmetric Encryption: X25519 ECDH + symmetric cipher (ECIES)
- Digital Signatures: Ed25519 (sign/verify)
- Key Storage: Keys cached in JS as non-extractable CryptoKey objects with cryptographic zeroing
Dual Key Derivation
BlazorPRF derives two independent key pairs from a single PRF seed:
PRF Seed (32 bytes)
│
├─── HKDF(context: "x25519-encryption") ──→ X25519 Key Pair (encryption)
│
└─── HKDF(context: "ed25519-signing") ──→ Ed25519 Key Pair (signatures)
This enables:
- X25519: Asymmetric encryption (ECIES) - share public key, receive encrypted messages
- Ed25519: Digital signatures - sign messages to prove identity/integrity
Identity Verification (Signed Invites)
BlazorPRF implements a dual-signature invite flow for secure identity verification:
USER A (Inviter) USER B (Invitee)
│ │
│ 1. Create invite for email │
│ 2. Sign invite with Ed25519 │
│ 3. Send signed invite ─────────────┼───→ 4. Verify A's signature
│ │ 5. Sign acceptance with B's keys
│ 7. Verify A's original sig ←────┼─── 6. Send signed response
│ 8. Verify B's signature │
│ │
▼ ▼
✅ Both signatures valid = Trusted identity
Security guarantees:
- A's signature proves the invite is authentic (not forged)
- B's signature proves key ownership (B controls the private keys)
- Combined verification prevents invite tampering and key substitution
Browser Support
Requires browsers supporting the WebAuthn PRF extension:
- Chrome 109+ / Edge 109+ (with platform authenticator)
- Safari 16.4+ (with iCloud Keychain)
- Firefox: Not yet supported
Note: PRF support depends on both the browser AND the authenticator (passkey provider). Platform authenticators (Windows Hello, Touch ID, Face ID) generally have good support.
Architecture
┌─────────────────────────────────────────────────────────────────┐
│ BlazorPRF.*.UI │
│ (WebAuthn PRF, Key Derivation, Services, MudBlazor Components) │
└─────────────────────────────────────────────────────────────────┘
│
┌─────────────────────────────────────────────────────────────────┐
│ BlazorPRF.Shared.Crypto │
│ (ICryptoProvider, Models, Abstractions) │
└─────────────────────────────────────────────────────────────────┘
│
┌─────────────────┴─────────────────┐
│ │
┌───────────────────────┐ ┌───────────────────────┐
│ BlazorPRF.Noble.Crypto│ │ BlazorPRF.BC.Crypto │
│ │ │ │
│ - Noble.js │ │ - BouncyCastle │
│ - SubtleCrypto │ │ - Pure .NET crypto │
│ - Keys stay in JS │ │ - Keys stay in JS │
└───────────────────────┘ └───────────────────────┘
Sample Application
See BlazorPRF.Sample for a complete example application demonstrating:
- Passkey registration
- Symmetric encryption/decryption
- Asymmetric encryption with public key sharing
- Digital signatures (sign and verify)
- Identity verification via signed invites
- Session management with different caching strategies
License
MIT License - see LICENSE for details.
Contributing
Contributions are welcome! Please note that any security-related changes should be carefully reviewed.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.1)
- Microsoft.Extensions.Options (>= 10.0.1)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.1)
- R3 (>= 1.3.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on BlazorPRF.Noble.Crypto:
| Package | Downloads |
|---|---|
|
BlazorPRF.Noble.UI
MudBlazor UI components for PRF-based deterministic encryption |
|
|
BlazorPRF.Persistence
Ready-to-use persistence layer for BlazorPRF applications. Provides trusted contacts, invitations, and settings storage using EF Core with SQLite. |
|
|
BlazorPRF.UI
MudBlazor UI components for PRF-based deterministic encryption |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 0.3.0-pre | 87 | 12/20/2025 | |
| 0.2.13-pre | 145 | 12/19/2025 | |
| 0.2.12-pre | 147 | 12/19/2025 | |
| 0.2.11-pre | 160 | 12/19/2025 | |
| 0.2.10-pre | 224 | 12/17/2025 | |
| 0.2.9-pre | 413 | 12/17/2025 | |
| 0.2.7-pre | 414 | 12/17/2025 | |
| 0.2.6-pre | 418 | 12/17/2025 | |
| 0.2.5-pre | 229 | 12/16/2025 | |
| 0.2.4-pre | 223 | 12/15/2025 | |
| 0.2.3-pre | 209 | 12/15/2025 |