feature: setup password

This commit is contained in:
Scott Wilson
2025-01-27 18:51:35 -08:00
parent c7ec9ff816
commit 72468d5428
17 changed files with 691 additions and 12 deletions
+23 -1
View File
@@ -23,6 +23,7 @@ import {
MfaMethod,
ResetPasswordDTO,
SendMfaTokenDTO,
SetupPasswordDTO,
SRP1DTO,
SRPR1Res,
TOauthTokenExchangeDTO,
@@ -286,7 +287,8 @@ export const useResetPassword = () => {
encryptedPrivateKeyIV: details.encryptedPrivateKeyIV,
encryptedPrivateKeyTag: details.encryptedPrivateKeyTag,
salt: details.salt,
verifier: details.verifier
verifier: details.verifier,
password: details.password
},
{
headers: {
@@ -336,3 +338,23 @@ export const checkUserTotpMfa = async () => {
return data.isVerified;
};
export const useSendPasswordSetupEmail = () => {
return useMutation({
mutationFn: async () => {
const { data } = await apiRequest.post("/api/v1/password/email/password-setup");
return data;
}
});
};
export const useSetupPassword = () => {
return useMutation({
mutationFn: async ({ verificationToken, ...payload }: SetupPasswordDTO) => {
const { data } = await apiRequest.post("/api/v1/password/password-setup", payload);
return data;
}
});
};
+14
View File
@@ -133,6 +133,20 @@ export type ResetPasswordDTO = {
salt: string;
verifier: string;
verificationToken: string;
password: string;
};
export type SetupPasswordDTO = {
protectedKey: string;
protectedKeyIV: string;
protectedKeyTag: string;
encryptedPrivateKey: string;
encryptedPrivateKeyIV: string;
encryptedPrivateKeyTag: string;
salt: string;
verifier: string;
token: string;
password: string;
};
export type IssueBackupPrivateKeyDTO = {