From ae54094fcdea3aa6466eb744f4656eb7455d71c9 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 27 Aug 2018 19:55:05 -0400 Subject: [PATCH] kdf apis --- src/abstractions/api.service.ts | 2 ++ src/enums/kdfType.ts | 2 +- src/models/request/kdfRequest.ts | 8 ++++++++ src/services/api.service.ts | 5 +++++ 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 src/models/request/kdfRequest.ts diff --git a/src/abstractions/api.service.ts b/src/abstractions/api.service.ts index 3c8775eaf8..81ba242d77 100644 --- a/src/abstractions/api.service.ts +++ b/src/abstractions/api.service.ts @@ -16,6 +16,7 @@ import { ImportCiphersRequest } from '../models/request/importCiphersRequest'; import { ImportDirectoryRequest } from '../models/request/importDirectoryRequest'; import { ImportOrganizationCiphersRequest } from '../models/request/importOrganizationCiphersRequest'; import { KeysRequest } from '../models/request/keysRequest'; +import { KdfRequest } from '../models/request/kdfRequest'; import { OrganizationCreateRequest } from '../models/request/organizationCreateRequest'; import { OrganizationUpdateRequest } from '../models/request/organizationUpdateRequest'; import { OrganizationUserAcceptRequest } from '../models/request/organizationUserAcceptRequest'; @@ -116,6 +117,7 @@ export abstract class ApiService { postAccountVerifyEmailToken: (request: VerifyEmailRequest) => Promise; postAccountRecoverDelete: (request: DeleteRecoverRequest) => Promise; postAccountRecoverDeleteToken: (request: VerifyDeleteRecoverRequest) => Promise; + postAccountKdf: (request: KdfRequest) => Promise; getFolder: (id: string) => Promise; postFolder: (request: FolderRequest) => Promise; diff --git a/src/enums/kdfType.ts b/src/enums/kdfType.ts index 53eb59c4ce..b23ef8e6da 100644 --- a/src/enums/kdfType.ts +++ b/src/enums/kdfType.ts @@ -1,3 +1,3 @@ export enum KdfType { - PBKDF2 = 0, + PBKDF2_SHA256 = 0, } diff --git a/src/models/request/kdfRequest.ts b/src/models/request/kdfRequest.ts new file mode 100644 index 0000000000..996aab0fa1 --- /dev/null +++ b/src/models/request/kdfRequest.ts @@ -0,0 +1,8 @@ +import { PasswordRequest } from './passwordRequest'; + +import { KdfType } from '../../enums/kdfType'; + +export class KdfRequest extends PasswordRequest { + kdf: KdfType; + kdfIterations: number; +} diff --git a/src/services/api.service.ts b/src/services/api.service.ts index 8d3669213b..a5291f9e91 100644 --- a/src/services/api.service.ts +++ b/src/services/api.service.ts @@ -21,6 +21,7 @@ import { GroupRequest } from '../models/request/groupRequest'; import { ImportCiphersRequest } from '../models/request/importCiphersRequest'; import { ImportDirectoryRequest } from '../models/request/importDirectoryRequest'; import { ImportOrganizationCiphersRequest } from '../models/request/importOrganizationCiphersRequest'; +import { KdfRequest } from '../models/request/kdfRequest'; import { KeysRequest } from '../models/request/keysRequest'; import { OrganizationCreateRequest } from '../models/request/organizationCreateRequest'; import { OrganizationUpdateRequest } from '../models/request/organizationUpdateRequest'; @@ -284,6 +285,10 @@ export class ApiService implements ApiServiceAbstraction { return this.send('POST', '/accounts/delete-recover-token', request, false, false); } + postAccountKdf(request: KdfRequest): Promise { + return this.send('POST', '/accounts/kdf', request, true, false); + } + // Folder APIs async getFolder(id: string): Promise {