@embedpdf/core-signature
v3.3.0
Published
Digital signatures for EmbedPDF: signs a PDF and validates the signatures it has. No DOM.
Readme
@embedpdf/core-signature
Digital signatures for EmbedPDF: signs a PDF and validates the signatures it has. No DOM.
Digital signatures
A digital signature seals a PDF as it was at the moment of signing. The engine reads every signature in a document, tells you what changed after it, and signs a field for you. It never sees your private key: it hands you the fingerprint of the file (a digest), your key signs it, and the engine writes the result into the PDF.
import { sign, webCryptoSigner } from '@embedpdf/core-signature';
const { signatures } = await doc.signatures.list();
const field = signatures.find((signature) => !signature.signed)!.field;
await sign(doc, {
field,
key: webCryptoSigner({ privateKey, certificateChain }),
signer: { name: 'Ada Lovelace', reason: 'Approved' },
});Signing needs doc.sign, and doc.forms.read to find the field with list(); see
Permissions.
The cryptography (building a signature from a key, checking one against its certificate) lives in its own package, which works with both engines:
npm install @embedpdf/core-signatureIt runs in every modern browser, and in Node from 22.12 on (on Node 20, from 20.19): see In Node.
Documentation
- Digital signatures: Check who signed a PDF and what changed since, sign a signature field with your own key or signing service, timestamp the signature, keep it checkable for years, and certify a document.
License
Apache-2.0
