Interface IErasureCertificateStore
- Namespace
- Excalibur.Compliance
- Assembly
- Excalibur.Compliance.Abstractions.dll
Certificate management operations for erasure compliance.
public interface IErasureCertificateStore
Remarks
This sub-interface of IErasureStore isolates certificate persistence concerns per the Interface Segregation Principle (ISP).
Consumers that only need certificate operations can depend on this
interface directly. Implementations that also implement IErasureStore
expose this interface via GetService(typeof(IErasureCertificateStore)).
Methods
CleanupExpiredCertificatesAsync(CancellationToken)
Deletes expired certificates past their retention period.
Task<int> CleanupExpiredCertificatesAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenCancellation token.
Returns
GetCertificateAsync(Guid, CancellationToken)
Gets a certificate by request ID.
Task<ErasureCertificate?> GetCertificateAsync(Guid requestId, CancellationToken cancellationToken)
Parameters
requestIdGuidThe request ID.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<ErasureCertificate>
The certificate, or null if not found.
GetCertificateByIdAsync(Guid, CancellationToken)
Gets a certificate by certificate ID.
Task<ErasureCertificate?> GetCertificateByIdAsync(Guid certificateId, CancellationToken cancellationToken)
Parameters
certificateIdGuidThe certificate ID.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<ErasureCertificate>
The certificate, or null if not found.
SaveCertificateAsync(ErasureCertificate, CancellationToken)
Saves an erasure certificate.
Task SaveCertificateAsync(ErasureCertificate certificate, CancellationToken cancellationToken)
Parameters
certificateErasureCertificateThe certificate to save.
cancellationTokenCancellationTokenCancellation token.
Returns
Remarks
Implementations raise these exceptions rather than the underlying database provider's own duplicate-key exception, so a caller can handle the condition without referencing that provider. A caller must catch DuplicateErasureCertificateException specifically rather than InvalidOperationException: the base type is also raised for conditions that mean the certificate was never persisted, and reading one of those as "already issued" would report an attestation that does not exist.
Exceptions
- DuplicateErasureCertificateException
A certificate with the same CertificateId already exists — this exception is raised for that condition and for no other. This operation inserts; it does not overwrite. A certificate is the erasure attestation itself, so replacing one in place would rewrite evidence that has already been issued and may already have been shown to a data subject or an auditor.
- ErasureStoreNotProvisionedException
The store's backing schema is absent, or is present but missing columns its statements bind. A deployment fault rather than an outcome of this call: the certificate was not stored.