{"_id":"@acryl/ledger","_rev":"1-2fbe38e285ec9a673e70c908173b380b","name":"@acryl/ledger","dist-tags":{"latest":"3.3.3"},"versions":{"3.3.3":{"name":"@acryl/ledger","version":"3.3.3","description":"Acryl ladger lib for browser","main":"lib/AcrylLedger.js","types":"lib/AcrylLedger.d.ts","repository":{"type":"git","url":"git+https://github.com/acrylplatform/acryl-ledger-js.git"},"scripts":{"build":"tsc && node_modules/.bin/browserify lib/AcrylLedger.js -s AcrylLedgerJs -u @acryl/signature-generator -u @ledgerhq/hw-transport-u2f -o dist/acryl-ledger.js && npm run build_transport","build_transport":"browserify ./node_modules/@ledgerhq/hw-transport-u2f/lib/TransportU2F.js -s TransportU2F -o dist/transport-u2f.js","prepare":"npm run build","build_ledger_monitor":"npm run build && node_modules/.bin/browserify ledgerTest/index.js -o dist/ledgerTest.js -x @acryl/signature-generator -t [ babelify ] -t [browserify-global-shim [\"@acryl/signature-generator\"=\"acrylSignatureGenerator\"] ]"},"publishConfig":{"access":"public"},"keywords":[],"license":"Apache-2.0","devDependencies":{"@babel/core":"^7.5.5","@babel/plugin-transform-runtime":"^7.5.5","@babel/preset-env":"^7.5.5","@babel/runtime":"^7.5.5","babel-runtime":"^6.26.0","babelify":"^9.0.0","browserify":"^16.2.3","browserify-global-shim":"^1.0.3","typescript":"^3.2.2","vinyl-buffer":"^1.0.1","vinyl-source-stream":"^2.0.0"},"dependencies":{"@babel/polyfill":"^7.4.3","@ledgerhq/hw-transport-u2f":"^4.56.0"},"gitHead":"30ae7529e706e7c30ab462015960b2b22a47045f","bugs":{"url":"https://github.com/acrylplatform/acryl-ledger-js/issues"},"homepage":"https://github.com/acrylplatform/acryl-ledger-js#readme","_id":"@acryl/ledger@3.3.3","_nodeVersion":"10.16.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-CtR34QcJzHQ2VYjkT0z5R57NTO3W5vRfY81EFjf9hyEPqN9pOueF2YX4ip0dZp2QBEZW2vYOa8opIZnU8RueiA==","shasum":"19b6a42869eaa27db3901d575dbd1d04c6f01ae1","tarball":"https://registry.npmjs.org/@acryl/ledger/-/ledger-3.3.3.tgz","fileCount":21,"unpackedSize":576566,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdcLN7CRA9TVsSAnZWagAA+LoP/1Omp59sZ0etVbTzq1kn\nKunvovtc1UN5QYru9NuQMTzHUJjkeFRiTDgv3sZ9C4c4z/s+BwmaXffn/BQh\nKfSRAVKJaJxdu7tXrCvr5WW3L+uVbQ3qXun35qeeiVzSh8YOIhKIDT1fypGy\nLR1LQfvkJ5kV/FprvlolyG49eNBaAjRtUu02GzQzWcuNI6MLg4OfTQX1pjJp\nc7bn+LafZDMLZEfr7XJm7n+dsvu9SVc+9fIEjUJ78qF7TZ9ce+nofDmKKohH\n8Taws+61N+WOKV+YnvnonShpJR2Ni925BAnpOrLOuhpje+e3lQL7mKBtD6Xa\ntHWvUXzWO+2nPNJC6R2o789fNvEhu7uGgbCyFJCGoGhkvwncNy9hkN2gkNfq\no3Z1ITkXKEJEZ7TYVFVk3W+n8ltpLQOx4O5sB+1u6+RdUQikesiPNa8xlpLo\nrX1cpTLns0GQhpY2IBui1JDIMMzBrYGjsVtstBKhDCX9qPUkWoBopxwLlyRE\nmG1Y8QlrHF9zwQQ3YwHhI0+u/OD1n9Yc2fNy/bjiIUP2uymdhE8+BAVbfxau\nR0sZYINiK2ELhy6iAq9q7Dz3NyJSkvQHjTU80IPp65AYO5M/zj/V91KvjIX0\notfe50J7EO7gRtGB88LabJBwaV7pYoa8emnvGpiy9y1KRLNUBcEWF5VM6mV+\nzQbX\r\n=wEfD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDGz/C7bhxm2EolOKuGZlHtAoJyahJVzkQsrOl5JHGk4gIhAPteqeVqDD4SCpmPrldZBVlSlpBqptOeYpcXj1awwWV7"}]},"maintainers":[{"name":"deadblackclover","email":"deadblackclover@protonmail.com"},{"name":"eaz","email":"eaz@acrylplatform.com"}],"_npmUser":{"name":"eaz","email":"eaz@acrylplatform.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ledger_3.3.3_1567667066463_0.5503895517351622"},"_hasShrinkwrap":false}},"time":{"created":"2019-09-05T07:04:26.244Z","3.3.3":"2019-09-05T07:04:26.608Z","modified":"2022-04-04T11:16:35.707Z"},"maintainers":[{"name":"deadblackclover","email":"deadblackclover@protonmail.com"},{"name":"eaz","email":"eaz@acrylplatform.com"}],"description":"Acryl ladger lib for browser","homepage":"https://github.com/acrylplatform/acryl-ledger-js#readme","keywords":[],"repository":{"type":"git","url":"git+https://github.com/acrylplatform/acryl-ledger-js.git"},"bugs":{"url":"https://github.com/acrylplatform/acryl-ledger-js/issues"},"license":"Apache-2.0","readme":"# Acryl sign data by ledger in browser\n\n## Install\n\n```\n$ npm install --save @acryl/ledger\n```\n\n## Usage\n\n##### Create connection\n```js\nconst AcrylLedger = require('@acryl/ledger');\nconst ledger = new AcrylLedger();\n```\n`AcrylLedger` can have optional arguments.\n\n```js\n    import TransportNodeHid from '@ledgerhq/hw-transport-node-u2f';\n\n    const options = {\n        debug: true, //boolean,\n        openTimeout: 3000, //number,\n        listenTimeout: 30000, //number,\n        exchangeTimeout: 30000, //number,\n        networkCode: 65, //number,\n        transport: TransportNodeHid\n    };\n\n    const ledger = new AcrylLedger(options);\n```\n \n##### Where: \n`debug` enable or not logs of the binary exchange.\n`openTimeout` is a delay number in ms for waiting connection.    \n`listenTimeout` is a delay number in ms for waiting listen request to U2F device.    \n`exchangeTimeout` is a timeout (in milliseconds) for the exchange call. Only some transport might implement it. (e.g. U2F).    \n`networkCode` is Acryl network code (65 - for mainet)  \n`transport` is U2F Transport implementation. (hw-transport-u2f by default) \n+ [@ledgerhq/hw-transport-u2f](https://github.com/LedgerHQ/ledgerjs/tree/master/packages/hw-transport-u2f) \n+ [@ledgerhq/hw-transport-webusb](https://github.com/LedgerHQ/ledgerjs/tree/master/packages/hw-transport-webusb) \n+ [@ledgerhq/hw-transport-web-ble](https://github.com/LedgerHQ/ledgerjs/tree/master/packages/hw-transport-web-ble) \n+ [@ledgerhq/hw-transport-http](https://github.com/LedgerHQ/ledgerjs/tree/master/packages/hw-transport-http) \n\n[Read about transport](https://github.com/LedgerHQ/ledgerjs)\n\n### AcrylLedger API\n\n+ ##### probeDevice\n    \n    probeDevice(): Promise<boolean>. If device available and ready, Promise returned true.\n    \n    ```js\n      const canIUse = async () => {\n          return await ledger.probeDevice();\n      }\n    ```\n+ ##### tryConnect\n\n    tryConnect(): Promise<>. reconnect to Transport and init ledger libs.\n\n    ```js\n      const isLedgerReady = async () => {\n          try {\n              return await ledger.tryConnect();\n          } catch (e) {\n              ///...error handlers\n          }\n      };\n\n+ ##### getUserDataById\n     getUserDataById(id): Promise<user>. Get user from ledger, where user is:\n     `{ id: number, path: string, acrylAddress: string, publicKey: string }` \n\n     id - is number from 0  \n     path - is string in internal ledger format  \n     acrylAddress - is string in base58 format  \n     publicKey - is string in base58 format  \n     \n    ```js\n    ledger.getUserDataById(id)\n        .then(\n            (user) => {...},\n            (err) => {...}\n        );\n    ```\n\n+ ##### signTransaction\n    Sign acryl transaction bytes (ledger show detailed transaction info)\n    ```js\n        ledger.signTransaction(userId, asset, data)\n    ```\n    userId - number<br>\n    data - Array<uInt8> number form 0 to 255\n    asset - {precision: number, ...}\n    \n    Result is Promise with signature string in base58 format\n\n+ ##### signSomeData     \n    Sign any bytes (ledger can't show detail info)\n    ```js\n      ledger.signSomeData(userId, data)\n    ```\n    userId - number<br>\n    data - Array<uInt8> number form 0 to 255\n    \n    Result is Promise with signature string in base58 format\n    \n+ ##### signRequest   \n    \n    Sign any bytes (ledger can't show detail info)\n    \n    ```js\n      ledger.signRequest(userId, data)\n    ```\n    userId - number<br>\n    data - Array<uInt8> number form 0 to 255\n    \n    Result is Promise with signature string in base58 format\n    \n+ ##### signMessage      \n    Sign any string (ledger can't show detail info)\n\n    ```js\n    ledger.signMessage(userId, data)\n    ```\n    userId - number<br>\n    data - string\n    \n    Result is Promise with signature string in base58 format\n","readmeFilename":"README.md"}