Migrate Bridge To WebUSB
This short guide helps you replace the legacy Bridge transport with native WebUSB, while keeping @onekeyfe/hd-web-sdk as your SDK entry.
Requirements
Chromium browsers (Chrome/Edge desktop)
Node.js 18+ (LTS recommended)
What Changed (At a Glance)
Initialize the SDK with
env: 'webusb'(Bridge (env:
web) → WebUSB (env:webusb).)
Update hd-web-sdk
connectSrcto the latest iframe host version (e.g.,https://jssdk.onekey.so/1.1.16/)Ask for user authorization via
navigator.usb.requestDevice()with official OneKey filters — must be triggered by a user gesture (e.g., a button click) due to Chrome security restrictions; automatic device discovery is not allowed before permissionBridge‑specific checks are deprecated (e.g.,
checkBridgeStatus())All other SDK usage remains the same
Initialize (hd-web-sdk + WebUSB)
Authorization (WebUSB Picker + Official Filter)
Enumerate Devices and First Call
Cleanup and Checklist
Remove Bridge‑specific checks/CTAs (e.g.,
checkBridgeStatus())Keep latest
connectSrcin hd-web-sdk init (the iframe host)Feature‑detect
navigator.usband show a friendly notice if unsupportedAll other SDK methods and UI flows are unchanged
Last updated
Was this helpful?