Refactor and rename to DocumentService

Renamed namespaces and projects from DocumentOperator to DocumentService, updating all references accordingly. Refactored PdfSignatureAppearanceDto and related enums to use properties with init accessors for improved clarity. Removed and re-added IPkcs11SelfTestStatusProvider with updated namespace. Simplified dependency injection by removing DocumentOperatorApplication registration. Updated appsettings.json with a specific AssetsRootPath. Incremented version numbers in project files for a new release. Introduced PdfSignatureClient and IPdfSignatureClient for PDF digital-signing operations. Updated project files to use newer Microsoft.Extensions package versions. Removed all DocumentOperator references, completing the transition to DocumentService. Added new DTOs and enums for PDF signature options and appearance.
This commit is contained in:
2026-10-25 18:49:08 +01:00
parent 5e007547b2
commit 5e7652ef88
34 changed files with 463 additions and 188 deletions

View File

@@ -0,0 +1,190 @@
namespace DocumentService.Client.Models.Requests;
/// <summary>
/// Request DTO for the PDF digital-signing endpoint (JSON payload).
/// </summary>
public sealed record SignPdfRequest
{
/// <summary>
/// Base64-encoded PDF to sign.
/// </summary>
public required string Base64Pdf { get; init; }
/// <summary>
/// Optional Base64-encoded signature image (PNG/JPEG).
/// </summary>
public string? Base64SignatureImage { get; init; }
/// <summary>
/// Signing options (metadata + appearance).
/// </summary>
public required SignPdfOptions Options { get; init; }
}
/// <summary>
/// Signing metadata and appearance options.
/// </summary>
public sealed record SignPdfOptions
{
/// <summary>
/// Document element id embedded into the signature metadata.
/// </summary>
public long DocumentElementId { get; init; }
/// <summary>
/// Signer name.
/// </summary>
public required string Name { get; init; }
/// <summary>
/// Signing reason.
/// </summary>
public string? Reason { get; init; }
/// <summary>
/// Signing location.
/// </summary>
public string? Location { get; init; }
/// <summary>
/// Signer email (optional contact info).
/// </summary>
public string? Email { get; init; }
/// <summary>
/// Signer phone (optional contact info).
/// </summary>
public string? Phone { get; init; }
/// <summary>
/// Application name embedded into the signature metadata.
/// </summary>
public string? ApplicationName { get; init; }
/// <summary>
/// Certification level applied to the signature.
/// </summary>
public PdfSignatureCertificationLevel CertificationLevel { get; init; }
/// <summary>
/// Optional visual appearance of the signature field.
/// </summary>
public PdfSignatureAppearance? Appearance { get; init; }
}
/// <summary>
/// Visual appearance of the signature field.
/// </summary>
public sealed record PdfSignatureAppearance
{
/// <summary>
/// Page number (1-based) where the signature is placed.
/// </summary>
public int PageNumber { get; init; }
/// <summary>
/// Left bound of the signature field.
/// </summary>
public double Left { get; init; }
/// <summary>
/// Bottom bound of the signature field.
/// </summary>
public double Bottom { get; init; }
/// <summary>
/// Width of the signature field.
/// </summary>
public double Width { get; init; }
/// <summary>
/// Height of the signature field.
/// </summary>
public double Height { get; init; }
public bool ShowLabels { get; init; }
public bool ShowName { get; init; }
public bool ShowDate { get; init; }
public bool ShowReason { get; init; }
public bool ShowLocation { get; init; }
public bool ShowDistinguishedName { get; init; }
/// <summary>
/// Date/time format used in the signature appearance.
/// </summary>
public string DateTimeFormat { get; init; } = "dd.MM.yyyy HH:mm:ss zzz";
/// <summary>
/// Coordinate unit of the signature bounds.
/// </summary>
public PdfSignatureCoordinateUnit CoordinateUnit { get; init; } = PdfSignatureCoordinateUnit.Point;
/// <summary>
/// Coordinate origin of the signature bounds.
/// </summary>
public PdfSignatureCoordinateOrigin CoordinateOrigin { get; init; } = PdfSignatureCoordinateOrigin.BottomLeft;
/// <summary>
/// Font settings of the signature appearance.
/// </summary>
public PdfSignatureFont Font { get; init; } = new();
}
/// <summary>
/// Font settings of the signature appearance.
/// </summary>
public sealed record PdfSignatureFont
{
public string FamilyName { get; init; } = "Helvetica";
public float Size { get; init; } = 10;
public bool IsBold { get; init; }
public bool IsItalic { get; init; }
public bool IsUnderline { get; init; }
public PdfSignatureColor Color { get; init; } = new();
}
/// <summary>
/// RGB color (0-255 channels) of the signature appearance font.
/// </summary>
public sealed record PdfSignatureColor
{
public double R { get; init; }
public double G { get; init; }
public double B { get; init; }
}
/// <summary>
/// Certification level of the PDF signature.
/// </summary>
public enum PdfSignatureCertificationLevel
{
/// <summary>All changes are allowed.</summary>
NoCertification = 0,
/// <summary>No changes are allowed.</summary>
NoChangesAllowed,
/// <summary>Allows form filling and signing.</summary>
FillForms,
/// <summary>Allows form filling, annotation and signing.</summary>
FillFormsAndAnnotate
}
/// <summary>
/// Coordinate unit of the signature bounds.
/// </summary>
public enum PdfSignatureCoordinateUnit
{
Point = 0,
Inch = 1
}
/// <summary>
/// Coordinate origin of the signature bounds.
/// </summary>
public enum PdfSignatureCoordinateOrigin
{
BottomLeft = 0,
TopLeft = 1
}