mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 17:23:37 +00:00
[PM-328] Move Send to Tools (#5104)
* Move send in libs/common * Move send in libs/angular * Move send in browser * Move send in cli * Move send in desktop * Move send in web
This commit is contained in:
committed by
GitHub
parent
e645688f8a
commit
e238ea20a9
50
libs/common/src/tools/send/models/domain/send-text.ts
Normal file
50
libs/common/src/tools/send/models/domain/send-text.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { Jsonify } from "type-fest";
|
||||
|
||||
import Domain from "../../../../models/domain/domain-base";
|
||||
import { EncString } from "../../../../models/domain/enc-string";
|
||||
import { SymmetricCryptoKey } from "../../../../models/domain/symmetric-crypto-key";
|
||||
import { SendTextData } from "../data/send-text.data";
|
||||
import { SendTextView } from "../view/send-text.view";
|
||||
|
||||
export class SendText extends Domain {
|
||||
text: EncString;
|
||||
hidden: boolean;
|
||||
|
||||
constructor(obj?: SendTextData) {
|
||||
super();
|
||||
if (obj == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.hidden = obj.hidden;
|
||||
this.buildDomainModel(
|
||||
this,
|
||||
obj,
|
||||
{
|
||||
text: null,
|
||||
},
|
||||
[]
|
||||
);
|
||||
}
|
||||
|
||||
decrypt(key: SymmetricCryptoKey): Promise<SendTextView> {
|
||||
return this.decryptObj(
|
||||
new SendTextView(this),
|
||||
{
|
||||
text: null,
|
||||
},
|
||||
null,
|
||||
key
|
||||
);
|
||||
}
|
||||
|
||||
static fromJSON(obj: Jsonify<SendText>) {
|
||||
if (obj == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return Object.assign(new SendText(), obj, {
|
||||
text: EncString.fromJSON(obj.text),
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user