ya-webadb/libraries/adb-credential-web
2023-07-11 21:05:39 +08:00
..
src refactor: migrate to ES private fields 2023-07-11 21:05:39 +08:00
.eslintrc.cjs chore: integrate ESLint 2022-12-22 01:42:24 +08:00
.npmignore chore: integrate ESLint 2022-12-22 01:42:24 +08:00
CHANGELOG.json chore: v0.0.20 2023-06-05 11:02:37 +08:00
CHANGELOG.md chore: v0.0.20 2023-06-05 11:02:37 +08:00
package.json chore: update dependencies 2023-07-07 18:30:13 +08:00
README.md feat(credential): save keys in indexedDB to support workers 2023-05-25 23:03:40 +08:00
tsconfig.build.json chore: update dependencies 2023-05-22 12:57:03 +08:00
tsconfig.json chore: update dependencies 2023-05-22 12:57:03 +08:00

@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.