Class KeyRotationResult
- Namespace
- Excalibur.Compliance
- Assembly
- Excalibur.Compliance.Abstractions.dll
Represents the result of a key rotation operation.
public sealed record KeyRotationResult : IEquatable<KeyRotationResult>
- Inheritance
-
KeyRotationResult
- Implements
- Inherited Members
Remarks
Key rotation creates a new key version while keeping the previous version available for decryption of existing data.
Properties
ErrorMessage
Gets an error message if the rotation failed. Null if successful.
public string? ErrorMessage { get; init; }
Property Value
NewKey
Gets the metadata for the newly created key. Null if rotation failed.
public KeyMetadata? NewKey { get; init; }
Property Value
PreviousKey
Gets the metadata for the previous (now decrypt-only) key. Null if there was no previous key.
public KeyMetadata? PreviousKey { get; init; }
Property Value
RotatedAt
Gets the timestamp when the rotation was performed.
public DateTimeOffset RotatedAt { get; init; }
Property Value
Success
Gets a value indicating whether the rotation was successful.
public required bool Success { get; init; }
Property Value
Methods
Failed(string)
Creates a failed rotation result.
public static KeyRotationResult Failed(string errorMessage)
Parameters
errorMessagestringThe error message describing the failure.
Returns
- KeyRotationResult
A failed rotation result.
Succeeded(KeyMetadata, KeyMetadata?)
Creates a successful rotation result.
public static KeyRotationResult Succeeded(KeyMetadata newKey, KeyMetadata? previousKey = null)
Parameters
newKeyKeyMetadataThe newly created key metadata.
previousKeyKeyMetadataThe previous key metadata (now decrypt-only).
Returns
- KeyRotationResult
A successful rotation result.