Integrations
Integrate Criipto Signatures with Node.js to sign PDFs using MitID, Swedish BankID, Norwegian BankId or other eIDs.
This guide shows you how to use implement Criipto Signatures in Node.js to sign PAdeS-LTA documents using MitID, BankID or any other eID supported by Criipto.
This library supports Node 16 and later.
The SDK is available on NPM:
npm install --save @criipto/signatures
yarn add @criipto/signatures
import CriiptoSignatures from '@criipto/signatures';
const client = new CriiptoSignatures("{YOUR_CRIIPTO_CLIENT_ID}", "{YOUR_CRIIPTO_CLIENT_SECRET}");
Create a signature order by
import CriiptoSignatures from '@criipto/signatures';
const client = new CriiptoSignatures("{YOUR_CRIIPTO_CLIENT_ID}", "{YOUR_CRIIPTO_CLIENT_SECRET}");
// Create signature order
const signatureOrder = await client.createSignatureOrder({
title: "Node.js sample",
documents: [
{
pdf: {
title: "Node.js Sample",
blob: pdf.toString('base64'),
storageMode: 'Temporary'
}
}
]
});
// ... store the signatureOrder.id
Signatories are the individuals you wish to sign your documents.
import CriiptoSignatures from '@criipto/signatures';
const signatureOrderId = "..." // The id from when you previosuly created the signature order
// Add signatory to signature order
var signatory = await client.addSignatory(signatureOrderId);
console.log(signatory.href); // The signatory.href is the signing link that you can show or send to your users
Once everyone has signed you must close the signature order to finalize the process and extract the signed documents.
const client = new CriiptoSignatures("{YOUR_CRIIPTO_CLIENT_ID}", "{YOUR_CRIIPTO_CLIENT_SECRET}");
var signatureOrderId = "..." // The id from when you previosuly created the signature order
// Close signature order
var closedSignatureOrder = await client.closeSignatureOrder(signatureOrderId);
closedSignatureOrder.documents.forEach(document => {
// document.blob is a Buffer containing the signed PDF
});
More Node.js examples are provided for all the options supported by the Criipto Signatures API.