mirror of
https://github.com/selfxyz/self.git
synced 2026-01-23 05:28:02 -05:00
Merge pull request #29 from zk-passport/dev
remove unnecessary formatProof function
This commit is contained in:
@@ -38,7 +38,7 @@ import { config } from "@gluestack-ui/config" // Optional if you want to use def
|
||||
|
||||
// @ts-ignore
|
||||
import PassportReader from 'react-native-passport-reader';
|
||||
import {getFirstName, formatDuration, formatProof} from './utils/utils';
|
||||
import {getFirstName, formatDuration } from './utils/utils';
|
||||
import {
|
||||
DEFAULT_PNUMBER,
|
||||
DEFAULT_DOB,
|
||||
@@ -294,13 +294,10 @@ function App(): JSX.Element {
|
||||
const deserializedProof = JSON.parse(parsedResponse.serialized_proof);
|
||||
console.log('deserializedProof', deserializedProof);
|
||||
|
||||
const proofFormattedForSolidity = formatProof(deserializedProof);
|
||||
console.log('proofFormattedForSolidity', proofFormattedForSolidity);
|
||||
|
||||
setProofTime(parsedResponse.duration);
|
||||
setTotalTime(end - start);
|
||||
|
||||
setProofResult(JSON.stringify(proofFormattedForSolidity));
|
||||
setProofResult(JSON.stringify(deserializedProof));
|
||||
|
||||
// les outputs publics vont être postés on-chain comment ?
|
||||
});
|
||||
|
||||
@@ -12,31 +12,3 @@ export function formatDuration(durationInMs: number) {
|
||||
|
||||
return minutes > 0 ? `${minutes}m ${seconds}s` : `${seconds}s`;
|
||||
}
|
||||
|
||||
export function formatProof(proof: any) {
|
||||
const formattedProof: { [key: string]: any } = {};
|
||||
|
||||
for (const key in proof) {
|
||||
if (Object.hasOwnProperty.call(proof, key)) {
|
||||
const element = proof[key];
|
||||
|
||||
if (key === 'b') {
|
||||
// Special formatting for 'b'
|
||||
formattedProof[key] = element.map((complex: string) => {
|
||||
const matches = complex.match(/QuadExtField\(([^)]+)\)/);
|
||||
if (matches && matches[1]) {
|
||||
return matches[1].split(' + ').map(num => {
|
||||
return num.replace(' * u', '').trim();
|
||||
});
|
||||
}
|
||||
return [];
|
||||
});
|
||||
} else {
|
||||
// Direct copy for 'a' and 'c'
|
||||
formattedProof[key] = [...element];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return formattedProof;
|
||||
}
|
||||
@@ -10,6 +10,8 @@ const fs = require('fs');
|
||||
|
||||
chai.use(chaiAsPromised)
|
||||
|
||||
console.log("The snarkjs error logs are normal and expected is the tests pass.")
|
||||
|
||||
describe('Circuit tests', function () {
|
||||
this.timeout(0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user