1
0
mirror of https://github.com/bitwarden/browser synced 2025-01-29 04:29:32 +01:00

Include revision date in cipher requests (#203)

This is in conjunction with API changes that validates the last known
revision date provided here with the actual last revision date on the
server to block potential data loss due to client desyncs.

Co-authored-by: Matt Gibson <mdgibson@Matts-MBP.lan>
This commit is contained in:
Matt Gibson 2020-11-23 08:48:40 -06:00 committed by GitHub
parent d9d13bbf0e
commit cd6b3d47c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View File

@ -28,6 +28,7 @@ export class CipherRequest {
// Deprecated, remove at some point and rename attachments2 to attachments
attachments: { [id: string]: string; };
attachments2: { [id: string]: AttachmentRequest; };
lastKnownRevisionDate: Date;
constructor(cipher: Cipher) {
this.type = cipher.type;
@ -36,6 +37,7 @@ export class CipherRequest {
this.name = cipher.name ? cipher.name.encryptedString : null;
this.notes = cipher.notes ? cipher.notes.encryptedString : null;
this.favorite = cipher.favorite;
this.lastKnownRevisionDate = cipher.revisionDate;
switch (this.type) {
case CipherType.Login:

View File

@ -143,6 +143,7 @@ export class CipherService implements CipherServiceAbstraction {
cipher.organizationId = model.organizationId;
cipher.type = model.type;
cipher.collectionIds = model.collectionIds;
cipher.revisionDate = model.revisionDate;
if (key == null && cipher.organizationId != null) {
key = await this.cryptoService.getOrgKey(cipher.organizationId);