Elliptic Curve Digital Signature Algorithm For jQuery - ECDSA

Elliptic Curve Digital Signature Algorithm For jQuery - ECDSA
File Size: 11.1 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

An Elliptic Curve Digital Signature Algorithm plugin for jQuery that lets you generate ECDSA signature, private key, and public key using the Web Crypto API.

How to use it:

1. Install the jQuery ECDSA with NPM.

# NPM
$ npm install jquery-ecdsa --save

2. Load the jQuery ECDSA plugin from the dist folder.

<script src="/path/to/jquery.min.js"></script>
<script src="/dist/jq-ecdsa.min.js"></script>

3. Or from the CDN.

<script src="/path/to/jquery.min.js"></script>
<script src="https://unpkg.com/jquery-ecdsa"></script>

4. Generate ECDSA keys using the $.ecGen method. Available parameters:

  • curve: '256', '384', or '521'
  • cb: callback function
// $.ecGen(curve, cb)
$.ecGen('384', function(err,res){
  // do something
})

5. Generate a ECDSA sign from the data you provide. Available parameters:

  • key: valid key
  • data: data to be signed
  • hash: '128', '256', or '512'
  • digest: 'hex', 'base64', or 'Uint8'
  • cb: callback function
// $.ecGen(curve, cb)
$.ecGen('384', function(err,res){
  // do something
})

6. Verify the generated signature. Available parameters:

  • key: valid key
  • sig: signature
  • hash: '128', '256', or '512'
  • digest: 'hex', 'base64', or 'Uint8'
  • cb: callback function
$.ecVerify(key, sig, data, hash, digest, cb)

This awesome jQuery plugin is developed by angeal185. For more Advanced Usages, please check the demo page or visit the official website.