Tango is a TypeScript re-implementation of ADB (Android Debugging Bridge) client that works in Chromium-based browsers (including Chrome for Android), Node.js, and Electron.
Generate RSA keys using Web Crypto API ([MDN](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API)) and store them in IndexedDB ([MDN](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API)).
Local storage is not available in Web Workers (for example WebUSB API is supported in Chrome extension service workers), so IndexedDB is used instead.
-[Constructor](#constructor)
-[`generateKey`](#generatekey)
-[`iterateKeys`](#iteratekeys)
## Constructor
```ts
publicconstructor();
```
Create a new instance of `AdbWebCredentialStore`.
## `generateKey`
```ts
asyncgenerateKey():Promise<Uint8Array>
```
Generate a RSA private key and store it into LocalStorage.
Calling this method multiple times will overwrite the previous key.
The returned `Uint8Array` is the private key in PKCS #8 format.
This package is part of [Tango ADB](https://github.com/yume-chan/ya-webadb). Generally you need multiple packages to build a complete ADB client that can run on Web browsers and Node.js. Read the documentation for more information.
## Documentation
Check the latest documentation at https://tango-adb.github.io/docs/
## Sponsors
[Become a backer](https://opencollective.com/ya-webadb) and get your image on our README on Github with a link to your site.
ADB daemon transport device for `@yume-chan/adb` using WebUSB ([MDN](https://developer.mozilla.org/en-US/docs/Web/API/USB), [Spec](https://wicg.github.io/webusb)) API.
| 61<sup>1</sup> | 79<sup>1</sup> | No | No | No |
<sup>1</sup>: Chrome for Android is supported, Chrome for iOS is NOT supported.
## Use in Node.js
| Node.js | `usb` NPM Package |
| ------- | ----------------- |
| 10.5 | 2.8.1 |
Node.js doesn't have native support for WebUSB API, but the [`usb`](https://www.npmjs.com/package/usb) NPM package provides a WebUSB compatible API.
To use a custom WebUSB API implementation, pass it to the constructor of `AdbDaemonWebUsbDevice`, `AdbDaemonWebUsbDeviceManager` and `AdbDaemonWebUsbConnectionWatcher` via the `usbManager` parameter.
Create a new instance of `AdbDaemonWebUsbDevice` using a specified `USBDevice` instance.
`USBDevice` and `USB` types are from WebUSB API.
The `filters` parameter specifies the `classCode`, `subclassCode` and `protocolCode` to use when searching for ADB interface. The default value is `[{ classCode: 0xff, subclassCode: 0x42, protocolCode: 0x1 }]`, defined by Google.
### `raw`
```ts
publicgetraw():USBDevice;
```
Gets the raw `USBDevice` from the device. Allow sending/receiving USB packets to other interfaces/endpoints. For example can be used with `@yume-chan/aoa` package.
This is a convince method for `usb.requestDevice()`.
The `filters` parameter must have `classCode`, `subclassCode` and `protocolCode` fields for selecting the ADB interface. It can also have `vendorId`, `productId` or `serialNumber` fields to limit the displayed device list.
Returns an `AdbDaemonWebUsbDevice` instance, or `undefined` if the user cancelled the picker.
WebUSB requires a [secure context](https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts)(HTTPS).
`localhost` is considered secure, so local development works. But to access a self-hosted server running on another machine, either add a certificate, or add the domain name to the allowlist on each client machine:
1. Open `chrome://flags/#unsafely-treat-insecure-origin-as-secure`
2. Add the protocol and domain part of your url (e.g. `http://192.168.0.100:9000`) to the input box
This package is part of [Tango ADB](https://github.com/yume-chan/ya-webadb). Generally you need multiple packages to build a complete ADB client that can run on Web browsers and Node.js. Read the documentation for more information.
## Documentation
Check the latest documentation at https://tango-adb.github.io/docs/
## Sponsors
[Become a backer](https://opencollective.com/ya-webadb) and get your image on our README on Github with a link to your site.