using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.IdentityModel.Tokens;
namespace StellaOps.Cryptography;
///
/// Represents an asymmetric signer capable of producing and verifying detached signatures.
///
public interface ICryptoSigner
{
///
/// Gets the key identifier associated with this signer.
///
string KeyId { get; }
///
/// Gets the signing algorithm identifier (e.g., ES256).
///
string AlgorithmId { get; }
///
/// Signs the supplied payload bytes.
///
/// Payload to sign.
/// Cancellation token.
/// Signature bytes.
ValueTask SignAsync(ReadOnlyMemory data, CancellationToken cancellationToken = default);
///
/// Verifies a previously produced signature over the supplied payload bytes.
///
/// Payload that was signed.
/// Signature to verify.
/// Cancellation token.
/// true when the signature is valid; otherwise false.
ValueTask VerifyAsync(ReadOnlyMemory data, ReadOnlyMemory signature, CancellationToken cancellationToken = default);
///
/// Exports the public representation of the key material as a JSON Web Key (JWK).
///
/// Public JWK for distribution (no private components).
JsonWebKey ExportPublicJsonWebKey();
}