diff --git a/dist/lib/generalUtils.js b/dist/lib/generalUtils.js index 64ce8f2a468dd2e309e585db9af80aab06ddca22..6a357588f5975f2f5dabc1e7d116dc1fee3726b0 100644 --- a/dist/lib/generalUtils.js +++ b/dist/lib/generalUtils.js @@ -7,7 +7,8 @@ const checkForSubFilter = (pdfBuffer) => { const matches = pdfBuffer.toString().match(/\/SubFilter\s*\/([\w.]*)/); const subFilter = Array.isArray(matches) && matches[1]; if (!subFilter) { - throw new errors_1.AppError("Can not find subfilter"); + //SubFilter is only available if there is a sig in the pdf + return; } const supportedTypes = [ "adbe.pkcs7.detached", diff --git a/dist/lib/index.js b/dist/lib/index.js index 6b0086a30113edba2177414a8757b468280c450d..7ed62642f5eb6075926e9f466dead8a95aa30553 100644 --- a/dist/lib/index.js +++ b/dist/lib/index.js @@ -10,8 +10,7 @@ const verifyPDF = (pdf) => { (0, generalUtils_1.checkForSubFilter)(pdfBuffer); } catch (error) { - //SubFilter is only available if there is a sig in the pdf - return null; + throw new Error(error.message); } try { const { signatureStr, signedData, signatureMeta } = (0, signatureUtils_1.extractSignature)(pdfBuffer); diff --git a/src/lib/generalUtils.ts b/src/lib/generalUtils.ts index 48509ab7fd383b357a5398891a97e5af6acc82f8..6ba8aa23f865fe580f4187c62b7b3dd57bbe8052 100644 --- a/src/lib/generalUtils.ts +++ b/src/lib/generalUtils.ts @@ -7,7 +7,8 @@ export const checkForSubFilter = (pdfBuffer: Buffer) => { const subFilter = Array.isArray(matches) && matches[1]; if (!subFilter) { - throw new AppError("Can not find subfilter"); + //SubFilter is only available if there is a sig in the pdf + return; } const supportedTypes = [ diff --git a/src/lib/index.ts b/src/lib/index.ts index f603cfdb331b800817364fb9da4a0939cdcd0d3d..81156ab550000e47034e5eece5da39106d147411 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -7,8 +7,7 @@ export const verifyPDF = (pdf: Buffer) => { try { checkForSubFilter(pdfBuffer); } catch (error) { - //SubFilter is only available if there is a sig in the pdf - return null; + throw new Error(error.message); } try {