1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 16:53:34 +00:00

update key api changes

This commit is contained in:
Kyle Spearrin
2018-07-17 17:22:45 -04:00
parent 3354f0b818
commit f35ecf0cd8
8 changed files with 39 additions and 6 deletions

View File

@@ -60,7 +60,7 @@ export class CipherService implements CipherServiceAbstraction {
this.decryptedCipherCache = null;
}
async encrypt(model: CipherView): Promise<Cipher> {
async encrypt(model: CipherView, key?: SymmetricCryptoKey): Promise<Cipher> {
const cipher = new Cipher();
cipher.id = model.id;
cipher.folderId = model.folderId;
@@ -69,7 +69,9 @@ export class CipherService implements CipherServiceAbstraction {
cipher.type = model.type;
cipher.collectionIds = model.collectionIds;
const key = await this.cryptoService.getOrgKey(cipher.organizationId);
if (key == null && cipher.organizationId != null) {
key = await this.cryptoService.getOrgKey(cipher.organizationId);
}
await Promise.all([
this.encryptObjProperty(model, cipher, {
name: null,