@e-sig/core 0.6.0 → 0.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/LICENSE +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/pem-signer.d.ts +26 -5
- package/dist/pem-signer.d.ts.map +1 -1
- package/dist/pem-signer.js +84 -13
- package/dist/pem-signer.js.map +1 -1
- package/dist/pq-seal.d.ts +53 -3
- package/dist/pq-seal.d.ts.map +1 -1
- package/dist/pq-seal.js +92 -8
- package/dist/pq-seal.js.map +1 -1
- package/dist/pq-verify.d.ts +22 -0
- package/dist/pq-verify.d.ts.map +1 -1
- package/dist/pq-verify.js +16 -0
- package/dist/pq-verify.js.map +1 -1
- package/dist/render-pdf.d.ts +5 -5
- package/dist/render-pdf.d.ts.map +1 -1
- package/dist/render-pdf.js +51 -17
- package/dist/render-pdf.js.map +1 -1
- package/dist/sign-pdf.d.ts +45 -4
- package/dist/sign-pdf.d.ts.map +1 -1
- package/dist/sign-pdf.js +24 -1
- package/dist/sign-pdf.js.map +1 -1
- package/dist/types.d.ts +36 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/vendor/placeholder-plain/LICENSE-signpdf.md +47 -0
- package/dist/vendor/placeholder-plain/createBufferPageWithAnnotation.d.ts +6 -0
- package/dist/vendor/placeholder-plain/createBufferPageWithAnnotation.d.ts.map +1 -0
- package/dist/vendor/placeholder-plain/createBufferPageWithAnnotation.js +38 -0
- package/dist/vendor/placeholder-plain/createBufferPageWithAnnotation.js.map +1 -0
- package/dist/vendor/placeholder-plain/createBufferRootWithAcroform.d.ts +6 -0
- package/dist/vendor/placeholder-plain/createBufferRootWithAcroform.d.ts.map +1 -0
- package/dist/vendor/placeholder-plain/createBufferRootWithAcroform.js +15 -0
- package/dist/vendor/placeholder-plain/createBufferRootWithAcroform.js.map +1 -0
- package/dist/vendor/placeholder-plain/createBufferTrailer.d.ts +4 -0
- package/dist/vendor/placeholder-plain/createBufferTrailer.d.ts.map +1 -0
- package/dist/vendor/placeholder-plain/createBufferTrailer.js +26 -0
- package/dist/vendor/placeholder-plain/createBufferTrailer.js.map +1 -0
- package/dist/vendor/placeholder-plain/findObject.d.ts +4 -0
- package/dist/vendor/placeholder-plain/findObject.d.ts.map +1 -0
- package/dist/vendor/placeholder-plain/findObject.js +18 -0
- package/dist/vendor/placeholder-plain/findObject.js.map +1 -0
- package/dist/vendor/placeholder-plain/getIndexFromRef.d.ts +4 -0
- package/dist/vendor/placeholder-plain/getIndexFromRef.d.ts.map +1 -0
- package/dist/vendor/placeholder-plain/getIndexFromRef.js +13 -0
- package/dist/vendor/placeholder-plain/getIndexFromRef.js.map +1 -0
- package/dist/vendor/placeholder-plain/getPageRef.d.ts +6 -0
- package/dist/vendor/placeholder-plain/getPageRef.d.ts.map +1 -0
- package/dist/vendor/placeholder-plain/getPageRef.js +18 -0
- package/dist/vendor/placeholder-plain/getPageRef.js.map +1 -0
- package/dist/vendor/placeholder-plain/getPagesDictionaryRef.d.ts +3 -0
- package/dist/vendor/placeholder-plain/getPagesDictionaryRef.d.ts.map +1 -0
- package/dist/vendor/placeholder-plain/getPagesDictionaryRef.js +12 -0
- package/dist/vendor/placeholder-plain/getPagesDictionaryRef.js.map +1 -0
- package/dist/vendor/placeholder-plain/index.d.ts +2 -0
- package/dist/vendor/placeholder-plain/index.d.ts.map +1 -0
- package/dist/vendor/placeholder-plain/index.js +4 -0
- package/dist/vendor/placeholder-plain/index.js.map +1 -0
- package/dist/vendor/placeholder-plain/pdfObject.d.ts +13 -0
- package/dist/vendor/placeholder-plain/pdfObject.d.ts.map +1 -0
- package/dist/vendor/placeholder-plain/pdfObject.js +142 -0
- package/dist/vendor/placeholder-plain/pdfObject.js.map +1 -0
- package/dist/vendor/placeholder-plain/pdfkitAddPlaceholder.d.ts +49 -0
- package/dist/vendor/placeholder-plain/pdfkitAddPlaceholder.d.ts.map +1 -0
- package/dist/vendor/placeholder-plain/pdfkitAddPlaceholder.js +115 -0
- package/dist/vendor/placeholder-plain/pdfkitAddPlaceholder.js.map +1 -0
- package/dist/vendor/placeholder-plain/plainAddPlaceholder.d.ts +41 -0
- package/dist/vendor/placeholder-plain/plainAddPlaceholder.d.ts.map +1 -0
- package/dist/vendor/placeholder-plain/plainAddPlaceholder.js +95 -0
- package/dist/vendor/placeholder-plain/plainAddPlaceholder.js.map +1 -0
- package/dist/vendor/placeholder-plain/readPdf.d.ts +20 -0
- package/dist/vendor/placeholder-plain/readPdf.d.ts.map +1 -0
- package/dist/vendor/placeholder-plain/readPdf.js +47 -0
- package/dist/vendor/placeholder-plain/readPdf.js.map +1 -0
- package/dist/vendor/placeholder-plain/readRefTable.d.ts +17 -0
- package/dist/vendor/placeholder-plain/readRefTable.d.ts.map +1 -0
- package/dist/vendor/placeholder-plain/readRefTable.js +84 -0
- package/dist/vendor/placeholder-plain/readRefTable.js.map +1 -0
- package/dist/vendor/placeholder-plain/xrefToRefMap.d.ts +3 -0
- package/dist/vendor/placeholder-plain/xrefToRefMap.d.ts.map +1 -0
- package/dist/vendor/placeholder-plain/xrefToRefMap.js +38 -0
- package/dist/vendor/placeholder-plain/xrefToRefMap.js.map +1 -0
- package/package.json +4 -5
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// Vendored from @signpdf/placeholder-plain@3.3.0 (MIT). See LICENSE-signpdf.md.
|
|
2
|
+
// Faithful TypeScript port — logic and byte-emitting paths are unchanged.
|
|
3
|
+
/* eslint-disable no-underscore-dangle */
|
|
4
|
+
import { DEFAULT_SIGNATURE_LENGTH, SUBFILTER_ADOBE_PKCS7_DETACHED, removeTrailingNewLine, PDFKitReferenceMock, } from "@signpdf/utils";
|
|
5
|
+
// NOT @signpdf/utils' PDFObject: that one splices any value containing "<<"
|
|
6
|
+
// into the dictionary raw and emits names unescaped, which lets caller-supplied
|
|
7
|
+
// option strings inject keys into the signature dictionary. See pdfObject.ts.
|
|
8
|
+
import { PDFObject } from "./pdfObject.js";
|
|
9
|
+
import { pdfkitAddPlaceholder } from "./pdfkitAddPlaceholder.js";
|
|
10
|
+
import getIndexFromRef from "./getIndexFromRef.js";
|
|
11
|
+
import readPdf from "./readPdf.js";
|
|
12
|
+
import getPageRef from "./getPageRef.js";
|
|
13
|
+
import createBufferRootWithAcroform from "./createBufferRootWithAcroform.js";
|
|
14
|
+
import createBufferPageWithAnnotation from "./createBufferPageWithAnnotation.js";
|
|
15
|
+
import createBufferTrailer from "./createBufferTrailer.js";
|
|
16
|
+
const getAcroFormRef = (slice) => {
|
|
17
|
+
const bufferRootWithAcroformRefRegex = /\/AcroForm\s+(\d+\s\d+\sR)/g;
|
|
18
|
+
const match = bufferRootWithAcroformRefRegex.exec(slice);
|
|
19
|
+
if (match != null && match[1] != null && match[1] !== "") {
|
|
20
|
+
return match[1];
|
|
21
|
+
}
|
|
22
|
+
return undefined;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Adds a signature placeholder to a PDF Buffer.
|
|
26
|
+
*
|
|
27
|
+
* This contrasts with the default pdfkit-based implementation.
|
|
28
|
+
* Parsing is done using simple string operations.
|
|
29
|
+
* Adding is done with `Buffer.concat`.
|
|
30
|
+
* This allows node-signpdf to be used on any PDF and
|
|
31
|
+
* not only on a freshly created through PDFKit one.
|
|
32
|
+
*/
|
|
33
|
+
export const plainAddPlaceholder = ({ pdfBuffer, reason, contactInfo, name, location, signingTime = undefined, signatureLength = DEFAULT_SIGNATURE_LENGTH, subFilter = SUBFILTER_ADOBE_PKCS7_DETACHED, widgetRect = [0, 0, 0, 0], appName = undefined, }) => {
|
|
34
|
+
let pdf = removeTrailingNewLine(pdfBuffer);
|
|
35
|
+
const info = readPdf(pdf);
|
|
36
|
+
const pageRef = getPageRef(pdf, info);
|
|
37
|
+
const pageIndex = getIndexFromRef(info.xref, pageRef);
|
|
38
|
+
const addedReferences = new Map();
|
|
39
|
+
const pdfKitMock = {
|
|
40
|
+
ref: (input, knownIndex) => {
|
|
41
|
+
info.xref.maxIndex += 1;
|
|
42
|
+
const index = knownIndex != null ? knownIndex : info.xref.maxIndex;
|
|
43
|
+
addedReferences.set(index, pdf.length + 1); // + 1 new line
|
|
44
|
+
pdf = Buffer.concat([
|
|
45
|
+
pdf,
|
|
46
|
+
Buffer.from("\n"),
|
|
47
|
+
Buffer.from(`${index} 0 obj\n`),
|
|
48
|
+
Buffer.from(PDFObject.convert(input)),
|
|
49
|
+
Buffer.from("\nendobj\n"),
|
|
50
|
+
]);
|
|
51
|
+
return new PDFKitReferenceMock(info.xref.maxIndex);
|
|
52
|
+
},
|
|
53
|
+
page: {
|
|
54
|
+
dictionary: new PDFKitReferenceMock(pageIndex, {
|
|
55
|
+
data: {
|
|
56
|
+
Annots: [],
|
|
57
|
+
},
|
|
58
|
+
}),
|
|
59
|
+
},
|
|
60
|
+
_root: {
|
|
61
|
+
data: {},
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
const acroFormRef = getAcroFormRef(info.root);
|
|
65
|
+
if (acroFormRef) {
|
|
66
|
+
pdfKitMock._root.data.AcroForm = acroFormRef;
|
|
67
|
+
}
|
|
68
|
+
const { form, widget } = pdfkitAddPlaceholder({
|
|
69
|
+
pdf: pdfKitMock,
|
|
70
|
+
pdfBuffer,
|
|
71
|
+
reason,
|
|
72
|
+
contactInfo,
|
|
73
|
+
name,
|
|
74
|
+
location,
|
|
75
|
+
signingTime,
|
|
76
|
+
signatureLength,
|
|
77
|
+
subFilter,
|
|
78
|
+
widgetRect,
|
|
79
|
+
appName,
|
|
80
|
+
});
|
|
81
|
+
if (!getAcroFormRef(pdf.toString())) {
|
|
82
|
+
const rootIndex = getIndexFromRef(info.xref, info.rootRef);
|
|
83
|
+
addedReferences.set(rootIndex, pdf.length + 1);
|
|
84
|
+
pdf = Buffer.concat([pdf, Buffer.from("\n"), createBufferRootWithAcroform(pdf, info, form)]);
|
|
85
|
+
}
|
|
86
|
+
addedReferences.set(pageIndex, pdf.length + 1);
|
|
87
|
+
pdf = Buffer.concat([
|
|
88
|
+
pdf,
|
|
89
|
+
Buffer.from("\n"),
|
|
90
|
+
createBufferPageWithAnnotation(pdf, info, pageRef, widget),
|
|
91
|
+
]);
|
|
92
|
+
pdf = Buffer.concat([pdf, Buffer.from("\n"), createBufferTrailer(pdf, info, addedReferences)]);
|
|
93
|
+
return pdf;
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=plainAddPlaceholder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plainAddPlaceholder.js","sourceRoot":"","sources":["../../../src/vendor/placeholder-plain/plainAddPlaceholder.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,0EAA0E;AAC1E,yCAAyC;AACzC,OAAO,EACL,wBAAwB,EACxB,8BAA8B,EAC9B,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AACxB,4EAA4E;AAC5E,gFAAgF;AAChF,8EAA8E;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAmB,MAAM,2BAA2B,CAAC;AAClF,OAAO,eAAe,MAAM,sBAAsB,CAAC;AACnD,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,4BAA4B,MAAM,mCAAmC,CAAC;AAC7E,OAAO,8BAA8B,MAAM,qCAAqC,CAAC;AACjF,OAAO,mBAAmB,MAAM,0BAA0B,CAAC;AAE3D,MAAM,cAAc,GAAG,CAAC,KAAa,EAAsB,EAAE;IAC3D,MAAM,8BAA8B,GAAG,6BAA6B,CAAC;IACrE,MAAM,KAAK,GAAG,8BAA8B,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACzD,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,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AAC;IAC/F,CAAC;IACD,eAAe,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC/C,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC;QAClB,GAAG;QACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;QACjB,8BAA8B,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC;KAC3D,CAAC,CAAC;IACH,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,mBAAmB,CAAC,GAAG,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;IAC/F,OAAO,GAAG,CAAC;AACb,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ReadRefTableReturnType } from "./readRefTable.js";
|
|
2
|
+
export declare const getValue: (trailer: Buffer, key: string) => string | undefined;
|
|
3
|
+
export interface ReadPdfReturnType {
|
|
4
|
+
xref: ReadRefTableReturnType;
|
|
5
|
+
rootRef: string;
|
|
6
|
+
root: string;
|
|
7
|
+
infoRef: string | undefined;
|
|
8
|
+
trailerStart: number;
|
|
9
|
+
previousXrefs: unknown[];
|
|
10
|
+
xRefPosition: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Simplified parsing of a PDF Buffer.
|
|
14
|
+
* Extracts reference table, root info and trailer start.
|
|
15
|
+
*
|
|
16
|
+
* See section 7.5.5 (File Trailer) of the PDF specs.
|
|
17
|
+
*/
|
|
18
|
+
declare const readPdf: (pdfBuffer: Buffer) => ReadPdfReturnType;
|
|
19
|
+
export default readPdf;
|
|
20
|
+
//# sourceMappingURL=readPdf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readPdf.d.ts","sourceRoot":"","sources":["../../../src/vendor/placeholder-plain/readPdf.ts"],"names":[],"mappings":"AAEA,OAAqB,EAAE,KAAK,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAG9E,eAAO,MAAM,QAAQ,GAAI,SAAS,MAAM,EAAE,KAAK,MAAM,KAAG,MAAM,GAAG,SAchE,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,sBAAsB,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,OAAO,EAAE,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;;GAKG;AACH,QAAA,MAAM,OAAO,GAAI,WAAW,MAAM,KAAG,iBAqBpC,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Vendored from @signpdf/placeholder-plain@3.3.0 (MIT). See LICENSE-signpdf.md.
|
|
2
|
+
// Faithful TypeScript port — logic and byte-emitting paths are unchanged.
|
|
3
|
+
import readRefTable from "./readRefTable.js";
|
|
4
|
+
import findObject from "./findObject.js";
|
|
5
|
+
export const getValue = (trailer, key) => {
|
|
6
|
+
let index = trailer.indexOf(key);
|
|
7
|
+
if (index === -1) {
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
const slice = trailer.slice(index);
|
|
11
|
+
index = slice.indexOf("/", 1);
|
|
12
|
+
if (index === -1) {
|
|
13
|
+
index = slice.indexOf(">", 1);
|
|
14
|
+
}
|
|
15
|
+
return slice
|
|
16
|
+
.slice(key.length + 1, index)
|
|
17
|
+
.toString()
|
|
18
|
+
.trim(); // key + at least one space
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Simplified parsing of a PDF Buffer.
|
|
22
|
+
* Extracts reference table, root info and trailer start.
|
|
23
|
+
*
|
|
24
|
+
* See section 7.5.5 (File Trailer) of the PDF specs.
|
|
25
|
+
*/
|
|
26
|
+
const readPdf = (pdfBuffer) => {
|
|
27
|
+
// Extract the trailer dictionary.
|
|
28
|
+
const trailerStart = pdfBuffer.lastIndexOf("trailer");
|
|
29
|
+
// The trailer is followed by xref. Then an EOF. EOF's length is 6 characters.
|
|
30
|
+
const trailer = pdfBuffer.slice(trailerStart, pdfBuffer.length - 6);
|
|
31
|
+
const xRefPosition = parseInt(trailer.slice(trailer.lastIndexOf("startxref") + 10).toString());
|
|
32
|
+
const refTable = readRefTable(pdfBuffer);
|
|
33
|
+
const rootRef = getValue(trailer, "/Root");
|
|
34
|
+
const root = findObject(pdfBuffer, refTable, rootRef).toString();
|
|
35
|
+
const infoRef = getValue(trailer, "/Info");
|
|
36
|
+
return {
|
|
37
|
+
xref: refTable,
|
|
38
|
+
rootRef,
|
|
39
|
+
root,
|
|
40
|
+
infoRef,
|
|
41
|
+
trailerStart,
|
|
42
|
+
previousXrefs: [],
|
|
43
|
+
xRefPosition,
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export default readPdf;
|
|
47
|
+
//# sourceMappingURL=readPdf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readPdf.js","sourceRoot":"","sources":["../../../src/vendor/placeholder-plain/readPdf.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,0EAA0E;AAC1E,OAAO,YAA6C,MAAM,mBAAmB,CAAC;AAC9E,OAAO,UAAU,MAAM,iBAAiB,CAAC;AAEzC,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,OAAe,EAAE,GAAW,EAAsB,EAAE;IAC3E,IAAI,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACjC,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;QACjB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACnC,KAAK,GAAG,KAAK,CAAC,OAAO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
1
|
+
export type FullXrefTable = Map<number, number>;
|
|
2
|
+
export interface ReadRefTableReturnType {
|
|
3
|
+
startingIndex: number;
|
|
4
|
+
maxIndex: number;
|
|
5
|
+
offsets: FullXrefTable;
|
|
6
|
+
}
|
|
7
|
+
interface GetXrefReturnType {
|
|
8
|
+
size: number;
|
|
9
|
+
prev: number | undefined;
|
|
10
|
+
xRefContent: Map<number, number>;
|
|
11
|
+
}
|
|
12
|
+
export declare const getLastTrailerPosition: (pdf: Buffer) => number;
|
|
13
|
+
export declare const getXref: (pdf: Buffer, position: number) => GetXrefReturnType;
|
|
14
|
+
export declare const getFullXrefTable: (pdf: Buffer) => FullXrefTable;
|
|
15
|
+
declare const readRefTable: (pdf: Buffer) => ReadRefTableReturnType;
|
|
16
|
+
export default readRefTable;
|
|
17
|
+
//# sourceMappingURL=readRefTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readRefTable.d.ts","sourceRoot":"","sources":["../../../src/vendor/placeholder-plain/readRefTable.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEhD,MAAM,WAAW,sBAAsB;IACrC,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,aAAa,CAAC;CACxB;AAED,UAAU,iBAAiB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,eAAO,MAAM,sBAAsB,GAAI,KAAK,MAAM,KAAG,MAOpD,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,KAAK,MAAM,EAAE,UAAU,MAAM,KAAG,iBAsDvD,CAAC;AAYF,eAAO,MAAM,gBAAgB,GAAI,KAAK,MAAM,KAAG,aAG9C,CAAC;AAEF,QAAA,MAAM,YAAY,GAAI,KAAK,MAAM,KAAG,sBASnC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// Vendored from @signpdf/placeholder-plain@3.3.0 (MIT). See LICENSE-signpdf.md.
|
|
2
|
+
// Faithful TypeScript port — logic and byte-emitting paths are unchanged.
|
|
3
|
+
// (Upstream carried `prev` as the matched digit string and let Buffer.slice
|
|
4
|
+
// coerce it; parseInt of an all-digit string yields the identical position.)
|
|
5
|
+
import { SignPdfError } from "@signpdf/utils";
|
|
6
|
+
import xrefToRefMap from "./xrefToRefMap.js";
|
|
7
|
+
export const getLastTrailerPosition = (pdf) => {
|
|
8
|
+
const trailerStart = pdf.lastIndexOf(Buffer.from("trailer", "utf8"));
|
|
9
|
+
const trailer = pdf.slice(trailerStart, pdf.length - 6);
|
|
10
|
+
const xRefPosition = trailer
|
|
11
|
+
.slice(trailer.lastIndexOf(Buffer.from("startxref", "utf8")) + 10)
|
|
12
|
+
.toString();
|
|
13
|
+
return parseInt(xRefPosition);
|
|
14
|
+
};
|
|
15
|
+
export const getXref = (pdf, position) => {
|
|
16
|
+
let refTable = pdf.slice(position); // slice starting from where xref starts
|
|
17
|
+
const realPosition = refTable.indexOf(Buffer.from("xref", "utf8"));
|
|
18
|
+
if (realPosition === -1) {
|
|
19
|
+
throw new SignPdfError(`Could not find xref anywhere at or after ${position}.`, SignPdfError.TYPE_PARSE);
|
|
20
|
+
}
|
|
21
|
+
if (realPosition > 0) {
|
|
22
|
+
const prefix = refTable.slice(0, realPosition);
|
|
23
|
+
if (prefix.toString().replace(/\s*/g, "") !== "") {
|
|
24
|
+
throw new SignPdfError(`Expected xref at ${position} but found other content.`, SignPdfError.TYPE_PARSE);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const nextEofPosition = refTable.indexOf(Buffer.from("%%EOF", "utf8"));
|
|
28
|
+
if (nextEofPosition === -1) {
|
|
29
|
+
throw new SignPdfError("Expected EOF after xref and trailer but could not find one.", SignPdfError.TYPE_PARSE);
|
|
30
|
+
}
|
|
31
|
+
refTable = refTable.slice(0, nextEofPosition);
|
|
32
|
+
refTable = refTable.slice(realPosition + 4); // move ahead with the "xref"
|
|
33
|
+
refTable = refTable.slice(refTable.indexOf("\n") + 1); // move after the next new line
|
|
34
|
+
// extract the size
|
|
35
|
+
const sizeString = refTable.toString().split("/Size")[1];
|
|
36
|
+
if (!sizeString) {
|
|
37
|
+
throw new SignPdfError("Size not found in xref table.", SignPdfError.TYPE_PARSE);
|
|
38
|
+
}
|
|
39
|
+
const sizeMatch = /^\s*(\d+)/.exec(sizeString);
|
|
40
|
+
if (sizeMatch === null) {
|
|
41
|
+
throw new SignPdfError("Failed to parse size of xref table.", SignPdfError.TYPE_PARSE);
|
|
42
|
+
}
|
|
43
|
+
const size = parseInt(sizeMatch[1]);
|
|
44
|
+
const [objects, infos] = refTable.toString().split("trailer");
|
|
45
|
+
const isContainingPrev = infos.split("/Prev")[1] != null;
|
|
46
|
+
let prev;
|
|
47
|
+
if (isContainingPrev) {
|
|
48
|
+
const pagesRefRegex = /Prev (\d+)/g;
|
|
49
|
+
const match = pagesRefRegex.exec(infos);
|
|
50
|
+
const [, prevPosition] = match;
|
|
51
|
+
prev = parseInt(prevPosition);
|
|
52
|
+
}
|
|
53
|
+
const xRefContent = xrefToRefMap(objects);
|
|
54
|
+
return {
|
|
55
|
+
size,
|
|
56
|
+
prev,
|
|
57
|
+
xRefContent,
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
const getFullXref = (pdf, xRefPosition) => {
|
|
61
|
+
const lastXrefTable = getXref(pdf, xRefPosition);
|
|
62
|
+
if (lastXrefTable.prev === undefined) {
|
|
63
|
+
return lastXrefTable.xRefContent;
|
|
64
|
+
}
|
|
65
|
+
const partOfXrefTable = getFullXref(pdf, lastXrefTable.prev);
|
|
66
|
+
const mergedXrefTable = new Map([...partOfXrefTable, ...lastXrefTable.xRefContent]);
|
|
67
|
+
return mergedXrefTable;
|
|
68
|
+
};
|
|
69
|
+
export const getFullXrefTable = (pdf) => {
|
|
70
|
+
const lastTrailerPosition = getLastTrailerPosition(pdf);
|
|
71
|
+
return getFullXref(pdf, lastTrailerPosition);
|
|
72
|
+
};
|
|
73
|
+
const readRefTable = (pdf) => {
|
|
74
|
+
const fullXrefTable = getFullXrefTable(pdf);
|
|
75
|
+
const startingIndex = 0;
|
|
76
|
+
const maxIndex = Math.max(...fullXrefTable.keys());
|
|
77
|
+
return {
|
|
78
|
+
startingIndex,
|
|
79
|
+
maxIndex,
|
|
80
|
+
offsets: fullXrefTable,
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
export default readRefTable;
|
|
84
|
+
//# sourceMappingURL=readRefTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readRefTable.js","sourceRoot":"","sources":["../../../src/vendor/placeholder-plain/readRefTable.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,0EAA0E;AAC1E,4EAA4E;AAC5E,6EAA6E;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAgB7C,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,GAAW,EAAU,EAAE;IAC5D,MAAM,YAAY,GAAG,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;IACrE,MAAM,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,YAAY,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACxD,MAAM,YAAY,GAAG,OAAO;SACzB,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC;SACjE,QAAQ,EAAE,CAAC;IACd,OAAO,QAAQ,CAAC,YAAY,CAAC,CAAC;AAChC,CAA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,0 +1,38 @@
|
|
|
1
|
+
// Vendored from @signpdf/placeholder-plain@3.3.0 (MIT). See LICENSE-signpdf.md.
|
|
2
|
+
// Faithful TypeScript port — logic and byte-emitting paths are unchanged.
|
|
3
|
+
import { SignPdfError } from "@signpdf/utils";
|
|
4
|
+
const xrefToRefMap = (xrefString) => {
|
|
5
|
+
const lines = xrefString.split("\n").filter((l) => l !== "");
|
|
6
|
+
let index = 0;
|
|
7
|
+
let expectedLines = 0;
|
|
8
|
+
const xref = new Map();
|
|
9
|
+
lines.forEach((line) => {
|
|
10
|
+
const split = line.split(" ");
|
|
11
|
+
if (split.length === 2) {
|
|
12
|
+
index = parseInt(split[0]);
|
|
13
|
+
expectedLines = parseInt(split[1]);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (expectedLines <= 0) {
|
|
17
|
+
throw new SignPdfError("Too many lines in xref table.", SignPdfError.TYPE_PARSE);
|
|
18
|
+
}
|
|
19
|
+
expectedLines -= 1;
|
|
20
|
+
const [offset, , inUse] = split;
|
|
21
|
+
if (inUse.trim() === "f") {
|
|
22
|
+
index += 1;
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (inUse.trim() !== "n") {
|
|
26
|
+
throw new SignPdfError(`Unknown in-use flag "${inUse}". Expected "n" or "f".`, SignPdfError.TYPE_PARSE);
|
|
27
|
+
}
|
|
28
|
+
if (!/^\d+$/.test(offset.trim())) {
|
|
29
|
+
throw new SignPdfError(`Expected integer offset. Got "${offset}".`, SignPdfError.TYPE_PARSE);
|
|
30
|
+
}
|
|
31
|
+
const storeOffset = parseInt(offset.trim());
|
|
32
|
+
xref.set(index, storeOffset);
|
|
33
|
+
index += 1;
|
|
34
|
+
});
|
|
35
|
+
return xref;
|
|
36
|
+
};
|
|
37
|
+
export default xrefToRefMap;
|
|
38
|
+
//# sourceMappingURL=xrefToRefMap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xrefToRefMap.js","sourceRoot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AAyB,EACtD,YAAY,CAAC,UAAU,CACxB,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;YACjC,MAAM,IAAI,YAAY,CAAC,iCAAiC,MAAM,IAAI,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC;QAC/F,CAAC;QACD,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QAC5C,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QAC7B,KAAK,IAAI,CAAC,CAAC;IACb,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-sig/core",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Self-contained PKCS#7 PDF signing
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"description": "Self-contained PKCS#7 PDF signing \u2014 no SaaS, no metering, no per-doc fees. Render\u2192sign\u2192verify engine + pluggable persistence interfaces + end-to-end signDocument() orchestrator.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"LICENSE"
|
|
42
42
|
],
|
|
43
43
|
"scripts": {
|
|
44
|
-
"build": "tsc -p tsconfig.build.json",
|
|
44
|
+
"build": "tsc -p tsconfig.build.json && node -e \"fs.copyFileSync('src/vendor/placeholder-plain/LICENSE-signpdf.md','dist/vendor/placeholder-plain/LICENSE-signpdf.md')\"",
|
|
45
45
|
"clean": "rm -rf dist",
|
|
46
46
|
"prepublishOnly": "npm run clean && npm run build",
|
|
47
47
|
"pretest": "npm run build",
|
|
@@ -75,7 +75,6 @@
|
|
|
75
75
|
"homepage": "https://github.com/vmvtech/esig-suite/tree/main/packages/esig-core#readme",
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"@noble/post-quantum": "^0.6.1",
|
|
78
|
-
"@signpdf/placeholder-plain": "^3.3.0",
|
|
79
78
|
"@signpdf/signpdf": "^3.3.0",
|
|
80
79
|
"@signpdf/utils": "^3.3.0",
|
|
81
80
|
"node-forge": "^1.4.0",
|
|
@@ -94,7 +93,7 @@
|
|
|
94
93
|
"@types/node": "^22.0.0",
|
|
95
94
|
"@types/node-forge": "^1.3.0",
|
|
96
95
|
"typescript": "^5.4.0",
|
|
97
|
-
"vitest": "^
|
|
96
|
+
"vitest": "^4.1.10"
|
|
98
97
|
},
|
|
99
98
|
"publishConfig": {
|
|
100
99
|
"registry": "https://registry.npmjs.org",
|