diff --git a/jest.config.js b/jest.config.js index 42a74ea30..7e6355cb1 100644 --- a/jest.config.js +++ b/jest.config.js @@ -5,6 +5,9 @@ const config = require('@polkadot/dev/config/jest.cjs'); module.exports = Object.assign({}, config, { moduleNameMapper: { + '@polkadot/hw-ledger-transports(.*)$': '/packages/hw-ledger-transports/src/node', + // eslint-disable-next-line sort-keys + '@polkadot/hw-ledger(.*)$': '/packages/hw-ledger/src/$1', '@polkadot/keyring(.*)$': '/packages/keyring/src/$1', '@polkadot/networks(.*)$': '/packages/networks/src/$1', '@polkadot/util-(crypto)(.*)$': '/packages/util-$1/src/$2', @@ -13,6 +16,8 @@ module.exports = Object.assign({}, config, { '@polkadot/x-(fetch|randomvalues|textdecoder|textencoder|ws)(.*)$': '/packages/x-$1/src/node' }, modulePathIgnorePatterns: [ + '/packages/hw-ledger/build', + '/packages/hw-ledger-transports/build', '/packages/keyring/build', '/packages/networks/build', '/packages/util/build', diff --git a/packages/hw-ledger-transports/LICENSE b/packages/hw-ledger-transports/LICENSE new file mode 100644 index 000000000..0d381b2e9 --- /dev/null +++ b/packages/hw-ledger-transports/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/packages/hw-ledger-transports/README.md b/packages/hw-ledger-transports/README.md new file mode 100644 index 000000000..17c7f05bf --- /dev/null +++ b/packages/hw-ledger-transports/README.md @@ -0,0 +1,2 @@ +# @polkadot/hw-ledger-transports + diff --git a/packages/hw-ledger-transports/package.json b/packages/hw-ledger-transports/package.json new file mode 100644 index 000000000..e126e5d39 --- /dev/null +++ b/packages/hw-ledger-transports/package.json @@ -0,0 +1,24 @@ +{ + "name": "@polkadot/hw-ledger-transports", + "version": "5.2.4-5", + "repository": "github:polkadot-js/common", + "author": "Jaco Greeff ", + "maintainers": [], + "contributors": [], + "license": "Apache-2.0", + "main": "node.js", + "browser": "browser.js", + "react-native": "react-native.js", + "sideEffects": false, + "dependencies": { + "@babel/runtime": "^7.12.5", + "@ledgerhq/hw-transport-webusb": "^5.38.0" + }, + "devDependencies": { + "@types/ledgerhq__hw-transport-node-hid": "^4.22.2", + "@types/ledgerhq__hw-transport-webusb": "^4.70.1" + }, + "optionalDependencies": { + "@ledgerhq/hw-transport-node-hid-singleton": "^5.38.0" + } +} diff --git a/packages/hw-ledger-transports/src/browser.ts b/packages/hw-ledger-transports/src/browser.ts new file mode 100644 index 000000000..f2d101ae7 --- /dev/null +++ b/packages/hw-ledger-transports/src/browser.ts @@ -0,0 +1,24 @@ +// Copyright 2017-2021 @polkadot/hw-ledger authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +import type Transport from '@ledgerhq/hw-transport'; +import type { TransportDef } from './types'; + +import LedgerWebUSB from '@ledgerhq/hw-transport-webusb'; + +const transports: TransportDef[] = [ + // deprecated + // import LedgerU2F from '@ledgerhq/hw-transport-u2f'; + // { + // create: (): Promise => + // LedgerU2F.create(), + // type: 'u2f' + // }, + { + create: (): Promise => + LedgerWebUSB.create(), + type: 'webusb' + } +]; + +export { transports }; diff --git a/packages/hw-ledger-transports/src/ledgerhq.d.ts b/packages/hw-ledger-transports/src/ledgerhq.d.ts new file mode 100644 index 000000000..736ce9a7f --- /dev/null +++ b/packages/hw-ledger-transports/src/ledgerhq.d.ts @@ -0,0 +1,15 @@ +// Copyright 2017-2021 @polkadot/hw-ledger authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +declare module '@ledgerhq/hw-transport-node-hid-noevents' { + import Transport from '@ledgerhq/hw-transport'; + + export default class TransportNodeHidNoEvents extends Transport {} + export function getDevices(): Array +} + +declare module '@ledgerhq/hw-transport-node-hid-singleton' { + import TransportNodeHidNoEvents from '@ledgerhq/hw-transport-node-hid-noevents'; + + export default class TransportNodeHid extends TransportNodeHidNoEvents { } +} diff --git a/packages/hw-ledger-transports/src/node.ts b/packages/hw-ledger-transports/src/node.ts new file mode 100644 index 000000000..c6612c056 --- /dev/null +++ b/packages/hw-ledger-transports/src/node.ts @@ -0,0 +1,17 @@ +// Copyright 2017-2021 @polkadot/hw-ledger authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +import type Transport from '@ledgerhq/hw-transport'; +import type { TransportDef } from './types'; + +import LedgerHid from '@ledgerhq/hw-transport-node-hid-singleton'; + +const transports: TransportDef[] = [ + { + create: (): Promise => + LedgerHid.create(), + type: 'hid' + } +]; + +export { transports }; diff --git a/packages/hw-ledger-transports/src/react-native.ts b/packages/hw-ledger-transports/src/react-native.ts new file mode 100644 index 000000000..94f9dca68 --- /dev/null +++ b/packages/hw-ledger-transports/src/react-native.ts @@ -0,0 +1,8 @@ +// Copyright 2017-2021 @polkadot/hw-ledger authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +import type { TransportDef } from './types'; + +const transports: TransportDef[] = []; + +export { transports }; diff --git a/packages/hw-ledger-transports/src/types.ts b/packages/hw-ledger-transports/src/types.ts new file mode 100644 index 000000000..c716b238d --- /dev/null +++ b/packages/hw-ledger-transports/src/types.ts @@ -0,0 +1,11 @@ +// Copyright 2017-2021 @polkadot/hw-ledger authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +import Transport from '@ledgerhq/hw-transport'; + +export type LedgerTypes = 'hid' | 'u2f' | 'webusb'; + +export interface TransportDef { + create (): Promise; + type: LedgerTypes; +} diff --git a/packages/hw-ledger/LICENSE b/packages/hw-ledger/LICENSE new file mode 100644 index 000000000..0d381b2e9 --- /dev/null +++ b/packages/hw-ledger/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/packages/hw-ledger/README.md b/packages/hw-ledger/README.md new file mode 100644 index 000000000..84cc7335e --- /dev/null +++ b/packages/hw-ledger/README.md @@ -0,0 +1,2 @@ +# @polkadot/hw-ledger + diff --git a/packages/hw-ledger/package.json b/packages/hw-ledger/package.json new file mode 100644 index 000000000..0103843f4 --- /dev/null +++ b/packages/hw-ledger/package.json @@ -0,0 +1,18 @@ +{ + "name": "@polkadot/hw-ledger", + "version": "5.2.4-5", + "repository": "github:polkadot-js/common", + "author": "Jaco Greeff ", + "maintainers": [], + "contributors": [], + "license": "Apache-2.0", + "main": "index.js", + "module": "index.mjs", + "sideEffects": false, + "dependencies": { + "@babel/runtime": "^7.12.5", + "@polkadot/hw-ledger-transports": "5.2.4-5", + "@polkadot/util": "^5.2.4-5", + "@zondax/ledger-polkadot": "^0.13.0" + } +} diff --git a/packages/hw-ledger/src/index.ts b/packages/hw-ledger/src/index.ts new file mode 100644 index 000000000..66b70ff9d --- /dev/null +++ b/packages/hw-ledger/src/index.ts @@ -0,0 +1,118 @@ +// Copyright 2017-2021 @polkadot/hw-ledger authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +import type Transport from '@ledgerhq/hw-transport'; +import type { AccountOptions, LedgerAddress, LedgerSignature, LedgerTypes, LedgerVersion } from './types'; + +import { newDockApp, newKusamaApp, newPolkadotApp, newPolymeshApp, ResponseBase, SubstrateApp } from '@zondax/ledger-polkadot'; + +import { transports } from '@polkadot/hw-ledger-transports'; +import { assert, bufferToU8a, u8aToBuffer, u8aToHex } from '@polkadot/util'; + +export const LEDGER_DEFAULT_ACCOUNT = 0x80000000; + +export const LEDGER_DEFAULT_CHANGE = 0x80000000; + +export const LEDGER_DEFAULT_INDEX = 0x80000000; + +const SUCCESS_CODE = 0x9000; + +// These match up with the network keys in the @polkadot/networks package +// (which is turn aligns with the substrate/ss58-registry.json as the single +// source of truth) +const APPS: Record SubstrateApp> = { + dock: newDockApp, + kusama: newKusamaApp, + polkadot: newPolkadotApp, + polymath: newPolymeshApp +}; + +type Chain = keyof typeof APPS; + +// A very basic wrapper for a ledger app - +// - it connects automatically, creating an app as required +// - Promises return errors (instead of wrapper errors) +export class Ledger { + #app: SubstrateApp | null = null; + + #chain: Chain; + + #transport: LedgerTypes; + + constructor (transport: LedgerTypes, chain: Chain) { + // u2f is deprecated + assert(['hid', 'webusb'].includes(transport), `Unsupported transport ${transport}`); + assert(Object.keys(APPS).includes(chain), `Unsupported chain ${chain}`); + + this.#chain = chain; + this.#transport = transport; + } + + public async getAddress (confirm = false, accountOffset = 0, addressOffset = 0, { account = LEDGER_DEFAULT_ACCOUNT, addressIndex = LEDGER_DEFAULT_INDEX, change = LEDGER_DEFAULT_CHANGE }: Partial = {}): Promise { + return this.#withApp(async (app: SubstrateApp): Promise => { + const { address, pubKey } = await this.#wrapError(app.getAddress(account + accountOffset, change, addressIndex + addressOffset, confirm)); + + return { + address, + publicKey: `0x${pubKey}` + }; + }); + } + + public async getVersion (): Promise { + return this.#withApp(async (app: SubstrateApp): Promise => { + const { device_locked: isLocked, major, minor, patch, test_mode: isTestMode } = await this.#wrapError(app.getVersion()); + + return { + isLocked, + isTestMode, + version: [major, minor, patch] + }; + }); + } + + public async sign (message: Uint8Array, accountOffset = 0, addressOffset = 0, { account = LEDGER_DEFAULT_ACCOUNT, addressIndex = LEDGER_DEFAULT_INDEX, change = LEDGER_DEFAULT_CHANGE }: Partial = {}): Promise { + return this.#withApp(async (app: SubstrateApp): Promise => { + const buffer = u8aToBuffer(message); + const { signature } = await this.#wrapError(app.sign(account + accountOffset, change, addressIndex + addressOffset, buffer)); + + return { + signature: u8aToHex(bufferToU8a(signature)) + }; + }); + } + + #getApp = async (): Promise => { + if (!this.#app) { + const def = transports.find(({ type }) => type === this.#transport); + + assert(def, `Unable to find a transport for ${this.#transport}`); + + const transport = await def.create(); + + this.#app = APPS[this.#chain](transport); + } + + return this.#app; + }; + + #withApp = async (fn: (app: SubstrateApp) => Promise): Promise => { + try { + const app = await this.#getApp(); + + return await fn(app); + } catch (error) { + this.#app = null; + + throw error; + } + }; + + #wrapError = async (promise: Promise): Promise => { + const result = await promise; + + assert(result.return_code === SUCCESS_CODE, result.error_message); + + return result; + }; +} diff --git a/packages/hw-ledger/src/types.ts b/packages/hw-ledger/src/types.ts new file mode 100644 index 000000000..33c2cf631 --- /dev/null +++ b/packages/hw-ledger/src/types.ts @@ -0,0 +1,25 @@ +// Copyright 2017-2021 @polkadot/hw-ledger authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +export type LedgerTypes = 'hid' | 'u2f' | 'webusb'; + +export interface AccountOptions { + account: number; + addressIndex: number; + change: number; +} + +export interface LedgerAddress { + address: string; + publicKey: string; +} + +export interface LedgerSignature { + signature: string; +} + +export interface LedgerVersion { + isLocked: boolean; + isTestMode: boolean; + version: [number, number, number]; +} diff --git a/tsconfig.json b/tsconfig.json index 71d469a57..be94a775d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,6 +7,10 @@ "compilerOptions": { "baseUrl": ".", "paths": { + "@polkadot/hw-ledger": [ "packages/ledger/src" ], + "@polkadot/hw-ledger/*": [ "packages/ledger/src/*" ], + "@polkadot/hw-ledger-transports": [ "packages/hw-ledger-transports/src/browser" ], + "@polkadot/hw-ledger-transports/*": [ "packages/hw-ledger-transports/src/browser" ], "@polkadot/keyring": [ "packages/keyring/src" ], "@polkadot/keyring/*": [ "packages/keyring/src/*" ], "@polkadot/networks": [ "packages/networks/src" ], diff --git a/yarn.lock b/yarn.lock index 47cdf517b..8878852a4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1571,6 +1571,83 @@ __metadata: languageName: node linkType: hard +"@ledgerhq/devices@npm:^5.38.0": + version: 5.38.0 + resolution: "@ledgerhq/devices@npm:5.38.0" + dependencies: + "@ledgerhq/errors": ^5.38.0 + "@ledgerhq/logs": ^5.38.0 + rxjs: ^6.6.3 + checksum: e36d0deb41f2b36bed738362a1e83e6335d01d00f8e16a754fb8eed4aaaf09c422bf516862e99496b67dea76c48d683138b8b7265ff3544311d575ba853ea650 + languageName: node + linkType: hard + +"@ledgerhq/errors@npm:^5.38.0": + version: 5.38.0 + resolution: "@ledgerhq/errors@npm:5.38.0" + checksum: 3cb10a76d25e24586e9bd2964f3e85a2533450e5488799777887a7aa0bd0f0780d48b0f3ff7256e2edb1a59c2766109ee3f217cb8e8a61674273dfc1094bf185 + languageName: node + linkType: hard + +"@ledgerhq/hw-transport-node-hid-noevents@npm:^5.38.0": + version: 5.38.0 + resolution: "@ledgerhq/hw-transport-node-hid-noevents@npm:5.38.0" + dependencies: + "@ledgerhq/devices": ^5.38.0 + "@ledgerhq/errors": ^5.38.0 + "@ledgerhq/hw-transport": ^5.38.0 + "@ledgerhq/logs": ^5.38.0 + node-hid: 2.1.1 + checksum: 6607b434ee35c947073185c64e501ba361aea18a6389a6028bf3e4b8bed6624f82f5ef866df02b734a6475534bb96a2163d222df8a0728423309de3051e89df3 + languageName: node + linkType: hard + +"@ledgerhq/hw-transport-node-hid-singleton@npm:^5.38.0": + version: 5.38.0 + resolution: "@ledgerhq/hw-transport-node-hid-singleton@npm:5.38.0" + dependencies: + "@ledgerhq/devices": ^5.38.0 + "@ledgerhq/errors": ^5.38.0 + "@ledgerhq/hw-transport": ^5.38.0 + "@ledgerhq/hw-transport-node-hid-noevents": ^5.38.0 + "@ledgerhq/logs": ^5.38.0 + lodash: ^4.17.20 + node-hid: 2.1.1 + usb-detection: ^4.10.0 + checksum: 7676862c59eeb19e3dadd6b9660bc4cdafe1236be8b11a9c8151dad1b7f4f15e2e3aedfb6784b6f669493373f0c15c54f0a9224d1473b18d90002980878ce4ce + languageName: node + linkType: hard + +"@ledgerhq/hw-transport-webusb@npm:^5.38.0": + version: 5.38.0 + resolution: "@ledgerhq/hw-transport-webusb@npm:5.38.0" + dependencies: + "@ledgerhq/devices": ^5.38.0 + "@ledgerhq/errors": ^5.38.0 + "@ledgerhq/hw-transport": ^5.38.0 + "@ledgerhq/logs": ^5.38.0 + checksum: 61f1f718afd309e21ad7b63436ad7bf234511fcfaed63e2885baab2846f133e074ebe4209ebb205737d238fd83869721f68bbba15ba5e068ec9384177a0f76f1 + languageName: node + linkType: hard + +"@ledgerhq/hw-transport@npm:^5.38.0": + version: 5.38.0 + resolution: "@ledgerhq/hw-transport@npm:5.38.0" + dependencies: + "@ledgerhq/devices": ^5.38.0 + "@ledgerhq/errors": ^5.38.0 + events: ^3.2.0 + checksum: 94f0cefbd1a3ee4195f4066d47ee493c7c22ea807fcdb2fc96d4e811618af8792a629bf2387313e234e599a434382fa92ee871bcac63c7c195c986dfdeb95071 + languageName: node + linkType: hard + +"@ledgerhq/logs@npm:^5.38.0": + version: 5.38.0 + resolution: "@ledgerhq/logs@npm:5.38.0" + checksum: 1cc94a59e4853e84960776edd46f6aa864d9ec49dedbb60a9632d0f9c29cc6d76d138562f4874295d26a362c115654a562662ce37641a687de364426471a7a66 + languageName: node + linkType: hard + "@nicolo-ribaudo/chokidar-2@npm:2.1.8-no-fsevents": version: 2.1.8-no-fsevents resolution: "@nicolo-ribaudo/chokidar-2@npm:2.1.8-no-fsevents" @@ -1708,6 +1785,32 @@ __metadata: languageName: node linkType: hard +"@polkadot/hw-ledger-transports@5.2.4-5, @polkadot/hw-ledger-transports@workspace:packages/hw-ledger-transports": + version: 0.0.0-use.local + resolution: "@polkadot/hw-ledger-transports@workspace:packages/hw-ledger-transports" + dependencies: + "@babel/runtime": ^7.12.5 + "@ledgerhq/hw-transport-node-hid-singleton": ^5.38.0 + "@ledgerhq/hw-transport-webusb": ^5.38.0 + "@types/ledgerhq__hw-transport-node-hid": ^4.22.2 + "@types/ledgerhq__hw-transport-webusb": ^4.70.1 + dependenciesMeta: + "@ledgerhq/hw-transport-node-hid-singleton": + optional: true + languageName: unknown + linkType: soft + +"@polkadot/hw-ledger@workspace:packages/hw-ledger": + version: 0.0.0-use.local + resolution: "@polkadot/hw-ledger@workspace:packages/hw-ledger" + dependencies: + "@babel/runtime": ^7.12.5 + "@polkadot/hw-ledger-transports": 5.2.4-5 + "@polkadot/util": ^5.2.4-5 + "@zondax/ledger-polkadot": ^0.13.0 + languageName: unknown + linkType: soft + "@polkadot/keyring@workspace:packages/keyring": version: 0.0.0-use.local resolution: "@polkadot/keyring@workspace:packages/keyring" @@ -1769,7 +1872,7 @@ __metadata: languageName: unknown linkType: soft -"@polkadot/util@5.2.4-5, @polkadot/util@workspace:packages/util": +"@polkadot/util@5.2.4-5, @polkadot/util@^5.2.4-5, @polkadot/util@workspace:packages/util": version: 0.0.0-use.local resolution: "@polkadot/util@workspace:packages/util" dependencies: @@ -2069,6 +2172,36 @@ __metadata: languageName: node linkType: hard +"@types/ledgerhq__hw-transport-node-hid@npm:^4.22.2": + version: 4.22.2 + resolution: "@types/ledgerhq__hw-transport-node-hid@npm:4.22.2" + dependencies: + "@types/ledgerhq__hw-transport": "*" + "@types/node": "*" + "@types/node-hid": "*" + checksum: 2e967635bb7de860f3b525d0629fae4cc2f7d460024a86b564c4239142f27b10fafdea6e2deeed05356dbb7dca45d8663ad2e522e94e51930549b4e5507aa014 + languageName: node + linkType: hard + +"@types/ledgerhq__hw-transport-webusb@npm:^4.70.1": + version: 4.70.1 + resolution: "@types/ledgerhq__hw-transport-webusb@npm:4.70.1" + dependencies: + "@types/ledgerhq__hw-transport": "*" + "@types/node": "*" + checksum: 4e233ba9e18bb4605f397e4e286904b5e51836007bdb8aeb35f1af5bfcf7df809d005ec9c6f5f58af79e0ad9aa1a1ede65d61401fbd2cbb6e1e3496b3bf7a2a6 + languageName: node + linkType: hard + +"@types/ledgerhq__hw-transport@npm:*": + version: 4.21.3 + resolution: "@types/ledgerhq__hw-transport@npm:4.21.3" + dependencies: + "@types/node": "*" + checksum: ca61594c52ab559a2a15fd4e3b60e5e46d9d1075a734544e5238f01618b5fcbafaec85dafae310e882658b012454ed818a124cbaba6a6b29ba96bc0ca09de326 + languageName: node + linkType: hard + "@types/node-fetch@npm:^2.5.7": version: 2.5.7 resolution: "@types/node-fetch@npm:2.5.7" @@ -2079,6 +2212,15 @@ __metadata: languageName: node linkType: hard +"@types/node-hid@npm:*": + version: 1.3.0 + resolution: "@types/node-hid@npm:1.3.0" + dependencies: + "@types/node": "*" + checksum: 7ad8f010c0f1aa23b09e820d69d5068077c20277622b9e33ccaab06b0bf29b37928ce4d0c64046615f93c382d5f2cd211a20b9c955c56679271dacfa52ef026d + languageName: node + linkType: hard + "@types/node@npm:*": version: 14.14.19 resolution: "@types/node@npm:14.14.19" @@ -2305,6 +2447,16 @@ __metadata: languageName: node linkType: hard +"@zondax/ledger-polkadot@npm:^0.13.0": + version: 0.13.0 + resolution: "@zondax/ledger-polkadot@npm:0.13.0" + dependencies: + "@babel/runtime": ^7.12.5 + "@ledgerhq/hw-transport": ^5.38.0 + checksum: 6eece4961ec7df1e630bab56a8a7d86d378b76f9f4658b007d5e253559cbc3b11dadc6e227bdb9be042f3142576bf114b46aa555e35fc8f95eea21fa384160ca + languageName: node + linkType: hard + "abab@npm:^2.0.3": version: 2.0.5 resolution: "abab@npm:2.0.5" @@ -2892,6 +3044,15 @@ __metadata: languageName: node linkType: hard +"bindings@npm:^1.3.0, bindings@npm:^1.5.0": + version: 1.5.0 + resolution: "bindings@npm:1.5.0" + dependencies: + file-uri-to-path: 1.0.0 + checksum: bd623dec58f126eb0c30f04a20da7080f06cdd5af26bf5a91615e70055fbba66c4cec5c88b156e8181c1d822f2392034a40a9121ef3ebc25638dc2163332b12d + languageName: node + linkType: hard + "bl@npm:^4.0.3": version: 4.0.3 resolution: "bl@npm:4.0.3" @@ -3204,6 +3365,13 @@ __metadata: languageName: node linkType: hard +"chownr@npm:^1.1.1": + version: 1.1.4 + resolution: "chownr@npm:1.1.4" + checksum: 4a7f1a0b2637450fd15ddb085b10649487ddd1d59a8d9335b1aa5b1e9ad55840a591ab7d7f9b568001cb6777d017334477ab2e32e048788b13a069d011cd5781 + languageName: node + linkType: hard + "chownr@npm:^2.0.0": version: 2.0.0 resolution: "chownr@npm:2.0.0" @@ -3708,6 +3876,15 @@ __metadata: languageName: node linkType: hard +"decompress-response@npm:^4.2.0": + version: 4.2.1 + resolution: "decompress-response@npm:4.2.1" + dependencies: + mimic-response: ^2.0.0 + checksum: d854171a100833d66171ffba0990fc581133cfb62befc18edd2365edc40e8a48f9f96b6156465f1a74802112b9c241c792d865f5ee27e285c2e4417a17ac6c66 + languageName: node + linkType: hard + "decompress-response@npm:^6.0.0": version: 6.0.0 resolution: "decompress-response@npm:6.0.0" @@ -3827,6 +4004,15 @@ __metadata: languageName: node linkType: hard +"detect-libc@npm:^1.0.3": + version: 1.0.3 + resolution: "detect-libc@npm:1.0.3" + bin: + detect-libc: ./bin/detect-libc.js + checksum: 6cec442139459ec2e8517076974b0eba42079885938683eca013c2e0b5db02ef048870725ce68e7ac8e4cf17e482f67d7322f45bbc5f203b7332817bc7833b39 + languageName: node + linkType: hard + "detect-newline@npm:^3.0.0": version: 3.1.0 resolution: "detect-newline@npm:3.1.0" @@ -4534,6 +4720,20 @@ __metadata: languageName: node linkType: hard +"eventemitter2@npm:^5.0.1": + version: 5.0.1 + resolution: "eventemitter2@npm:5.0.1" + checksum: 9f09a225e1d2cda18cfff04c042866b97c298bfca28a1f3224ac0adf4bb237642999135ce98860513c50524d7be1149d5de07c57e89368c00fb75e137ab40df9 + languageName: node + linkType: hard + +"events@npm:^3.2.0": + version: 3.2.0 + resolution: "events@npm:3.2.0" + checksum: 6ea52b160c2dfbe060feb2388d3d6d8b76a58779c2b14d66d96fdfcb255ccecaac11464634af4e5a7ba272b5412de929ead65d24cd203f3ff8ca881d4ba3796b + languageName: node + linkType: hard + "exec-sh@npm:^0.3.2": version: 0.3.4 resolution: "exec-sh@npm:0.3.4" @@ -4595,6 +4795,13 @@ __metadata: languageName: node linkType: hard +"expand-template@npm:^2.0.3": + version: 2.0.3 + resolution: "expand-template@npm:2.0.3" + checksum: d1c08a374a2335647562d6958bf23a40371fd9eb64362f3a2475b232a8d2e4bfa8f746066ff45c17efde185dab66f5d0824eaaa26e3e491d03bff50be0be7c3d + languageName: node + linkType: hard + "expect@npm:^26.6.2": version: 26.6.2 resolution: "expect@npm:26.6.2" @@ -4756,6 +4963,13 @@ __metadata: languageName: node linkType: hard +"file-uri-to-path@npm:1.0.0": + version: 1.0.0 + resolution: "file-uri-to-path@npm:1.0.0" + checksum: 5ddb9682f04f6f87b7765b93306206db2f96bc86162487e27639c55fe3ffeed12c30906ef1dedaa5307d7cabbbbdcbfa299b79aaec435de0f17e17ab31bd20b3 + languageName: node + linkType: hard + "filename-reserved-regex@npm:^1.0.0": version: 1.0.0 resolution: "filename-reserved-regex@npm:1.0.0" @@ -4964,6 +5178,13 @@ __metadata: languageName: node linkType: hard +"fs-constants@npm:^1.0.0": + version: 1.0.0 + resolution: "fs-constants@npm:1.0.0" + checksum: b8382395f555012591b20bddf08d258723f660b4e7312943d10431a893e2af879295fefc15a917df43c9ed52d80d2f014c0ca8ca359367969be5c8a133e39742 + languageName: node + linkType: hard + "fs-extra@npm:^8.1.0": version: 8.1.0 resolution: "fs-extra@npm:8.1.0" @@ -5225,6 +5446,13 @@ fsevents@~2.1.2: languageName: node linkType: hard +"github-from-package@npm:0.0.0": + version: 0.0.0 + resolution: "github-from-package@npm:0.0.0" + checksum: 9c3bae601535f7de7e2f54cc58dcd2ae62aa7afd262e9edea9021a264e633859ad0aef6ec23328e26607e4259f1efb97ce9b5b01e3f80d7d258085a628c9b710 + languageName: node + linkType: hard + "github-url-to-object@npm:^4.0.4": version: 4.0.4 resolution: "github-url-to-object@npm:4.0.4" @@ -7345,6 +7573,13 @@ fsevents@~2.1.2: languageName: node linkType: hard +"mimic-response@npm:^2.0.0": + version: 2.1.0 + resolution: "mimic-response@npm:2.1.0" + checksum: 9c206f3aebdc8de306550394301de8ce593e7757f3f9be43b5f99728e38ae787d17e6b72b96eb1b7a998d041da0ee465c48d29c927be4ff6ac3319453285d075 + languageName: node + linkType: hard + "mimic-response@npm:^3.1.0": version: 3.1.0 resolution: "mimic-response@npm:3.1.0" @@ -7375,7 +7610,7 @@ fsevents@~2.1.2: languageName: node linkType: hard -"minimist@npm:^1.1.1, minimist@npm:^1.2.0, minimist@npm:^1.2.5": +"minimist@npm:^1.1.1, minimist@npm:^1.2.0, minimist@npm:^1.2.3, minimist@npm:^1.2.5": version: 1.2.5 resolution: "minimist@npm:1.2.5" checksum: b77b8590147a4e217ff34266236bc39de23b52e6e33054076991ff674c7397a1380a7bde11111916f16f003a94aaa7e4f3d92595a32189644ff607fabc65a5b6 @@ -7411,6 +7646,13 @@ fsevents@~2.1.2: languageName: node linkType: hard +"mkdirp-classic@npm:^0.5.2, mkdirp-classic@npm:^0.5.3": + version: 0.5.3 + resolution: "mkdirp-classic@npm:0.5.3" + checksum: b3c46c62840bdc82c2a5bee417e4e7518a8109d32a85a6dc67bdcfecbe6aff5cfc73cdb98844a61178ddd8ac75743f977857f0badd6e12d14fd18cf1639e41a1 + languageName: node + linkType: hard + "mkdirp@npm:^1.0.3, mkdirp@npm:^1.0.4": version: 1.0.4 resolution: "mkdirp@npm:1.0.4" @@ -7468,6 +7710,15 @@ fsevents@~2.1.2: languageName: node linkType: hard +"nan@npm:^2.13.2": + version: 2.14.2 + resolution: "nan@npm:2.14.2" + dependencies: + node-gyp: latest + checksum: 36349b2e5df4182aa0d0cc43fcd6cc782ca560a83c2764743d80c14ba5028d0c54041a2f464b8d4cb18a884e04415034a0a764c745e1d5502ea34a5cb6470a39 + languageName: node + linkType: hard + "nanoid@npm:^3.1.20": version: 3.1.20 resolution: "nanoid@npm:3.1.20" @@ -7496,6 +7747,13 @@ fsevents@~2.1.2: languageName: node linkType: hard +"napi-build-utils@npm:^1.0.1": + version: 1.0.2 + resolution: "napi-build-utils@npm:1.0.2" + checksum: e4dfbec94d315533fea33a96ef5fb4de0d9e8828f2bb2b30e38de089500dfe35fe058ea5bcd72e104381457263f854c3d52d4d8700df9e1f9e6b78e9500ba435 + languageName: node + linkType: hard + "natural-compare-lite@npm:^1.4.0": version: 1.4.0 resolution: "natural-compare-lite@npm:1.4.0" @@ -7531,6 +7789,24 @@ fsevents@~2.1.2: languageName: node linkType: hard +"node-abi@npm:^2.7.0": + version: 2.19.3 + resolution: "node-abi@npm:2.19.3" + dependencies: + semver: ^5.4.1 + checksum: 503acaa092dbf3e1d4cd96fb8496f726d6d0b3f441e37c8e8be8a622fe88d9fcda495e2016a687c1c147a28c2a9b24bd9ce39f5ae5ac8223c30ab20aece376d8 + languageName: node + linkType: hard + +"node-addon-api@npm:^3.0.2": + version: 3.1.0 + resolution: "node-addon-api@npm:3.1.0" + dependencies: + node-gyp: latest + checksum: 9b5c1f5f24acb9255fd47914b0f0b80c76d735b7b91611366cd30217f8ead5fafcd1cfeb65e467612b40420b6ad3faf1e7fa3666bd4e15a2bdf1762748f3fa8a + languageName: node + linkType: hard + "node-fetch@npm:^2.6.0, node-fetch@npm:^2.6.1": version: 2.6.1 resolution: "node-fetch@npm:2.6.1" @@ -7569,6 +7845,20 @@ fsevents@~2.1.2: languageName: node linkType: hard +"node-hid@npm:2.1.1": + version: 2.1.1 + resolution: "node-hid@npm:2.1.1" + dependencies: + bindings: ^1.5.0 + node-addon-api: ^3.0.2 + node-gyp: latest + prebuild-install: ^6.0.0 + bin: + hid-showdevices: src/show-devices.js + checksum: e39bf570b6c6687272b0c247491b44dbc111dda8c83c4774993967b528455230484e2251a56db4ea15ad18c5fa78eb3390d1f4e237f30b82a65706e14bd06f19 + languageName: node + linkType: hard + "node-int64@npm:^0.4.0": version: 0.4.0 resolution: "node-int64@npm:0.4.0" @@ -7613,6 +7903,13 @@ fsevents@~2.1.2: languageName: node linkType: hard +"noop-logger@npm:^0.1.1": + version: 0.1.1 + resolution: "noop-logger@npm:0.1.1" + checksum: 353d31cd08698c797af21069df593772a081b694d0edbb3f1d9aca526ddc414bb0992e3deb9aaf69ad197ddee3a5e3be6dd09043023d3abe385d2872a863829c + languageName: node + linkType: hard + "nopt@npm:^5.0.0": version: 5.0.0 resolution: "nopt@npm:5.0.0" @@ -7689,7 +7986,7 @@ fsevents@~2.1.2: languageName: node linkType: hard -"npmlog@npm:^4.1.2": +"npmlog@npm:^4.0.1, npmlog@npm:^4.1.2": version: 4.1.2 resolution: "npmlog@npm:4.1.2" dependencies: @@ -8270,6 +8567,56 @@ fsevents@~2.1.2: languageName: node linkType: hard +"prebuild-install@npm:^5.3.5": + version: 5.3.6 + resolution: "prebuild-install@npm:5.3.6" + dependencies: + detect-libc: ^1.0.3 + expand-template: ^2.0.3 + github-from-package: 0.0.0 + minimist: ^1.2.3 + mkdirp-classic: ^0.5.3 + napi-build-utils: ^1.0.1 + node-abi: ^2.7.0 + noop-logger: ^0.1.1 + npmlog: ^4.0.1 + pump: ^3.0.0 + rc: ^1.2.7 + simple-get: ^3.0.3 + tar-fs: ^2.0.0 + tunnel-agent: ^0.6.0 + which-pm-runs: ^1.0.0 + bin: + prebuild-install: bin.js + checksum: 81ff157668dc26349e1f8076fce0ba990f45481e39a64645efad60c9ae2d61e73e3c420d56f5f38fbe6dc3275e8e27067d2613d941c778f41658a6110e544130 + languageName: node + linkType: hard + +"prebuild-install@npm:^6.0.0": + version: 6.0.0 + resolution: "prebuild-install@npm:6.0.0" + dependencies: + detect-libc: ^1.0.3 + expand-template: ^2.0.3 + github-from-package: 0.0.0 + minimist: ^1.2.3 + mkdirp-classic: ^0.5.3 + napi-build-utils: ^1.0.1 + node-abi: ^2.7.0 + noop-logger: ^0.1.1 + npmlog: ^4.0.1 + pump: ^3.0.0 + rc: ^1.2.7 + simple-get: ^3.0.3 + tar-fs: ^2.0.0 + tunnel-agent: ^0.6.0 + which-pm-runs: ^1.0.0 + bin: + prebuild-install: ./bin.js + checksum: 02db5ebaf2c45996a5005928996ffcd2cf13ed5daf10386b3b4fc0ea51d27c4d045fa21acaf4359c07474773bed1d4e4f55f8a33b2efb24339566497cbe7d223 + languageName: node + linkType: hard + "precinct@npm:^7.0.0": version: 7.0.0 resolution: "precinct@npm:7.0.0" @@ -8989,7 +9336,7 @@ fsevents@~2.1.2: languageName: node linkType: hard -"rxjs@npm:^6.6.0": +"rxjs@npm:^6.6.0, rxjs@npm:^6.6.3": version: 6.6.3 resolution: "rxjs@npm:6.6.3" dependencies: @@ -9260,6 +9607,17 @@ fsevents@~2.1.2: languageName: node linkType: hard +"simple-get@npm:^3.0.3": + version: 3.1.0 + resolution: "simple-get@npm:3.1.0" + dependencies: + decompress-response: ^4.2.0 + once: ^1.3.1 + simple-concat: ^1.0.0 + checksum: f56f08765eafde034b379d38d3dd1eb9b9ffb41d090d8216e71dce6ea3936499ee34b20942773a2605b08e8abce940691bd06e110ac12d08f83917493078831e + languageName: node + linkType: hard + "simple-get@npm:^4.0.0": version: 4.0.0 resolution: "simple-get@npm:4.0.0" @@ -9812,6 +10170,31 @@ fsevents@~2.1.2: languageName: node linkType: hard +"tar-fs@npm:^2.0.0": + version: 2.1.1 + resolution: "tar-fs@npm:2.1.1" + dependencies: + chownr: ^1.1.1 + mkdirp-classic: ^0.5.2 + pump: ^3.0.0 + tar-stream: ^2.1.4 + checksum: 4739382487b6ed646670a52cac637c818ecdceb728eb4718847dfdaddd7322d8cce2ea9db160ba8ad2920194034fda7c307b44f4eeb50d244f198bd7e28f2914 + languageName: node + linkType: hard + +"tar-stream@npm:^2.1.4": + version: 2.2.0 + resolution: "tar-stream@npm:2.2.0" + dependencies: + bl: ^4.0.3 + end-of-stream: ^1.4.1 + fs-constants: ^1.0.0 + inherits: ^2.0.3 + readable-stream: ^3.1.1 + checksum: 7eec0a7fc8d0337729c1c2356d567a7527141d6ba0dd4804db979e17fc6389163e70fd4abdb855fc5ab54b944aeff7988e35e95ab6cee34a4156ca2d42980576 + languageName: node + linkType: hard + "tar@npm:^6.0.2": version: 6.0.5 resolution: "tar@npm:6.0.5" @@ -10346,6 +10729,19 @@ fsevents@~2.1.2: languageName: node linkType: hard +"usb-detection@npm:^4.10.0": + version: 4.10.0 + resolution: "usb-detection@npm:4.10.0" + dependencies: + bindings: ^1.3.0 + eventemitter2: ^5.0.1 + nan: ^2.13.2 + node-gyp: latest + prebuild-install: ^5.3.5 + checksum: 17c60db18f268ef679fc3401d39348c0a248b588a46a0b7dde25fb866849511c00503b4cb4dceac02651caf5d6964388c92b46a0fb8b9b53eab3e5e520dd0a44 + languageName: node + linkType: hard + "use@npm:^3.1.0": version: 3.1.1 resolution: "use@npm:3.1.1" @@ -10553,6 +10949,13 @@ fsevents@~2.1.2: languageName: node linkType: hard +"which-pm-runs@npm:^1.0.0": + version: 1.0.0 + resolution: "which-pm-runs@npm:1.0.0" + checksum: 0bb79a782e98955afec8f35a3ae95c4711fdd3d0743772ee98211da67c2421fdd4c92c95c93532cc0b4dcc085d8e27f3ad2f8a9173cb632692379bd3d2818821 + languageName: node + linkType: hard + "which@npm:^1.2.9": version: 1.3.1 resolution: "which@npm:1.3.1"