@ledgerhq/devices
Advanced tools
Comparing version 4.37.0-beta.2b8718d2 to 4.37.0
@@ -23,3 +23,6 @@ "use strict"; | ||
exports.default = function (channel, packetSize) { | ||
/** | ||
* | ||
*/ | ||
var createHIDframing = function createHIDframing(channel, packetSize) { | ||
return { | ||
@@ -83,2 +86,4 @@ makeBlocks: function makeBlocks(apdu) { | ||
}; | ||
exports.default = createHIDframing; | ||
//# sourceMappingURL=hid-framing.js.map |
@@ -38,8 +38,12 @@ "use strict"; | ||
// $FlowFixMe | ||
var devicesList = Object.values(devices); | ||
/** | ||
* | ||
*/ | ||
var ledgerUSBVendorId = exports.ledgerUSBVendorId = 0x2c97; | ||
/** | ||
* | ||
*/ | ||
var getDeviceModel = exports.getDeviceModel = function getDeviceModel(id) { | ||
@@ -51,2 +55,5 @@ var info = devices[id]; | ||
/** | ||
* | ||
*/ | ||
var identifyUSBProductId = exports.identifyUSBProductId = function identifyUSBProductId(usbProductId) { | ||
@@ -74,2 +81,5 @@ return devicesList.find(function (d) { | ||
/** | ||
* | ||
*/ | ||
var getBluetoothServiceUuids = exports.getBluetoothServiceUuids = function getBluetoothServiceUuids() { | ||
@@ -79,5 +89,17 @@ return bluetoothServices; | ||
/** | ||
* | ||
*/ | ||
var getInfosForServiceUuid = exports.getInfosForServiceUuid = function getInfosForServiceUuid(uuid) { | ||
return serviceUuidToInfos[uuid.toLowerCase()]; | ||
}; | ||
/** | ||
* | ||
*/ | ||
/** | ||
* | ||
*/ | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@ledgerhq/devices", | ||
"version": "4.37.0-beta.2b8718d2", | ||
"version": "4.37.0", | ||
"description": "Ledger devices", | ||
@@ -22,7 +22,7 @@ "keywords": [ | ||
"devDependencies": { | ||
"flow-bin": "^0.78.0", | ||
"flow-bin": "^0.92.1", | ||
"flow-typed": "^2.5.1" | ||
}, | ||
"dependencies": { | ||
"@ledgerhq/errors": "^4.37.0-beta.2b8718d2" | ||
"@ledgerhq/errors": "^4.37.0" | ||
}, | ||
@@ -33,4 +33,6 @@ "scripts": { | ||
"build": "bash ../../script/build.sh", | ||
"watch": "bash ../../script/watch.sh" | ||
} | ||
"watch": "bash ../../script/watch.sh", | ||
"doc": "bash ../../script/doc.sh" | ||
}, | ||
"gitHead": "8b31eec9c71f2b8ec4d1db47c2fb7ae20f188de2" | ||
} |
@@ -5,2 +5,82 @@ <img src="https://user-images.githubusercontent.com/211411/34776833-6f1ef4da-f618-11e7-8b13-f0697901d6a8.png" height="100" /> | ||
Logic for all Ledger devices. | ||
Logic for all Ledger devices. | ||
## API | ||
<!-- Generated by documentation.js. Update this documentation by updating the source code. --> | ||
#### Table of Contents | ||
- [createHIDframing](#createhidframing) | ||
- [Parameters](#parameters) | ||
- [ledgerUSBVendorId](#ledgerusbvendorid) | ||
- [getDeviceModel](#getdevicemodel) | ||
- [Parameters](#parameters-1) | ||
- [identifyUSBProductId](#identifyusbproductid) | ||
- [Parameters](#parameters-2) | ||
- [getBluetoothServiceUuids](#getbluetoothserviceuuids) | ||
- [getInfosForServiceUuid](#getinfosforserviceuuid) | ||
- [Parameters](#parameters-3) | ||
- [DeviceModel](#devicemodel) | ||
- [Properties](#properties) | ||
- [BluetoothInfos](#bluetoothinfos) | ||
- [Properties](#properties-1) | ||
### createHIDframing | ||
#### Parameters | ||
- `channel` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `packetSize` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
### ledgerUSBVendorId | ||
Type: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number) | ||
### getDeviceModel | ||
#### Parameters | ||
- `id` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
Returns **[DeviceModel](#devicemodel)** | ||
### identifyUSBProductId | ||
#### Parameters | ||
- `usbProductId` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
Returns **[DeviceModel](#devicemodel)?** | ||
### getBluetoothServiceUuids | ||
### getInfosForServiceUuid | ||
#### Parameters | ||
- `uuid` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
Returns **[BluetoothInfos](#bluetoothinfos)?** | ||
### DeviceModel | ||
Type: {id: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), productName: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), usbProductId: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), bluetoothSpec: [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<{serviceUuid: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), writeUuid: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), notifyUuid: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>?} | ||
#### Properties | ||
- `id` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
- `productName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
- `usbProductId` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `bluetoothSpec` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<{serviceUuid: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), writeUuid: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), notifyUuid: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>?** | ||
### BluetoothInfos | ||
Type: {deviceModel: [DeviceModel](#devicemodel), serviceUuid: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), writeUuid: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), notifyUuid: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)} | ||
#### Properties | ||
- `deviceModel` **[DeviceModel](#devicemodel)** | ||
- `serviceUuid` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
- `writeUuid` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
- `notifyUuid` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** |
@@ -25,3 +25,6 @@ // @flow | ||
export default (channel: number, packetSize: number) => { | ||
/** | ||
* | ||
*/ | ||
const createHIDframing = (channel: number, packetSize: number) => { | ||
return { | ||
@@ -86,1 +89,3 @@ makeBlocks(apdu: Buffer): Buffer[] { | ||
}; | ||
export default createHIDframing; |
// @flow | ||
export type DeviceModel = { | ||
id: string, | ||
productName: string, | ||
usbProductId: number, | ||
bluetoothSpec?: Array<{ | ||
serviceUuid: string, | ||
writeUuid: string, | ||
notifyUuid: string | ||
}> | ||
}; | ||
const devices: { [id: string]: DeviceModel } = { | ||
@@ -48,4 +37,10 @@ blue: { | ||
/** | ||
* | ||
*/ | ||
export const ledgerUSBVendorId = 0x2c97; | ||
/** | ||
* | ||
*/ | ||
export const getDeviceModel = (id: string): DeviceModel => { | ||
@@ -57,12 +52,8 @@ const info = devices[id]; | ||
/** | ||
* | ||
*/ | ||
export const identifyUSBProductId = (usbProductId: number): ?DeviceModel => | ||
devicesList.find(d => d.usbProductId === usbProductId); | ||
export type BluetoothInfos = { | ||
deviceModel: DeviceModel, | ||
serviceUuid: string, | ||
writeUuid: string, | ||
notifyUuid: string | ||
}; | ||
const bluetoothServices: string[] = []; | ||
@@ -85,5 +76,35 @@ const serviceUuidToInfos: { | ||
/** | ||
* | ||
*/ | ||
export const getBluetoothServiceUuids = () => bluetoothServices; | ||
/** | ||
* | ||
*/ | ||
export const getInfosForServiceUuid = (uuid: string): ?BluetoothInfos => | ||
serviceUuidToInfos[uuid.toLowerCase()]; | ||
/** | ||
* | ||
*/ | ||
export type DeviceModel = { | ||
id: string, | ||
productName: string, | ||
usbProductId: number, | ||
bluetoothSpec?: Array<{ | ||
serviceUuid: string, | ||
writeUuid: string, | ||
notifyUuid: string | ||
}> | ||
}; | ||
/** | ||
* | ||
*/ | ||
export type BluetoothInfos = { | ||
deviceModel: DeviceModel, | ||
serviceUuid: string, | ||
writeUuid: string, | ||
notifyUuid: string | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
471502
13
332
0
86
Updated@ledgerhq/errors@^4.37.0