feat: updated ui for srp handover

This commit is contained in:
=
2024-06-12 19:25:06 +05:30
parent 777dfd5f58
commit f3ea7b3dfd
11 changed files with 202 additions and 112 deletions
+3 -1
View File
@@ -1,5 +1,6 @@
export {
useGetAuthToken,
useOauthTokenExchange,
useResetPassword,
useSelectOrganization,
useSendMfaToken,
@@ -7,4 +8,5 @@ export {
useSendVerificationEmail,
useVerifyMfaToken,
useVerifyPasswordResetCode,
useVerifySignupEmailVerificationCode} from "./queries";
useVerifySignupEmailVerificationCode
} from "./queries";
+16
View File
@@ -23,6 +23,7 @@ import {
SendMfaTokenDTO,
SRP1DTO,
SRPR1Res,
TOauthTokenExchangeDTO,
VerifyMfaTokenDTO,
VerifyMfaTokenRes,
VerifySignupInviteDTO
@@ -92,6 +93,7 @@ export const useLogin2 = () => {
mutationFn: async (details: {
email: string;
clientProof: string;
password: string;
providerAuthToken?: string;
}) => {
return login2(details);
@@ -99,6 +101,20 @@ export const useLogin2 = () => {
});
};
export const oauthTokenExchange = async (details: TOauthTokenExchangeDTO) => {
const { data } = await apiRequest.post<Login2Res>("/api/v1/sso/token-exchange", details);
return data;
};
export const useOauthTokenExchange = () => {
// note: use after srp1
return useMutation({
mutationFn: async (details: TOauthTokenExchangeDTO) => {
return oauthTokenExchange(details);
}
});
};
export const srp1 = async (details: SRP1DTO) => {
const { data } = await apiRequest.post<SRPR1Res>("/api/v1/password/srp1", details);
return data;
+7
View File
@@ -23,6 +23,11 @@ export type VerifyMfaTokenRes = {
tag: string;
};
export type TOauthTokenExchangeDTO = {
providerAuthToken: string;
email: string;
};
export type Login1DTO = {
email: string;
clientPublicKey: string;
@@ -34,6 +39,7 @@ export type Login2DTO = {
email: string;
clientProof: string;
providerAuthToken?: string;
password: string;
};
export type Login1Res = {
@@ -86,6 +92,7 @@ export type CompleteAccountDTO = {
encryptedPrivateKeyTag: string;
salt: string;
verifier: string;
password: string;
};
export type CompleteAccountSignupDTO = CompleteAccountDTO & {