JSPM

elliptic-utils

0.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q24178F
  • License MIT

This module provides native bindings to ecdsa fully compliant ISO requirement functions

Package Exports

  • elliptic-utils
  • elliptic-utils/elliptic.js
  • elliptic-utils/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (elliptic-utils) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

This project is for secp256r1 EC operations. The original version is forked from https://github.com/cryptocoinjs/secp256k1-node

secp256r1-node

Installation

npm i secp256r1

Usage

const { randomBytes } = require('crypto')
const secp256r1 = require('secp256r1')
// or require('secp256r1/elliptic')
//   if you want to use pure js implementation in node

// generate message to sign
const msg = randomBytes(32)

// generate privKey
let privKey
do {
  privKey = randomBytes(32)
} while (!secp256r1.privateKeyVerify(privKey))

// get the public key in a compressed format
const pubKey = secp256r1.publicKeyCreate(privKey)

// sign the message
const sigObj = secp256r1.sign(msg, privKey)

// verify the signature
console.log(secp256r1.verify(msg, sigObj.signature, pubKey))
// => true

LICENSE

This library is free and open-source software released under the MIT license.