1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-14 07:13:32 +00:00

[PM-3797 Part 1] Add Emergency Access Service (#6612)

* lazy load and move accept emergency component

* create emergency access services
- move api calls to specific api service and refactor

* remove any from emergency api service

* move emergency access logic to service

* create emergency access view

* move view ciphers logic to service

* move models to web folder

* move takeover logic to service

* remove emergency api service dependency from other files

* write tests for emergency access service

* import shared module into component

* fix imports

* Revert "fix imports"

This reverts commit d21cb02bd8.

* create emergency access module for service

* move emergency access out of core folder
- add more organization to components under settings

* change EA views to domain models

* move EA enums to folder

* resolve PR feedback
This commit is contained in:
Jake Fink
2023-11-08 16:03:10 -05:00
committed by GitHub
parent cf6ada531e
commit 929a08339f
36 changed files with 889 additions and 435 deletions

View File

@@ -1,3 +0,0 @@
export class EmergencyAccessAcceptRequest {
token: string;
}

View File

@@ -1,3 +0,0 @@
export class EmergencyAccessConfirmRequest {
key: string;
}

View File

@@ -1,7 +0,0 @@
import { EmergencyAccessType } from "../../enums/emergency-access-type";
export class EmergencyAccessInviteRequest {
email: string;
type: EmergencyAccessType;
waitTimeDays: number;
}

View File

@@ -1,4 +0,0 @@
export class EmergencyAccessPasswordRequest {
newMasterPasswordHash: string;
key: string;
}

View File

@@ -1,7 +0,0 @@
import { EmergencyAccessType } from "../../enums/emergency-access-type";
export class EmergencyAccessUpdateRequest {
type: EmergencyAccessType;
waitTimeDays: number;
keyEncrypted?: string;
}

View File

@@ -1,89 +0,0 @@
import { KdfType } from "../../../enums";
import { BaseResponse } from "../../../models/response/base.response";
import { CipherResponse } from "../../../vault/models/response/cipher.response";
import { EmergencyAccessStatusType } from "../../enums/emergency-access-status-type";
import { EmergencyAccessType } from "../../enums/emergency-access-type";
export class EmergencyAccessGranteeDetailsResponse extends BaseResponse {
id: string;
granteeId: string;
name: string;
email: string;
type: EmergencyAccessType;
status: EmergencyAccessStatusType;
waitTimeDays: number;
creationDate: string;
avatarColor: string;
constructor(response: any) {
super(response);
this.id = this.getResponseProperty("Id");
this.granteeId = this.getResponseProperty("GranteeId");
this.name = this.getResponseProperty("Name");
this.email = this.getResponseProperty("Email");
this.type = this.getResponseProperty("Type");
this.status = this.getResponseProperty("Status");
this.waitTimeDays = this.getResponseProperty("WaitTimeDays");
this.creationDate = this.getResponseProperty("CreationDate");
this.avatarColor = this.getResponseProperty("AvatarColor");
}
}
export class EmergencyAccessGrantorDetailsResponse extends BaseResponse {
id: string;
grantorId: string;
name: string;
email: string;
type: EmergencyAccessType;
status: EmergencyAccessStatusType;
waitTimeDays: number;
creationDate: string;
avatarColor: string;
constructor(response: any) {
super(response);
this.id = this.getResponseProperty("Id");
this.grantorId = this.getResponseProperty("GrantorId");
this.name = this.getResponseProperty("Name");
this.email = this.getResponseProperty("Email");
this.type = this.getResponseProperty("Type");
this.status = this.getResponseProperty("Status");
this.waitTimeDays = this.getResponseProperty("WaitTimeDays");
this.creationDate = this.getResponseProperty("CreationDate");
this.avatarColor = this.getResponseProperty("AvatarColor");
}
}
export class EmergencyAccessTakeoverResponse extends BaseResponse {
keyEncrypted: string;
kdf: KdfType;
kdfIterations: number;
kdfMemory?: number;
kdfParallelism?: number;
constructor(response: any) {
super(response);
this.keyEncrypted = this.getResponseProperty("KeyEncrypted");
this.kdf = this.getResponseProperty("Kdf");
this.kdfIterations = this.getResponseProperty("KdfIterations");
this.kdfMemory = this.getResponseProperty("KdfMemory");
this.kdfParallelism = this.getResponseProperty("KdfParallelism");
}
}
export class EmergencyAccessViewResponse extends BaseResponse {
keyEncrypted: string;
ciphers: CipherResponse[] = [];
constructor(response: any) {
super(response);
this.keyEncrypted = this.getResponseProperty("KeyEncrypted");
const ciphers = this.getResponseProperty("Ciphers");
if (ciphers != null) {
this.ciphers = ciphers.map((c: any) => new CipherResponse(c));
}
}
}