feat(application): add DocumentOperator.Application PDF signing contracts

This commit is contained in:
2026-10-22 02:26:07 +02:00
parent de5e2d613f
commit 3b4134e873
11 changed files with 430 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
using DocumentOperator.Application.Common.Dto;
using DocumentOperator.Application.Common.Interfaces.Services;
using MediatR;
namespace DocumentOperator.Application.SignPdf;
public sealed record SignPdfCommand : IRequest<byte[]>
{
public required Stream InputPdf { get; init; }
public required PdfSignOptionsDto Options { get; init; }
public Stream? SignatureImage { get; init; }
}
public sealed class SignPdfCommandHandler(IPdfDigitalSignatureService signer) : IRequestHandler<SignPdfCommand, byte[]>
{
public async Task<byte[]> Handle(SignPdfCommand command, CancellationToken cancellationToken)
{
using var output = new MemoryStream();
await signer.SignPdfAsync(command.InputPdf, output, command.Options, command.SignatureImage, cancellationToken);
return output.ToArray();
}
}