@ledgerhq/react-native-hw-transport-ble
Advanced tools
Comparing version 1.1.0 to 1.2.0-beta.ae9d68f7
{ | ||
"name": "@ledgerhq/react-native-hw-transport-ble", | ||
"version": "1.1.0", | ||
"description": | ||
"Ledger Hardware Wallet bluetooth BLE implementation of the transport layer", | ||
"keywords": ["Ledger", "LedgerWallet", "NanoS", "Blue", "Hardware Wallet"], | ||
"version": "1.2.0-beta.ae9d68f7", | ||
"description": "Ledger Hardware Wallet bluetooth BLE implementation of the transport layer", | ||
"keywords": [ | ||
"Ledger", | ||
"LedgerWallet", | ||
"NanoS", | ||
"Blue", | ||
"Hardware Wallet" | ||
], | ||
"repository": { | ||
@@ -24,3 +29,3 @@ "type": "git", | ||
"dependencies": { | ||
"@ledgerhq/hw-transport": "^1.1.0", | ||
"@ledgerhq/hw-transport": "^1.2.0-beta.df091f88", | ||
"invariant": "^2.2.0" | ||
@@ -35,7 +40,5 @@ }, | ||
"clean": "rm -rf lib/", | ||
"build": | ||
"cd ../.. && export PATH=$(yarn bin):$PATH && cd - && babel --source-maps -d lib src && flow-copy-source -v src lib", | ||
"watch": | ||
"cd ../.. && export PATH=$(yarn bin):$PATH && cd - && babel --watch --source-maps -d lib src & flow-copy-source -w -v src lib" | ||
"build": "cd ../.. && export PATH=$(yarn bin):$PATH && cd - && babel --source-maps -d lib src && flow-copy-source -v src lib", | ||
"watch": "cd ../.. && export PATH=$(yarn bin):$PATH && cd - && babel --watch --source-maps -d lib src & flow-copy-source -w -v src lib" | ||
} | ||
} |
@@ -9,3 +9,2 @@ //@flow | ||
const NotifyCharacteristicUuid = "d973f2e1-b19e-11e2-9e96-0800200c9a66"; | ||
const ClientCharacteristicConfig = "00002902-0000-1000-8000-00805f9b34fb"; | ||
const MaxChunkBytes = 20; | ||
@@ -17,47 +16,2 @@ const TagId = 0x05; | ||
/** | ||
* Ledger Bluetooth Low Energy APDU Protocol | ||
* Characteristic content: | ||
* [______________________________] | ||
* TT SSSS VVVV................VV | ||
* | ||
* All fields are big endian encoded. | ||
* TT: 1 byte content tag | ||
* SSSS: 2 bytes sequence number, big endian encoded (start @ 0). | ||
* VVVV..VV: variable length content. When SSSS is 0, the first two bytes encodes in big endian the total length of the APDU to transport. | ||
* | ||
* Command/Response APDU are split in chunks to fill up the bluetooth's characteristic | ||
* | ||
* APDU are using either standard or extended header. up to the application to check the total received length and the lc field | ||
* | ||
* Tags: | ||
* Direction: < and > T:0x05 S=<sequence-idx-U2BE> V=<seq==0?totallength(U2BE):NONE><apducontent> APDU (command/response) packet. | ||
* | ||
* Example: | ||
* -------- | ||
* Wrapping of Command APDU: | ||
* E0 FF 12 13 14 | ||
* 15 16 17 18 19 1A 1B 1C | ||
* 1D 1E 1F 20 21 22 23 24 | ||
* 25 26 27 28 29 2A 2B 2C | ||
* 2D 2E 2F 30 31 32 33 34 | ||
* 35 | ||
* Result in 3 chunks (20 bytes at most): | ||
* 0500000026E0FF12131415161718191A1B1C1D1E | ||
* 0500011F202122232425262728292A2B2C2D2E2F | ||
* 050002303132333435 | ||
* | ||
* | ||
* Wrapping of Response APDU: | ||
* 15 16 17 18 19 1a 1b 1c | ||
* 1d 1e 1f 20 21 22 23 24 | ||
* 25 26 27 28 29 2a 2b 2c | ||
* 2d 2e 2f 30 31 32 33 34 | ||
* 35 90 00 | ||
* Result in 3 chunks (20 bytes at most): | ||
* 050000002315161718191a1b1c1d1e1f20212223 | ||
* 0500012425262728292a2b2c2d2e2f3031323334 | ||
* 050002359000 | ||
*/ | ||
function chunkBuffer( | ||
@@ -154,5 +108,12 @@ buffer: Buffer, | ||
/** | ||
* react-native bluetooth BLE implementation | ||
* @example | ||
* import BluetoothTransport from "@ledgerhq/react-native-hw-transport-ble"; | ||
*/ | ||
export default class BluetoothTransport extends Transport<Device> { | ||
static list = (): * => Promise.resolve([]); | ||
/** | ||
*/ | ||
static listen(observer: *) { | ||
@@ -171,3 +132,2 @@ let bleManager; | ||
}; | ||
const all = {}; | ||
const onBleStateChange = (state: string) => { | ||
@@ -196,5 +156,8 @@ if (state === "PoweredOn") { | ||
static async open(device: Device, timeout?: number) { | ||
/** | ||
*/ | ||
static async open(device: Device) { | ||
await device.connect(); | ||
await device.discoverAllServicesAndCharacteristics(); | ||
/* | ||
const services = await device.services(); | ||
@@ -204,2 +167,3 @@ for (const service of services) { | ||
} | ||
*/ | ||
const characteristics = await device.characteristicsForService(ServiceUuid); | ||
@@ -206,0 +170,0 @@ invariant(characteristics, "service found"); |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
45079
711
1
+ Added@ledgerhq/hw-transport@1.2.0-beta.ffc162fd(transitive)
- Removed@ledgerhq/hw-transport@1.1.0(transitive)