A Capacitor USB HID Plugin
npm install https://github.com/mytonwallet-org/capacitor-usb-hid
npx cap sync
getDeviceList()
openDevice(...)
exchange(...)
closeDevice(...)
addListener('onDeviceConnect', ...)
addListener('onDeviceDisconnect', ...)
- Interfaces
getDeviceList() => Promise<{ devices: ICapacitorUSBDevice[]; }>
Returns: Promise<{ devices: ICapacitorUSBDevice[]; }>
openDevice(options: { deviceId: number; }) => Promise<{ success: boolean; }>
Param | Type |
---|---|
options |
{ deviceId: number; } |
Returns: Promise<{ success: boolean; }>
exchange(options: { deviceId: number; apduHex: string; }) => Promise<{ response: string; }>
Param | Type |
---|---|
options |
{ deviceId: number; apduHex: string; } |
Returns: Promise<{ response: string; }>
closeDevice(options: { deviceId: number; }) => Promise<{ response: string; }>
Param | Type |
---|---|
options |
{ deviceId: number; } |
Returns: Promise<{ response: string; }>
addListener(eventName: 'onDeviceConnect', handler: (device: ICapacitorUSBDevice) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Param | Type |
---|---|
eventName |
'onDeviceConnect' |
handler |
(device: ICapacitorUSBDevice) => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
addListener(eventName: 'onDeviceDisconnect', handler: (device: ICapacitorUSBDevice) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Param | Type |
---|---|
eventName |
'onDeviceDisconnect' |
handler |
(device: ICapacitorUSBDevice) => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Prop | Type |
---|---|
id |
number |
name |
string |
vendorId |
number |
productId |
number |
Prop | Type |
---|---|
remove |
() => Promise<void> |
This project is tested with BrowserStack