factuges-document-signing-s.../src/signing_service/infrastructure/pdf/fake_pdf_signer.py
2026-01-22 11:37:35 +01:00

17 lines
580 B
Python

from signing_service.domain.ports.pdf_signer import PDFSignerPort
class FakePDFSigner(PDFSignerPort):
"""
Fake implementation of PDFSignerPort.
It does NOT sign a real PDF.
It only simulates the behavior for testing and development.
"""
def sign(self, pdf_bytes: bytes, certificate: str, password: str) -> bytes:
# Simulación simple:
# añadimos un marcador para indicar "firmado"
signature_marker = f"\n\n-- Signed with certificate: {certificate} and password: {password}".encode()
return pdf_bytes + signature_marker