Backend for @yume-chan/adb
using WebUSB API.
WebUSB API requires a secure context (basically means HTTPS).
Chrome will treat localhost
as secure, but if you want to access a dev server running on another machine, you need to add the domain to the allowlist:
- Open
chrome://flags/#unsafely-treat-insecure-origin-as-secure
- Add the protocol and domain part of your url (e.g.
http://192.168.0.100:9000
) to the input box - Choose
Enable
from the dropdown menu - Restart your browser
static async pickDevice(): Promise<AdbWebBackend | undefined>
Request browser to present a list of connected Android devices to let the user choose from.
Returns undefined
if the user canceled the picker.
static async fromDevice(device: USBDevice): Promise<AdbWebBackend>
Create an AdbWebBackend
instance from an exist USBDevice
instance.
Read/write data from/to the underlying USBDevice
instance.
Web Crypto API (MDN)
Web Storage API (MDN)
Generate a RSA private key and store it into LocalStorage.
Return the stored RSA private key. (This backend only supports a single key)
Encode/decode string in UTF-8 with TextEncoder
(MDN) and TextDecoder
(MDN).