{"_id":"rustbn-wasm","_rev":"4-0785fb6d7f18a391a445b1e8025998ea","name":"rustbn-wasm","dist-tags":{"latest":"0.4.0"},"versions":{"0.1.0":{"name":"rustbn-wasm","version":"0.1.0","description":"Javascript bindings for https://github.com/paritytech/bn (using WASM)","keywords":["ethereum","ecc","bn128","pairing"],"author":{"name":"acolytec3"},"homepage":"https://github.com/ethereumjs/rustbn-wasm","bugs":{"url":"https://github.com/ethereumjs/rustbn-wasm/issues"},"repository":{"type":"git","url":"git+https://github.com/ethereumjs/rustbn-wasm.git"},"license":"(MIT OR Apache-2.0)","scripts":{"build-node":"wasm-pack build --target nodejs -d dist/cjs","build-esm":"tsc","build":"npm run build-node && npm run wasm2b64 && npm run build-esm","wasm2b64":"node scripts/wasmToB64.js"},"main":"dist/cjs/rustbn.js","module":"dist/esm/rustbn.js","dependencies":{"@scure/base":"^1.1.1"},"devDependencies":{"@wasm-tool/wasm-pack-plugin":"^1.1.0","copy-webpack-plugin":"^5.0.3","typescript":"^5.1.5"},"types":"./dist/cjs/rustbn.d.ts","gitHead":"a20bb6b5bcc2d0be2939f8eea3aaec02ec880e09","_id":"rustbn-wasm@0.1.0","_nodeVersion":"18.14.2","_npmVersion":"9.5.0","dist":{"integrity":"sha512-aioejicxMxkJJr5LtNlRunhAypkLZfLX73vJYxY17TVMZsfNbsy1xuy3WPR9lANYFd2jDACQ8yKtsfJCX0TY2w==","shasum":"1c8b052f2640778763faa1415ffc64ba44656e6f","tarball":"https://registry.npmjs.org/rustbn-wasm/-/rustbn-wasm-0.1.0.tgz","fileCount":18,"unpackedSize":485915,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGR7k4by3vmyaAv/dTK9bkBbAHiionFWt2ahPEDKoM7JAiBQTF11nA04H18kedZDv/6iMxFbmLKguj6D2Yxytu3W2g=="}]},"_npmUser":{"name":"holgerd77","email":"Holger.Drewes@gmail.com"},"directories":{},"maintainers":[{"name":"holgerd77","email":"Holger.Drewes@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rustbn-wasm_0.1.0_1688040061975_0.4165451382140093"},"_hasShrinkwrap":false},"0.2.0":{"name":"rustbn-wasm","version":"0.2.0","description":"Javascript bindings for https://github.com/paritytech/bn (using WASM)","keywords":["ethereum","ecc","bn128","pairing"],"author":{"name":"acolytec3"},"homepage":"https://github.com/ethereumjs/rustbn-wasm","bugs":{"url":"https://github.com/ethereumjs/rustbn-wasm/issues"},"repository":{"type":"git","url":"git+https://github.com/ethereumjs/rustbn-wasm.git"},"license":"(MIT OR Apache-2.0)","scripts":{"build-node":"wasm-pack build --target nodejs -d dist/cjs","build-esm":"tsc","build":"npm run build-node && npm run wasm2b64 && npm run build-esm","wasm2b64":"node scripts/wasmToB64.js"},"main":"dist/cjs/rustbn.js","module":"dist/esm/rustbn.js","dependencies":{"@scure/base":"^1.1.1"},"devDependencies":{"@wasm-tool/wasm-pack-plugin":"^1.1.0","copy-webpack-plugin":"^5.0.3","typescript":"^5.1.5"},"types":"./dist/cjs/rustbn.d.ts","gitHead":"43a395f6b6bca942244d66e6fbddd69d0b69b91f","_id":"rustbn-wasm@0.2.0","_nodeVersion":"18.14.2","_npmVersion":"9.5.0","dist":{"integrity":"sha512-FThvYFNTqrEKGqXuseeg0zR7yROh/6U1617mCHF68OVqrN1tNKRN7Tdwy4WayPVsCmmK+eMxtIZX1qL6JxTkMg==","shasum":"0407521fb55ae69eeb4968d01885d63efd1c4ff9","tarball":"https://registry.npmjs.org/rustbn-wasm/-/rustbn-wasm-0.2.0.tgz","fileCount":18,"unpackedSize":490223,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGM+AZPYORB1D6OYac2cqLgK28SWUgUzLhCgt7zPGTKeAiEA1uyavYqJYpZVcQGQIV8evCeC2W4oVeCkkWsqHDkxYSk="}]},"_npmUser":{"name":"holgerd77","email":"Holger.Drewes@gmail.com"},"directories":{},"maintainers":[{"name":"holgerd77","email":"Holger.Drewes@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rustbn-wasm_0.2.0_1688460115129_0.4255209175572763"},"_hasShrinkwrap":false},"0.3.0":{"name":"rustbn-wasm","version":"0.3.0","description":"Javascript bindings for https://github.com/paritytech/bn (using WASM)","keywords":["ethereum","ecc","bn128","pairing"],"author":{"name":"acolytec3"},"homepage":"https://github.com/ethereumjs/rustbn-wasm","bugs":{"url":"https://github.com/ethereumjs/rustbn-wasm/issues"},"repository":{"type":"git","url":"git+https://github.com/ethereumjs/rustbn-wasm.git"},"license":"(MIT OR Apache-2.0)","scripts":{"build-node":"wasm-pack build --target nodejs -d dist/cjs","build-esm":"tsc","build":"npm run build-node && npm run wasm2b64 && npm run build-esm","test":"vitest run test/*","wasm2b64":"node scripts/wasmToB64.js"},"main":"dist/cjs/rustbn.js","module":"dist/esm/rustbn.js","dependencies":{"@scure/base":"^1.1.5"},"devDependencies":{"@wasm-tool/wasm-pack-plugin":"^1.1.0","copy-webpack-plugin":"^5.0.3","typescript":"^5.1.5","vitest":"^1.2.2"},"_id":"rustbn-wasm@0.3.0","gitHead":"be38c9172e5db06a3e32af1d4db4958fb9c6432a","types":"./dist/cjs/rustbn.d.ts","_nodeVersion":"18.18.0","_npmVersion":"9.8.1","dist":{"integrity":"sha512-dTLAHcnEpLPFPT1e2bLVsJ1yaUjUjxv9ooPrs830SE4x7d61p+SwQ1rpjE3p1cYCjR/eV5cFuKPZjAdwb0tzLQ==","shasum":"989a404a7bc58381656553d603419b44d522e910","tarball":"https://registry.npmjs.org/rustbn-wasm/-/rustbn-wasm-0.3.0.tgz","fileCount":22,"unpackedSize":668727,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCgQN4o25OqaK+JwdEZ/7pEanwxHOB8RlL+0o1nt2BZAgIhAOWnHw72ltuit0Q/fEvTZimmbIrr4kjjxctr48CaYis+"}]},"_npmUser":{"name":"holgerd77","email":"Holger.Drewes@gmail.com"},"directories":{},"maintainers":[{"name":"holgerd77","email":"Holger.Drewes@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rustbn-wasm_0.3.0_1707933967244_0.36278412345114286"},"_hasShrinkwrap":false},"0.4.0":{"name":"rustbn-wasm","version":"0.4.0","description":"Javascript bindings for https://github.com/paritytech/bn (using WASM)","keywords":["ethereum","ecc","bn128","pairing"],"author":{"name":"acolytec3"},"homepage":"https://github.com/ethereumjs/rustbn-wasm","bugs":{"url":"https://github.com/ethereumjs/rustbn-wasm/issues"},"repository":{"type":"git","url":"git+https://github.com/ethereumjs/rustbn-wasm.git"},"license":"(MIT OR Apache-2.0)","scripts":{"build:node":"babel dist/esm --out-dir dist/cjs","build:esm":"tsc","build":"rm -rf dist && scripts/ts-build.sh","prepare":"npm run build","test":"vitest run test/*","build:wasm":"wasm-pack build --target web -d wasm","wasm2b64":"node scripts/wasmToB64.js"},"main":"dist/cjs/rustbn.js","module":"dist/esm/rustbn.js","exports":{"require":"./dist/cjs/rustbn.js","import":"./dist/esm/rustbn.js"},"dependencies":{"@scure/base":"^1.1.5"},"devDependencies":{"@wasm-tool/wasm-pack-plugin":"^1.1.0","copy-webpack-plugin":"^5.0.3","typescript":"^5.1.5","vitest":"^1.2.2","@babel/cli":"^7.23.9","@babel/core":"^7.23.9","@babel/preset-env":"^7.23.9"},"_id":"rustbn-wasm@0.4.0","gitHead":"44e22d0ec5cdf042b8c12f5563c7ea51acb93b61","types":"./dist/cjs/rustbn.d.ts","_nodeVersion":"18.18.0","_npmVersion":"9.8.1","dist":{"integrity":"sha512-C2ujvPv05hXC69MD7YwSsoUEsT/X/dKHkkgwN9B0ZTgb0OXDC9yaHhE6Pq+uaRAzMyW0Y97bwc4JO4cqPDzVuQ==","shasum":"fe5601c8d795dd9aa91c19cfad9637ec1df941b0","tarball":"https://registry.npmjs.org/rustbn-wasm/-/rustbn-wasm-0.4.0.tgz","fileCount":24,"unpackedSize":550117,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGC04OUGnE+gmYfw6wQ9PqFbB9EGrgDFqMD11yv6owSuAiAisCoHkE3K0SoETgrQxG3GHpaF48MVyOYhKdiXz6j3iA=="}]},"_npmUser":{"name":"holgerd77","email":"Holger.Drewes@gmail.com"},"directories":{},"maintainers":[{"name":"holgerd77","email":"Holger.Drewes@gmail.com"},{"name":"acolytec3","email":"metroman374@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rustbn-wasm_0.4.0_1709886544926_0.6566573890569036"},"_hasShrinkwrap":false}},"time":{"created":"2023-06-29T12:01:01.974Z","0.1.0":"2023-06-29T12:01:02.307Z","modified":"2024-03-08T08:29:05.763Z","0.2.0":"2023-07-04T08:41:55.369Z","0.3.0":"2024-02-14T18:06:07.443Z","0.4.0":"2024-03-08T08:29:05.147Z"},"maintainers":[{"name":"holgerd77","email":"Holger.Drewes@gmail.com"},{"name":"acolytec3","email":"metroman374@gmail.com"}],"description":"Javascript bindings for https://github.com/paritytech/bn (using WASM)","homepage":"https://github.com/ethereumjs/rustbn-wasm","keywords":["ethereum","ecc","bn128","pairing"],"repository":{"type":"git","url":"git+https://github.com/ethereumjs/rustbn-wasm.git"},"author":{"name":"acolytec3"},"bugs":{"url":"https://github.com/ethereumjs/rustbn-wasm/issues"},"license":"(MIT OR Apache-2.0)","readme":"# SYNOPSIS \nRust to Javascript/Webassembly compilation of [ethereum-bn128.rs](https://github.com/ewasm/ethereum-bn128.rs).\n\nDerived largely from [rustbn.js](https://github.com/ethereumjs/rustbn.js) and recompiled used [`wasm-pack`](https://rustwasm.github.io/docs/wasm-pack/introduction.html)\n\nInternally it uses the [Parity fork](https://github.com/paritytech/bn) of the [Zcash bn\npairing cryptography library](https://github.com/zcash/bn), implementing an efficient bilinear pairing on the Barreto-Naehrig (BN) curve. \n\nIt implements helpers to support the functionality defined in [EIP-196](https://eips.ethereum.org/EIPS/eip-196) and [EIP-197](https://eips.ethereum.org/EIPS/eip-197).\n\n## Installation\n\nClone this repo and build following the [Compilation] instructions below.\n\n## Usage\n\nImport the module:\n\n```\nimport { initRustBN } from 'rustbn'\n\nconst bn128 = await initRustBN()\n```\n\nCurve Addition\n\n```\nlet inputHexString = ...\nlet outputHexString = bn128.ec_add(inputHexString)\n```\n\nCurve Multiplication\n\n```\nlet inputHexString = ...\nlet outputHexString = bn128.ec_mul(inputHexString)\n```\n\nCurve Pairing\n```\nlet inputHexString = ...\nlet outputHexString = bn128.ec_pairing(inputHexString)\n```\n\n## Developer\n\n### Building the module\n\nFor basic setup:\n\n- Install `rust` and `wasm-pack` via the [`wasm-pack` prerequisites](https://rustwasm.github.io/docs/wasm-pack/prerequisites/index.html)\n- Clone this repo\n- Install JS dependencies - `npm i`\n- Run `npm run build:wasm` to compile the Rust code to WASM\n- Run `npm run wasm2b64` to convert the WASM bytecode to a base64 string consumable by the Typescript wrapper\n- Run `npm run build` to build the final JS outputs\n\n### Build Outputs\n\nThe build process outputs both CommonJS and ESM builds of the library and specifies entry points based on the `main`, `module`, and alternatively the `exports` fields in `package.json`. Both builds start with the wasm build from `wasm-bindgen` which is then loaded by a Typescript wrapper of the WASM output.  Our Typescript code is slightly different than the original Javascript generated by `wasm-bindgen` because the default ESM output would require a bundler.  \n\n## License\n\nLicensed under either of\n\n * MIT license, ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n\nat your option.\n\nCopyright 2016 [Zcash Electric Coin Company](https://z.cash/). The Zcash Company promises to maintain the \"bn\" crate on crates.io under this MIT/Apache-2.0 dual license.\n \n","readmeFilename":"README.md"}