Naravel.Queue.Encryption 0.2.0

dotnet add package Naravel.Queue.Encryption --version 0.2.0
                    
NuGet\Install-Package Naravel.Queue.Encryption -Version 0.2.0
                    
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="Naravel.Queue.Encryption" Version="0.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Naravel.Queue.Encryption" Version="0.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Naravel.Queue.Encryption" />
                    
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 Naravel.Queue.Encryption --version 0.2.0
                    
#r "nuget: Naravel.Queue.Encryption, 0.2.0"
                    
#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 Naravel.Queue.Encryption@0.2.0
                    
#: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=Naravel.Queue.Encryption&version=0.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Naravel.Queue.Encryption&version=0.2.0
                    
Install as a Cake Tool

Naravel.Queue.Encryption

NuGet Downloads .NET 10 License: MIT

Optional Naravel.Queue adapter that encrypts the payload of jobs marked IShouldBeEncrypted with ASP.NET Core Data Protection. Unmarked jobs keep the existing wire format.

Fact Detail
Install dotnet add package Naravel.Queue.Encryption
Targets .NET 10
Needs Naravel.Encryption and Naravel.Queue, which NuGet installs with it, and a queue driver package of your own
Marker IShouldBeEncrypted, an empty interface on the job class

What you get

  • Opt in per job. Only classes that implement IShouldBeEncrypted are stored encrypted; every other job keeps the existing wire format.
  • ASP.NET Core Data Protection does the work. Naravel adds no cryptography of its own.
  • Never plaintext where it is registered. A marked job is neither sent nor run as plaintext by an application that registered the package.
  • Undecryptable jobs fail normally. They take the usual retry and failed-job path, and the error says to check the shared key ring and application name first.

Quick start

using Naravel.Queue.Encryption;
using Naravel.Queue.Extensions;
using Naravel.Queue.Jobs;
using Naravel.Queue.Memory;

// AddMemoryDriver comes from Naravel.Queue.Memory, which this package does not install: use the driver package you already have
// AddQueue goes first: the encryption wraps the job serializer that it registers
builder.Services.AddQueue(builder.Configuration).AddMemoryDriver(builder.Configuration);
builder.Services.AddDataProtection()                                                      // the same key ring and application name in every producer and worker
    .SetApplicationName("my-shop")
    .PersistKeysToFileSystem(new DirectoryInfo("/shared/keys"));
builder.Services.AddNaravelQueueEncryption();

public sealed class ChargeCard : Job, IShouldBeEncrypted
{
    public string CardNumber { get; set; } = "";

    public override Task HandleAsync(JobContext context, CancellationToken cancellationToken) =>
        Task.CompletedTask;                                                               // your work goes here
}

Call AddNaravelQueueEncryption in every application that dispatches marked jobs and in every worker: a dispatching application without it sends a marked job as plaintext, and a worker without it cannot decrypt one. If a producer and its worker do not share the key ring and the application name, the worker cannot decrypt and every marked job fails with DecryptException. A job that was queued as plaintext before its class was marked is refused unless you set AddNaravelQueueEncryption(o => o.AcceptPlaintextForMarkedJobs = true) for a deploy window. AddNaravelQueueEncryption throws if AddQueue has not been called before it.

Package Adds
Naravel.Encryption The Encrypt and Decrypt facade over Data Protection
Naravel.Queue Jobs, retries and the background worker whose payloads this package encrypts

Learn more

Part of Naravel: Laravel's names, .NET's type system. All Naravel packages share one version.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.0 91 11/13/2026
0.1.1 99 11/2/2026
0.1.0 104 11/1/2026