Add name for public key so it will not be displayed as "nouser@nohostname"
RikkaW opened this issue · 1 comments
The name is displayed in "Developer options" - "Wireless debugging" - "Paired devices".
The current implementation does not set the name of the key, so its name is displayed as "nouser@nohostname". If there are more than one, the user cannot distinguish the source of the key.
The method of adding a name is quite simple, just add " name
" at the end of publicKeyBuffer
(note the space before name).
ya-webadb/libraries/adb/src/daemon/auth.ts
Lines 102 to 107 in 347beb3
const name = " webadb"; // a space is required
const publicKeyBuffer = new Uint8Array(publicKeyBase64Length + name.length + 1);
// ...
publicKeyBuffer.set(Uint8Array.from(Array.from(name).map(letter => letter.charCodeAt(0))), publicKeyBase64Length);
Because I don't know how to pass the name
is better, so I cannot send a pull request x_x
I changed the return type of AdbCredentialStore#iterateKeys
to include an optional name
field. Developers can provide their own AdbCredentialStore
implementations to specify the name.
The reference implementation @yume-chan/adb-credential-web
will set name to Tango@<hostname>
(e.g. Tango@www.tangoapp.dev
).