1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-29 22:53:44 +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

@@ -41,6 +41,7 @@ import { TwoFactorEmailRequest } from '../models/request/twoFactorEmailRequest';
import { TwoFactorProviderRequest } from '../models/request/twoFactorProviderRequest';
import { TwoFactorRecoveryRequest } from '../models/request/twoFactorRecoveryRequest';
import { UpdateDomainsRequest } from '../models/request/updateDomainsRequest';
import { UpdateKeyRequest } from '../models/request/updateKeyRequest';
import { UpdateProfileRequest } from '../models/request/updateProfileRequest';
import { UpdateTwoFactorAuthenticatorRequest } from '../models/request/updateTwoFactorAuthenticatorRequest';
import { UpdateTwoFactorDuoRequest } from '../models/request/updateTwoFactorDuoRequest';
@@ -256,6 +257,10 @@ export class ApiService implements ApiServiceAbstraction {
return this.send('POST', '/accounts/keys', request, true, false);
}
postAccountKey(request: UpdateKeyRequest): Promise<any> {
return this.send('POST', '/accounts/key', request, true, false);
}
postAccountVerifyEmail(): Promise<any> {
return this.send('POST', '/accounts/verify-email', null, true, false);
}

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,

View File

@@ -1,6 +1,7 @@
import { FolderData } from '../models/data/folderData';
import { Folder } from '../models/domain/folder';
import { SymmetricCryptoKey } from '../models/domain/symmetricCryptoKey';
import { FolderRequest } from '../models/request/folderRequest';
@@ -35,10 +36,10 @@ export class FolderService implements FolderServiceAbstraction {
this.decryptedFolderCache = null;
}
async encrypt(model: FolderView): Promise<Folder> {
async encrypt(model: FolderView, key?: SymmetricCryptoKey): Promise<Folder> {
const folder = new Folder();
folder.id = model.id;
folder.name = await this.cryptoService.encrypt(model.name);
folder.name = await this.cryptoService.encrypt(model.name, key);
return folder;
}