{"name":"secp256k1","version":"3.5.2","description":"This module provides native bindings to ecdsa secp256k1 functions","keywords":["ec","ecdh","ecdsa","secp256k1"],"bugs":{"url":"https://github.com/cryptocoinjs/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","email":"fanatid@ya.ru","url":"https://github.com/fanatid"}],"files":["lib","src","API.md","binding.gyp","bindings.js","elliptic.js","index.js","js.js","utils/has_lib.sh"],"main":"./index.js","repository":{"type":"git","url":"git+https://github.com/cryptocoinjs/secp256k1-node.git"},"scripts":{"coverage":"RANDOM_TESTS_REPEAT=1 nyc tape test/index.js","coverage-lcov":"npm run coverage && nyc report -r lcov","install":"npm run rebuild || echo \"Secp256k1 bindings compilation fail. Pure JS implementation will be used.\"","lint":"standard","rebuild":"node-gyp rebuild","test":"npm run lint && npm run unit","test:browser":"karma start karma.conf.js","unit":"tape test/index.js"},"dependencies":{"bindings":"^1.2.1","bip66":"^1.1.3","bn.js":"^4.11.3","create-hash":"^1.1.2","drbg.js":"^1.0.1","elliptic":"^6.2.3","nan":"^2.2.1","safe-buffer":"^5.1.0"},"devDependencies":{"bignum":"^0.13.0","browserify":"^14.4.0","karma":"^1.3.0","karma-browserify":"^5.0.4","karma-chrome-launcher":"^2.0.0","karma-detect-browsers":"^2.1.0","karma-env-preprocessor":"^0.1.1","karma-firefox-launcher":"^1.0.0","karma-tap":"^3.1.1","node-gyp":"^3.3.1","nyc":"^11.0.2","standard":"*","tape":"^4.5.1","xorshift.js":"^1.0.3"},"engines":{"node":">=4.0.0"},"gypfile":true,"browser":{"./index.js":"./elliptic.js"},"gitHead":"25a4b6cb567b49a40f47f50c5ca9a756f5343e4d","homepage":"https://github.com/cryptocoinjs/secp256k1-node#readme","_id":"secp256k1@3.5.2","_npmVersion":"5.6.0","_nodeVersion":"8.11.2","_npmUser":{"name":"fanatid","email":"fanatid@ya.ru"},"dist":{"integrity":"sha512-iin3kojdybY6NArd+UFsoTuapOF7bnJNf2UbcWXaY3z+E1sJDipl60vtzB5hbO/uquBu7z0fd4VC4Irp+xoFVQ==","shasum":"f95f952057310722184fe9c914e6b71281f2f2ae","tarball":"http://registry-npm.ywwl.com/secp256k1/download/secp256k1-3.5.2.tgz","fileCount":121,"unpackedSize":931591,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbfRoaCRA9TVsSAnZWagAADdgQAJ9W/z0vEyfTnaR3u5T3\n6g3uSAazCP+gub89kw1w4tzC4XZbP88OLROlf2ynPY4td21AFNkuPVUneTnR\nW+ehevj2jRgibowzooO2NOd8rDID+2I+jVLmra7m0iQ2TWO/Flg3l1O+16hh\nNaVEAJA0nPE2/OwhAEkD0OB8CdZBaqIJlfrqY/sRAwyybKXWiY6WWY4Kb1R4\ncsczTwQkbC0a9LyNGRngZ8bxZzGOxiXw+ysmnx9NLak8TbcsF8LZthCmpERM\ncevF4JKz+pW6t8A8fEugSqhp4iYhJMhpvo+EPiN3erJnL4VtWmGu5GqRqn3l\nA7MyDvhpPaizlvjO+B8QLOIjApXl6Ga1Bt7PBSjC/sNx6sBeoxXuWOyYlAF+\nX6Lo9oCR6L4LWnB3Y4av+T76T/NPh+3SiylyuvQVKANgl+SXqlcclzIR5b/q\nRRj9BaexsG/ajYVoPo1nfVbpsQbB64VdD2Kxpqh8PgiVd33PriehCfnsjUr+\nieoLTVkuHW9F+5dQwgfnJqNNnm5PI9TzS9duo0eggmc9Gx6sXFIPeOCjbZwi\nqWhk2MD07z5pNIlEFNy0Q5HcXR6jU9F+OpNkYM1xo5+K07XZgU2Yrkn6AmPY\n6qp2ILM4AgLL6fXRkKEk57TVXCbfriwvDhFoH6Qf8YKPIajmH5I5LE7lHpMC\nChrY\r\n=FsX8\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE2GUV4cI9txA34jg1MiehIkYB6lZeMvJd8hODBEeI36AiEA6VZDouNJUF8RLDkV5YxW7+Ib5i9riYeRpt+UMYDNodw="}],"size":176835,"noattachment":false,"key":"/secp256k1/-/secp256k1-3.5.2.tgz"},"maintainers":[{"name":"fanatid","email":"fanatid@ya.ru"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/secp256k1_3.5.2_1534925338021_0.993257081078537"},"_hasShrinkwrap":false,"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":1534925338149,"_cnpm_publish_time":1534925338149,"dist-tags":{"latest":"5.0.2"}}