mirror of
https://github.com/bitwarden/browser
synced 2026-02-24 16:43:27 +00:00
* PM-28183 implemented new sends filter and search design * PM-28183 resolved table issue fallout from merge conflict * PM-28183 resolved browser paste url issue * PM-28183 put new feature behind feature flag * PM-28183 resolved feature flag * PM-28183 resolved type-safe approach pr comment * PM-28183 resolved DesktopSendUIRefresh feature flag is enabled. pr comment * PM-28183 restored SendUIRefresh * PM-28183 resolved query parameter subscription pr comment * PM-28183 resolved pr comment re enum like objects * PM-28183 resolved remove enum like objects pr comment * PM-28183 resolved pr comment re defining filteredSends member variable * PM-28183 resolved pr comment re Code Duplication in syncCompleted Handler * PM-28183 resolved pr comment re Floating Promise * PM-28183 restored feature flag * PM-28183 resolved pr comment re Dual Binding Pattern * PM28183 resolved options cell button pr comment * PM 28183 resolved pr comment re Incorrect CSS Class - Breaking Layout * PM 28183 resolved pr comment re uery Param Update Causes Redundant Filter Application * PM-28183 resolved lint issues * PM 28183 resolved lint issues * PM-28183 resolved type issue with import * PM-28183 resolved import in failling test * chore: rerun web build * PM-28183 resolved build issues * PM-28183 resolved build issues * PM-28183 resolved lint issues
73 lines
1.8 KiB
TypeScript
73 lines
1.8 KiB
TypeScript
// FIXME: Update this file to be type safe and remove this and next line
|
|
// @ts-strict-ignore
|
|
import { EncString } from "../../../../key-management/crypto/models/enc-string";
|
|
import Domain from "../../../../platform/models/domain/domain-base";
|
|
import { SymmetricCryptoKey } from "../../../../platform/models/domain/symmetric-crypto-key";
|
|
import { SendType } from "../../types/send-type";
|
|
import { SendAccessResponse } from "../response/send-access.response";
|
|
import { SendAccessView } from "../view/send-access.view";
|
|
|
|
import { SendFile } from "./send-file";
|
|
import { SendText } from "./send-text";
|
|
|
|
export class SendAccess extends Domain {
|
|
id: string;
|
|
type: SendType;
|
|
name: EncString;
|
|
file: SendFile;
|
|
text: SendText;
|
|
expirationDate: Date;
|
|
creatorIdentifier: string;
|
|
|
|
constructor(obj?: SendAccessResponse) {
|
|
super();
|
|
if (obj == null) {
|
|
return;
|
|
}
|
|
|
|
this.buildDomainModel(
|
|
this,
|
|
obj,
|
|
{
|
|
id: null,
|
|
name: null,
|
|
expirationDate: null,
|
|
creatorIdentifier: null,
|
|
},
|
|
["id", "expirationDate", "creatorIdentifier"],
|
|
);
|
|
|
|
this.type = obj.type;
|
|
|
|
switch (this.type) {
|
|
case SendType.Text:
|
|
this.text = new SendText(obj.text);
|
|
break;
|
|
case SendType.File:
|
|
this.file = new SendFile(obj.file);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
async decrypt(key: SymmetricCryptoKey): Promise<SendAccessView> {
|
|
const model = new SendAccessView(this);
|
|
|
|
await this.decryptObj<SendAccess, SendAccessView>(this, model, ["name"], key);
|
|
|
|
switch (this.type) {
|
|
case SendType.File:
|
|
model.file = await this.file.decrypt(key);
|
|
break;
|
|
case SendType.Text:
|
|
model.text = await this.text.decrypt(key);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
return model;
|
|
}
|
|
}
|