vbuch / node-signpdf

Simple signing of PDFs in node.
MIT License
676 stars 174 forks source link

signpdf.sign's Signer and P12Signer type incompatibility #224

Closed zentetsukenz closed 5 months ago

zentetsukenz commented 5 months ago

Describe the bug and the expected behaviour

I have encountered a type incompatibility issue between the expected Signer and P12Signer. The bug is causing unexpected behavior when attempting to use the sign function.

Basically this code

await signpdf.sign(pdfWithPlaceholder, p12Signer);

will report type incompatibility between expected Signer (by sign function) and p12Signer'ssign function.

Is it a bug in signing or in the helpers?

The issue appears to be related to the signing functionality, specifically in the P12Signer implementation.

To Reproduce

Upgrade both @signpdf/signer-p12 and @signpdf/signpdf to 3.2.0

"@signpdf/signer-p12": "^3.2.0",
"@signpdf/signpdf": "^3.2.0",

Typescript should now report type incompatibility between them.

Here is an example of the report from type checking.

Screenshot 2024-01-26 at 11 14 36 AM

And upon further inspection

image