Refactor DTOs and simplify PdfDigitalSignatureService
Refactored `PdfSignOptionsDto` and `PdfVisualSignatureOptionsDto`: - Converted both to immutable `record` types with non-nullable properties. - Added XML documentation comments for properties and parameters. Simplified `PdfDigitalSignatureService`: - Updated `SignPdfAsync` to enforce non-nullable `PdfSignOptionsDto`. - Removed redundant null checks and inlined `CreateSignatureBounds`. - Simplified signature appearance and image data logic. - Refactored `TryGetKeySize` to use `bool` with `out` parameter. General improvements: - Enhanced code readability and maintainability. - Reduced nullable references and enforced stricter type safety.
This commit is contained in:
@@ -2,15 +2,53 @@ using EnvelopeGenerator.Application.Common.Enums;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Common.Dto;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public sealed record PdfSignOptionsDto
|
||||
{
|
||||
public string? UUID { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public string? Reason { get; set; }
|
||||
public string? Location { get; set; }
|
||||
public string? Email { get; set; }
|
||||
public string? Phone { get; set; }
|
||||
public string? ApplicationName { get; set; }
|
||||
public PdfSignatureCertificationLevel? CertificationLevel { get; set; }
|
||||
public PdfVisualSignatureOptionsDto? VisualSignature { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string UUID { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Name { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Reason { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Location { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Email { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Phone { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ApplicationName { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public PdfSignatureCertificationLevel CertificationLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public PdfVisualSignatureOptionsDto VisualSignature { get; set; } = null!;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
namespace EnvelopeGenerator.Application.Common.Dto;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="ImageBytes"></param>
|
||||
/// <param name="PageNumber"></param>
|
||||
/// <param name="Left"></param>
|
||||
/// <param name="Bottom"></param>
|
||||
/// <param name="Width"></param>
|
||||
/// <param name="Height"></param>
|
||||
/// <param name="ShowLabels"></param>
|
||||
public sealed record PdfVisualSignatureOptionsDto(
|
||||
byte[] ImageBytes,
|
||||
int PageNumber,
|
||||
|
||||
Reference in New Issue
Block a user