diff --git a/src/auth/index.ts b/src/auth/index.ts index 0d89f346..125c8e26 100644 --- a/src/auth/index.ts +++ b/src/auth/index.ts @@ -158,7 +158,7 @@ export class Auth { }> { const securityDetails = await this.securityDetails(details.email); const encryptedSalt = securityDetails.encryptedSalt; - const encryptedPasswordHash = cryptoProvider.encryptPasswordHash(details.password, encryptedSalt); + const encryptedPasswordHash = await cryptoProvider.encryptPasswordHash(details.password, encryptedSalt); const keys = await cryptoProvider.generateKeys(details.password); return this.client diff --git a/src/auth/types.ts b/src/auth/types.ts index 4cb8d4b7..2550d094 100644 --- a/src/auth/types.ts +++ b/src/auth/types.ts @@ -47,7 +47,7 @@ export interface Keys { } export interface CryptoProvider { - encryptPasswordHash: (password: Password, encryptedSalt: string) => string; + encryptPasswordHash: (password: Password, encryptedSalt: string) => Promise; generateKeys: (password: Password) => Promise; } diff --git a/src/drive/share/index.ts b/src/drive/share/index.ts index b04ae0f9..20680291 100644 --- a/src/drive/share/index.ts +++ b/src/drive/share/index.ts @@ -31,7 +31,7 @@ import { UpdateUserRolePayload, UpdateUserRoleResponse, } from './types'; -import { ItemType } from 'src/workspaces'; +import { ItemType } from '../../workspaces'; export * as ShareTypes from './types'; diff --git a/test/auth/index.test.ts b/test/auth/index.test.ts index fbef1e8e..e525d33d 100644 --- a/test/auth/index.test.ts +++ b/test/auth/index.test.ts @@ -175,7 +175,7 @@ describe('# auth service tests', () => { tfaCode: undefined, }; const cryptoProvider: CryptoProvider = { - encryptPasswordHash: () => '', + encryptPasswordHash: () => Promise.resolve(''), generateKeys: (password: Password) => { const keys: Keys = { privateKeyEncrypted: '', @@ -211,7 +211,7 @@ describe('# auth service tests', () => { tfaCode: undefined, }; const cryptoProvider: CryptoProvider = { - encryptPasswordHash: () => '', + encryptPasswordHash: () => Promise.resolve(''), generateKeys: (password: Password) => { const keys: Keys = { privateKeyEncrypted: '', @@ -254,7 +254,7 @@ describe('# auth service tests', () => { tfaCode: undefined, }; const cryptoProvider: CryptoProvider = { - encryptPasswordHash: (password, encryptedSalt) => password + '-' + encryptedSalt, + encryptPasswordHash: (password, encryptedSalt) => Promise.resolve(password + '-' + encryptedSalt), generateKeys: (password: Password) => { const keys: Keys = { privateKeyEncrypted: 'priv',