pretext-pdf 1.6.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,36 @@ Format: [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/)
7
7
 
8
8
  ---
9
9
 
10
+ ## [1.7.0] — 2026-05-25
11
+
12
+ Signing path repaired. **No public API changes.** The cryptographic signing pipeline has been architecturally broken end-to-end since v1.3.6 — calling `render({ signature: { p12, passphrase } })` would fail with `SIGNATURE_FAILED: PDF signing failed: No ByteRangeStrings found within PDF buffer`. v1.7.0 fixes it with a surgical change inside `applySignature`.
13
+
14
+ ### Fixed (critical)
15
+
16
+ - **Signing path was architecturally broken since v1.3.6**. Root cause: `applySignature` loaded the placeholder doc via `@cantoo/pdf-lib`'s `PDFDocument.load`, then handed it to `@signpdf/placeholder-pdf-lib.pdflibAddPlaceholder`, which internally builds `/ByteRange` using **upstream** `pdf-lib`'s `PDFArray`/`PDFNumber`/`PDFName` classes (it imports them directly from `"pdf-lib"`). Cantoo's serializer doesn't recognize upstream's class instances and emitted a malformed `/ByteRange` dict; `@signpdf/utils.findByteRange` then aborted parsing with `No ByteRangeStrings found within PDF buffer`. Fix: load the doc via **upstream `pdf-lib`** for the placeholder hop only. Encryption stays on `@cantoo/pdf-lib` in `applyEncryption` — the two paths are mutually exclusive via the existing `SIGNATURE_CERT_AND_ENCRYPTION` guard, so we never need both pdf-libs active simultaneously. The previously KNOWN-BROKEN `test/signatures-crypto.test.ts → P12 signature verifies cryptographically (real CMS verify)` is now unskipped and green.
17
+
18
+ ### Added
19
+
20
+ - **AcroForm regression assertion** inside `test/signatures-crypto.test.ts`. Any valid signed PDF must carry `/AcroForm`, `/Fields [...]`, `/SigFlags 3`, and a `/Type /Sig` object — these four properties are asserted on the signed bytes so a future regression that loses AcroForm structure surfaces immediately.
21
+ - **Signature path snapshot tripwire** (`test/signatures-snapshot.test.ts` + `test/data/signatures-snapshot.json`). Captures the categorical structural shape of a signed PDF (presence of `/ByteRange`, `/AcroForm`, `/SigFlags` value, etc.) rather than byte offsets (which are document- and randomness-dependent). Wired into `test:phases`. Regenerate with `UPDATE_SNAPSHOT=1`.
22
+
23
+ ### Changed
24
+
25
+ - **`pdf-lib` declared as an explicit optional peer dependency** (`^1.17.1`). It was previously only present transitively via `@signpdf/placeholder-pdf-lib`'s `dependencies`. Now it's a documented peer with `peerDependenciesMeta.pdf-lib.optional: true`, mirroring the existing `@signpdf/*` pattern. Users with `@signpdf/*` already installed need no action — npm satisfies the new peer from the existing transitive install.
26
+ - **`SIGNATURE_DEP_MISSING` error message** now lists `pdf-lib` alongside the three `@signpdf/*` packages and drops the "currently non-functional due to fork incompatibility" disclaimer that was added in v1.3.6.
27
+
28
+ ### Migration
29
+
30
+ None. Same `signature: { p12, passphrase, reason, contactInfo, signerName, location, page, invisible }` config. Same error codes (`SIGNATURE_DEP_MISSING`, `SIGNATURE_P12_LOAD_FAILED`, `SIGNATURE_FAILED`, `SIGNATURE_CERT_AND_ENCRYPTION`). One error message string changed: `SIGNATURE_DEP_MISSING` now mentions `pdf-lib` and no longer carries the "non-functional" disclaimer.
31
+
32
+ ### Verification
33
+
34
+ - All 456 tests pass (was 454 pass + 1 skipped pre-fix; now 455 pass after unskip + 1 new snapshot test = 456 total).
35
+ - Encryption-after-signing path still rejected with `SIGNATURE_CERT_AND_ENCRYPTION` (regression-tested).
36
+ - All 7 v1.6.0 verification gates (G1–G7) still pass.
37
+
38
+ ---
39
+
10
40
  ## [1.6.0] — 2026-05-25
11
41
 
12
42
  Internal restructuring + SVG sanitizer hardening. **No public API changes.** The previously-monolithic `src/assets.ts` (961 lines pre-sprint) has been split into 10 focused files under `src/assets/`. A 14-line back-compat shim at `src/assets.ts` re-exports the barrel so every existing consumer (internal modules, public API, and direct test imports via `dist/assets.js`) keeps working unchanged.
@@ -1 +1 @@
1
- {"version":3,"file":"post-process.d.ts","sourceRoot":"","sources":["../src/post-process.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAI1D;;;GAGG;AACH,wBAAsB,cAAc,CAClC,QAAQ,EAAE,UAAU,EACpB,GAAG,EAAE,WAAW,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,EAC1C,eAAe,CAAC,EAAE,MAAM,EAAE,GACzB,OAAO,CAAC,UAAU,CAAC,CAyFrB;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,UAAU,EACpB,GAAG,EAAE,WAAW,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,GAC1C,OAAO,CAAC,UAAU,CAAC,CAarB;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,UAAU,EACpB,GAAG,EAAE,WAAW,GACf,OAAO,CAAC,UAAU,CAAC,CAGrB"}
1
+ {"version":3,"file":"post-process.d.ts","sourceRoot":"","sources":["../src/post-process.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAI1D;;;GAGG;AACH,wBAAsB,cAAc,CAClC,QAAQ,EAAE,UAAU,EACpB,GAAG,EAAE,WAAW,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,EAC1C,eAAe,CAAC,EAAE,MAAM,EAAE,GACzB,OAAO,CAAC,UAAU,CAAC,CA0GrB;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,UAAU,EACpB,GAAG,EAAE,WAAW,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,GAC1C,OAAO,CAAC,UAAU,CAAC,CAarB;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,UAAU,EACpB,GAAG,EAAE,WAAW,GACf,OAAO,CAAC,UAAU,CAAC,CAGrB"}
@@ -10,10 +10,19 @@ export async function applySignature(pdfBytes, sig, allowedFileDirs) {
10
10
  let signpdfMod;
11
11
  let placeholderMod;
12
12
  let signerP12Mod;
13
+ let pdfLibMod;
14
+ // NOTE: upstream `pdf-lib` (not @cantoo/pdf-lib) is used here for the
15
+ // placeholder hop only. @signpdf/placeholder-pdf-lib builds its placeholder
16
+ // objects with upstream pdf-lib classes (see pdflibAddPlaceholder.js), so
17
+ // the doc fed into it must be loaded with the matching pdf-lib variant to
18
+ // produce a serializer-compatible /ByteRange dictionary. Encryption stays
19
+ // on @cantoo/pdf-lib in applyEncryption — the two paths are mutually
20
+ // exclusive via the SIGNATURE_CERT_AND_ENCRYPTION guard.
13
21
  const signpdfPackages = [
14
22
  { name: '@signpdf/signpdf', load: () => import('@signpdf/signpdf') },
15
23
  { name: '@signpdf/placeholder-pdf-lib', load: () => import('@signpdf/placeholder-pdf-lib') },
16
24
  { name: '@signpdf/signer-p12', load: () => import('@signpdf/signer-p12') },
25
+ { name: 'pdf-lib', load: () => import('pdf-lib') },
17
26
  ];
18
27
  const missing = [];
19
28
  const loaded = {};
@@ -26,11 +35,12 @@ export async function applySignature(pdfBytes, sig, allowedFileDirs) {
26
35
  }
27
36
  }
28
37
  if (missing.length > 0) {
29
- throw new PretextPdfError('SIGNATURE_DEP_MISSING', `Cryptographic signing requires the @signpdf/signpdf, @signpdf/placeholder-pdf-lib, and @signpdf/signer-p12 packages. Missing: ${missing.join(', ')}. Install: npm install ${missing.join(' ')}. NOTE: signing currently non-functional due to @cantoo/pdf-lib + @signpdf/placeholder-pdf-lib fork incompatibility — see CHANGELOG v1.3.6.`);
38
+ throw new PretextPdfError('SIGNATURE_DEP_MISSING', `Cryptographic signing requires the @signpdf/signpdf, @signpdf/placeholder-pdf-lib, @signpdf/signer-p12, and pdf-lib packages. Missing: ${missing.join(', ')}. Install: npm install ${missing.join(' ')}.`);
30
39
  }
31
40
  signpdfMod = loaded['@signpdf/signpdf'];
32
41
  placeholderMod = loaded['@signpdf/placeholder-pdf-lib'];
33
42
  signerP12Mod = loaded['@signpdf/signer-p12'];
43
+ pdfLibMod = loaded['pdf-lib'];
34
44
  const { SignPdf } = signpdfMod;
35
45
  const { pdflibAddPlaceholder } = placeholderMod;
36
46
  const { P12Signer } = signerP12Mod;
@@ -55,7 +65,11 @@ export async function applySignature(pdfBytes, sig, allowedFileDirs) {
55
65
  throw e;
56
66
  throw new PretextPdfError('SIGNATURE_P12_LOAD_FAILED', 'Failed to load P12 certificate');
57
67
  }
58
- const pdfDoc = await PDFDocument.load(pdfBytes);
68
+ // Load with upstream pdf-lib (not @cantoo/pdf-lib) so the doc instance
69
+ // shares the exact same PDFArray/PDFNumber/PDFName classes that
70
+ // placeholder-pdf-lib uses internally — otherwise the serializer emits a
71
+ // /ByteRange dict the signpdf parser cannot find.
72
+ const pdfDoc = await pdfLibMod.PDFDocument.load(pdfBytes);
59
73
  pdflibAddPlaceholder({
60
74
  pdfDoc,
61
75
  reason: sig.reason ?? 'Signed',
@@ -1 +1 @@
1
- {"version":3,"file":"post-process.js","sourceRoot":"","sources":["../src/post-process.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAE/C;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,QAAoB,EACpB,GAA0C,EAC1C,eAA0B;IAW1B,IAAI,UAAyB,CAAA;IAC7B,IAAI,cAAiC,CAAA;IACrC,IAAI,YAA6B,CAAA;IACjC,MAAM,eAAe,GAAG;QACtB,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,kBAA4B,CAAC,EAAE;QAC9E,EAAE,IAAI,EAAE,8BAA8B,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,8BAAwC,CAAC,EAAE;QACtG,EAAE,IAAI,E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;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,QAAoB,EACpB,GAAgB;IAEhB,MAAM,WAAW,GAAG,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC,MAAM,cAAc,CAAC,QAAQ,EAAE,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAA;IACtH,OAAO,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,eAAe,CAAC,WAAW,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,WAAW,CAAA;AAC1F,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pretext-pdf",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Generate PDFs from JSON — declarative, serverless, no Chromium. TypeScript-first with professional typography. Ideal for invoices, reports, and AI agents.",
5
5
  "keywords": [
6
6
  "pdf",
@@ -100,7 +100,7 @@
100
100
  "test:10d": "tsx --test test/templates.test.ts",
101
101
  "test:phase-4": "tsx --test test/footnotes.test.ts",
102
102
  "test:phase-5": "tsx --test test/image-floats.test.ts",
103
- "test:phases": "tsx --test test/footnotes.test.ts test/image-floats.test.ts test/bookmarks.test.ts test/watermarks.test.ts test/hyphenation.test.ts test/toc.test.ts test/svg.test.ts test/rtl.test.ts test/encryption.test.ts test/integration.test.ts test/hyperlinks.test.ts test/inline-formatting.test.ts test/annotations.test.ts test/assembly.test.ts test/metadata.test.ts test/signatures-visual.test.ts test/forms.test.ts test/callout.test.ts test/signatures-crypto.test.ts test/float-groups.test.ts test/font-subsetting.test.ts test/performance.test.ts test/signatures-validation.test.ts test/cross-cutting.test.ts test/qr-barcode.test.ts test/charts.test.ts test/markdown-entry.test.ts test/templates.test.ts test/security-ssrf.test.ts test/security-ipv4-bypass.test.ts test/markdown-gfm.test.ts test/assets-dns-dedup.test.ts test/measure-text-cache.test.ts test/public-api-surface.test.ts test/assets-split-tripwire.test.ts test/assets-concurrency.test.ts test/assets-errorcode-stability.test.ts test/assets-perf-coldstart.test.ts test/svg-sanitizer.test.ts",
103
+ "test:phases": "tsx --test test/footnotes.test.ts test/image-floats.test.ts test/bookmarks.test.ts test/watermarks.test.ts test/hyphenation.test.ts test/toc.test.ts test/svg.test.ts test/rtl.test.ts test/encryption.test.ts test/integration.test.ts test/hyperlinks.test.ts test/inline-formatting.test.ts test/annotations.test.ts test/assembly.test.ts test/metadata.test.ts test/signatures-visual.test.ts test/forms.test.ts test/callout.test.ts test/signatures-crypto.test.ts test/signatures-snapshot.test.ts test/float-groups.test.ts test/font-subsetting.test.ts test/performance.test.ts test/signatures-validation.test.ts test/cross-cutting.test.ts test/qr-barcode.test.ts test/charts.test.ts test/markdown-entry.test.ts test/templates.test.ts test/security-ssrf.test.ts test/security-ipv4-bypass.test.ts test/markdown-gfm.test.ts test/assets-dns-dedup.test.ts test/measure-text-cache.test.ts test/public-api-surface.test.ts test/assets-split-tripwire.test.ts test/assets-concurrency.test.ts test/assets-errorcode-stability.test.ts test/assets-perf-coldstart.test.ts test/svg-sanitizer.test.ts",
104
104
  "test:phase-7": "tsx --test test/bookmarks.test.ts test/watermarks.test.ts test/hyphenation.test.ts test/toc.test.ts test/svg.test.ts test/rtl.test.ts test/encryption.test.ts test/integration.test.ts",
105
105
  "test:phase-8": "tsx --test test/hyperlinks.test.ts test/inline-formatting.test.ts test/annotations.test.ts test/assembly.test.ts test/forms.test.ts test/callout.test.ts test/signatures-visual.test.ts test/metadata.test.ts",
106
106
  "test:8d": "tsx --test test/callout.test.ts",
@@ -159,6 +159,7 @@
159
159
  "bwip-js": "^4.0.0",
160
160
  "highlight.js": "^11.0.0",
161
161
  "marked": ">=9.0.0",
162
+ "pdf-lib": "^1.17.1",
162
163
  "qrcode": "^1.5.0",
163
164
  "vega": "^5.0.0 || ^6.0.0",
164
165
  "vega-lite": "^5.0.0 || ^6.0.0"
@@ -176,6 +177,9 @@
176
177
  "@signpdf/signer-p12": {
177
178
  "optional": true
178
179
  },
180
+ "pdf-lib": {
181
+ "optional": true
182
+ },
179
183
  "highlight.js": {
180
184
  "optional": true
181
185
  },