mirror of
https://github.com/bitwarden/browser
synced 2025-12-19 17:53:39 +00:00
* Use typescript-strict-plugin to iteratively turn on strict * Add strict testing to pipeline Can be executed locally through either `npm run test:types` for full type checking including spec files, or `npx tsc-strict` for only tsconfig.json included files. * turn on strict for scripts directory * Use plugin for all tsconfigs in monorepo vscode is capable of executing tsc with plugins, but uses the most relevant tsconfig to do so. If the plugin is not a part of that config, it is skipped and developers get no feedback of strict compile time issues. These updates remedy that at the cost of slightly more complex removal of the plugin when the time comes. * remove plugin from configs that extend one that already has it * Update workspace settings to honor strict plugin * Apply strict-plugin to native message test runner * Update vscode workspace to use root tsc version * `./node_modules/.bin/update-strict-comments` 🤖 This is a one-time operation. All future files should adhere to strict type checking. * Add fixme to `ts-strict-ignore` comments * `update-strict-comments` 🤖 repeated for new merge files
74 lines
2.6 KiB
TypeScript
74 lines
2.6 KiB
TypeScript
// FIXME: Update this file to be type safe and remove this and next line
|
|
// @ts-strict-ignore
|
|
import { BiometricKey } from "../../auth/types/biometric-key";
|
|
import { Account } from "../models/domain/account";
|
|
import { StorageOptions } from "../models/domain/storage-options";
|
|
|
|
/**
|
|
* Options for customizing the initiation behavior.
|
|
*/
|
|
export type InitOptions = {
|
|
/**
|
|
* Whether or not to run state migrations as part of the init process. Defaults to true.
|
|
*
|
|
* If false, the init method will instead wait for migrations to complete before doing its
|
|
* other init operations. Make sure migrations have either already completed, or will complete
|
|
* before calling {@link StateService.init} with `runMigrations: false`.
|
|
*/
|
|
runMigrations?: boolean;
|
|
};
|
|
|
|
export abstract class StateService<T extends Account = Account> {
|
|
addAccount: (account: T) => Promise<void>;
|
|
clean: (options?: StorageOptions) => Promise<void>;
|
|
init: (initOptions?: InitOptions) => Promise<void>;
|
|
|
|
/**
|
|
* Gets the user's auto key
|
|
*/
|
|
getUserKeyAutoUnlock: (options?: StorageOptions) => Promise<string>;
|
|
/**
|
|
* Sets the user's auto key
|
|
*/
|
|
setUserKeyAutoUnlock: (value: string, options?: StorageOptions) => Promise<void>;
|
|
/**
|
|
* Gets the user's biometric key
|
|
*/
|
|
getUserKeyBiometric: (options?: StorageOptions) => Promise<string>;
|
|
/**
|
|
* Checks if the user has a biometric key available
|
|
*/
|
|
hasUserKeyBiometric: (options?: StorageOptions) => Promise<boolean>;
|
|
/**
|
|
* Sets the user's biometric key
|
|
*/
|
|
setUserKeyBiometric: (value: BiometricKey, options?: StorageOptions) => Promise<void>;
|
|
/**
|
|
* @deprecated For backwards compatible purposes only, use DesktopAutofillSettingsService
|
|
*/
|
|
setEnableDuckDuckGoBrowserIntegration: (
|
|
value: boolean,
|
|
options?: StorageOptions,
|
|
) => Promise<void>;
|
|
/**
|
|
* @deprecated For migration purposes only, use getUserKeyMasterKey instead
|
|
*/
|
|
getEncryptedCryptoSymmetricKey: (options?: StorageOptions) => Promise<string>;
|
|
/**
|
|
* @deprecated For migration purposes only, use setUserKeyAuto instead
|
|
*/
|
|
setCryptoMasterKeyAuto: (value: string, options?: StorageOptions) => Promise<void>;
|
|
getDuckDuckGoSharedKey: (options?: StorageOptions) => Promise<string>;
|
|
setDuckDuckGoSharedKey: (value: string, options?: StorageOptions) => Promise<void>;
|
|
|
|
/**
|
|
* @deprecated Use `TokenService.hasAccessToken$()` or `AuthService.authStatusFor$` instead.
|
|
*/
|
|
getIsAuthenticated: (options?: StorageOptions) => Promise<boolean>;
|
|
|
|
/**
|
|
* @deprecated Use `AccountService.activeAccount$` instead.
|
|
*/
|
|
getUserId: (options?: StorageOptions) => Promise<string>;
|
|
}
|