From 979cadd3de5c5a4302b82929f029b8037feb8032 Mon Sep 17 00:00:00 2001 From: Valery Buchinsky Date: Thu, 11 Jan 2024 15:59:55 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=A6=20Build=203.2.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dist/pdfkitAddPlaceholder.d.ts | 7 +++++- .../dist/pdfkitAddPlaceholder.d.ts.map | 2 +- .../dist/pdfkitAddPlaceholder.js | 22 +++++++++++++++---- .../dist/pdfkitAddPlaceholder.d.ts | 7 +++++- .../dist/pdfkitAddPlaceholder.d.ts.map | 2 +- .../dist/pdfkitAddPlaceholder.js | 21 +++++++++++++++--- .../dist/plainAddPlaceholder.d.ts | 7 +++++- .../dist/plainAddPlaceholder.d.ts.map | 2 +- .../dist/plainAddPlaceholder.js | 10 +++++++-- 9 files changed, 65 insertions(+), 15 deletions(-) diff --git a/packages/placeholder-pdfkit/dist/pdfkitAddPlaceholder.d.ts b/packages/placeholder-pdfkit/dist/pdfkitAddPlaceholder.d.ts index 9c831b12..361ebc40 100644 --- a/packages/placeholder-pdfkit/dist/pdfkitAddPlaceholder.d.ts +++ b/packages/placeholder-pdfkit/dist/pdfkitAddPlaceholder.d.ts @@ -1,4 +1,4 @@ -export function pdfkitAddPlaceholder({ pdf, reason, contactInfo, name, location, signatureLength, byteRangePlaceholder, subFilter, widgetRect, }: InputType): ReturnType; +export function pdfkitAddPlaceholder({ pdf, reason, contactInfo, name, location, signingTime, signatureLength, byteRangePlaceholder, subFilter, widgetRect, appName, }: InputType): ReturnType; export type InputType = { /** * PDFDocument @@ -9,6 +9,7 @@ export type InputType = { contactInfo: string; name: string; location: string; + signingTime?: Date; signatureLength?: number; byteRangePlaceholder?: string; /** @@ -19,6 +20,10 @@ export type InputType = { * [x1, y1, x2, y2] widget rectangle */ widgetRect?: number[]; + /** + * Name of the application generating the signature + */ + appName?: string; }; export type ReturnType = { signature: any; diff --git a/packages/placeholder-pdfkit/dist/pdfkitAddPlaceholder.d.ts.map b/packages/placeholder-pdfkit/dist/pdfkitAddPlaceholder.d.ts.map index 7c6ae9ba..919cce0c 100644 --- a/packages/placeholder-pdfkit/dist/pdfkitAddPlaceholder.d.ts.map +++ b/packages/placeholder-pdfkit/dist/pdfkitAddPlaceholder.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"pdfkitAddPlaceholder.d.ts","sourceRoot":"","sources":["../src/pdfkitAddPlaceholder.js"],"names":[],"mappings":"AAmCO,kJAHI,SAAS,GACP,UAAU,CAqEtB;;;;;SA7FY,MAAM;eACN,MAAM;YACN,MAAM;iBACN,MAAM;UACN,MAAM;cACN,MAAM;sBACN,MAAM;2BACN,MAAM;;;;gBACN,MAAM;;;;iBACN,MAAM,EAAE;;;eAKR,GAAG;UACH,GAAG;YACH,GAAG"} \ No newline at end of file +{"version":3,"file":"pdfkitAddPlaceholder.d.ts","sourceRoot":"","sources":["../src/pdfkitAddPlaceholder.js"],"names":[],"mappings":"AAqCO,wKAHI,SAAS,GACP,UAAU,CA6EtB;;;;;SAvGY,MAAM;eACN,MAAM;YACN,MAAM;iBACN,MAAM;UACN,MAAM;cACN,MAAM;kBACN,IAAI;sBACJ,MAAM;2BACN,MAAM;;;;gBACN,MAAM;;;;iBACN,MAAM,EAAE;;;;cACR,MAAM;;;eAKN,GAAG;UACH,GAAG;YACH,GAAG"} \ No newline at end of file diff --git a/packages/placeholder-pdfkit/dist/pdfkitAddPlaceholder.js b/packages/placeholder-pdfkit/dist/pdfkitAddPlaceholder.js index 58da0f1e..daadb2a3 100644 --- a/packages/placeholder-pdfkit/dist/pdfkitAddPlaceholder.js +++ b/packages/placeholder-pdfkit/dist/pdfkitAddPlaceholder.js @@ -13,10 +13,12 @@ var _utils = require("@signpdf/utils"); * @property {string} contactInfo * @property {string} name * @property {string} location +* @property {Date} [signingTime] * @property {number} [signatureLength] * @property {string} [byteRangePlaceholder] * @property {string} [subFilter] One of SUBFILTER_* from \@signpdf/utils * @property {number[]} [widgetRect] [x1, y1, x2, y2] widget rectangle +* @property {string} [appName] Name of the application generating the signature */ /** @@ -39,10 +41,12 @@ const pdfkitAddPlaceholder = ({ contactInfo, name, location, + signingTime = undefined, signatureLength = _utils.DEFAULT_SIGNATURE_LENGTH, byteRangePlaceholder = _utils.DEFAULT_BYTE_RANGE_PLACEHOLDER, subFilter = _utils.SUBFILTER_ADOBE_PKCS7_DETACHED, - widgetRect = [0, 0, 0, 0] + widgetRect = [0, 0, 0, 0], + appName = undefined }) => { /* eslint-disable no-underscore-dangle,no-param-reassign */ // Generate the signature placeholder @@ -54,14 +58,24 @@ const pdfkitAddPlaceholder = ({ Contents: Buffer.from(String.fromCharCode(0).repeat(signatureLength)), Reason: new String(reason), // eslint-disable-line no-new-wrappers - M: new Date(), + M: signingTime !== null && signingTime !== void 0 ? signingTime : new Date(), ContactInfo: new String(contactInfo), // eslint-disable-line no-new-wrappers Name: new String(name), // eslint-disable-line no-new-wrappers - Location: new String(location) // eslint-disable-line no-new-wrappers + Location: new String(location), + // eslint-disable-line no-new-wrappers + Prop_Build: { + Filter: { + Name: 'Adobe.PPKLite' + }, + ...(appName ? { + App: { + Name: appName + } + } : {}) + } }); - if (!pdf._acroform) { pdf.initForm(); } diff --git a/packages/placeholder-pdfkit010/dist/pdfkitAddPlaceholder.d.ts b/packages/placeholder-pdfkit010/dist/pdfkitAddPlaceholder.d.ts index 1e24dff0..c8d3e926 100644 --- a/packages/placeholder-pdfkit010/dist/pdfkitAddPlaceholder.d.ts +++ b/packages/placeholder-pdfkit010/dist/pdfkitAddPlaceholder.d.ts @@ -1,4 +1,4 @@ -export function pdfkitAddPlaceholder({ pdf, pdfBuffer, reason, contactInfo, name, location, signatureLength, byteRangePlaceholder, subFilter, widgetRect, }: InputType): ReturnType; +export function pdfkitAddPlaceholder({ pdf, pdfBuffer, reason, contactInfo, name, location, signingTime, signatureLength, byteRangePlaceholder, subFilter, widgetRect, appName, }: InputType): ReturnType; export type InputType = { /** * PDFDocument @@ -9,6 +9,7 @@ export type InputType = { contactInfo: string; name: string; location: string; + signingTime?: Date; signatureLength?: number; byteRangePlaceholder?: string; /** @@ -19,6 +20,10 @@ export type InputType = { * [x1, y1, x2, y2] widget rectangle */ widgetRect?: number[]; + /** + * Name of the application generating the signature + */ + appName?: string; }; export type ReturnType = { signature: any; diff --git a/packages/placeholder-pdfkit010/dist/pdfkitAddPlaceholder.d.ts.map b/packages/placeholder-pdfkit010/dist/pdfkitAddPlaceholder.d.ts.map index f4604ecd..966e3c86 100644 --- a/packages/placeholder-pdfkit010/dist/pdfkitAddPlaceholder.d.ts.map +++ b/packages/placeholder-pdfkit010/dist/pdfkitAddPlaceholder.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"pdfkitAddPlaceholder.d.ts","sourceRoot":"","sources":["../src/pdfkitAddPlaceholder.js"],"names":[],"mappings":"AAsCO,6JAHI,SAAS,GACP,UAAU,CAmHtB;;;;;SA3IY,MAAM;eACN,MAAM;YACN,MAAM;iBACN,MAAM;UACN,MAAM;cACN,MAAM;sBACN,MAAM;2BACN,MAAM;;;;gBACN,MAAM;;;;iBACN,MAAM,EAAE;;;eAKR,GAAG;UACH,GAAG;YACH,GAAG"} \ No newline at end of file +{"version":3,"file":"pdfkitAddPlaceholder.d.ts","sourceRoot":"","sources":["../src/pdfkitAddPlaceholder.js"],"names":[],"mappings":"AAwCO,mLAHI,SAAS,GACP,UAAU,CA2HtB;;;;;SArJY,MAAM;eACN,MAAM;YACN,MAAM;iBACN,MAAM;UACN,MAAM;cACN,MAAM;kBACN,IAAI;sBACJ,MAAM;2BACN,MAAM;;;;gBACN,MAAM;;;;iBACN,MAAM,EAAE;;;;cACR,MAAM;;;eAKN,GAAG;UACH,GAAG;YACH,GAAG"} \ No newline at end of file diff --git a/packages/placeholder-pdfkit010/dist/pdfkitAddPlaceholder.js b/packages/placeholder-pdfkit010/dist/pdfkitAddPlaceholder.js index 88d3a63d..fa0be4e3 100644 --- a/packages/placeholder-pdfkit010/dist/pdfkitAddPlaceholder.js +++ b/packages/placeholder-pdfkit010/dist/pdfkitAddPlaceholder.js @@ -16,10 +16,12 @@ var _pdfkitReferenceMock = require("./pdfkitReferenceMock"); * @property {string} contactInfo * @property {string} name * @property {string} location +* @property {Date} [signingTime] * @property {number} [signatureLength] * @property {string} [byteRangePlaceholder] * @property {string} [subFilter] One of SUBFILTER_* from \@signpdf/utils * @property {number[]} [widgetRect] [x1, y1, x2, y2] widget rectangle +* @property {string} [appName] Name of the application generating the signature */ /** @@ -43,10 +45,12 @@ const pdfkitAddPlaceholder = ({ contactInfo, name, location, + signingTime = undefined, signatureLength = _utils.DEFAULT_SIGNATURE_LENGTH, byteRangePlaceholder = _utils.DEFAULT_BYTE_RANGE_PLACEHOLDER, subFilter = _utils.SUBFILTER_ADOBE_PKCS7_DETACHED, - widgetRect = [0, 0, 0, 0] + widgetRect = [0, 0, 0, 0], + appName = undefined }) => { /* eslint-disable no-underscore-dangle,no-param-reassign */ // Generate the signature placeholder @@ -58,12 +62,23 @@ const pdfkitAddPlaceholder = ({ Contents: Buffer.from(String.fromCharCode(0).repeat(signatureLength)), Reason: new String(reason), // eslint-disable-line no-new-wrappers - M: new Date(), + M: signingTime !== null && signingTime !== void 0 ? signingTime : new Date(), ContactInfo: new String(contactInfo), // eslint-disable-line no-new-wrappers Name: new String(name), // eslint-disable-line no-new-wrappers - Location: new String(location) // eslint-disable-line no-new-wrappers + Location: new String(location), + // eslint-disable-line no-new-wrappers + Prop_Build: { + Filter: { + Name: 'Adobe.PPKLite' + }, + ...(appName ? { + App: { + Name: appName + } + } : {}) + } }); // Check if pdf already contains acroform field diff --git a/packages/placeholder-plain/dist/plainAddPlaceholder.d.ts b/packages/placeholder-plain/dist/plainAddPlaceholder.d.ts index 10320769..f18f592e 100644 --- a/packages/placeholder-plain/dist/plainAddPlaceholder.d.ts +++ b/packages/placeholder-plain/dist/plainAddPlaceholder.d.ts @@ -1,10 +1,11 @@ -export function plainAddPlaceholder({ pdfBuffer, reason, contactInfo, name, location, signatureLength, subFilter, widgetRect, }: InputType): Buffer; +export function plainAddPlaceholder({ pdfBuffer, reason, contactInfo, name, location, signingTime, signatureLength, subFilter, widgetRect, appName, }: InputType): Buffer; export type InputType = { pdfBuffer: Buffer; reason: string; contactInfo: string; name: string; location: string; + signingTime?: Date; signatureLength?: number; /** * One of SUBFILTER_* from \@signpdf/utils @@ -14,5 +15,9 @@ export type InputType = { * [x1, y1, x2, y2] widget rectangle */ widgetRect?: number[]; + /** + * Name of the application generating the signature + */ + appName?: string; }; //# sourceMappingURL=plainAddPlaceholder.d.ts.map \ No newline at end of file diff --git a/packages/placeholder-plain/dist/plainAddPlaceholder.d.ts.map b/packages/placeholder-plain/dist/plainAddPlaceholder.d.ts.map index e40bbc1e..3d2edf47 100644 --- a/packages/placeholder-plain/dist/plainAddPlaceholder.d.ts.map +++ b/packages/placeholder-plain/dist/plainAddPlaceholder.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"plainAddPlaceholder.d.ts","sourceRoot":"","sources":["../src/plainAddPlaceholder.js"],"names":[],"mappings":"AAyDO,iIAHI,SAAS,GACP,MAAM,CA6FlB;;eAjHY,MAAM;YACN,MAAM;iBACN,MAAM;UACN,MAAM;cACN,MAAM;sBACN,MAAM;;;;gBACN,MAAM;;;;iBACN,MAAM,EAAE"} \ No newline at end of file +{"version":3,"file":"plainAddPlaceholder.d.ts","sourceRoot":"","sources":["../src/plainAddPlaceholder.js"],"names":[],"mappings":"AA2DO,uJAHI,SAAS,GACP,MAAM,CAiGlB;;eAvHY,MAAM;YACN,MAAM;iBACN,MAAM;UACN,MAAM;cACN,MAAM;kBACN,IAAI;sBACJ,MAAM;;;;gBACN,MAAM;;;;iBACN,MAAM,EAAE;;;;cACR,MAAM"} \ No newline at end of file diff --git a/packages/placeholder-plain/dist/plainAddPlaceholder.js b/packages/placeholder-plain/dist/plainAddPlaceholder.js index 39015ae5..4a7e13f8 100644 --- a/packages/placeholder-plain/dist/plainAddPlaceholder.js +++ b/packages/placeholder-plain/dist/plainAddPlaceholder.js @@ -35,9 +35,11 @@ const getAcroFormRef = slice => { * @property {string} contactInfo * @property {string} name * @property {string} location +* @property {Date} [signingTime] * @property {number} [signatureLength] * @property {string} [subFilter] One of SUBFILTER_* from \@signpdf/utils * @property {number[]} [widgetRect] [x1, y1, x2, y2] widget rectangle +* @property {string} [appName] Name of the application generating the signature */ /** @@ -58,9 +60,11 @@ const plainAddPlaceholder = ({ contactInfo, name, location, + signingTime = undefined, signatureLength = _utils.DEFAULT_SIGNATURE_LENGTH, subFilter = _utils.SUBFILTER_ADOBE_PKCS7_DETACHED, - widgetRect = [0, 0, 0, 0] + widgetRect = [0, 0, 0, 0], + appName = undefined }) => { let pdf = (0, _utils.removeTrailingNewLine)(pdfBuffer); const info = (0, _readPdf.default)(pdf); @@ -101,9 +105,11 @@ const plainAddPlaceholder = ({ contactInfo, name, location, + signingTime, signatureLength, subFilter, - widgetRect + widgetRect, + appName }); if (!getAcroFormRef(pdf.toString())) { const rootIndex = (0, _getIndexFromRef.default)(info.xref, info.rootRef);