{"_id":"@accesschains/accesschains.js","name":"@accesschains/accesschains.js","dist-tags":{"latest":"6.3.2"},"versions":{"6.3.2":{"name":"@accesschains/accesschains.js","version":"6.3.2","description":"Handle communication with AccessChains nodes","main":"dist/torusUtils.cjs.js","module":"dist/torusUtils.esm.js","unpkg":"dist/torusUtils.umd.min.js","jsdelivr":"dist/torusUtils.umd.min.js","types":"dist/types/index.d.ts","scripts":{"start":"torus-scripts start","build":"torus-scripts build","release":"torus-scripts release","prepack":"npm run build","lint:ts":"eslint --fix 'src/**/*.ts'","test":"cross-env NODE_ENV=test mocha","prepare":"husky install"},"peerDependencies":{"@babel/runtime":"7.x"},"dependencies":{"@accesschains/eccrypto":"^1.1.8","@toruslabs/http-helpers":"^3.2.0","bn.js":"^5.2.1","elliptic":"^6.5.4","json-stable-stringify":"^1.0.2","keccak":"^3.0.3","loglevel":"^1.8.1","web3-utils":"^1.8.1"},"devDependencies":{"@babel/register":"^7.18.9","@babel/runtime":"^7.20.7","@toruslabs/eslint-config-typescript":"^1.2.0","@accesschains/fetch-node-details":"^4.0.2","@toruslabs/torus-scripts":"^1.3.0","@types/chai":"^4.3.4","@types/elliptic":"^6.4.14","@types/json-stable-stringify":"^1.0.34","@types/jsonwebtoken":"^8.5.9","@types/keccak":"^3.0.1","@types/mocha":"^10.0.1","@types/faker":"^5.5.3","@typescript-eslint/eslint-plugin":"^5.48.1","@typescript-eslint/parser":"^5.48.1","chai":"^4.3.7","cross-env":"^7.0.3","dotenv":"^16.0.3","eslint":"^8.31.0","eslint-plugin-chai-expect":"^3.0.0","eslint-plugin-import":"^2.26.0","eslint-plugin-mocha":"^10.1.0","eslint-plugin-n":"^15.6.0","eslint-plugin-prettier":"^4.2.1","eslint-plugin-promise":"^6.1.1","eslint-plugin-simple-import-sort":"^8.0.0","eslint-plugin-tsdoc":"^0.2.17","faker":"^5.5.3","husky":"^8.0.3","jsonwebtoken":"^8.5.1","lint-staged":"^13.1.0","mocha":"^10.2.0","node-fetch":"^3.3.0","prettier":"^2.8.2","rimraf":"^3.0.2","ts-node":"^10.9.1","typescript":"^4.9.4","webpack-node-externals":"^3.0.0"},"repository":{"type":"git","url":"git+https://github.com/AllAccessOne/allaccessone.js.git"},"keywords":["torus.js","key assign","get public address","torus nodes","torus-embed","torus-website","torus-utils","elliptic"],"author":{"name":"Chaitanya Potti"},"license":"MIT","bugs":{"url":"https://github.com/AllAccessOne/allaccessone.js/issues"},"homepage":"https://github.com/AllAccessOne/allaccessone.js#readme","lint-staged":{"!(*d).{js,ts}":["eslint --cache --fix","prettier --write"],"*.{json, md}":["prettier --write"]},"engines":{"node":">=14.17.0","npm":">=6.x"},"gitHead":"1eb0be9cbc7f98b53a0739136a42b71ac8229a94","_id":"@accesschains/accesschains.js@6.3.2","_nodeVersion":"18.14.0","_npmVersion":"9.3.1","dist":{"integrity":"sha512-s71b5itquejq76WQCn0VR4XweAru6VP/HAL9q7Kjj4WN/xswc/SoA+33FeU2sm26kIG1aFU0C5uZANI/ONwYLw==","shasum":"b120b69f02f5d44c28f46127ff37ae8ce7fbac75","tarball":"https://registry.npmjs.org/@accesschains/accesschains.js/-/accesschains.js-6.3.2.tgz","fileCount":26,"unpackedSize":4942828,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGc2BaGdi5m2xm77MPMq12II0ARItjAd8sdnFoRqew12AiAM+Dgjog11HU7rTML5u5BKykJvce0EZ4wVmmOwDQZGFA=="}]},"_npmUser":{"name":"nvkhiem2016","email":"nvkhiem2016@gmail.com"},"directories":{},"maintainers":[{"name":"nvkhiem2016","email":"nvkhiem2016@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/accesschains.js_6.3.2_1690791247084_0.028632814320070032"},"_hasShrinkwrap":false}},"time":{"created":"2023-07-31T08:14:06.952Z","6.3.2":"2023-07-31T08:14:07.401Z","modified":"2023-07-31T08:14:07.611Z"},"maintainers":[{"name":"nvkhiem2016","email":"nvkhiem2016@gmail.com"}],"description":"Handle communication with AccessChains nodes","homepage":"https://github.com/AllAccessOne/allaccessone.js#readme","keywords":["torus.js","key assign","get public address","torus nodes","torus-embed","torus-website","torus-utils","elliptic"],"repository":{"type":"git","url":"git+https://github.com/AllAccessOne/allaccessone.js.git"},"author":{"name":"Chaitanya Potti"},"bugs":{"url":"https://github.com/AllAccessOne/allaccessone.js/issues"},"license":"MIT","readme":"# Torus.js\n\n[![npm version](https://badge.fury.io/js/%40toruslabs%2Ftorus.js.svg)](https://badge.fury.io/js/%40toruslabs%2Ftorus.js)\n![npm](https://img.shields.io/npm/dw/@toruslabs/torus.js)\n\n## Introduction\n\nA JS utility library (w/ typescript bindings!) to make calls to the Torus network\n\nThe Torus network assumes that n/4 of nodes may be malicious, and n/2 + 1 of the nodes are required\nfor key reconstruction. Given these threshold assumptions, all API calls to the Torus nodes need to be checked\nfor consistency while still allowing for early exits in optimistic scenarios where the first n/2 + 1 responses\nare from honest nodes.\n\nAlso, in order to prevent front-running by nodes, a commit-reveal process is also necessary for share retrieval.\n\nThis library handles these checks and allows you to query the Torus network easily through these APIs:\n\n- retrieveShares\n- getPublicAddress\n\n## Features\n\n- Typescript compatible. Includes Type definitions\n- All API's return `Promises`\n\n## Installation\n\n### Bundling\n\nThis module is distributed in 5 formats\n\n- `esm` build `dist/torusUtils.esm.js` in es6 format\n- `commonjs` build `dist/torusUtils.cjs.js` in es5 format\n- `commonjs` build `dist/torusUtils-bundled.cjs.js` in es5 format with problematic packages bundled (benfits non-webpack users)\n- `umd` build `dist/torusUtils.umd.min.js` in es5 format without polyfilling corejs minified\n- `nodejs` build `dist/torusUtils-node.js` in es5 format\n\nBy default, the appropriate format is used for your specified usecase\nYou can use a different format (if you know what you're doing eg. node) by referencing the correct file\n\nThe cjs build is not polyfilled with core-js.\nIt is upto the user to polyfill based on the browserlist they target\n\n### Directly in Browser\n\nCDN's serve the non-core-js polyfilled version by default. You can use a different\n\njsdeliver\n\n```js\n<script src=\"https://cdn.jsdelivr.net/npm/@toruslabs/torus.js\"></script>\n```\n\nunpkg\n\n```js\n<script src=\"https://unpkg.com/@toruslabs/torus.js\"></script>\n```\n\n### Tips for NUXT\n\nThis is a plugin that works [only on the client side](https://nuxtjs.org/guide/plugins/#client-side-only). So please register it as a ssr-free plugin.\n\n## Usage\n\nAdd [`@toruslabs/torus.js`](https://www.npmjs.com/package/@toruslabs/torus.js) to your project:\n\nNeeds to be used in conjuction with [`@toruslabs/fetch-node-details`](https://www.npmjs.com/package/@toruslabs/fetch-node-details)\n\n```ts\nimport FetchNodeDetails from '@toruslabs/fetch-node-details'\nimport TorusUtils from '@toruslabs/torus.js'\n\nconst fetchNodeDetails = new FetchNodeDetails()\nconst torus = new TorusUtils({ network: 'mainnet' })\nconst verifier = 'google'\nconst verifierId = 'hello@tor.us'\nconst { torusNodeEndpoints, torusNodePub, torusIndexes } = await fetchNodeDetails.getNodeDetails()\nconst publicAddress = await torus.getPublicAddress(torusNodeEndpoints, torusNodePub, { verifier, verifierId })\n\nconst idToken = 'YOUR_ID_TOKEN'\nconst keyData = await torus.retrieveShares(torusNodeEndpoints, torusIndexes, verifier, { verifier_id: verifierId }, idToken)\n```\n\n```js\nconst FetchNodeDetails = require('@toruslabs/fetch-node-details').default\nconst TorusUtils = require('@toruslabs/torus.js').default\n\nconst fetchNodeDetails = new FetchNodeDetails()\nconst torus = new TorusUtils({ network: 'mainnet' })\nconst verifier = 'google' // any verifier\nconst verifierId = 'hello@tor.us' // any verifier id\nfetchNodeDetails\n  .getNodeDetails()\n  .then(({ torusNodeEndpoints, torusNodePub }) => torus.getPublicAddress(torusNodeEndpoints, torusNodePub, { verifier, verifierId }))\n  .then((publicAddress) => console.log(publicAddress))\n\nconst idToken = 'YOUR_ID_TOKEN'\nfetchNodeDetails\n  .getNodeDetails()\n  .then(({ torusNodeEndpoints, torusIndexes }) =>\n    torus.retrieveShares(torusNodeEndpoints, torusIndexes, verifier, { verifier_id: verifierId }, idToken)\n  )\n  .then((keyData) => console.log(keyData))\n```\n\n```js\n// For Node.js\nconst FetchNodeDetails = require('@toruslabs/fetch-node-details/dist/fetchNodeDetails-node.js').default\nconst TorusUtils = require('@toruslabs/torus.js/dist/torusUtils-node.js').default\n\nconst fetchNodeDetails = new FetchNodeDetails()\nconst torus = new TorusUtils({ network: 'mainnet' })\nconst verifier = 'google' // any verifier\nconst verifierId = 'hello@tor.us' // any verifier id\nfetchNodeDetails\n  .getNodeDetails()\n  .then(({ torusNodeEndpoints, torusNodePub }) => torus.getPublicAddress(torusNodeEndpoints, torusNodePub, { verifier, verifierId }))\n  .then((publicAddress) => console.log(publicAddress))\n```\n\n## Requirements\n\n- This package requires a peer dependency of `@babel/runtime`\n- Node 14+\n","readmeFilename":"README.md"}