Skip to content

Commit

Permalink
update home component
Browse files Browse the repository at this point in the history
  • Loading branch information
daoauth committed Sep 13, 2024
1 parent 4f74c8d commit 7d6c8e6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
42 changes: 23 additions & 19 deletions packages/holder/src/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,25 +96,29 @@ export const Home = () => {
id_token: string;
};
if (jwt) {
const address = jwtToAddress(jwt, BigInt(SALT_TEMP));
const proof = await getZkProof({
randomness: account.nonce.randomness,
maxEpoch: account.nonce.maxEpoch,
jwt,
ephemeralPublicKey: account.nonce.publicKey,
salt: SALT_TEMP,
});
account.zkAddress = {
address,
salt: SALT_TEMP,
proof,
jwt,
};
setWalrusState({ account, didDocs: [] });
await fs.writeFile(
FILE_NAME_ACCOUNT,
Buffer.from(JSON.stringify(account), 'utf8'),
);
try {
const address = jwtToAddress(jwt, BigInt(SALT_TEMP));
const proof = await getZkProof({
randomness: account.nonce.randomness,
maxEpoch: account.nonce.maxEpoch,
jwt,
ephemeralPublicKey: account.nonce.publicKey,
salt: SALT_TEMP,
});
account.zkAddress = {
address,
salt: SALT_TEMP,
proof,
jwt,
};
setWalrusState({ account, didDocs: [] });
await fs.writeFile(
FILE_NAME_ACCOUNT,
Buffer.from(JSON.stringify(account), 'utf8'),
);
} catch (error) {
console.log(error);
}
} else {
handleReset();
}
Expand Down
4 changes: 3 additions & 1 deletion packages/holder/src/utils/getZkProof.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getExtendedEphemeralPublicKey } from '@mysten/zklogin';
import { Secp256r1PublicKey } from '@mysten/sui/keypairs/secp256r1';
import { fromB64 } from '@mysten/sui/utils';
import { enqueueSnackbar } from 'notistack';
// import { enqueueSnackbar } from 'notistack';

// import { ENOKI } from './config';

Expand Down Expand Up @@ -43,9 +43,11 @@ export const getZkProof = async ({
}
return JSON.stringify(data);
} catch (error) {
/*
enqueueSnackbar(`${error}`, {
variant: 'error',
});
*/
throw new Error(`${error}`);
}
};

0 comments on commit 7d6c8e6

Please sign in to comment.