Plain JavaScript and JQuery

UUIDs

In order to generate unique IDs, the Authentication Service Team recommends to use node-uuid (https://www.npmjs.com/package/uuid) which has a browser ready version. 

Cryptography

Important:  Cryptographic operations on browsers with JavaScript come with several drawbacks:
  • Security first, a browser is never to be fully trusted, as you cannot know how secured the environment it runs in is. JavaScript injections, CORS (Cross domain origins) can be serious threats.
  • Then performance and user experience, indeed JavaScript is a slow technology, especially when it comes to cryptographic operations. Moreover, using a third party may require to download big payloads, which can still be a problem with slow mobile networks.
  • The reliability of third parties. A lot of third parties are publishing libraries for cryptography with JavaScript, the choice might be difficult. The Authentication Service Team identified node-jose (https://developer.cisco.com/codeexchange/github/repo/cisco/node-jose/) as a fair/secured and efficient choice.
  • Finally compatibility. JavaScript comes with a native WebCrypto API (https://www.w3.org/TR/WebCryptoAPI/) that seems to be optimal. However, Microsoft Internet Explorer supports it only partially and only since IE 11.

The Authentication Service recommends to prefer server side technologies for every cryptographic operations.

However, in the case that your project requires to have those operations done within browsers, the Authentication Service Team recommends to use:

The Authentication Service Team recommends to use forge (https://github.com/digitalbazaar/forge) to carry out multi-platform compatible (Internet Explorer >= 10) cryptographic operations. 

Simply download forge using Node.JS npm: 

npm install node-forge

In the "node_modules\node-forge\dist" folder of your environment, you will find browser ready distribution files such as "forge.min.js", simply include this file as a JavaScript script in your HTML page. 

Topics in this section: