Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@radixdlt/hardware-wallet

Package Overview
Dependencies
Maintainers
4
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@radixdlt/hardware-wallet - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1-alpha.0

dist/_index.d.ts

63

package.json
{
"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"
}

@@ -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"}
]
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc