Fix build and code structure improvements. New but essential UI functionality. CI improvements. Documentation improvements. AI module improvements.
This commit is contained in:
@@ -13,8 +13,17 @@ public sealed class OfflineVerificationCryptoProvider : ICryptoProvider
|
||||
{
|
||||
private readonly ConcurrentDictionary<string, CryptoSigningKey> signingKeys = new(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the provider name.
|
||||
/// </summary>
|
||||
public string Name => "offline.verification";
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether this provider supports the specified capability and algorithm.
|
||||
/// </summary>
|
||||
/// <param name="capability">The cryptographic capability to check.</param>
|
||||
/// <param name="algorithmId">The algorithm identifier.</param>
|
||||
/// <returns>True if the capability and algorithm are supported; otherwise, false.</returns>
|
||||
public bool Supports(CryptoCapability capability, string algorithmId)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(algorithmId))
|
||||
@@ -33,6 +42,11 @@ public sealed class OfflineVerificationCryptoProvider : ICryptoProvider
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a password hasher for the specified algorithm.
|
||||
/// </summary>
|
||||
/// <param name="algorithmId">The password hashing algorithm identifier.</param>
|
||||
/// <returns>An instance of <see cref="IPasswordHasher"/>.</returns>
|
||||
public IPasswordHasher GetPasswordHasher(string algorithmId)
|
||||
{
|
||||
var normalizedAlg = algorithmId.ToUpperInvariant();
|
||||
@@ -45,6 +59,11 @@ public sealed class OfflineVerificationCryptoProvider : ICryptoProvider
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a content hasher for the specified algorithm.
|
||||
/// </summary>
|
||||
/// <param name="algorithmId">The hash algorithm identifier.</param>
|
||||
/// <returns>An instance of <see cref="ICryptoHasher"/>.</returns>
|
||||
public ICryptoHasher GetHasher(string algorithmId)
|
||||
{
|
||||
var normalizedAlg = algorithmId.ToUpperInvariant();
|
||||
@@ -57,6 +76,12 @@ public sealed class OfflineVerificationCryptoProvider : ICryptoProvider
|
||||
return new DefaultCryptoHasher(normalizedAlg);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a signer for the specified algorithm and key.
|
||||
/// </summary>
|
||||
/// <param name="algorithmId">The signing algorithm identifier.</param>
|
||||
/// <param name="keyReference">The key reference.</param>
|
||||
/// <returns>An instance of <see cref="ICryptoSigner"/>.</returns>
|
||||
public ICryptoSigner GetSigner(string algorithmId, CryptoKeyReference keyReference)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(keyReference);
|
||||
@@ -82,6 +107,10 @@ public sealed class OfflineVerificationCryptoProvider : ICryptoProvider
|
||||
return EcdsaSigner.Create(signingKey);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Upserts a signing key into the provider.
|
||||
/// </summary>
|
||||
/// <param name="signingKey">The signing key to add or update.</param>
|
||||
public void UpsertSigningKey(CryptoSigningKey signingKey)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(signingKey);
|
||||
@@ -96,6 +125,11 @@ public sealed class OfflineVerificationCryptoProvider : ICryptoProvider
|
||||
signingKeys.AddOrUpdate(signingKey.Reference.KeyId, signingKey, (_, _) => signingKey);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a signing key from the provider.
|
||||
/// </summary>
|
||||
/// <param name="keyId">The key identifier to remove.</param>
|
||||
/// <returns>True if the key was removed; otherwise, false.</returns>
|
||||
public bool RemoveSigningKey(string keyId)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(keyId))
|
||||
@@ -106,6 +140,10 @@ public sealed class OfflineVerificationCryptoProvider : ICryptoProvider
|
||||
return signingKeys.TryRemove(keyId, out _);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all signing keys stored in the provider.
|
||||
/// </summary>
|
||||
/// <returns>A read-only collection of signing keys.</returns>
|
||||
public IReadOnlyCollection<CryptoSigningKey> GetSigningKeys()
|
||||
=> signingKeys.Values.ToArray();
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="8.3.2" />
|
||||
<PackageReference Include="Microsoft.IdentityModel.Tokens" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user