Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PB-2153] feat: do not request the user's password in security endpoints #256

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,8 @@ export class Auth {
* @param pass
* @param code
*/
public disableTwoFactorAuth(pass: string, code: string): Promise<void> {
public disableTwoFactorAuth(code: string): Promise<void> {
return this.client.delete('/tfa', this.headersWithToken(<string>this.apiSecurity?.token), {
pass: pass,
code: code,
});
}
Expand Down
1 change: 0 additions & 1 deletion src/drive/users/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion src/drive/users/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export interface ChangePasswordPayload {
}

export interface ChangePasswordPayloadNew {
currentEncryptedPassword: string;
newEncryptedPassword: string;
newEncryptedSalt: string;
encryptedMnemonic: string;
Expand Down
5 changes: 2 additions & 3 deletions test/auth/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
]);
Expand Down
2 changes: 0 additions & 2 deletions test/drive/users/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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,
Expand Down
Loading