npm.io
8.17.0 • Published 1 week ago

@ledgerhq/devices

Licence
Apache-2.0
Version
8.17.0
Deps
1
Size
99 kB
Vulns
0
Weekly
0
Stars
607

@ledgerhq/devices

Logic for all Ledger devices.

API

Table of Contents
IIGenericHID

The USB product IDs will be defined as MMII, encoding a model (MM) and an interface bitfield (II)

  • Model Ledger Nano S : 0x10 Ledger Blue : 0x00 Ledger Nano X : 0x40

  • Interface support bitfield Generic HID : 0x01 Keyboard HID : 0x02 U2F : 0x04 CCID : 0x08 WebUSB : 0x10

Type: number

blue

Ledger Blue

Type: string

nanoS

Ledger Nano S

Type: string

nanoSP

Ledger Nano S Plus

Type: string

nanoX

Ledger Nano X

Type: string

stax

Ledger Stax

Type: string

europa

Ledger Flex ("europa" is the internal name)

Type: string

apex

Apex

Type: string

ledgerUSBVendorId

Type: number

getDeviceModel
Parameters
  • id DeviceModelId

Returns DeviceModel

getProductName

Return the official, full product name of a device model (e.g. "Ledger Flex", "Ledger Nano X").

This is the canonical name and must be used as-is: do not strip the "Ledger" prefix, reword, or otherwise transform it.

Parameters
  • id DeviceModelId

Returns string

identifyTargetId

Given a targetId, return the deviceModel associated to it, based on the first two bytes.

Parameters

Returns (DeviceModel | null | undefined)

identifyUSBProductId

From a given USB product id, return the deviceModel associated to it.

The mapping from the product id is only based on the 2 most significant bytes. For example, Stax is defined with a product id of 0x60ii, a product id 0x6011 would be mapped to it.

Parameters

Returns (DeviceModel | null | undefined)

getBluetoothServiceUuids

Returns Array<string>

getInfosForServiceUuid
Parameters

Returns (BluetoothInfos | undefined)

DeviceModel
BluetoothInfos

Keywords