Licence
ISC
Version
1.1.27-alpha.5
Deps
4
Size
24 kB
Vulns
18
Weekly
0
UnionKey Hardware Emulator Transport
This package provides HTTP-based transport for connecting to UnionKey hardware emulator.
Features
- HTTP-based communication with emulator server
- Compatible with UnionKey Connect SDK
- Support for switchTransport functionality
- Default emulator server URL:
http://localhost:21333
Installation
npm install @unionkeyhq/hd-transport-emulator
Usage
Basic Usage
import EmulatorTransport from '@unionkeyhq/hd-transport-emulator';
// Create transport instance
const transport = new EmulatorTransport();
// or with custom URL
const transport = new EmulatorTransport('http://localhost:21333');
// Initialize transport
await transport.init(logger);
// Configure with protobuf messages
await transport.configure(signedData);
With UnionKey Connect SDK
import HardwareSDK from '@unionkeyhq/hd-web-sdk';
// Initialize with emulator environment
await HardwareSDK.init({
env: 'emulator',
debug: true
});
// Switch to emulator transport
await HardwareSDK.switchTransport('emulator');
In Connect Examples
The emulator transport is integrated into the connect examples:
- Expo Example: Select "Emulator" from the transport picker
- Electron Example: Use switchTransport API to switch to emulator
API
Constructor
new EmulatorTransport(url?: string)
url(optional): Emulator server URL, defaults tohttp://localhost:21333
Methods
All methods implement the standard UnionKey Transport interface:
init(logger): Initialize transportconfigure(signedData): Configure protobuf messagesenumerate(): List available devicesacquire(input): Acquire device sessionrelease(session, onclose): Release device sessioncall(session, name, data): Call device methodstop(): Stop transport
Emulator Server
Make sure your UnionKey emulator server is running on the configured URL (default: http://localhost:21333) before using this transport.
Development
# Build
npm run build
# Development mode
npm run dev