Added the account recovery flow

This commit is contained in:
Vladyslav Matsiiako
2022-12-12 20:42:16 -05:00
parent c83c75db96
commit 07bb3496e7
12 changed files with 616 additions and 67 deletions
@@ -0,0 +1,26 @@
/**
* This is the route that get an encrypted private key (will be decrypted with a backup key)
* @param {object} obj
* @param {object} obj.verificationToken - this is the token that confirms that a user is the right one
* @returns
*/
const getBackupEncryptedPrivateKey = ({
verificationToken
}: {
verificationToken: string;
}) => {
return fetch('/api/v1/password/backup-private-key', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + verificationToken
}
}).then(async (res) => {
if (res?.status !== 200) {
console.log('Failed to get the backup key');
}
return (await res?.json())?.backupPrivateKey;
});
};
export default getBackupEncryptedPrivateKey;