Skip to content

Commit

Permalink
fix: should check secretTable not csvData (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
ch3njust1n authored Aug 22, 2023
1 parent 4ab42d9 commit fa0f32a
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions client/src/pages/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,16 @@ export const HomePage: FC = () => {
useEffect(() => {
const loadData = async () => {
if (file) {
console.log('Starting MPC Encryption');
const csvData = await readCsv(file);
console.log('Validating Data');
setIsDataValid(validateData(csvData));
console.log('Loading File Data');
setData(csvData);
const scale = (num: number) => num * 100;
const prime = await getPrime(sessionId);
console.log('Loading Prime Number');
const publicKeyString = await getPublicKey(sessionId);
console.log('Loading Public Key');
const publicCryptoKey = await importPemPublicKey(publicKeyString);
console.log('Imported Public Key');
const secretTable = await tableToSecretShares(csvData, numShares, threshold, numEncryptWithKey, publicCryptoKey, new BigNumber(prime), true, scale);
console.log('Encrypted Data');
setTable(secretTable);
setDataIsEncrypted(Object.keys(data).length !== 0);
console.log('MPC Encryption Complete');
setDataIsEncrypted(Object.keys(secretTable).length !== 0);
}
};
loadData();
Expand Down

0 comments on commit fa0f32a

Please sign in to comment.