Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
vbuch committed Mar 18, 2024
2 parents 15bdf9a + 402c4a2 commit 5fb5f82
Show file tree
Hide file tree
Showing 31 changed files with 293 additions and 73 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
custom: ['https://buymeacoffee.com/vbuch?utm_source=github-sponsor-signpdf']
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## [3.2.4]

* [placeholder-pdf-lib] Fix typing for `pdf-lib`'s `PDFPage`.
* [placeholder-pdf-lib] Correctly noted that either `pdfDoc` or `pdfPage` is required, not both.
* Introduced `tsd` to verify the types that we generate.

## [3.2.3]

* [examples] Run linting on examples;
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
[![Known Vulnerabilities](https://snyk.io/test/npm/node-signpdf/badge.svg)](https://snyk.io/test/npm/node-signpdf)
![Coverage as reported by Coveralls](https://img.shields.io/coverallsCoverage/github/vbuch/node-signpdf)
![GitHub last commit](https://img.shields.io/github/last-commit/vbuch/node-signpdf?color=red)
[![Donate to this project using Buy Me A Coffee](https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg)](https://buymeacoffee.com/vbuch)

Formerly known as [`node-signpdf`](https://www.npmjs.com/package/node-signpdf) `@signpdf` is a family of packages trying to make signing of PDFs simple in Node.js.

Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"version": "3.2.3",
"version": "3.2.4",
"npmClient": "yarn",
"ignoreChanges": [
"*.md",
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"type": "git",
"url": "https://github.com/vbuch/node-signpdf"
},
"funding": [
{
"type": "individual",
"url": "https://buymeacoffee.com/vbuch?utm_source=npm-funding-signpdf"
}
],
"license": "MIT",
"engines": {
"node": ">=12"
Expand Down
8 changes: 4 additions & 4 deletions packages/examples/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@signpdf/examples",
"version": "3.2.3",
"version": "3.2.4",
"description": "",
"scripts": {
"js": "node src/javascript.js",
Expand All @@ -16,9 +16,9 @@
"url": "git+https://github.com/vbuch/node-signpdf.git"
},
"dependencies": {
"@signpdf/placeholder-plain": "^3.2.3",
"@signpdf/signer-p12": "^3.2.3",
"@signpdf/signpdf": "^3.2.3",
"@signpdf/placeholder-plain": "^3.2.4",
"@signpdf/signer-p12": "^3.2.4",
"@signpdf/signpdf": "^3.2.4",
"ts-node": "^10.9.1",
"typescript": "^5.2.2"
},
Expand Down
1 change: 0 additions & 1 deletion packages/placeholder-pdf-lib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
for [![@signpdf](https://raw.githubusercontent.com/vbuch/node-signpdf/master/resources/logo-horizontal.svg?sanitize=true)](https://github.com/vbuch/node-signpdf/)

[![npm version](https://badge.fury.io/js/@signpdf%2Fplaceholder-pdf-lib.svg)](https://badge.fury.io/js/@signpdf%2Fplaceholder-pdf-lib)
[![Donate to this project using Buy Me A Coffee](https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg)](https://buymeacoffee.com/vbuch)

Works with `PDF-LIB` and given a PDFDocument that is in the works, adds an e-signature placeholder. When the PDF is ready you can convert it to Buffer and pass it to `@signpdf/signpdf` to complete the process.

Expand Down
14 changes: 11 additions & 3 deletions packages/placeholder-pdf-lib/dist/pdflibAddPlaceholder.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
export function pdflibAddPlaceholder({ pdfDoc, pdfPage, reason, contactInfo, name, location, signingTime, signatureLength, byteRangePlaceholder, subFilter, widgetRect, appName, }: InputType): void;
export type PDFDocument = import('pdf-lib').PDFDocument;
export type InputType = {
pdfDoc: PDFDocument;
pdfPage: PDFPage;
export type PDFPage = import('pdf-lib').PDFPage;
export type CommonInputType = {
pdfDoc?: PDFDocument;
pdfPage?: PDFPage;
reason: string;
contactInfo: string;
name: string;
Expand All @@ -23,4 +24,11 @@ export type InputType = {
*/
appName?: string;
};
export type DocInputType = {
pdfDoc: PDFDocument;
};
export type PageInputType = {
pdfPage: PDFPage;
};
export type InputType = CommonInputType & (DocInputType | PageInputType);
//# sourceMappingURL=pdflibAddPlaceholder.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 29 additions & 11 deletions packages/placeholder-pdf-lib/dist/pdflibAddPlaceholder.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,37 @@ var _pdfLib = require("pdf-lib");
*/

/**
* @typedef {object} InputType
* @typedef {import('pdf-lib').PDFPage} PDFPage
*/

/**
* @typedef {object} CommonInputType
* @property {PDFDocument} [pdfDoc]
* @property {PDFPage} [pdfPage]
* @property {string} reason
* @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
*/

/**
* @typedef {object} DocInputType
* @property {PDFDocument} pdfDoc
*/

/**
* @typedef {object} PageInputType
* @property {PDFPage} pdfPage
* @property {string} reason
* @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
*/

/**
* @typedef {CommonInputType & (DocInputType | PageInputType)} InputType
*/

/**
Expand Down
1 change: 1 addition & 0 deletions packages/placeholder-pdf-lib/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './dist/pdflibAddPlaceholder'
20 changes: 16 additions & 4 deletions packages/placeholder-pdf-lib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@signpdf/placeholder-pdf-lib",
"version": "3.2.3",
"version": "3.2.4",
"description": "Use PDF-LIB to insert a signature placeholder.",
"repository": {
"type": "git",
Expand All @@ -21,6 +21,12 @@
"pades",
"digital signature"
],
"funding": [
{
"type": "individual",
"url": "https://buymeacoffee.com/vbuch?utm_source=npm-funding-signpdf"
}
],
"main": "dist/pdflibAddPlaceholder.js",
"types": "dist/pdflibAddPlaceholder.d.ts",
"files": [
Expand All @@ -34,11 +40,16 @@
},
"scripts": {
"test": "jest",
"build": "rm -rf ./dist/* & babel ./src -d ./dist --ignore \"**/*.test.js\" & tsc",
"lint": "eslint -c .eslintrc --ignore-path ../../.eslintignore ./"
"build": "yarn build:clean && yarn build:compile && yarn build:types",
"lint": "eslint -c .eslintrc --ignore-path ../../.eslintignore ./",
"build:clean": "rm -rf ./dist/*",
"build:compile": "babel ./src -d ./dist --ignore \"**/*.test.js\"",
"build:types": "yarn build:types:compile && yarn build:types:verify",
"build:types:compile": "tsc",
"build:types:verify": "tsd --files=index.test-d.ts"
},
"dependencies": {
"@signpdf/utils": "^3.2.3"
"@signpdf/utils": "^3.2.4"
},
"peerDependencies": {
"pdf-lib": "^1.17.1"
Expand Down Expand Up @@ -67,6 +78,7 @@
"jest": "^27.3.1",
"node-forge": "^1.2.1",
"pdf-lib": "^1.17.1",
"tsd": "^0.30.7",
"typescript": "^5.2.2"
},
"gitHead": "56f621c5b6b240f363927cdab47ec8e0bb9fa180"
Expand Down
40 changes: 29 additions & 11 deletions packages/placeholder-pdf-lib/src/pdflibAddPlaceholder.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,37 @@ import {
*/

/**
* @typedef {object} InputType
* @typedef {import('pdf-lib').PDFPage} PDFPage
*/

/**
* @typedef {object} CommonInputType
* @property {PDFDocument} [pdfDoc]
* @property {PDFPage} [pdfPage]
* @property {string} reason
* @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
*/

/**
* @typedef {object} DocInputType
* @property {PDFDocument} pdfDoc
*/

/**
* @typedef {object} PageInputType
* @property {PDFPage} pdfPage
* @property {string} reason
* @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
*/

/**
* @typedef {CommonInputType & (DocInputType | PageInputType)} InputType
*/

/**
Expand Down
1 change: 0 additions & 1 deletion packages/placeholder-pdfkit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
for [![@signpdf](https://raw.githubusercontent.com/vbuch/node-signpdf/master/resources/logo-horizontal.svg?sanitize=true)](https://github.com/vbuch/node-signpdf/)

[![npm version](https://badge.fury.io/js/@signpdf%2Fplaceholder-pdfkit.svg)](https://badge.fury.io/js/@signpdf%2Fplaceholder-pdfkit)
[![Donate to this project using Buy Me A Coffee](https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg)](https://buymeacoffee.com/vbuch)

Works on top of `PDFKit 0.11+` and given a PDFDocument that is in the works, adds an e-signature placeholder. When the PDF is ready you can pass it to `@signpdf/signpdf` to complete the process.

Expand Down
1 change: 1 addition & 0 deletions packages/placeholder-pdfkit/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './dist'
20 changes: 16 additions & 4 deletions packages/placeholder-pdfkit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@signpdf/placeholder-pdfkit",
"version": "3.2.3",
"version": "3.2.4",
"description": "Use foliojs/PDFKit 0.11+ to insert a signature placeholder.",
"repository": {
"type": "git",
Expand All @@ -21,6 +21,12 @@
"pades",
"digital signature"
],
"funding": [
{
"type": "individual",
"url": "https://buymeacoffee.com/vbuch?utm_source=npm-funding-signpdf"
}
],
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
Expand All @@ -34,11 +40,16 @@
},
"scripts": {
"test": "jest",
"build": "rm -rf ./dist/* & babel ./src -d ./dist --ignore \"**/*.test.js\" & tsc",
"lint": "eslint -c .eslintrc --ignore-path ../../.eslintignore ./"
"build": "yarn build:clean && yarn build:compile && yarn build:types",
"lint": "eslint -c .eslintrc --ignore-path ../../.eslintignore ./",
"build:clean": "rm -rf ./dist/*",
"build:compile": "babel ./src -d ./dist --ignore \"**/*.test.js\"",
"build:types": "yarn build:types:compile && yarn build:types:verify",
"build:types:compile": "tsc",
"build:types:verify": "tsd --files=index.test-d.ts"
},
"dependencies": {
"@signpdf/utils": "^3.2.3"
"@signpdf/utils": "^3.2.4"
},
"peerDependencies": {
"pdfkit": "^0.11.0"
Expand Down Expand Up @@ -67,6 +78,7 @@
"jest": "^27.3.1",
"node-forge": "^1.2.1",
"pdfkit": "^0.11.0",
"tsd": "^0.30.7",
"typescript": "^5.2.2"
}
}
1 change: 0 additions & 1 deletion packages/placeholder-pdfkit010/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
for [![@signpdf](https://raw.githubusercontent.com/vbuch/node-signpdf/master/resources/logo-horizontal.svg?sanitize=true)](https://github.com/vbuch/node-signpdf/)

[![npm version](https://badge.fury.io/js/@signpdf%2Fplaceholder-pdfkit010.svg)](https://badge.fury.io/js/@signpdf%2Fplaceholder-pdfkit010)
[![Donate to this project using Buy Me A Coffee](https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg)](https://buymeacoffee.com/vbuch)

Works on top of `PDFKit 0.10.0` and given a PDFDocument that is in the works, adds an e-signature placeholder. When the PDF is ready you can pass it to `@signpdf/signpdf` to complete the process.

Expand Down
1 change: 1 addition & 0 deletions packages/placeholder-pdfkit010/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './dist'
20 changes: 16 additions & 4 deletions packages/placeholder-pdfkit010/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@signpdf/placeholder-pdfkit010",
"version": "3.2.3",
"version": "3.2.4",
"description": "Use foliojs/PDFKit 0.10 to insert a signature placeholder.",
"repository": {
"type": "git",
Expand All @@ -21,6 +21,12 @@
"pades",
"digital signature"
],
"funding": [
{
"type": "individual",
"url": "https://buymeacoffee.com/vbuch?utm_source=npm-funding-signpdf"
}
],
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
Expand All @@ -34,11 +40,16 @@
},
"scripts": {
"test": "jest",
"build": "rm -rf ./dist/* & babel ./src -d ./dist --ignore \"**/*.test.js\" & tsc",
"lint": "eslint -c .eslintrc --ignore-path ../../.eslintignore ./"
"build": "yarn build:clean && yarn build:compile && yarn build:types",
"lint": "eslint -c .eslintrc --ignore-path ../../.eslintignore ./",
"build:clean": "rm -rf ./dist/*",
"build:compile": "babel ./src -d ./dist --ignore \"**/*.test.js\"",
"build:types": "yarn build:types:compile && yarn build:types:verify",
"build:types:compile": "tsc",
"build:types:verify": "tsd --files=index.test-d.ts"
},
"dependencies": {
"@signpdf/utils": "^3.2.3"
"@signpdf/utils": "^3.2.4"
},
"peerDependencies": {
"pdfkit": "~0.10.0"
Expand Down Expand Up @@ -67,6 +78,7 @@
"jest": "^27.3.1",
"node-forge": "^1.2.1",
"pdfkit": "~0.10.0",
"tsd": "^0.30.7",
"typescript": "^5.2.2"
},
"gitHead": "5d5ec00c21e072613acb9776c7c6ac7697314955"
Expand Down
1 change: 0 additions & 1 deletion packages/placeholder-plain/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
for [![@signpdf](https://raw.githubusercontent.com/vbuch/node-signpdf/master/resources/logo-horizontal.svg?sanitize=true)](https://github.com/vbuch/node-signpdf/)

[![npm version](https://badge.fury.io/js/@signpdf%2Fplaceholder-plain.svg)](https://badge.fury.io/js/@signpdf%2Fplaceholder-plain)
[![Donate to this project using Buy Me A Coffee](https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg)](https://buymeacoffee.com/vbuch)

Implements adding e-signature placeholder with plain string operations (.indexOf(), .replace(), .match(), etc.). Because of the lack of semantics it is rather *fragile*. Additionally it doesn't support streams and only works on PDF version <= 1.3. Regardless of those disadvantages this flow seems to be **the most popular among the users of @signpdf**.

Expand Down
1 change: 1 addition & 0 deletions packages/placeholder-plain/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './dist/plainAddPlaceholder'
Loading

0 comments on commit 5fb5f82

Please sign in to comment.