{"id":17685959,"url":"https://github.com/lionello/secp256k1-js","last_synced_at":"2025-08-21T01:13:00.421Z","repository":{"id":40693612,"uuid":"128745646","full_name":"lionello/secp256k1-js","owner":"lionello","description":"Pure JS implementation of secp256k1 signing, verification, recovery ECDSA.","archived":false,"fork":false,"pushed_at":"2025-04-24T13:38:00.000Z","size":155,"stargazers_count":30,"open_issues_count":4,"forks_count":16,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-02T16:00:08.864Z","etag":null,"topics":["bitcoin","blockchain","ecc","ecc-algorithms","ecdsa","elliptic-curves","ethereum","javascript","nodejs","secp256k1"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lionello.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-04-09T09:15:13.000Z","updated_at":"2025-04-24T13:36:59.000Z","dependencies_parsed_at":"2025-04-13T04:16:50.734Z","dependency_job_id":"a26a1bda-cb25-4817-a495-9235c81d0a5a","html_url":"https://github.com/lionello/secp256k1-js","commit_stats":{"total_commits":28,"total_committers":4,"mean_commits":7.0,"dds":0.1785714285714286,"last_synced_commit":"821158f075c212239c5397043189f3c4b4a0f924"},"previous_names":["enumatech/secp256k1-js"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/lionello/secp256k1-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lionello%2Fsecp256k1-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lionello%2Fsecp256k1-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lionello%2Fsecp256k1-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lionello%2Fsecp256k1-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lionello","download_url":"https://codeload.github.com/lionello/secp256k1-js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lionello%2Fsecp256k1-js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271411559,"owners_count":24754949,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-20T02:00:09.606Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitcoin","blockchain","ecc","ecc-algorithms","ecdsa","elliptic-curves","ethereum","javascript","nodejs","secp256k1"],"created_at":"2024-10-24T10:29:33.550Z","updated_at":"2025-08-21T01:13:00.394Z","avatar_url":"https://github.com/lionello.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# secp256k1-js\n[![CircleCI](https://circleci.com/gh/lionello/secp256k1-js.svg?style=svg)](https://circleci.com/gh/lionello/secp256k1-js)\n\nPure JS implementation of secp256k1 signing, verification, recovery ECDSA.\n\nThe code works as-is both in browsers and NodeJS, without the need of a bundler.\n\n## Node.js Usage\n\n```sh\nnpm install @lionello/secp256k1-js\n```\n\n### Example\n\n```javascript\nconst crypto = require('crypto')\nconst assert = require('assert')\nconst Secp256k1 = require('@lionello/secp256k1-js')\n\n// Generating private key\nconst privateKeyBuf = crypto.randomBytes(32)\nconst privateKey = Secp256k1.uint256(privateKeyBuf, 16)\n\n// Generating public key\nconst publicKey = Secp256k1.generatePublicKeyFromPrivateKeyData(privateKey)\nconst pubX = Secp256k1.uint256(publicKey.x, 16)\nconst pubY = Secp256k1.uint256(publicKey.y, 16)\n\n// Signing a digest\nconst digest = Secp256k1.uint256(\"483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8\", 16)\nconst sig = Secp256k1.ecsign(privateKey, digest)\nconst sigR = Secp256k1.uint256(sig.r,16)\nconst sigS = Secp256k1.uint256(sig.s,16)\n\n// Verifying signature\nconst isValidSig = Secp256k1.ecverify(pubX, pubY, sigR, sigS, digest)\nassert(isValidSig === true, 'Signature must be valid')\n```\n\n## Browser Usage\n\nInclude this library and [bn.js](https://github.com/indutny/bn.js/)\n\n```html\n\u003cscript src=\"https://unpkg.com/bn.js@4.11.8/lib/bn.js\" type=\"text/javascript\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://unpkg.com/@lionello/secp256k1-js@1.1.0/src/secp256k1.js\" type=\"text/javascript\"\u003e\u003c/script\u003e\n```\n\n### Example\n```javascript\n// Generating private key\nconst privateKeyBuf = window.crypto.getRandomValues(new Uint8Array(32))\nconst privateKey = Secp256k1.uint256(privateKeyBuf, 16)\n\n// Generating public key\nconst publicKey = Secp256k1.generatePublicKeyFromPrivateKeyData(privateKey)\nconst pubX = Secp256k1.uint256(publicKey.x, 16)\nconst pubY = Secp256k1.uint256(publicKey.y, 16)\n\n// Signing a digest\nconst digest = Secp256k1.uint256(\"483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8\", 16)\nconst sig = Secp256k1.ecsign(privateKey, digest)\nconst sigR = Secp256k1.uint256(sig.r,16)\nconst sigS = Secp256k1.uint256(sig.s,16)\n\n// Verifying signature\nconst isValidSig = Secp256k1.ecverify(pubX, pubY, sigR, sigS, digest)\nconsole.assert(isValidSig === true, 'Signature must be valid')\n````\n\n## Development\n```sh\nnpm install\nnpm test\n```\n\nOpen `test/test.html` to run the same tests in the browser.\n\n# The MIT License\nCopyright 2018 Enuma Technologies Limited.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flionello%2Fsecp256k1-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flionello%2Fsecp256k1-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flionello%2Fsecp256k1-js/lists"}