mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-23 11:56:00 +01:00
fix encryptCipherData
This commit is contained in:
parent
bb18729306
commit
9fe0cfb2d8
@ -30,7 +30,11 @@ export class CipherView implements View {
|
|||||||
// tslint:disable-next-line
|
// tslint:disable-next-line
|
||||||
private _subTitle: string;
|
private _subTitle: string;
|
||||||
|
|
||||||
constructor(c: Cipher) {
|
constructor(c?: Cipher) {
|
||||||
|
if (!c) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.id = c.id;
|
this.id = c.id;
|
||||||
this.organizationId = c.organizationId;
|
this.organizationId = c.organizationId;
|
||||||
this.folderId = c.folderId;
|
this.folderId = c.folderId;
|
||||||
|
@ -2,10 +2,14 @@ import { CipherType } from '../enums/cipherType';
|
|||||||
|
|
||||||
import { CipherData } from '../models/data/cipherData';
|
import { CipherData } from '../models/data/cipherData';
|
||||||
|
|
||||||
|
import { Card } from '../models/domain/card';
|
||||||
import { Cipher } from '../models/domain/cipher';
|
import { Cipher } from '../models/domain/cipher';
|
||||||
import { CipherString } from '../models/domain/cipherString';
|
import { CipherString } from '../models/domain/cipherString';
|
||||||
import Domain from '../models/domain/domain';
|
import Domain from '../models/domain/domain';
|
||||||
import { Field } from '../models/domain/field';
|
import { Field } from '../models/domain/field';
|
||||||
|
import { Identity } from '../models/domain/identity';
|
||||||
|
import { Login } from '../models/domain/login';
|
||||||
|
import { SecureNote } from '../models/domain/secureNote';
|
||||||
import { SymmetricCryptoKey } from '../models/domain/symmetricCryptoKey';
|
import { SymmetricCryptoKey } from '../models/domain/symmetricCryptoKey';
|
||||||
|
|
||||||
import { CipherRequest } from '../models/request/cipherRequest';
|
import { CipherRequest } from '../models/request/cipherRequest';
|
||||||
@ -472,7 +476,7 @@ export class CipherService implements CipherServiceAbstraction {
|
|||||||
private async encryptCipherData(cipher: Cipher, model: CipherView, key: SymmetricCryptoKey) {
|
private async encryptCipherData(cipher: Cipher, model: CipherView, key: SymmetricCryptoKey) {
|
||||||
switch (cipher.type) {
|
switch (cipher.type) {
|
||||||
case CipherType.Login:
|
case CipherType.Login:
|
||||||
model.login = new LoginView();
|
cipher.login = new Login();
|
||||||
await this.encryptObjProperty(model.login, cipher.login, {
|
await this.encryptObjProperty(model.login, cipher.login, {
|
||||||
uri: null,
|
uri: null,
|
||||||
username: null,
|
username: null,
|
||||||
@ -481,12 +485,11 @@ export class CipherService implements CipherServiceAbstraction {
|
|||||||
}, key);
|
}, key);
|
||||||
return;
|
return;
|
||||||
case CipherType.SecureNote:
|
case CipherType.SecureNote:
|
||||||
model.secureNote = {
|
cipher.secureNote = new SecureNote();
|
||||||
type: cipher.secureNote.type,
|
cipher.secureNote.type = model.secureNote.type;
|
||||||
};
|
|
||||||
return;
|
return;
|
||||||
case CipherType.Card:
|
case CipherType.Card:
|
||||||
model.card = new CardView();
|
cipher.card = new Card();
|
||||||
await this.encryptObjProperty(model.card, cipher.card, {
|
await this.encryptObjProperty(model.card, cipher.card, {
|
||||||
cardholderName: null,
|
cardholderName: null,
|
||||||
brand: null,
|
brand: null,
|
||||||
@ -497,7 +500,7 @@ export class CipherService implements CipherServiceAbstraction {
|
|||||||
}, key);
|
}, key);
|
||||||
return;
|
return;
|
||||||
case CipherType.Identity:
|
case CipherType.Identity:
|
||||||
model.identity = new IdentityView();
|
cipher.identity = new Identity();
|
||||||
await this.encryptObjProperty(model.identity, cipher.identity, {
|
await this.encryptObjProperty(model.identity, cipher.identity, {
|
||||||
title: null,
|
title: null,
|
||||||
firstName: null,
|
firstName: null,
|
||||||
|
Loading…
Reference in New Issue
Block a user