Disable KYC verification using const flag (#11)

Part of [Sumsub KYC integration in onboarding app](https://www.notion.so/Sumsub-KYC-integration-in-onboarding-app-607b598c9c1d4d12adc71725e2ab5e7e)

Co-authored-by: IshaVenikar <ishavenikar7@gmail.com>
Reviewed-on: #11
This commit is contained in:
nabarun 2024-08-07 05:52:57 +00:00
parent ae4c57f336
commit bf8b6fc016
3 changed files with 42 additions and 18 deletions

View File

@ -29,3 +29,5 @@ export const TNC_PARTICIPANT_CONTENT = `Lorem ipsum dolor sit amet, consectetur
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.`; Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.`;
export const WALLET_DISCLAIMER_MSG = 'You are connecting to an experimental wallet! It is not secure. Do not use it elsewhere and/or for managing real assets.' export const WALLET_DISCLAIMER_MSG = 'You are connecting to an experimental wallet! It is not secure. Do not use it elsewhere and/or for managing real assets.'
export const ENABLE_KYC = false;

View File

@ -8,6 +8,7 @@ import SumsubWebSdk from "@sumsub/websdk-react";
import { MessageHandler } from "@sumsub/websdk"; import { MessageHandler } from "@sumsub/websdk";
import { config, fetchAccessToken, getAccessTokenExpirationHandler, options } from "../utils/sumsub"; import { config, fetchAccessToken, getAccessTokenExpirationHandler, options } from "../utils/sumsub";
import { ENABLE_KYC } from "../constants";
interface Participant { interface Participant {
cosmosAddress: string; cosmosAddress: string;
@ -63,7 +64,7 @@ const OnboardingSuccess = () => {
setLoading(false); setLoading(false);
}; };
if (cosmosAddress) { if (cosmosAddress && ENABLE_KYC) {
getToken(cosmosAddress).catch(error => { getToken(cosmosAddress).catch(error => {
console.error(error); console.error(error);
alert("Failed to fetch token"); alert("Failed to fetch token");
@ -104,6 +105,8 @@ const OnboardingSuccess = () => {
)} )}
</pre> </pre>
</Box> </Box>
{ENABLE_KYC ? (
<Box>
<Typography variant="h5">KYC Status</Typography> <Typography variant="h5">KYC Status</Typography>
{!loading && token && cosmosAddress && ( {!loading && token && cosmosAddress && (
<SumsubWebSdk <SumsubWebSdk
@ -115,6 +118,9 @@ const OnboardingSuccess = () => {
/> />
)} )}
</Box> </Box>
) : ''
}
</Box>
); );
}; };

View File

@ -2,6 +2,7 @@ import React, { useState, useMemo, useEffect } from "react";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { enqueueSnackbar } from "notistack"; import { enqueueSnackbar } from "notistack";
import canonicalStringify from "canonical-json"; import canonicalStringify from "canonical-json";
import { ethers } from "ethers";
import { import {
Select, Select,
@ -13,6 +14,7 @@ import LoadingButton from '@mui/lab/LoadingButton';
import { utf8ToHex } from "@walletconnect/encoding"; import { utf8ToHex } from "@walletconnect/encoding";
import { useWalletConnectContext } from "../context/WalletConnectContext"; import { useWalletConnectContext } from "../context/WalletConnectContext";
import { ENABLE_KYC } from "../constants";
const SignWithNitroKey = () => { const SignWithNitroKey = () => {
@ -56,6 +58,8 @@ const SignWithNitroKey = () => {
}); });
setIsLoading(false) setIsLoading(false)
setEthSignature(ethSignature); setEthSignature(ethSignature);
if (ENABLE_KYC) {
navigate("/user-verification", { navigate("/user-verification", {
state: { state: {
message, message,
@ -63,6 +67,18 @@ const SignWithNitroKey = () => {
receivedEthSig, receivedEthSig,
}, },
}); });
} else {
const kycIdHash = ethers.utils.sha256(ethers.utils.toUtf8Bytes(cosmosAddress));
navigate("/sign-with-cosmos", {
state: {
message,
cosmosAddress,
receivedEthSig,
kycIdHash,
},
});
}
} catch (error) { } catch (error) {
console.log("err in signing ", error); console.log("err in signing ", error);
setIsLoading(false) setIsLoading(false)