@radixdlt/hardware-wallet
Advanced tools
Comparing version 1.0.0 to 1.0.1-alpha.0
{ | ||
"name": "@radixdlt/hardware-wallet", | ||
"version": "1.0.0", | ||
"main": "build/index.js", | ||
"license": "MIT", | ||
"version": "1.0.1-alpha.0", | ||
"description": "Application for the Ledger Nano hardware wallet", | ||
"keywords": [ | ||
"Ledger", | ||
"Hardware", | ||
"Wallet", | ||
"Nano" | ||
], | ||
"author": "Alexander Cyon <alex.cyon@gmail.com>", | ||
"homepage": "https://github.com/radixdlt/radixdlt-javascript/tree/master/packages/hardware-wallet#readme", | ||
"license": "Apache-2.0", | ||
"main": "dist/_index.js", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/radixdlt/radixdlt-javascript.git" | ||
}, | ||
"scripts": { | ||
"build": "tsc -p tsconfig.json", | ||
"test": "mocha -r ts-node/register test/**/*.spec.ts --file test/setup.ts", | ||
"test:hardware": "mocha -r ts-node/register test-hardware/**/*.spec.ts --file test/setup.ts", | ||
"coverage": "nyc --reporter=lcov mocha -r ts-node/register test/**/*.spec.ts --file test/setup.ts --exit" | ||
"test": "echo \"Error: run tests from root\" && exit 1" | ||
}, | ||
"dependencies": { | ||
"@ledgerhq/hw-transport-node-hid": "^5.12.0", | ||
"bip32": "^2.0.5", | ||
"bip39": "^3.0.2", | ||
"cbor": "^5.0.2", | ||
"elliptic": "^6.5.3", | ||
"radixdlt": "git://github.com/radixdlt/radixdlt-js.git#release/2.0-beta.10", | ||
"rxjs": "^6.5.5" | ||
"bugs": { | ||
"url": "https://github.com/radixdlt/radixdlt-javascript/issues" | ||
}, | ||
"devDependencies": { | ||
"@types/chai": "^4.2.11", | ||
"@types/mocha": "^7.0.2", | ||
"chai": "^4.2.0", | ||
"mocha": "^7.1.2", | ||
"nyc": "^15.1.0", | ||
"sinon": "^9.0.2", | ||
"ts-node": "^8.10.1", | ||
"typescript": "^3.8.3" | ||
"engines": { | ||
"node": ">=15.5.0 <16" | ||
}, | ||
"nyc": { | ||
"extension": [ | ||
".ts", | ||
".tsx" | ||
], | ||
"exclude": [ | ||
"test/**/*", | ||
"**/*.d.ts" | ||
], | ||
"include": "src", | ||
"reporter": [ | ||
"text-summary" | ||
] | ||
} | ||
"gitHead": "d4912e22fcb4884c8af847610752be360290197d" | ||
} |
145
README.md
@@ -1,144 +0,11 @@ | ||
# Hardware-wallet | ||
# `@radixdlt/hardware-wallet` | ||
This package implements communication to a hardware wallet device, and an interface for sending messages to the Radix Ledger App. | ||
> TODO: description | ||
Refer to the Radix APDU spec for detailed information on message formats: | ||
https://github.com/radixdlt/radixdlt-ledger-app/blob/master/APDUSPEC.md | ||
| Version | Device Support | | ||
|---------|----------------| | ||
| 1.0.0 | Ledger Nano S | | ||
## Install | ||
`yarn add @radixdlt/hardware-wallet` | ||
NOTE: If you get any errors related to the node-hid package, please check installation instructions here: https://github.com/node-hid/node-hid#compiling-from-source. On Linux you may need to run sudo apt install libusb-1.0-0 libusb-1.0-0-dev, for example. | ||
## Usage | ||
Initializing Radix identity: | ||
``` | ||
const radixHardwareWallet = require('@radixdlt/hardware-wallet') | ||
import { RadixHardwareWalletIdentity } from 'radixdlt' | ||
import { app } from '@radixdlt/hardware-wallet' | ||
const BIP44_PATH = '80000002' + '00000001' + '00000003' // Will use 44'/536'/2'/1/3 | ||
const identity = await RadixHardwareWalletIdentity.createNew(app, BIP44_PATH) | ||
Subscribing to events: | ||
import { subscribeAppConnection, subscribeDeviceConnection, AppState } from '@radixdlt/hardware-wallet' | ||
let deviceConnected: boolean = false | ||
let appState: AppState | ||
await subscribeDeviceConnection(isConnected => { | ||
deviceConnected = isConnected | ||
}) | ||
subscribeAppConnection(state => { | ||
appState = state | ||
}) | ||
## API | ||
### app.getPublicKey | ||
app.getPublicKey(bip44: string, p1: 0 | 1 = 0): Promise<{ publicKey: Buffer }> | ||
Gets the public key from the hardware wallet, using the keypath defined by `bip44`. | ||
##### Parameters | ||
`bip44: string` - The last 3 parameters of a BIP44 derivation path (the first two are hard coded as 44'/536'). It expects a string representing the bit values, 1 byte per parameter. Example: "800000020000000100000003" (44'/536'/2'/1/3). | ||
`p1: 0 | 1` - 0 = No confirmation of BIP32 path needed. 1 = Confirmation of BIP 32 path needed before generation of pub key. | ||
##### Returns | ||
`Promise<{ publicKey: Buffer }>` - A promise that resolves to an object with the public key. The public key is a byte array (NodeJS Buffer). | ||
### app.getVersion | ||
app.getVersion(): Promise<string> | ||
Gets the Radix Ledger App version. | ||
##### Returns | ||
`Promise<string>` - Resolves to a string for the app version, in semver form "<major>.<minor>.<patch>". | ||
### app.signAtom | ||
app.signAtom(bip44: string, atom: RadixAtom, address: RadixAddress): Promise<RadixAtom> | ||
Signs a Radix atom, using the account with the bip44 keypath. | ||
##### Parameters | ||
`bip44: string` - See above. | ||
`atom: RadixAtom` - Radix atom object to be signed. | ||
##### Returns | ||
`Promise<RadixAtom>` - The atom with the included signature. | ||
### app.signHash | ||
app.signHash(bip44: string, hash: Buffer): Promise<{ signature: Buffer }> | ||
Signs a hash of an atom. | ||
##### Parameters | ||
`bip44: string` - See above. | ||
`hash: Buffer` - Byte array of hash to be signed. | ||
##### Returns | ||
`Promise<{ signature: Buffer }` - The resulting signature. | ||
### subscribeDeviceConnection | ||
subscribeDeviceConnection(next: (isConnected: boolean) => any) | ||
Subscribes to events firing when the hardware device is connected/disconnected. | ||
This happens when the device is unlocked/locked with a PIN code. | ||
##### Parameters | ||
`next: (isConnected: boolean) => void)` - A callback function, called with either true or false when the device connects/disconnects. | ||
### subscribeAppConnection | ||
subscribeAppConnection(next: (status: AppState) => void) | ||
Subscribes to status events from the Radix Ledger App. | ||
Can be: | ||
- APP_OPEN | ||
- APP_CLOSED | ||
- SIGN_CONFIRM | ||
- SIGN_REJECT | ||
##### Parameters | ||
`next: (status: AppState) => void)` - A callback function, called with an app state change. | ||
// TODO: DEMONSTRATE API | ||
``` |
{ | ||
"extends": "../../../tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "build", | ||
"rootDir": "src", | ||
"declaration": true | ||
}, | ||
"exclude": [ | ||
"node_modules/**", | ||
"src/**/*.spec.ts" | ||
], | ||
"include": [ | ||
"src/**/*.ts" | ||
] | ||
"extends": "../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"rootDir": "src", | ||
"outDir": "dist" | ||
}, | ||
"include": [ | ||
"src" | ||
], | ||
"references": [ | ||
{"path": "../atom"} | ||
] | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Git dependency
Supply chain riskContains a dependency which resolves to a remote git URL. Dependencies fetched from git URLs are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
0
0
0
0
0
64869
11
24
12
1
- Removedbip32@^2.0.5
- Removedbip39@^3.0.2
- Removedcbor@^5.0.2
- Removedelliptic@^6.5.3
- Removedradixdlt@git://github.com/radixdlt/radixdlt-js.git#release/2.0-beta.10
- Removedrxjs@^6.5.5
- Removed@ledgerhq/devices@5.51.1(transitive)
- Removed@ledgerhq/errors@5.50.0(transitive)
- Removed@ledgerhq/hw-transport@5.51.1(transitive)
- Removed@ledgerhq/hw-transport-node-hid@5.51.1(transitive)
- Removed@ledgerhq/hw-transport-node-hid-noevents@5.51.1(transitive)
- Removed@ledgerhq/logs@5.50.0(transitive)
- Removed@noble/hashes@1.5.0(transitive)
- Removed@types/node@10.12.18(transitive)
- Removedansi-regex@2.1.1(transitive)
- Removedaproba@1.2.0(transitive)
- Removedare-we-there-yet@1.1.7(transitive)
- Removedbase-x@3.0.10(transitive)
- Removedbase64-js@1.5.1(transitive)
- Removedbignumber.js@9.1.2(transitive)
- Removedbindings@1.5.0(transitive)
- Removedbip32@2.0.6(transitive)
- Removedbip39@3.1.0(transitive)
- Removedbl@4.1.0(transitive)
- Removedbn.js@4.12.1(transitive)
- Removedbrorand@1.1.0(transitive)
- Removedbs58@4.0.1(transitive)
- Removedbs58check@2.1.2(transitive)
- Removedbuffer@5.7.1(transitive)
- Removedcbor@5.2.0(transitive)
- Removedchownr@1.1.4(transitive)
- Removedcipher-base@1.0.5(transitive)
- Removedcode-point-at@1.1.0(transitive)
- Removedconsole-control-strings@1.1.0(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removedcreate-hash@1.2.0(transitive)
- Removedcreate-hmac@1.1.7(transitive)
- Removeddecompress-response@4.2.1(transitive)
- Removeddeep-extend@0.6.0(transitive)
- Removeddelegates@1.0.0(transitive)
- Removeddetect-libc@1.0.3(transitive)
- Removedelliptic@6.6.1(transitive)
- Removedend-of-stream@1.4.4(transitive)
- Removedevents@3.3.0(transitive)
- Removedexpand-template@2.0.3(transitive)
- Removedfile-uri-to-path@1.0.0(transitive)
- Removedfs-constants@1.0.0(transitive)
- Removedgauge@2.7.4(transitive)
- Removedgithub-from-package@0.0.0(transitive)
- Removedhas-unicode@2.0.1(transitive)
- Removedhash-base@3.1.0(transitive)
- Removedhash.js@1.1.7(transitive)
- Removedhmac-drbg@1.0.1(transitive)
- Removedieee754@1.2.1(transitive)
- Removedinherits@2.0.4(transitive)
- Removedini@1.3.8(transitive)
- Removedis-fullwidth-code-point@1.0.0(transitive)
- Removedisarray@1.0.0(transitive)
- Removedlodash@4.17.21(transitive)
- Removedmd5.js@1.3.5(transitive)
- Removedmimic-response@2.1.0(transitive)
- Removedminimalistic-assert@1.0.1(transitive)
- Removedminimalistic-crypto-utils@1.0.1(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp-classic@0.5.3(transitive)
- Removednan@2.22.0(transitive)
- Removednapi-build-utils@1.0.2(transitive)
- Removednode-abi@2.30.1(transitive)
- Removednode-addon-api@3.2.14.3.0(transitive)
- Removednode-gyp-build@4.8.3(transitive)
- Removednode-hid@2.1.1(transitive)
- Removednofilter@1.0.4(transitive)
- Removednpmlog@4.1.2(transitive)
- Removednumber-is-nan@1.0.1(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedonce@1.4.0(transitive)
- Removedprebuild-install@6.1.4(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedpump@3.0.2(transitive)
- Removedrc@1.2.8(transitive)
- Removedreadable-stream@2.3.83.6.2(transitive)
- Removedripemd160@2.0.2(transitive)
- Removedrxjs@6.6.7(transitive)
- Removedsafe-buffer@5.1.25.2.1(transitive)
- Removedsemver@5.7.27.6.3(transitive)
- Removedset-blocking@2.0.0(transitive)
- Removedsha.js@2.4.11(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedsimple-concat@1.0.1(transitive)
- Removedsimple-get@3.1.1(transitive)
- Removedstring-width@1.0.2(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedstrip-ansi@3.0.1(transitive)
- Removedstrip-json-comments@2.0.1(transitive)
- Removedtar-fs@2.1.1(transitive)
- Removedtar-stream@2.2.0(transitive)
- Removedtiny-secp256k1@1.1.7(transitive)
- Removedtslib@1.14.1(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedtypeforce@1.18.0(transitive)
- Removedusb@1.9.2(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedwide-align@1.1.5(transitive)
- Removedwif@2.0.6(transitive)
- Removedwrappy@1.0.2(transitive)