mirror of
https://github.com/bitwarden/browser
synced 2026-01-04 09:33:27 +00:00
* add `CipherViewLike` and utilities to handle `CipherView` and `CipherViewLike` * migrate libs needed for web vault to support `CipherViewLike` * migrate web vault components to support * add for CipherView. will have to be later * fetch full CipherView for copying a password * have only the cipher service utilize SDK migration flag - This keeps feature flag logic away from the component - Also cuts down on what is needed for other platforms * strongly type CipherView for AC vault - Probably temporary before migration of the AC vault to `CipherListView` SDK * fix build icon tests by being more gracious with the uri structure * migrate desktop components to CipherListViews$ * consume card from sdk * add browser implementation for `CipherListView` * update copy message for single copiable items * refactor `getCipherViewLikeLogin` to `getLogin` * refactor `getCipherViewLikeCard` to `getCard` * add `hasFido2Credentials` helper * add decryption failure to cipher like utils * add todo with ticket * fix decryption failure typing * fix copy card messages * fix addition of organizations and collections for `PopupCipherViewLike` - accessors were being lost * refactor to getters to fix re-rendering bug * fix decryption failure helper * fix sorting functions for `CipherViewLike` * formatting * add `CipherViewLikeUtils` tests * refactor "copiable" to "copyable" to match SDK * use `hasOldAttachments` from cipherlistview * fix typing * update SDK version * add feature flag for cipher list view work * use `CipherViewLikeUtils` for copyable values rather than referring to the cipher directly * update restricted item type to support CipherViewLike * add cipher support to `CipherViewLikeUtils` * update `isCipherListView` check * refactor CipherLike to a separate type * refactor `getFullCipherView` into the cipher service * add optional chaining for `uriChecksum` * set empty array for decrypted CipherListView * migrate nudge service to use `cipherListViews` * update web vault to not depend on `cipherViews$` * update popup list filters to use `CipherListView` * fix storybook * fix tests * accept undefined as a MY VAULT filter value for cipher list views * use `LoginUriView` for uri logic (#15530) * filter out null ciphers from the `_allDecryptedCiphers$` (#15539) * use `launchUri` to avoid any unexpected behavior in URIs - this appends `http://` when missing
57 lines
1.7 KiB
TypeScript
57 lines
1.7 KiB
TypeScript
import { Injectable } from "@angular/core";
|
|
import { firstValueFrom, lastValueFrom } from "rxjs";
|
|
|
|
import { UserVerificationService } from "@bitwarden/common/auth/abstractions/user-verification/user-verification.service.abstraction";
|
|
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
|
import { CipherRepromptType } from "@bitwarden/common/vault/enums";
|
|
import { CipherViewLike } from "@bitwarden/common/vault/utils/cipher-view-like-utils";
|
|
import { DialogService } from "@bitwarden/components";
|
|
|
|
import { PasswordRepromptComponent } from "../components/password-reprompt.component";
|
|
|
|
/**
|
|
* Used to verify the user's Master Password for the "Master Password Re-prompt" feature only.
|
|
* See UserVerificationService for any other situation where you need to verify the user's identity.
|
|
*/
|
|
@Injectable()
|
|
export class PasswordRepromptService {
|
|
constructor(
|
|
private dialogService: DialogService,
|
|
private userVerificationService: UserVerificationService,
|
|
) {}
|
|
|
|
enabled$ = Utils.asyncToObservable(() =>
|
|
this.userVerificationService.hasMasterPasswordAndMasterKeyHash(),
|
|
);
|
|
|
|
protectedFields() {
|
|
return ["TOTP", "Password", "H_Field", "Card Number", "Security Code"];
|
|
}
|
|
|
|
async passwordRepromptCheck(cipher: CipherViewLike) {
|
|
if (cipher.reprompt === CipherRepromptType.None) {
|
|
return true;
|
|
}
|
|
|
|
return await this.showPasswordPrompt();
|
|
}
|
|
|
|
async showPasswordPrompt() {
|
|
if (!(await this.enabled())) {
|
|
return true;
|
|
}
|
|
|
|
const dialog = this.dialogService.open<boolean>(PasswordRepromptComponent, {
|
|
ariaModal: true,
|
|
});
|
|
|
|
const result = await lastValueFrom(dialog.closed);
|
|
|
|
return result === true;
|
|
}
|
|
|
|
enabled() {
|
|
return firstValueFrom(this.enabled$);
|
|
}
|
|
}
|