{"name":"secp256k1","version":"2.0.0","description":"This module provides native bindings to ecdsa secp256k1 functions","keywords":["secp256k1","ecdsa","ec"],"bugs":{"url":"https://github.com/wanderer/secp256k1-node/issues"},"license":"MIT","author":{"name":"martin becze","email":"mjbecze@gmail.com"},"contributors":[{"name":"Aaron Davis","url":"https://github.com/kumavis"},{"name":"Ian Matyssik","url":"https://github.com/phpb-com"},{"name":"Kagami Hiiragi","email":"kagami@genshiken.org","url":"http://kagami.genshiken.org/"},{"name":"ethers","url":"https://github.com/ethers"},{"name":"Kirill Fomichev fanatid@ya.ru","url":"https://github.com/fanatid"}],"main":"./bindings.js","repository":{"type":"git","url":"git+https://github.com/wanderer/secp256k1-node.git"},"scripts":{"clean":"node-gyp clean","coverage":"istanbul cover _mocha","coveralls":"npm run coverage && coveralls <coverage/lcov.info","install":"npm run rebuild","lint":"eslint src test","rebuild":"node-gyp rebuild","test":"npm run test:node && npm run test:browser","test:browser":"karma start karma.conf.js","test:node":"istanbul test _mocha -- --reporter spec"},"dependencies":{"bindings":"^1.2.1","bluebird":"^3.0.2","bn.js":"^4.1.1","elliptic":"^6.0.1","nan":"^2.0.9","object-assign":"^4.0.1"},"devDependencies":{"bigi":"^1.3.0","chai":"^3.4.0","chai-as-promised":"^5.1.0","coveralls":"^2.11.4","ecdsa":"^0.6.0","eckey":"^0.8.0","ecurve":"^1.0.2","eslint":"^1.7.3","eslint-config-standard":"^4.4.0","eslint-plugin-standard":"^1.3.1","istanbul":"^0.4.0","karma":"^0.13.14","karma-browserify":"^4.4.0","karma-chrome-launcher":"^0.2.1","karma-detect-browsers":"^2.0.2","karma-env-preprocessor":"^0.1.1","karma-firefox-launcher":"^0.1.6","karma-mocha":"^0.2.0","mocha":"^2.3.3","node-gyp":"^3.0.3","progress":"^1.1.8"},"gypfile":true,"browser":{"./bindings.js":"./js.js"},"gitHead":"2ad4e91a10fe6e8caa0668641584cd66a4ce00c3","homepage":"https://github.com/wanderer/secp256k1-node#readme","_id":"secp256k1@2.0.0","_shasum":"40a8193c589b1d49497456409a7a45746e42ec88","_from":".","_npmVersion":"3.3.8","_nodeVersion":"4.2.1","_npmUser":{"name":"null_radix","email":"mjbecze@gmail.com"},"dist":{"shasum":"40a8193c589b1d49497456409a7a45746e42ec88","tarball":"http://registry-npm.ywwl.com/secp256k1/download/secp256k1-2.0.0.tgz","integrity":"sha512-wFCED7WXJyJ1pkmx9ZLOoLSadUeihgHebAywbmqgTw9JblydweQKrudbK+QnbSJ671cSdUm3DI8aeeUmP/Bc0A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDxC95vB9Pg6u7nzQFmb+ttg9K2p7xQpULbME2DkbVIawIhAIZE05wegPDdYgxFoMx0WAN9jU1b1YIjfxZ4AeNahpDv"}],"size":19961,"noattachment":false,"key":"/secp256k1/-/secp256k1-2.0.0.tgz"},"maintainers":[{"name":"null_radix","email":"mjbecze@gmail.com"}],"directories":{},"readme":"# secp256k1-node\n\nThis module provides native bindings to [bitcoin-core/secp256k1](https://github.com/bitcoin-core/secp256k1). In browser [elliptic](https://github.com/indutny/elliptic) will be used as fallback.\n\nWorks on node version 14.0.0 or greater, because use [N-API](https://nodejs.org/api/n-api.html).\n\n## Installation\n\n##### from npm\n\n`npm install secp256k1`\n\n##### from git\n\n```\ngit clone git@github.com:cryptocoinjs/secp256k1-node.git\ncd secp256k1-node\ngit submodule update --init\nnpm install\n```\n\n##### Windows\n\nThe easiest way to build the package on windows is to install [windows-build-tools](https://github.com/felixrieseberg/windows-build-tools).\n\nOr install the following software:\n\n  * Git: https://git-scm.com/download/win\n  * nvm: https://github.com/coreybutler/nvm-windows\n  * Python 2.7: https://www.python.org/downloads/release/python-2712/\n  * Visual C++ Build Tools: http://landinghub.visualstudio.com/visual-cpp-build-tools (Custom Install, and select both Windows 8.1 and Windows 10 SDKs)\n\nAnd run commands:\n\n```\nnpm config set msvs_version 2015 --global\nnpm install npm@next -g\n```\n\nBased on:\n\n  * https://github.com/nodejs/node-gyp/issues/629#issuecomment-153196245\n  * https://github.com/nodejs/node-gyp/issues/972\n\n## Usage\n\n* [API Reference (v4.x)](API.md) (current version)\n* [API Reference (v3.x)](https://github.com/cryptocoinjs/secp256k1-node/blob/v3.x/API.md)\n* [API Reference (v2.x)](https://github.com/cryptocoinjs/secp256k1-node/blob/v2.x/API.md)\n\n##### Private Key generation, Public Key creation, signature creation, signature verification\n\n```js\nconst { randomBytes } = require('crypto')\nconst secp256k1 = require('secp256k1')\n// or require('secp256k1/elliptic')\n//   if you want to use pure js implementation in node\n\n// generate message to sign\n// message should have 32-byte length, if you have some other length you can hash message\n// for example `msg = sha256(rawMessage)`\nconst msg = randomBytes(32)\n\n// generate privKey\nlet privKey\ndo {\n  privKey = randomBytes(32)\n} while (!secp256k1.privateKeyVerify(privKey))\n\n// get the public key in a compressed format\nconst pubKey = secp256k1.publicKeyCreate(privKey)\n\n// sign the message\nconst sigObj = secp256k1.ecdsaSign(msg, privKey)\n\n// verify the signature\nconsole.log(secp256k1.ecdsaVerify(sigObj.signature, msg, pubKey))\n// => true\n```\n\n\\* **.verify return false for high signatures**\n\n##### Get X point of ECDH\n\n```js\nconst { randomBytes } = require('crypto')\n// const secp256k1 = require('./elliptic')\nconst secp256k1 = require('./')\n\n// generate privKey\nfunction getPrivateKey () {\n  while (true) {\n    const privKey = randomBytes(32)\n    if (secp256k1.privateKeyVerify(privKey)) return privKey\n  }\n}\n\n// generate private and public keys\nconst privKey = getPrivateKey()\nconst pubKey = secp256k1.publicKeyCreate(privKey)\n\n// compressed public key from X and Y\nfunction hashfn (x, y) {\n  const pubKey = new Uint8Array(33)\n  pubKey[0] = (y[31] & 1) === 0 ? 0x02 : 0x03\n  pubKey.set(x, 1)\n  return pubKey\n}\n\n// get X point of ecdh\nconst ecdhPointX = secp256k1.ecdh(pubKey, privKey, { hashfn }, Buffer.alloc(33))\nconsole.log(ecdhPointX.toString('hex'))\n```\n\n## LICENSE\n\nThis library is free and open-source software released under the MIT license.\n","publish_time":1446692206696,"_cnpm_publish_time":1446692206696,"dist-tags":{"latest":"5.0.2"}}