1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 08:43:33 +00:00

update cipher service to use new crypto service

This commit is contained in:
Jacob Fink
2023-05-30 12:59:06 -04:00
parent 7d8c4a430a
commit 7a037724d5

View File

@@ -325,9 +325,9 @@ export class CipherService implements CipherServiceAbstraction {
return await this.getDecryptedCipherCache(); return await this.getDecryptedCipherCache();
} }
const hasKey = await this.cryptoService.hasKey(); const hasKey = await this.cryptoService.hasUserKey();
if (!hasKey) { if (!hasKey) {
throw new Error("No key."); throw new Error("No user key found.");
} }
const ciphers = await this.getAll(); const ciphers = await this.getAll();
@@ -636,7 +636,7 @@ export class CipherService implements CipherServiceAbstraction {
const key = await this.cryptoService.getOrgKey(cipher.organizationId); const key = await this.cryptoService.getOrgKey(cipher.organizationId);
const encFileName = await this.cryptoService.encrypt(filename, key); const encFileName = await this.cryptoService.encrypt(filename, key);
const dataEncKey = await this.cryptoService.makeEncKey(key); const dataEncKey = await this.cryptoService.makeUserSymKey(key);
const encData = await this.cryptoService.encryptToBytes(data, dataEncKey[0]); const encData = await this.cryptoService.encryptToBytes(data, dataEncKey[0]);
const response = await this.cipherFileUploadService.upload( const response = await this.cipherFileUploadService.upload(
@@ -949,7 +949,7 @@ export class CipherService implements CipherServiceAbstraction {
const key = await this.cryptoService.getOrgKey(organizationId); const key = await this.cryptoService.getOrgKey(organizationId);
const encFileName = await this.cryptoService.encrypt(attachmentView.fileName, key); const encFileName = await this.cryptoService.encrypt(attachmentView.fileName, key);
const dataEncKey = await this.cryptoService.makeEncKey(key); const dataEncKey = await this.cryptoService.makeUserSymKey(key);
const encData = await this.cryptoService.encryptToBytes(decBuf, dataEncKey[0]); const encData = await this.cryptoService.encryptToBytes(decBuf, dataEncKey[0]);
const fd = new FormData(); const fd = new FormData();