Skip to content

mytonwallet-org/capacitor-usb-hid

Repository files navigation

@mytonwallet/capacitor-usb-hid

A Capacitor USB HID Plugin

Install

npm install https://github.com/mytonwallet-org/capacitor-usb-hid
npx cap sync

API

getDeviceList()

getDeviceList() => Promise<{ devices: ICapacitorUSBDevice[]; }>

Returns: Promise<{ devices: ICapacitorUSBDevice[]; }>


openDevice(...)

openDevice(options: { deviceId: number; }) => Promise<{ success: boolean; }>
Param Type
options { deviceId: number; }

Returns: Promise<{ success: boolean; }>


exchange(...)

exchange(options: { deviceId: number; apduHex: string; }) => Promise<{ response: string; }>
Param Type
options { deviceId: number; apduHex: string; }

Returns: Promise<{ response: string; }>


closeDevice(...)

closeDevice(options: { deviceId: number; }) => Promise<{ response: string; }>
Param Type
options { deviceId: number; }

Returns: Promise<{ response: string; }>


addListener('onDeviceConnect', ...)

addListener(eventName: 'onDeviceConnect', handler: (device: ICapacitorUSBDevice) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Param Type
eventName 'onDeviceConnect'
handler (device: ICapacitorUSBDevice) => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


addListener('onDeviceDisconnect', ...)

addListener(eventName: 'onDeviceDisconnect', handler: (device: ICapacitorUSBDevice) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Param Type
eventName 'onDeviceDisconnect'
handler (device: ICapacitorUSBDevice) => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


Interfaces

ICapacitorUSBDevice

Prop Type
id number
name string
vendorId number
productId number

PluginListenerHandle

Prop Type
remove () => Promise<void>

This project is tested with BrowserStack

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •