Class RecoveryToken
- Namespace
- Excalibur.Compliance
- Assembly
- Excalibur.Compliance.Abstractions.dll
Represents a recovery token for key escrow recovery using Shamir's Secret Sharing.
public sealed record RecoveryToken : IEquatable<RecoveryToken>
- Inheritance
-
RecoveryToken
- Implements
- Inherited Members
Remarks
Recovery tokens are generated using Shamir's Secret Sharing scheme, which allows a secret to be divided into multiple shares. A threshold number of shares (e.g., 3 of 5) must be combined to reconstruct the original secret.
Each token represents one share and should be distributed to a different custodian. The ShareIndex identifies which share this token represents.
Properties
CreatedAt
Gets the timestamp when this token was created.
public required DateTimeOffset CreatedAt { get; init; }
Property Value
CustodianId
Gets the optional custodian identifier this token is assigned to.
public string? CustodianId { get; init; }
Property Value
EscrowId
Gets the escrow identifier this token belongs to.
public required string EscrowId { get; init; }
Property Value
ExpiresAt
Gets the timestamp when this token expires.
public required DateTimeOffset ExpiresAt { get; init; }
Property Value
IsExpired
Gets a value indicating whether this token has expired.
public bool IsExpired { get; }
Property Value
KeyId
Gets the key identifier this token can recover.
public required string KeyId { get; init; }
Property Value
ShareData
Gets the share data (the actual share value from Shamir's algorithm).
public required byte[] ShareData { get; init; }
Property Value
- byte[]
ShareIndex
Gets the share index in the Shamir's Secret Sharing scheme (1-based).
public required int ShareIndex { get; init; }
Property Value
Threshold
Gets the threshold number of shares required for recovery.
public required int Threshold { get; init; }
Property Value
TokenId
Gets the unique identifier of this token.
public required string TokenId { get; init; }
Property Value
TotalShares
Gets the total number of shares generated.
public required int TotalShares { get; init; }
Property Value
Methods
Combine(IEnumerable<RecoveryToken>)
Combines multiple recovery tokens to reconstruct a complete recovery credential.
public static RecoveryToken Combine(IEnumerable<RecoveryToken> tokens)
Parameters
tokensIEnumerable<RecoveryToken>The tokens to combine (must meet threshold).
Returns
- RecoveryToken
A combined token that can be used for recovery.
Exceptions
- ArgumentException
Thrown when tokens are from different escrows or threshold is not met.