Class RedbXmlRepository

Assembly: redb.Identity.DataProtection.dll

ASP.NET DataProtection XML key repository backed by redb PROPS storage.
Each key is stored as a of .

Snapshot pattern (A1): returns an in-memory
snapshot — pure-sync, no I/O on the auth hot path
(called per Protect/Unprotect). The snapshot is seeded by a host-side init
listener (Core's RedbXmlRepositoryInitListener, or any facade-local equivalent)
in OnContextStarting, before any route processes its first exchange.
is a rare write (key-ring rotation): it persists via a
fresh DI scope and updates the snapshot in-process via
.


Lifetime: registered as Singleton so it can be safely consumed by
(resolved from the root container by KeyManager).
Persistence uses per call, so no Scoped
is captured.

public sealed class RedbXmlRepository : IXmlRepository

Inheritance

Object→RedbXmlRepository

Implements

Methods

GetAllElements()

Gets all top-level XML elements in the repository.

public IReadOnlyCollection<XElement> GetAllElements()

ImportFileKeyRingsAsync(IRedbService, IEnumerable<string>, ILogger, CancellationToken)

Copies into redb the elements of file-system key rings that redb does not hold yet. Before

public static Task<int> ImportFileKeyRingsAsync(IRedbService redb, IEnumerable<string> directories, ILogger logger, CancellationToken ct = default)

ReloadAsync(IRedbService, CancellationToken)

Reloads the snapshot from redb: the most recent elements, one per key

public Task<int> ReloadAsync(IRedbService redb, CancellationToken ct = default)

ReplaceSnapshot(ImmutableArray<XElement>)

Replaces the in-memory snapshot wholesale. Called by the host-side init listener

public void ReplaceSnapshot(ImmutableArray<XElement> newSnapshot)

StoreElement(XElement, string)

Adds a top-level XML element to the repository.

public void StoreElement(XElement element, string friendlyName)

Constructors