From a581ca65cbb5775f63665cdc4a13dd1adfddad15 Mon Sep 17 00:00:00 2001 From: Ederson Date: Tue, 5 Nov 2024 18:34:12 -0400 Subject: [PATCH] feat: change endpoint calling to not send the current password --- src/auth/index.ts | 3 +-- src/drive/users/index.ts | 1 - src/drive/users/types.ts | 1 - test/auth/index.test.ts | 5 ++--- test/drive/users/index.test.ts | 2 -- 5 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/auth/index.ts b/src/auth/index.ts index d0288412..236dc574 100644 --- a/src/auth/index.ts +++ b/src/auth/index.ts @@ -224,9 +224,8 @@ export class Auth { * @param pass * @param code */ - public disableTwoFactorAuth(pass: string, code: string): Promise { + public disableTwoFactorAuth(code: string): Promise { return this.client.delete('/tfa', this.headersWithToken(this.apiSecurity?.token), { - pass: pass, code: code, }); } diff --git a/src/drive/users/index.ts b/src/drive/users/index.ts index 749ce34c..9484b178 100644 --- a/src/drive/users/index.ts +++ b/src/drive/users/index.ts @@ -125,7 +125,6 @@ export class Users { return this.client.patch( '/users/password', { - currentPassword: payload.currentEncryptedPassword, newPassword: payload.newEncryptedPassword, newSalt: payload.newEncryptedSalt, mnemonic: payload.encryptedMnemonic, diff --git a/src/drive/users/types.ts b/src/drive/users/types.ts index 994b9dc7..d8f9bb90 100644 --- a/src/drive/users/types.ts +++ b/src/drive/users/types.ts @@ -16,7 +16,6 @@ export interface ChangePasswordPayload { } export interface ChangePasswordPayloadNew { - currentEncryptedPassword: string; newEncryptedPassword: string; newEncryptedSalt: string; encryptedMnemonic: string; diff --git a/test/auth/index.test.ts b/test/auth/index.test.ts index ab0a1131..26051ffe 100644 --- a/test/auth/index.test.ts +++ b/test/auth/index.test.ts @@ -386,17 +386,16 @@ describe('# auth service tests', () => { // Arrange const callStub = sinon.stub(httpClient, 'delete').resolves({}); const { client, headers } = clientAndHeadersWithToken(); - const pass = 'pass', code = 'code'; + const code = 'code'; // Act - const body = await client.disableTwoFactorAuth(pass, code); + const body = await client.disableTwoFactorAuth(code); // Assert await expect(callStub.firstCall.args).toEqual([ '/tfa', headers, { - pass: pass, code: code, } ]); diff --git a/test/drive/users/index.test.ts b/test/drive/users/index.test.ts index 381d2821..70f810cb 100644 --- a/test/drive/users/index.test.ts +++ b/test/drive/users/index.test.ts @@ -121,7 +121,6 @@ describe('# users service tests', () => { const { client, headers } = clientAndHeaders(); const callStub = sinon.stub(httpClient, 'patch').resolves({}); const payload: ChangePasswordPayloadNew = { - currentEncryptedPassword: '1', encryptedMnemonic: '2', encryptedPrivateKey: '3', newEncryptedPassword: '4', @@ -136,7 +135,6 @@ describe('# users service tests', () => { expect(callStub.firstCall.args).toEqual([ '/users/password', { - currentPassword: payload.currentEncryptedPassword, newPassword: payload.newEncryptedPassword, newSalt: payload.newEncryptedSalt, mnemonic: payload.encryptedMnemonic,