1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-26 21:23:34 +00:00

Temporary local changes not meant to be merged

This commit is contained in:
Daniel James Smith
2024-09-10 19:51:05 +02:00
committed by jaasen-livefront
parent 89751f46d6
commit 605269813e
13 changed files with 397 additions and 14 deletions

View File

@@ -36,5 +36,5 @@ export abstract class SendApiService {
renewSendFileUploadUrl: (sendId: string, fileId: string) => Promise<SendFileUploadDataResponse>;
removePassword: (id: string) => Promise<any>;
delete: (id: string) => Promise<any>;
save: (sendData: [Send, EncArrayBuffer]) => Promise<any>;
save: (sendData: [Send, EncArrayBuffer]) => Promise<Send>;
}

View File

@@ -1,3 +1,5 @@
import { SendId } from "@bitwarden/common/types/guid";
import { ApiService } from "../../../abstractions/api.service";
import { ErrorResponse } from "../../../models/response/error.response";
import { ListResponse } from "../../../models/response/list.response";
@@ -135,11 +137,13 @@ export class SendApiService implements SendApiServiceAbstraction {
return this.apiService.send("DELETE", "/sends/" + id, null, true, false);
}
async save(sendData: [Send, EncArrayBuffer]): Promise<any> {
async save(sendData: [Send, EncArrayBuffer]): Promise<Send> {
const response = await this.upload(sendData);
const data = new SendData(response);
await this.sendService.upsert(data);
const updated = await this.sendService.upsert(data);
// No local data for new Sends
return new Send(updated[response.id as SendId]);
}
async delete(id: string): Promise<any> {

View File

@@ -4,7 +4,7 @@ import { UserKeyRotationDataProvider } from "@bitwarden/auth/common";
import { EncArrayBuffer } from "../../../platform/models/domain/enc-array-buffer";
import { SymmetricCryptoKey } from "../../../platform/models/domain/symmetric-crypto-key";
import { UserId } from "../../../types/guid";
import { SendId, UserId } from "../../../types/guid";
import { UserKey } from "../../../types/key";
import { SendData } from "../models/data/send.data";
import { Send } from "../models/domain/send";
@@ -54,7 +54,7 @@ export abstract class SendService implements UserKeyRotationDataProvider<SendWit
}
export abstract class InternalSendService extends SendService {
upsert: (send: SendData | SendData[]) => Promise<any>;
upsert: (send: SendData | SendData[]) => Promise<Record<SendId, SendData>>;
replace: (sends: { [id: string]: SendData }, userId: UserId) => Promise<void>;
delete: (id: string | string[]) => Promise<any>;
delete: (id: string | string[]) => Promise<void>;
}

View File

@@ -57,6 +57,8 @@ export class SendService implements InternalSendServiceAbstraction {
send.disabled = model.disabled;
send.hideEmail = model.hideEmail;
send.maxAccessCount = model.maxAccessCount;
send.deletionDate = model.deletionDate;
send.expirationDate = model.expirationDate;
if (model.key == null) {
const key = await this.keyGenerationService.createKeyWithPurpose(
128,