mirror of
https://github.com/bitwarden/directory-connector
synced 2025-12-10 21:33:20 +00:00
Copy jslib into Directory Connector [TI-6] (#262)
This commit is contained in:
44
jslib/common/src/models/domain/sendFile.ts
Normal file
44
jslib/common/src/models/domain/sendFile.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import { SendFileData } from "../data/sendFileData";
|
||||
import { SendFileView } from "../view/sendFileView";
|
||||
|
||||
import Domain from "./domainBase";
|
||||
import { EncString } from "./encString";
|
||||
import { SymmetricCryptoKey } from "./symmetricCryptoKey";
|
||||
|
||||
export class SendFile extends Domain {
|
||||
id: string;
|
||||
size: string;
|
||||
sizeName: string;
|
||||
fileName: EncString;
|
||||
|
||||
constructor(obj?: SendFileData) {
|
||||
super();
|
||||
if (obj == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.size = obj.size;
|
||||
this.buildDomainModel(
|
||||
this,
|
||||
obj,
|
||||
{
|
||||
id: null,
|
||||
sizeName: null,
|
||||
fileName: null,
|
||||
},
|
||||
["id", "sizeName"]
|
||||
);
|
||||
}
|
||||
|
||||
async decrypt(key: SymmetricCryptoKey): Promise<SendFileView> {
|
||||
const view = await this.decryptObj(
|
||||
new SendFileView(this),
|
||||
{
|
||||
fileName: null,
|
||||
},
|
||||
null,
|
||||
key
|
||||
);
|
||||
return view;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user