mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 16:53:34 +00:00
* create new user decryption options service * rename new service to user decryption options * add hasMasterPassword to user decryption options service * migrate device trust service to new user decryption options service * add migration for user-decryption-options * migrate sync service and calls to trust-device-service * rename abstraction file * migrate two factor component * migrate two factor spec * migrate sso component * migrate set-password component * migrate base login decryption component * migrate organization options component * fix component imports * add missing imports - remove state service calls - add update user decryption options method * remove acct decryption options from account * lint * fix tests and linting * fix browser * fix desktop * add user decryption options service to cli * remove default value from migration * bump migration number * fix merge conflict * fix vault timeout settings * fix cli * more fixes * add user decryption options service to deps of vault timeout settings service * update login strategy service with user decryption options * remove early return from sync bandaid for user decryption options * move user decryption options service to lib/auth * move user decryption options to libs/auth * fix reference * fix browser * check user decryption options after 2fa check * update migration and revert tsconfig changes * add more documentation * clear user decryption options on logout * fix tests by creating helper for user decryption options * fix tests * pr feedback * fix factory * update migration * add tests * update missed migration num in test
35 lines
1.5 KiB
TypeScript
35 lines
1.5 KiB
TypeScript
import { Observable } from "rxjs";
|
|
|
|
import { UserDecryptionOptions } from "../models";
|
|
|
|
export abstract class UserDecryptionOptionsServiceAbstraction {
|
|
/**
|
|
* Returns what decryption options are available for the current user.
|
|
* @remark This is sent from the server on authentication.
|
|
*/
|
|
abstract userDecryptionOptions$: Observable<UserDecryptionOptions>;
|
|
/**
|
|
* Uses user decryption options to determine if current user has a master password.
|
|
* @remark This is sent from the server, and does not indicate if the master password
|
|
* was used to login and/or if a master key is saved locally.
|
|
*/
|
|
abstract hasMasterPassword$: Observable<boolean>;
|
|
|
|
/**
|
|
* Returns the user decryption options for the given user id.
|
|
* @param userId The user id to check.
|
|
*/
|
|
abstract userDecryptionOptionsById$(userId: string): Observable<UserDecryptionOptions>;
|
|
}
|
|
|
|
export abstract class InternalUserDecryptionOptionsServiceAbstraction extends UserDecryptionOptionsServiceAbstraction {
|
|
/**
|
|
* Sets the current decryption options for the user, contains the current configuration
|
|
* of the users account related to how they can decrypt their vault.
|
|
* @remark Intended to be used when user decryption options are received from server, does
|
|
* not update the server. Consider syncing instead of updating locally.
|
|
* @param userDecryptionOptions Current user decryption options received from server.
|
|
*/
|
|
abstract setUserDecryptionOptions(userDecryptionOptions: UserDecryptionOptions): Promise<void>;
|
|
}
|