Fix change password private key removal

This commit is contained in:
Tuan Dang
2023-02-20 13:27:16 +07:00
parent d5bc377e3d
commit 59beabb445
3 changed files with 46 additions and 54 deletions
+16 -25
View File
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import { apiRequest } from "@app/config/request";
interface Props {
clientProof: string;
@@ -17,7 +17,7 @@ interface Props {
* @param {*} clientPublicKey
* @returns
*/
const changePassword2 = ({
const changePassword2 = async ({
clientProof,
protectedKey,
protectedKeyIV,
@@ -27,29 +27,20 @@ const changePassword2 = ({
encryptedPrivateKeyTag,
salt,
verifier
}: Props) =>
SecurityClient.fetchCall('/api/v1/password/change-password', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
clientProof,
protectedKey,
protectedKeyIV,
protectedKeyTag,
encryptedPrivateKey,
encryptedPrivateKeyIV,
encryptedPrivateKeyTag,
salt,
verifier
})
}).then(async (res) => {
if (res && res.status === 200) {
return res;
}
console.log('Failed to change the password');
return undefined;
}: Props) => {
const { data } = await apiRequest.post('/api/v1/password/change-password', {
clientProof,
protectedKey,
protectedKeyIV,
protectedKeyTag,
encryptedPrivateKey,
encryptedPrivateKeyIV,
encryptedPrivateKeyTag,
salt,
verifier
});
return data;
}
export default changePassword2;