Show / Hide Table of Contents
Edit on GitHub

Node.js MVC samples project

The Node.js MVC samples project shows how to use Rest PKI together with Web PKI on a Node.js project following the Model-View-Controller pattern. It is hosted on GitHub at:

https://github.com/LacunaSoftware/RestPkiSamples/tree/master/NodeJS/mvc

Running the project

  1. Download the project or clone the repository
  2. Generate an API access token on the REST PKI website
  3. Paste your access token on the file util.js
  4. Install dependencies: npm install
  5. Run application: npm start
  6. Access the URL http://localhost:3000

Project map

This section lists where to find the relevant parts in each feature sample on the project.

Authentication with digital certificate

  • Route: authentication.js
  • Views:
    • authentication.pug (JavaScript on signature-form.js)
    • authentication-fail.pug

PAdES signature with file already on server

  • Route: pades-signature.js
  • Views:
    • pades-signature.pug (JavaScript on signature-form.js)
    • pades-signature-complete.pug

PAdES signature with file uploaded by user

After the file upload (which is crudely implemented merely for demonstration purposes on the route upload.js and view upload.pug) is done the control flow is the same as in the sample PAdES signature with file already on server, but with the URL parameter userfile filled.

PAdES co-signature

After the control flow of the sample PAdES signature with file already on server is completed and the link Co-sign with another certificate is clicked, the same control flow is repeated, but now with the URL parameter userfile filled.

PAdES marks

Not yet available on this project.

PAdES signature using server key

  • Route: pades-signature-server-key.js
  • View: pades-signature-complete.pug

PAdES signature without client communication

Not yet available on this project.

Open/validate an existing PAdES signature

  • Route: open-pades-signature.js
  • View: open-pades-signature.pug

Printer-friendly version

After the control flow of the sample PAdES signature with file already on server is completed and the link Download a printer-friendly version of the signed file is clicked, the flow goes to the file printer-friendly-version.js with the URL parameter file filled.

CAdES signature with file already on server

  • Route: cades-signature.js
  • Views:
    • cades-signature.pug (JavaScript on signature-form.js)
    • cades-signature-complete.pug

CAdES signature with file uploaded by user

After the file upload (which is crudely implemented merely for demonstration purposes on the route upload.js and view upload.pug) is done the control flow is the same as in the sample CAdES signature with file already on server, but with the URL parameter userfile filled.

CAdES co-signature

After the control flow of the sample CAdES signature with file already on server is completed and the link Co-sign with another certificate is clicked, the same control flow is repeated, but now with the URL parameter cmsfile filled.

CAdES signature using server key

  • Route: cades-signature-server-key.js
  • View: cades-signature-complete.pug

Open/validate an existing CAdES signature

  • Route: open-cades-signature.js
  • View: open-cades-signature.pug

XML signature of the entire document

  • Route: xml-full-signature.js
  • Views:
    • xml-full-signature.pug (JavaScript on signature-form.js)
    • xml-signature-complete.pug

XML signature of an element

  • Route: xml-element-signature.js
  • Views:
    • xml-element-signature.pug (JavaScript on signature-form.js)
    • xml-signature-complete.pug

XAdES signature of an element

Not yet available on this project.

Open/validate signatures on an existing XML file

Not yet available on this project.

Batch of PAdES signatures

Not yet available on this project.

Optimized batch of PAdES signatures

Not yet available on this project.

Batch of CAdES signatures

Not yet available on this project.

Batch of XML signatures of elements on the same document

Not yet available on this project.

Back to top Copyright © 2015-2020 Lacuna Software