Class PIIManager

Namespace
Cratis.Chronicle.Compliance.GDPR
Assembly
Cratis.Chronicle.dll

Represents an implementation of IPIIManager that proxies to the Chronicle kernel over the client connection.

public class PIIManager : IPIIManager
Inheritance
PIIManager
Implements
Inherited Members
Extension Methods

Constructors

PIIManager(EventStoreName, EventStoreNamespaceName, IChronicleConnection)

Represents an implementation of IPIIManager that proxies to the Chronicle kernel over the client connection.

public PIIManager(EventStoreName eventStore, EventStoreNamespaceName @namespace, IChronicleConnection connection)

Parameters

eventStore EventStoreName

The EventStoreName the manager operates within.

namespace EventStoreNamespaceName

The EventStoreNamespaceName the manager operates within.

connection IChronicleConnection

The IChronicleConnection for talking to the kernel.

Methods

AllowNewEncryptionKeyFor(EncryptionKeyIdentifier)

Authorize a new encryption key for a subject that was erased, so a later lawful lifecycle can protect their data again.

public Task AllowNewEncryptionKeyFor(EncryptionKeyIdentifier identifier)

Parameters

identifier EncryptionKeyIdentifier

EncryptionKeyIdentifier to authorize a new key for.

Returns

Task

Awaitable task.

Remarks

Erasing a subject removes the key that exists now; it does not ban the identifier forever. This creates no key - it lets the next PII value written for the subject provision a fresh, independent one, which can decrypt nothing written before the erasure. The erased key itself never comes back, whatever else happens.

The default implementation exists so that adding this member did not break implementations written before it - realistically test doubles, which never call it and keep compiling. It throws rather than doing nothing, because an authorization that silently did not happen reads as a subject who can be protected again right up until the append that proves they cannot.

Exceptions

AllowNewEncryptionKeyNotSupported

Thrown by an implementation that does not override this member.

DeleteEncryptionKeyFor(EncryptionKeyIdentifier)

Erase the encryption key for a subject, making every PII value protected under it permanently unreadable.

public Task DeleteEncryptionKeyFor(EncryptionKeyIdentifier identifier)

Parameters

identifier EncryptionKeyIdentifier

EncryptionKeyIdentifier to erase.

Returns

Task

Awaitable task.

Remarks

The erasure covers every event store in this manager's namespace, not only the event store it was resolved from. Chronicle copies a subject's key into any event store it forwards their events into, so that set is exactly where the key can have reached; erasing less than all of it leaves a copy that is put back the next time an event is forwarded. It also records the erasure, so nothing provisions or copies a key for the subject afterwards - appending a PII value for them fails rather than silently minting a new key, until AllowNewEncryptionKeyFor(EncryptionKeyIdentifier) authorizes one.