{"_id":"@bradthomasbrown/finite-domain","_rev":"3-15f7ccf39dbad0eb41d2f3c6c553dbe5","name":"@bradthomasbrown/finite-domain","dist-tags":{"latest":"2.0.0"},"versions":{"1.0.0":{"name":"@bradthomasbrown/finite-domain","version":"1.0.0","author":{"name":"Brad Brown","email":"https://t.me/bradthomasbrown"},"_id":"@bradthomasbrown/finite-domain@1.0.0","maintainers":[{"name":"bradthomasbrown","email":"bradthomasbrown@outlook.com"}],"dist":{"shasum":"6c3057e04a4a2ad44f4456617bc61a88a804c730","tarball":"https://registry.npmjs.org/@bradthomasbrown/finite-domain/-/finite-domain-1.0.0.tgz","fileCount":8,"integrity":"sha512-rZGTtPBWA8KoRhCUbTJervCbjgjYjH8rrJ9KJ+oaBQCsQ2iCeG2aWFMBesSIJY/c60fkmXUO2BMNRjy21+wz9Q==","signatures":[{"sig":"MEYCIQDiPMtYVd8sr9Yc5JSFwAD/vCSsa/wX31Lu8SBNBo8RuAIhANo52fNK/Yi17evQKWuMPsua9oGg8kXaHfHqZysLHyWq","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":9692},"type":"module","exports":{".":"./dist/finite-domain.js"},"gitHead":"b88fd28ece6219308bc2fd5a3c57b61239010ea1","_npmUser":{"name":"bradthomasbrown","email":"bradthomasbrown@outlook.com"},"_npmVersion":"10.9.2","description":"Minimal, unoptimized, and unaudited cryptographic domain library in JavaScript/TypeScript.","directories":{},"_nodeVersion":"22.16.0","dependencies":{"@bradthomasbrown/finite-curve":"^2.0.1","@bradthomasbrown/finite-field":"^1.1.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/finite-domain_1.0.0_1765601500778_0.9134514831548042","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@bradthomasbrown/finite-domain","version":"1.0.1","author":{"name":"Brad Brown","email":"https://t.me/bradthomasbrown"},"_id":"@bradthomasbrown/finite-domain@1.0.1","maintainers":[{"name":"bradthomasbrown","email":"bradthomasbrown@outlook.com"}],"dist":{"shasum":"d3a41b316a37ad486b0ce9fd4ecb65e62fb306f2","tarball":"https://registry.npmjs.org/@bradthomasbrown/finite-domain/-/finite-domain-1.0.1.tgz","fileCount":8,"integrity":"sha512-BJK45oPF5/a7whKuFJLZoTJ1TB16Ih3UmongJYOBQU2OLSpsF3s51Qn4Mpp3E/1IqYGbXPDOuXO2pBT00mMvng==","signatures":[{"sig":"MEYCIQCOjcZx3mkG3zGkITFctUelllMIto2exEWUHBidfI7XsgIhAN6sXUURjQ2uti0oJvo4bLKJ/qkAhAW6MQBSDdT0k+wA","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":9734},"type":"module","exports":{".":"./dist/finite-domain.js","./domains":"./dist/domains.js"},"gitHead":"007741a92bbc6695bb181d31627fc77b4733af41","_npmUser":{"name":"bradthomasbrown","email":"bradthomasbrown@outlook.com"},"_npmVersion":"10.9.2","description":"Minimal, unoptimized, and unaudited cryptographic domain library in JavaScript/TypeScript.","directories":{},"_nodeVersion":"22.16.0","dependencies":{"@bradthomasbrown/finite-curve":"^2.0.1","@bradthomasbrown/finite-field":"^1.1.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/finite-domain_1.0.1_1765601722395_0.5392041660813693","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@bradthomasbrown/finite-domain","description":"Minimal, unoptimized, and unaudited cryptographic domain library in JavaScript/TypeScript.","version":"2.0.0","author":{"name":"Brad Brown","email":"https://t.me/bradthomasbrown"},"type":"module","exports":{".":"./dist/finite-domain.js","./domains":"./dist/domains.js"},"dependencies":{"@bradthomasbrown/finite-curve":"^3.0.0","@bradthomasbrown/finite-field":"^2.0.0"},"_id":"@bradthomasbrown/finite-domain@2.0.0","gitHead":"977cb04479cc51c4246b6738b0821ec0dd616821","_nodeVersion":"22.16.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-cGJsXPFKQ+CkGexolfTD8k3I6XIXN5iODPcBKZ7TaivVWezuMCVH1rApWzhZHVL4PYAYJZuX2UfFoXJ/Ewsuew==","shasum":"e3d346b2d75ef9c2c93091cd9b5fc3c5eae1dfd1","tarball":"https://registry.npmjs.org/@bradthomasbrown/finite-domain/-/finite-domain-2.0.0.tgz","fileCount":8,"unpackedSize":9717,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIGqkZAcJ5vZPzdwZc30T9V4FhVbn0bzOEOLeoLG/RuB2AiEAzZLMIPC4wrxxM6PEx9ljLCy0AJhQ1Oj7Xx9thlM75/w="}]},"_npmUser":{"name":"bradthomasbrown","email":"bradthomasbrown@outlook.com"},"directories":{},"maintainers":[{"name":"bradthomasbrown","email":"bradthomasbrown@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/finite-domain_2.0.0_1766213692789_0.39244645632039377"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-13T04:51:40.642Z","modified":"2025-12-20T06:54:53.143Z","1.0.0":"2025-12-13T04:51:40.923Z","1.0.1":"2025-12-13T04:55:22.535Z","2.0.0":"2025-12-20T06:54:52.934Z"},"author":{"name":"Brad Brown","email":"https://t.me/bradthomasbrown"},"description":"Minimal, unoptimized, and unaudited cryptographic domain library in JavaScript/TypeScript.","maintainers":[{"name":"bradthomasbrown","email":"bradthomasbrown@outlook.com"}],"readme":"# finite-domain\r\nThis is a simple, minimal implementation of elliptic curve domain parameters in TypeScript/JavaScript. \r\n\r\n## Why?\r\nThere is surprisingly little information on all aspects of the \"cryptographic stack\" in JavaScript and elsewhere that is simple and minimal. This repository is part of a series of repositories that builds up this stack from first principles, including:\r\n- [Finite field arithmetic](https://github.com/bradthomasbrown/finite-field)\r\n- [Elliptic curves over finite fields](https://github.com/bradthomasbrown/finite-curve)\r\n- [Sponge constructions and Keccak](https://github.com/bradthomasbrown/keccak)\r\n- Elliptic curve domain parameters (this library)\r\n- ECDSA\r\n- Interacting with EVM nodes\r\n- And potentially more\r\n\r\n## Dependencies\r\nThese should be installed when you install the `finite-domain` package, but this is listed here for completeness.\r\n- [@bradthomasbrown/finite-field](https://github.com/bradthomasbrown/finite-field)\r\n- [@bradthomasbrown/finite-curve](https://github.com/bradthomasbrown/finite-curve)\r\n\r\n## Installation\r\n```sh\r\nnpm i @bradthomasbrown/finite-domain\r\n```\r\n\r\n## Usage\r\n```js\r\nimport { FiniteField } from \"@bradthomasbrown/finite-field\";\r\nimport { FiniteCurve, FinitePoint } from \"@bradthomasbrown/finite-curve\";\r\nimport { FiniteDomain } from \"@bradthomasbrown/finite-domain.js\";\r\n\r\nlet secp256k1:FiniteDomain;\r\n{\r\n    const p =\r\n          (1n << 256n)\r\n        - (1n << 32n)\r\n        - 977n;\r\n    const F = new FiniteField(p);\r\n    const E = new FiniteCurve(F, 0, 7);\r\n    const G = new FinitePoint(\r\n        0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798n,\r\n        0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8n\r\n    );\r\n    const n = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n;\r\n    const h = 1;\r\n    secp256k1 = new FiniteDomain(E, G, n, h);\r\n}\r\n\r\n// this should be the same as the example from `finite-curve`, but a bit simpler\r\nconst P = secp256k1.divide(new FinitePoint(), 2, secp256k1.G);\r\nconsole.log({ x: P.x, y: P.y });\r\n// x: 86918276961810349294276103416548851884759982251107n\r\n// y: 87194829221142880348582938487511785107150118762739500766654458540580527283772n\r\n// # note the relatively extremely low value of x after halving the generator point,\r\n// # a characteristic of SEC 2 curves (https://bitcoin.stackexchange.com/a/113122)\r\n```","readmeFilename":"README.md"}