mirror of
https://github.com/yume-chan/ya-webadb.git
synced 2025-10-03 01:39:21 +02:00
.. | ||
src | ||
.eslintrc.cjs | ||
.npmignore | ||
CHANGELOG.json | ||
CHANGELOG.md | ||
package.json | ||
README.md | ||
tsconfig.build.json | ||
tsconfig.json |
@yume-chan/adb-credential-web
Generate RSA keys using Web Crypto API (MDN) and store them in IndexedDB (MDN).
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
public constructor();
Create a new instance of AdbWebCredentialStore
.
generateKey
async generateKey(): 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.
iterateKeys
async *iterateKeys(): AsyncGenerator<Uint8Array, void, void>
Yield the stored RSA private key. AdbWebCredentialStore
only stores one key, so only one value will be yielded.
This method returns a generator, so for await...of...
loop should be used to read the key.