From e02e2bdb988f5c8c77da33b2aaecce364f4fa8c6 Mon Sep 17 00:00:00 2001 From: ChakravartiRaghavan Date: Fri, 1 Dec 2023 17:36:28 -0800 Subject: [PATCH] htmlInputs --- .gitignore | 3 +- pages/index.tsx | 108 ++++++++++--------- pages/offChain.tsx | 233 ++++++++++++++++++++++++++++++++--------- styles/Home.module.css | 9 +- styles/globals.css | 8 ++ tailwind.config.js | 1 + 6 files changed, 261 insertions(+), 101 deletions(-) diff --git a/.gitignore b/.gitignore index d852d58..0bc3cf0 100644 --- a/.gitignore +++ b/.gitignore @@ -65,4 +65,5 @@ next-env.d.ts *secret* getData.ts *getData.ts* -secret.json \ No newline at end of file +secret.json +testingDataSecret.txt \ No newline at end of file diff --git a/pages/index.tsx b/pages/index.tsx index e3c7ca1..512769e 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -3,23 +3,32 @@ import Head from 'next/head' import WalletConnect from '../components/WalletConnect' import { useStoreActions, useStoreState } from "../utils/store" import Link from 'next/link' -import { useState, useEffect } from 'react' +import { useState, useEffect} from 'react' import { getAssets } from "../utils/cardano"; import NftGrid from "../components/NftGrid"; import initLucid from '../utils/lucid' +import { useRouter } from 'next/router'; + const Home: NextPage = () => { const walletStore = useStoreState((state: any) => state.wallet) const [nftList, setNftList] = useState([]) const [jsonData, setJsonData] = useState(null); const [secretData, setSecretData] = useState(null); + // for Redirect to offChain.tsx + const router = useRouter(); useEffect(() => { + // Call fetchSecretData when the component mounts or walletStore.address changes + fetchSecretData(); //const lucid = initLucid(walletStore.name) if (walletStore.address != "") { getAssets(walletStore.address) .then((res: any) => { setNftList(res.addressInfo.nfts) }) } + + // for Redirect to offChain.tsx + router.push('/offChain'); }, [walletStore.address]) @@ -43,53 +52,54 @@ const Home: NextPage = () => { } }; - return ( -
- - Cardano dapp quickstart - - - -
-
- Cardano -
-
- -
-
-
Address: {walletStore.address}
-
Your NFTs:
- -
- - - - {/*
Your NFTs:
- */} -
-
- - {/* */} - {jsonData && ( -
- {/*
{JSON.stringify(jsonData, null, 2)}
// this gives the whole JSON file */} -

Item 1 Description: {jsonData.items[0].description}

-
- )} -
-
- - {/* */} - {secretData && ( -
-
{JSON.stringify(secretData, null, 2)}
// this gives the whole JSON file -

{secretData.seed[0].name} : {secretData.seed[0].description}

-
- )} -
-
- ) -} + return null; +// return ( +//
+// +// Cardano dapp quickstart +// +// +// +//
+//
+// Cardano +//
+//
+// +//
+//
+//
Address: {walletStore.address}
+//
Your NFTs:
+// +//
+// +// +// +// {/*
Your NFTs:
+// */} +//
+//
+// {/* */} +// {/* */} +// {jsonData && ( +//
+// {/*
{JSON.stringify(jsonData, null, 2)}
// this gives the whole JSON file */} +//

Item 1 Description: {jsonData.items[0].description}

+//
+// )} +//
+// {/*
*/} +// {/* */} +// {/* */} +// {/* {secretData && ( */} +// {/*
*/} +// {/*
{JSON.stringify(secretData, null, 2)}
// this gives the whole JSON file */} +// {/*

{secretData.seed[0].name} : {secretData.seed[0].description}

*/} +// {/*
*/} +// {/* )} */} +// {/*
*/} +//
+// ) + } export default Home diff --git a/pages/offChain.tsx b/pages/offChain.tsx index 842dec5..ad4286c 100644 --- a/pages/offChain.tsx +++ b/pages/offChain.tsx @@ -44,20 +44,32 @@ import * as CryptoJS from 'crypto-js'; // import * as Aes from // from my Plutarch decentralSeed -const decentralSeedPlutus = "58a758a501000022223253335734664646460044660040040024600446600400400244a666aae7c0045280a999ab9a3375e6ae8400400c528898011aba200137526eb8d5d09aba20013758646ae84c8d5d11aba2357446ae88d5d11aba2357446ae88004c8d55cf1baa00100135742646aae78dd50008010a4c2a66ae712411e646174756d20616e6420706172616d2061726520646966666572656e742000163235573c6ea800400d" +// const decentralSeedPlutus = "58a758a501000022223253335734664646460044660040040024600446600400400244a666aae7c0045280a999ab9a3375e6ae8400400c528898011aba200137526eb8d5d09aba20013758646ae84c8d5d11aba2357446ae88d5d11aba2357446ae88004c8d55cf1baa00100135742646aae78dd50008010a4c2a66ae712411e646174756d20616e6420706172616d2061726520646966666572656e742000163235573c6ea800400d" + +// https://github.com/HarunJr/decentralSeedRecover/blob/main/code/SeedPhraseManager/assets/plutus-scripts/lucid-seed-phrase.plutus +// const decentralSeedPlutus = "59087a590877010000323322323233223232323232323232323233223232323232322322323222323253353330083333573466e1cd55cea803240004664424660020060046eb8d5d0a8031bae357426ae8940188c98c8070cd5ce00f80e00d1999ab9a3370e6aae74dd5002240004038464c6403866ae7007c070068cccd5cd19b8735573aa0049000119910919800801801191919191919191919191919191999ab9a3370e6aae754031200023333333333332222222222221233333333333300100d00c00b00a00900800700600500400300233501901a35742a01866a0320346ae85402ccd406406cd5d0a805199aa80ebae501c35742a012666aa03aeb94070d5d0a80419a80c8121aba150073335501d02575a6ae854018c8c8c8cccd5cd19b8735573aa00490001199109198008018011919191999ab9a3370e6aae754009200023322123300100300233502f75a6ae854008c0c0d5d09aba2500223263203233573806a06406026aae7940044dd50009aba150023232323333573466e1cd55cea8012400046644246600200600466a05eeb4d5d0a80118181aba135744a004464c6406466ae700d40c80c04d55cf280089baa001357426ae8940088c98c80b8cd5ce01881701609aab9e5001137540026ae854014cd4065d71aba150043335501d021200135742a006666aa03aeb88004d5d0a80118119aba135744a004464c6405466ae700b40a80a04d5d1280089aba25001135744a00226ae8940044d5d1280089aba25001135744a00226ae8940044d5d1280089aba25001135573ca00226ea8004d5d0a80118099aba135744a004464c6403866ae7007c070068406c4c98c806ccd5ce2481035054350001b135573ca00226ea80044d55cf280089baa001322225335323235002222222222222533533355302912001321233001225335002210031001002501a25335333573466e3c0380040a009c4d40700045406c010840a04098d401088004d40048800840644cd5ce249257369676e656442794f776e65723a204e6f74207369676e6564206279206f776e6572504b480001832123001002375c0022464460046eb0004c8004d5406488cccd55cf8009280d919a80d18021aba1002300335744004028464646666ae68cdc39aab9d5002480008cc8848cc00400c008c030d5d0a80118029aba135744a004464c6402866ae7005c0500484d55cf280089baa0012323232323333573466e1cd55cea8022400046666444424666600200a0080060046464646666ae68cdc39aab9d5002480008cc8848cc00400c008c054d5d0a80119a80680a1aba135744a004464c6403266ae7007006405c4d55cf280089baa00135742a008666aa010eb9401cd5d0a8019919191999ab9a3370ea0029002119091118010021aba135573ca00646666ae68cdc3a80124004464244460020086eb8d5d09aab9e500423333573466e1d400d20002122200323263201b33573803c03603203002e26aae7540044dd50009aba1500233500975c6ae84d5d1280111931900a99ab9c018015013135744a00226ae8940044d55cf280089baa0011335500175ceb44488c88c008dd5800990009aa80b11191999aab9f00225019233501833221233001003002300635573aa004600a6aae794008c010d5d100180909aba100112232323333573466e1d400520002350073005357426aae79400c8cccd5cd19b875002480089401c8c98c8048cd5ce00a80900800789aab9d5001137540022424460040062244002464646666ae68cdc3a800a400c46424444600800a600e6ae84d55cf280191999ab9a3370ea004900211909111180100298049aba135573ca00846666ae68cdc3a801a400446424444600200a600e6ae84d55cf280291999ab9a3370ea00890001190911118018029bae357426aae7940188c98c8040cd5ce00980800700680600589aab9d500113754002464646666ae68cdc39aab9d5002480008cc8848cc00400c008c014d5d0a8011bad357426ae8940088c98c8030cd5ce00780600509aab9e5001137540024646666ae68cdc39aab9d5001480008dd71aba135573ca004464c6401466ae700340280204dd5000919191919191999ab9a3370ea002900610911111100191999ab9a3370ea004900510911111100211999ab9a3370ea00690041199109111111198008048041bae35742a00a6eb4d5d09aba2500523333573466e1d40112006233221222222233002009008375c6ae85401cdd71aba135744a00e46666ae68cdc3a802a400846644244444446600c01201060186ae854024dd71aba135744a01246666ae68cdc3a8032400446424444444600e010601a6ae84d55cf280591999ab9a3370ea00e900011909111111180280418071aba135573ca018464c6402666ae7005804c04404003c03803403002c4d55cea80209aab9e5003135573ca00426aae7940044dd50009191919191999ab9a3370ea002900111999110911998008028020019bad35742a0086eb4d5d0a8019bad357426ae89400c8cccd5cd19b875002480008c8488c00800cc020d5d09aab9e500623263200c33573801e01801401226aae75400c4d5d1280089aab9e500113754002464646666ae68cdc3a800a400446424460020066eb8d5d09aab9e500323333573466e1d400920002321223002003375c6ae84d55cf280211931900499ab9c00c009007006135573aa00226ea8004488c8c8cccd5cd19b87500148010848880048cccd5cd19b875002480088c84888c00c010c018d5d09aab9e500423333573466e1d400d20002122200223263200a33573801a01401000e00c26aae7540044dd50009191999ab9a3370ea0029001100391999ab9a3370ea0049000100391931900319ab9c009006004003135573a6ea80052612001122002122001490103505431003200135500322112225335001135003220012213335005220023004002333553007120010050040011122002122122330010040031123230010012233003300200200101" +// const decentralSeedPlutus = "5908b55908b201000033232323322323232323232323232332232332232323232323222323222323253353232325335323235002222222222222533533355301a12001321233001225335002210031001002502325335333573466e3c0380040c00bc4d409400454090010840c040b8d401088004d40048800840844cd5ce249257369676e656442794f776e65723a204e6f74207369676e6564206279206f776e6572504b48000203333573466e1cd55cea80224000466442466002006004646464646464646464646464646666ae68cdc39aab9d500c480008cccccccccccc88888888888848cccccccccccc00403403002c02802402001c01801401000c008cd406c070d5d0a80619a80d80e1aba1500b33501b01d35742a014666aa03eeb94078d5d0a804999aa80fbae501e35742a01066a0360506ae85401cccd5407c0a5d69aba150063232323333573466e1cd55cea801240004664424660020060046464646666ae68cdc39aab9d5002480008cc8848cc00400c008cd40cdd69aba150023034357426ae8940088c98c80d8cd5ce01c81c01a09aab9e5001137540026ae854008c8c8c8cccd5cd19b8735573aa004900011991091980080180119a819bad35742a00460686ae84d5d1280111931901b19ab9c039038034135573ca00226ea8004d5d09aba2500223263203233573806a06806026aae7940044dd50009aba1500533501b75c6ae854010ccd5407c0948004d5d0a801999aa80fbae200135742a004604e6ae84d5d1280111931901719ab9c03103002c135744a00226ae8940044d5d1280089aba25001135744a00226ae8940044d5d1280089aba25001135744a00226ae8940044d55cf280089baa00135742a008602e6ae84d5d1280211931901019ab9c02302201e3333573466e1cd55ce9baa0054800080848c98c807ccd5ce01101080e9999ab9a3370e6aae7540192000233221233001003002375c6ae854018dd71aba135744a00c464c6403c66ae70084080070407c4c98c8074cd5ce249035054350001f135573ca00226ea80044d55cf280089baa0013200135501822112225335001135003220012213335005220023004002333553007120010050040011232230023758002640026aa030446666aae7c004940288cd4024c010d5d080118019aba2002018232323333573466e1cd55cea80124000466442466002006004601c6ae854008c014d5d09aba2500223263201633573803203002826aae7940044dd50009191919191999ab9a3370e6aae75401120002333322221233330010050040030023232323333573466e1cd55cea80124000466442466002006004602e6ae854008cd403c058d5d09aba2500223263201b33573803c03a03226aae7940044dd50009aba150043335500875ca00e6ae85400cc8c8c8cccd5cd19b875001480108c84888c008010d5d09aab9e500323333573466e1d4009200223212223001004375c6ae84d55cf280211999ab9a3370ea00690001091100191931900e99ab9c02001f01b01a019135573aa00226ea8004d5d0a80119a805bae357426ae8940088c98c805ccd5ce00d00c80a89aba25001135744a00226aae7940044dd5000899aa800bae75a224464460046eac004c8004d5405488c8cccd55cf80112804119a8039991091980080180118031aab9d5002300535573ca00460086ae8800c0584d5d080088910010910911980080200189119191999ab9a3370ea002900011a80398029aba135573ca00646666ae68cdc3a801240044a00e464c6402466ae7005405004003c4d55cea80089baa0011212230020031122001232323333573466e1d400520062321222230040053007357426aae79400c8cccd5cd19b875002480108c848888c008014c024d5d09aab9e500423333573466e1d400d20022321222230010053007357426aae7940148cccd5cd19b875004480008c848888c00c014dd71aba135573ca00c464c6402066ae7004c04803803403002c4d55cea80089baa001232323333573466e1cd55cea80124000466442466002006004600a6ae854008dd69aba135744a004464c6401866ae7003c0380284d55cf280089baa0012323333573466e1cd55cea800a400046eb8d5d09aab9e500223263200a33573801a01801026ea80048c8c8c8c8c8cccd5cd19b8750014803084888888800c8cccd5cd19b875002480288488888880108cccd5cd19b875003480208cc8848888888cc004024020dd71aba15005375a6ae84d5d1280291999ab9a3370ea00890031199109111111198010048041bae35742a00e6eb8d5d09aba2500723333573466e1d40152004233221222222233006009008300c35742a0126eb8d5d09aba2500923333573466e1d40192002232122222223007008300d357426aae79402c8cccd5cd19b875007480008c848888888c014020c038d5d09aab9e500c23263201333573802c02a02202001e01c01a01801626aae7540104d55cf280189aab9e5002135573ca00226ea80048c8c8c8c8cccd5cd19b875001480088ccc888488ccc00401401000cdd69aba15004375a6ae85400cdd69aba135744a00646666ae68cdc3a80124000464244600400660106ae84d55cf280311931900619ab9c00f00e00a009135573aa00626ae8940044d55cf280089baa001232323333573466e1d400520022321223001003375c6ae84d55cf280191999ab9a3370ea004900011909118010019bae357426aae7940108c98c8024cd5ce00600580380309aab9d50011375400224464646666ae68cdc3a800a40084244400246666ae68cdc3a8012400446424446006008600c6ae84d55cf280211999ab9a3370ea00690001091100111931900519ab9c00d00c008007006135573aa00226ea80048c8cccd5cd19b8750014800880188cccd5cd19b8750024800080188c98c8018cd5ce00480400200189aab9d37540029309100109100089000a4810350543100112323001001223300330020020013351223002489383536333730653461363633396639323163336265616664313932643665313638616565653862636636326233616638363839643831396430002123001002200101" + +// from Haruns but compiled in Jambhala +// const decentralSeedPlutus = "59087a590877010000323322323233223232323232323232323233223232323232322322323222323253353330083333573466e1cd55cea803240004664424660020060046eb8d5d0a8031bae357426ae8940188c98c8070cd5ce00f80e00d1999ab9a3370e6aae74dd5002240004038464c6403866ae7007c070068cccd5cd19b8735573aa0049000119910919800801801191919191919191919191919191999ab9a3370e6aae754031200023333333333332222222222221233333333333300100d00c00b00a00900800700600500400300233501901a35742a01866a0320346ae85402ccd406406cd5d0a805199aa80ebae501c35742a012666aa03aeb94070d5d0a80419a80c8121aba150073335501d02575a6ae854018c8c8c8cccd5cd19b8735573aa00490001199109198008018011919191999ab9a3370e6aae754009200023322123300100300233502f75a6ae854008c0c0d5d09aba2500223263203233573806a06406026aae7940044dd50009aba150023232323333573466e1cd55cea8012400046644246600200600466a05eeb4d5d0a80118181aba135744a004464c6406466ae700d40c80c04d55cf280089baa001357426ae8940088c98c80b8cd5ce01881701609aab9e5001137540026ae854014cd4065d71aba150043335501d021200135742a006666aa03aeb88004d5d0a80118119aba135744a004464c6405466ae700b40a80a04d5d1280089aba25001135744a00226ae8940044d5d1280089aba25001135744a00226ae8940044d5d1280089aba25001135573ca00226ea8004d5d0a80118099aba135744a004464c6403866ae7007c070068406c4c98c806ccd5ce2481035054350001b135573ca00226ea80044d55cf280089baa001322225335323235002222222222222533533355302912001321233001225335002210031001002501a25335333573466e3c0380040a009c4d40700045406c010840a04098d401088004d40048800840644cd5ce249257369676e656442794f776e65723a204e6f74207369676e6564206279206f776e6572504b480001832123001002375c0022464460046eb0004c8004d5406488cccd55cf8009280d919a80d18021aba1002300335744004028464646666ae68cdc39aab9d5002480008cc8848cc00400c008c030d5d0a80118029aba135744a004464c6402866ae7005c0500484d55cf280089baa0012323232323333573466e1cd55cea8022400046666444424666600200a0080060046464646666ae68cdc39aab9d5002480008cc8848cc00400c008c054d5d0a80119a80680a1aba135744a004464c6403266ae7007006405c4d55cf280089baa00135742a008666aa010eb9401cd5d0a8019919191999ab9a3370ea0029002119091118010021aba135573ca00646666ae68cdc3a80124004464244460020086eb8d5d09aab9e500423333573466e1d400d20002122200323263201b33573803c03603203002e26aae7540044dd50009aba1500233500975c6ae84d5d1280111931900a99ab9c018015013135744a00226ae8940044d55cf280089baa0011335500175ceb44488c88c008dd5800990009aa80b11191999aab9f00225019233501833221233001003002300635573aa004600a6aae794008c010d5d100180909aba100112232323333573466e1d400520002350073005357426aae79400c8cccd5cd19b875002480089401c8c98c8048cd5ce00a80900800789aab9d5001137540022424460040062244002464646666ae68cdc3a800a400c46424444600800a600e6ae84d55cf280191999ab9a3370ea004900211909111180100298049aba135573ca00846666ae68cdc3a801a400446424444600200a600e6ae84d55cf280291999ab9a3370ea00890001190911118018029bae357426aae7940188c98c8040cd5ce00980800700680600589aab9d500113754002464646666ae68cdc39aab9d5002480008cc8848cc00400c008c014d5d0a8011bad357426ae8940088c98c8030cd5ce00780600509aab9e5001137540024646666ae68cdc39aab9d5001480008dd71aba135573ca004464c6401466ae700340280204dd5000919191919191999ab9a3370ea002900610911111100191999ab9a3370ea004900510911111100211999ab9a3370ea00690041199109111111198008048041bae35742a00a6eb4d5d09aba2500523333573466e1d40112006233221222222233002009008375c6ae85401cdd71aba135744a00e46666ae68cdc3a802a400846644244444446600c01201060186ae854024dd71aba135744a01246666ae68cdc3a8032400446424444444600e010601a6ae84d55cf280591999ab9a3370ea00e900011909111111180280418071aba135573ca018464c6402666ae7005804c04404003c03803403002c4d55cea80209aab9e5003135573ca00426aae7940044dd50009191919191999ab9a3370ea002900111999110911998008028020019bad35742a0086eb4d5d0a8019bad357426ae89400c8cccd5cd19b875002480008c8488c00800cc020d5d09aab9e500623263200c33573801e01801401226aae75400c4d5d1280089aab9e500113754002464646666ae68cdc3a800a400446424460020066eb8d5d09aab9e500323333573466e1d400920002321223002003375c6ae84d55cf280211931900499ab9c00c009007006135573aa00226ea8004488c8c8cccd5cd19b87500148010848880048cccd5cd19b875002480088c84888c00c010c018d5d09aab9e500423333573466e1d400d20002122200223263200a33573801a01401000e00c26aae7540044dd50009191999ab9a3370ea0029001100391999ab9a3370ea0049000100391931900319ab9c009006004003135573a6ea80052612001122002122001490103505431003200135500322112225335001135003220012213335005220023004002333553007120010050040011122002122122330010040031123230010012233003300200200101" + +// compiled from Jambhla but using spacebudz wormhole methods +// https://github.com/spacebudz/wormhole/blob/af6828ad27e0ae801cb8331f389563c79634c8cd/src/onchain.hs --- referenceInstance and referenceSerialized +// https://github.com/spacebudz/wormhole/blob/af6828ad27e0ae801cb8331f389563c79634c8cd/src/ghc/app/Main.hs#L13 +const decentralSeedPlutus = "59087f59087c01000032323232332232323232323232323233223233223232323232322335501a22323222323253353330083333573466e1cd55cea803240004664424660020060046eb8d5d0a8031bae357426ae8940188c98c807ccd5ce01101080e9999ab9a3370e6aae74dd5002240004042464c6403e66ae70088084074cccd5cd19b8735573aa0049000119910919800801801191919191919191919191919191999ab9a3370e6aae754031200023333333333332222222222221233333333333300100d00c00b00a00900800700600500400300233501a01b35742a01866a0340366ae85402ccd4068070d5d0a805199aa80f3ae501d35742a012666aa03ceb94074d5d0a80419a80d0139aba150073335501e02875a6ae854018c8c8c8cccd5cd19b8735573aa00490001199109198008018011919191999ab9a3370e6aae754009200023322123300100300233503275a6ae854008c0ccd5d09aba2500223263203533573807006e06626aae7940044dd50009aba150023232323333573466e1cd55cea8012400046644246600200600466a064eb4d5d0a80118199aba135744a004464c6406a66ae700e00dc0cc4d55cf280089baa001357426ae8940088c98c80c4cd5ce01a01981789aab9e5001137540026ae854014cd4069d71aba150043335501e024200135742a006666aa03ceb88004d5d0a80118131aba135744a004464c6405a66ae700c00bc0ac4d5d1280089aba25001135744a00226ae8940044d5d1280089aba25001135744a00226ae8940044d5d1280089aba25001135573ca00226ea8004d5d0a801180b1aba135744a004464c6403e66ae7008808407440804c98c8078cd5ce24810350543500020135573ca00226ea80044d55cf280089baa001222325335001101b1335738921257369676e656442794f776e65723a204e6f74207369676e6564206279206f776e6572504b480001a335501d32235002222222222222533533355301312001321233001225335002210031001002501c25335333573466e3c0380040a40a04d407800454074010840a4409cd400488008d400c88004c8004d5406488448894cd40044d400c88004884ccd401488008c010008ccd54c01c4800401401000448c88c008dd6000990009aa80c911999aab9f0012500a233500930043574200460066ae880080608c8c8cccd5cd19b8735573aa004900011991091980080180118071aba150023005357426ae8940088c98c8058cd5ce00c80c00a09aab9e5001137540024646464646666ae68cdc39aab9d5004480008cccc888848cccc00401401000c008c8c8c8cccd5cd19b8735573aa0049000119910919800801801180b9aba1500233500f016357426ae8940088c98c806ccd5ce00f00e80c89aab9e5001137540026ae854010ccd54021d728039aba150033232323333573466e1d4005200423212223002004357426aae79400c8cccd5cd19b875002480088c84888c004010dd71aba135573ca00846666ae68cdc3a801a400042444006464c6403a66ae7008007c06c0680644d55cea80089baa00135742a00466a016eb8d5d09aba2500223263201733573803403202a26ae8940044d5d1280089aab9e500113754002266aa002eb9d6889119118011bab00132001355016223233335573e0044a010466a00e66442466002006004600c6aae754008c014d55cf280118021aba200301613574200222440042442446600200800624464646666ae68cdc3a800a400046a00e600a6ae84d55cf280191999ab9a3370ea00490011280391931900919ab9c01501401000f135573aa00226ea800448488c00800c44880048c8c8cccd5cd19b875001480188c848888c010014c01cd5d09aab9e500323333573466e1d400920042321222230020053009357426aae7940108cccd5cd19b875003480088c848888c004014c01cd5d09aab9e500523333573466e1d40112000232122223003005375c6ae84d55cf280311931900819ab9c01301200e00d00c00b135573aa00226ea80048c8c8cccd5cd19b8735573aa004900011991091980080180118029aba15002375a6ae84d5d1280111931900619ab9c00f00e00a135573ca00226ea80048c8cccd5cd19b8735573aa002900011bae357426aae7940088c98c8028cd5ce00680600409baa001232323232323333573466e1d4005200c21222222200323333573466e1d4009200a21222222200423333573466e1d400d2008233221222222233001009008375c6ae854014dd69aba135744a00a46666ae68cdc3a8022400c4664424444444660040120106eb8d5d0a8039bae357426ae89401c8cccd5cd19b875005480108cc8848888888cc018024020c030d5d0a8049bae357426ae8940248cccd5cd19b875006480088c848888888c01c020c034d5d09aab9e500b23333573466e1d401d2000232122222223005008300e357426aae7940308c98c804ccd5ce00b00a80880800780700680600589aab9d5004135573ca00626aae7940084d55cf280089baa0012323232323333573466e1d400520022333222122333001005004003375a6ae854010dd69aba15003375a6ae84d5d1280191999ab9a3370ea0049000119091180100198041aba135573ca00c464c6401866ae7003c0380280244d55cea80189aba25001135573ca00226ea80048c8c8cccd5cd19b875001480088c8488c00400cdd71aba135573ca00646666ae68cdc3a8012400046424460040066eb8d5d09aab9e500423263200933573801801600e00c26aae7540044dd500089119191999ab9a3370ea00290021091100091999ab9a3370ea00490011190911180180218031aba135573ca00846666ae68cdc3a801a400042444004464c6401466ae7003403002001c0184d55cea80089baa0012323333573466e1d40052002200623333573466e1d40092000200623263200633573801201000800626aae74dd5000a4c244004244002240029210350543100112230020011123230010012233003300200200101" -// https://github.com/HarunJr/decentralSeedRecover/blob/main/code/SeedPhraseManager/assets/plutus-scripts/seed-phrase.plutus -//const decentralSeedPlutus = "5908b55908b201000033232323322323232323232323232332232332232323232323222323222323253353232325335323235002222222222222533533355301a12001321233001225335002210031001002502325335333573466e3c0380040c00bc4d409400454090010840c040b8d401088004d40048800840844cd5ce249257369676e656442794f776e65723a204e6f74207369676e6564206279206f776e6572504b48000203333573466e1cd55cea80224000466442466002006004646464646464646464646464646666ae68cdc39aab9d500c480008cccccccccccc88888888888848cccccccccccc00403403002c02802402001c01801401000c008cd406c070d5d0a80619a80d80e1aba1500b33501b01d35742a014666aa03eeb94078d5d0a804999aa80fbae501e35742a01066a0360506ae85401cccd5407c0a5d69aba150063232323333573466e1cd55cea801240004664424660020060046464646666ae68cdc39aab9d5002480008cc8848cc00400c008cd40cdd69aba150023034357426ae8940088c98c80d8cd5ce01c81c01a09aab9e5001137540026ae854008c8c8c8cccd5cd19b8735573aa004900011991091980080180119a819bad35742a00460686ae84d5d1280111931901b19ab9c039038034135573ca00226ea8004d5d09aba2500223263203233573806a06806026aae7940044dd50009aba1500533501b75c6ae854010ccd5407c0948004d5d0a801999aa80fbae200135742a004604e6ae84d5d1280111931901719ab9c03103002c135744a00226ae8940044d5d1280089aba25001135744a00226ae8940044d5d1280089aba25001135744a00226ae8940044d55cf280089baa00135742a008602e6ae84d5d1280211931901019ab9c02302201e3333573466e1cd55ce9baa0054800080848c98c807ccd5ce01101080e9999ab9a3370e6aae7540192000233221233001003002375c6ae854018dd71aba135744a00c464c6403c66ae70084080070407c4c98c8074cd5ce249035054350001f135573ca00226ea80044d55cf280089baa0013200135501822112225335001135003220012213335005220023004002333553007120010050040011232230023758002640026aa030446666aae7c004940288cd4024c010d5d080118019aba2002018232323333573466e1cd55cea80124000466442466002006004601c6ae854008c014d5d09aba2500223263201633573803203002826aae7940044dd50009191919191999ab9a3370e6aae75401120002333322221233330010050040030023232323333573466e1cd55cea80124000466442466002006004602e6ae854008cd403c058d5d09aba2500223263201b33573803c03a03226aae7940044dd50009aba150043335500875ca00e6ae85400cc8c8c8cccd5cd19b875001480108c84888c008010d5d09aab9e500323333573466e1d4009200223212223001004375c6ae84d55cf280211999ab9a3370ea00690001091100191931900e99ab9c02001f01b01a019135573aa00226ea8004d5d0a80119a805bae357426ae8940088c98c805ccd5ce00d00c80a89aba25001135744a00226aae7940044dd5000899aa800bae75a224464460046eac004c8004d5405488c8cccd55cf80112804119a8039991091980080180118031aab9d5002300535573ca00460086ae8800c0584d5d080088910010910911980080200189119191999ab9a3370ea002900011a80398029aba135573ca00646666ae68cdc3a801240044a00e464c6402466ae7005405004003c4d55cea80089baa0011212230020031122001232323333573466e1d400520062321222230040053007357426aae79400c8cccd5cd19b875002480108c848888c008014c024d5d09aab9e500423333573466e1d400d20022321222230010053007357426aae7940148cccd5cd19b875004480008c848888c00c014dd71aba135573ca00c464c6402066ae7004c04803803403002c4d55cea80089baa001232323333573466e1cd55cea80124000466442466002006004600a6ae854008dd69aba135744a004464c6401866ae7003c0380284d55cf280089baa0012323333573466e1cd55cea800a400046eb8d5d09aab9e500223263200a33573801a01801026ea80048c8c8c8c8c8cccd5cd19b8750014803084888888800c8cccd5cd19b875002480288488888880108cccd5cd19b875003480208cc8848888888cc004024020dd71aba15005375a6ae84d5d1280291999ab9a3370ea00890031199109111111198010048041bae35742a00e6eb8d5d09aba2500723333573466e1d40152004233221222222233006009008300c35742a0126eb8d5d09aba2500923333573466e1d40192002232122222223007008300d357426aae79402c8cccd5cd19b875007480008c848888888c014020c038d5d09aab9e500c23263201333573802c02a02202001e01c01a01801626aae7540104d55cf280189aab9e5002135573ca00226ea80048c8c8c8c8cccd5cd19b875001480088ccc888488ccc00401401000cdd69aba15004375a6ae85400cdd69aba135744a00646666ae68cdc3a80124000464244600400660106ae84d55cf280311931900619ab9c00f00e00a009135573aa00626ae8940044d55cf280089baa001232323333573466e1d400520022321223001003375c6ae84d55cf280191999ab9a3370ea004900011909118010019bae357426aae7940108c98c8024cd5ce00600580380309aab9d50011375400224464646666ae68cdc3a800a40084244400246666ae68cdc3a8012400446424446006008600c6ae84d55cf280211999ab9a3370ea00690001091100111931900519ab9c00d00c008007006135573aa00226ea80048c8cccd5cd19b8750014800880188cccd5cd19b8750024800080188c98c8018cd5ce00480400200189aab9d37540029309100109100089000a4810350543100112323001001223300330020020013351223002489383536333730653461363633396639323163336265616664313932643665313638616565653862636636326233616638363839643831396430002123001002200101" const minAda = 2000000; const minAdaBigInt = 2000000n; // const infoToHash = "Passport# 123456 address 1111 Los angeles 10-21-23-750AM"; // adding date/time just for testing purpose for unique info -const infoToHash = "Passport# 123456 address 1111 Los angeles 10-29-23-737am"; // adding date/time just for testing purpose for unique info -let gPersonalInfo = "Passport# 123456 address 1111 Los angeles-Oct30-0727am" -const seed23Words : string = 'custom help female park blush clutch fancy lion fence innocent rebuild amount tip custom help female park blush clutch fancy lion fence innocent 10'; // for now 13 words +const infoToHash = "Passport# 123456 address 1111 Los angeles 11-03-23-318PM"; // adding date/time just for testing purpose for unique info +let gPersonalInfo = "Passport# 123456 address 1111 Los angeles 11-18-23-0045AM" +let seed23Words : string = 'custom help female park blush clutch fancy lion fence innocent rebuild amount tip custom help female park blush clutch fancy lion fence innocent'; // for now 13 words +let indexWord : number = 10; let passPhrase : string = 'myOwnPassword$123'; +let varDecryptWord = ""; const offChain: NextPage = () => { const walletStore = useStoreState((state: any) => state.wallet) @@ -71,9 +83,21 @@ const offChain: NextPage = () => { const [inputPrivateKey, setInputValuePrivateKey] = useState(''); const [privAddress,setPrivAddress] = useState(''); const [txHash,settxHash] = useState(''); + const [decryptWord,setdecryptWord] = useState(''); const [firstLine, setFirstLine] = useState(''); const [readSecretData, setReadSecretData] = useState(null); +// for decentralized Seed phrase mgr + // for seed phrase 23 words from User + const [seed23InputValue, setseed23InputValue] = useState(''); + // Index of hidden word + const [indexInputValue, setIndexInputValue] = useState(''); + // for Pass Phrase from User + const [passPhraseinputValue, setPassPhraseinputValue] = useState(''); + // for Personal Info + const [personalInfoinputValue, setPersonalInfoinputValue] = useState(''); + + useEffect(() => { if (lucid) { ; @@ -105,8 +129,10 @@ const offChain: NextPage = () => { const sLockEncryptedSeedPhrase = async () => { if (lucid) { - + gPersonalInfo = personalInfoinputValue; const hashedDataInString = hashInfo(gPersonalInfo); + // const hashedDataInString = hashInfo(personalInfoinputValue); + const sValCbor = decentralSeedPlutus; @@ -144,7 +170,9 @@ const offChain: NextPage = () => { // Now do encryption // let encryptedString : string = ''; // 23 words - 1 word left out. plus index at the end - + seed23Words = seed23InputValue + ' ' + indexInputValue; + passPhrase = passPhraseinputValue; + const encryptedS = encryptD( seed23Words, passPhrase) // const encryptedS = encryptSeedPassInfo( seed23Words, passPhrase); console.log("encryptedS = ", encryptedS) @@ -184,6 +212,7 @@ const offChain: NextPage = () => { // const sContributeCrowdFund = async () => { const sDecentralSeedRedeem = async () => { if (lucid) { + gPersonalInfo = personalInfoinputValue; const sValCbor = decentralSeedPlutus; const { paymentCredential } = lucid.utils.getAddressDetails( @@ -262,8 +291,11 @@ const offChain: NextPage = () => { // Now Decrypt from the Encrypted word on Datum // const decryptedS = decryptD( toText(utxoInDatum.encryptedWordsWithIndex), passPhrase) const decryptedS = decryptD( toText(encryptedWordsWithIndexFound), passPhrase) - console.log("Decrupted 23 words = ", decryptedS) - + console.log("Decrupted 23 words with Index = ", decryptedS) + varDecryptWord = decryptedS; + const decryptWord = varDecryptWord; + // console.log("decryptWord output = ", decryptWord) + setdecryptWord(varDecryptWord); // set the output retrieved words } // End - try to read Datum catch (error) { @@ -289,6 +321,9 @@ const offChain: NextPage = () => { const signedTx = await tx.sign().complete(); const txHash = await signedTx.submit(); console.log("Collect Test TxHash: " + txHash) + const decryptWord = varDecryptWord; + setdecryptWord(varDecryptWord); + // setdecryptWord(decryptWord); // set the output retrieved words return txHash; } // End - if lucid @@ -580,6 +615,22 @@ const offChain: NextPage = () => { }; + const handleChangeSeed = (event: React.ChangeEvent) => { + setseed23InputValue(event.target.value); + }; + const handleChangeIndex = (event: React.ChangeEvent) => { + setIndexInputValue(event.target.value); + }; + const handleChangePassword = (event: React.ChangeEvent) => { + setPassPhraseinputValue(event.target.value); + }; + const handleChangePersonalInfo = (event: React.ChangeEvent) => { + setPersonalInfoinputValue(event.target.value); + }; + + + + const handleButtonSDeposit = async () => { try { await sDeposit(); @@ -907,6 +958,51 @@ const offChain: NextPage = () => { // }; + function ReusableInput({ type = "text", id, value, onChange, placeholder, style }) { + return ( + + ); + } + + const compPassword = ( + + ); + + const compIndex = ( + + ); + + const compPersonalInfo = ( + + ); + return (
@@ -917,72 +1013,111 @@ const offChain: NextPage = () => {
-
Address: {walletStore.address}
+
My Wallet Address: {walletStore.address}
{/*

Emurgo example

*/}
-
- - - - - - - - +
+ {/* */} + + {/* */} + {/* */} + {/* */} + + {/* */} + {/* */}
-
- {/* */} - - {txHash !== null &&

Tx Hash: {txHash}

} -
+
- - - {privAddress !== null &&

Result: {privAddress}

} + {/* */} + {/* */} + {/* {privAddress !== null &&

Result: {privAddress}

} */}
+ + {/*
*/} + {/*
*/} +
+ {/*

Test color

*/} + {/* */} + + +
+
+ {/* we will re-use this in Redeem so make it a variable */} + {compIndex} +
+
+ {compPassword} {/* we will re-use this in Redeem so make it a variable */} +
+
+ {compPersonalInfo} {/* we will re-use this in Redeem so make it a variable */} +
+
+ + +
+
+ {/* */} + {/* */} + {txHash !== null &&

Tx Hash: {txHash}

} +
+ +
+
+
+ {compPassword} {/* we will re-use this in Redeem so make it a variable */} +
+
+ {compPersonalInfo} {/* we will re-use this in Redeem so make it a variable */} +
+
+ {/* */} + + +
+ +
+ {decryptWord !== null &&

Decrypted Seed Phrase and Index : {decryptWord}

} +
+ +
- - {/* */} - - {privAddress !== null &&

Address: {privAddress}

} -
-
- - - {privAddress !== null &&

Address: {privAddress}

} + /> */} + {/* */} + {/* {privAddress !== null &&

Address: {privAddress}

} */}
{/* */}
{/* */} -

First Line from File:

-

{firstLine}

+ {/*

First Line from File:

*/} + {/*

{firstLine}

*/}
- + {/* */}
- + {/* */} {/* */} {readSecretData && (
diff --git a/styles/Home.module.css b/styles/Home.module.css index bd50f42..9a5067b 100644 --- a/styles/Home.module.css +++ b/styles/Home.module.css @@ -1,6 +1,9 @@ .container { padding: 0 2rem; } +.px-10 { + background-color: white; +} .main { min-height: 100vh; @@ -118,10 +121,12 @@ @media (prefers-color-scheme: dark) { .card, .footer { - border-color: #222; + /* border-color: #222; */ + border-color: white } .code { - background: #111; + /* background: #111; */ + background: white; } .logo img { filter: invert(1); diff --git a/styles/globals.css b/styles/globals.css index 6138cf9..f1516e3 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -18,3 +18,11 @@ a { * { box-sizing: border-box; } + + +#seed { + color: blueviolet; +} +.tmptest { + color: blueviolet; +} \ No newline at end of file diff --git a/tailwind.config.js b/tailwind.config.js index 97b22a9..2c59231 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -11,6 +11,7 @@ module.exports = { daisyui: { styled: true, themes: ['night'], + // themes: ['light'], base: true, utils: true, logs: true,