Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions app/src/utils/proving/provingInputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,23 @@ export function generateTEEInputsRegister(
secret: string,
passportData: PassportData,
dscTree: string,
env: 'prod' | 'stg',
) {
const inputs = generateCircuitInputsRegister(secret, passportData, dscTree);
const circuitName = getCircuitNameFromPassportData(passportData, 'register');
const endpointType =
passportData.documentType && passportData.documentType !== 'passport'
? 'staging_celo'
: 'celo';
const endpointType = env === 'stg' ? 'staging_celo' : 'celo';
const endpoint = 'https://self.xyz';
return { inputs, circuitName, endpointType, endpoint };
}

export function generateTEEInputsDSC(
passportData: PassportData,
cscaTree: string[][],
env: 'prod' | 'stg',
) {
const inputs = generateCircuitInputsDSC(passportData, cscaTree);
const circuitName = getCircuitNameFromPassportData(passportData, 'dsc');
const endpointType =
passportData.documentType && passportData.documentType !== 'passport'
? 'staging_celo'
: 'celo';
const endpointType = env === 'stg' ? 'staging_celo' : 'celo';
const endpoint = 'https://self.xyz';
return { inputs, circuitName, endpointType, endpoint };
}
Expand Down
10 changes: 9 additions & 1 deletion app/src/utils/proving/provingMachine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,8 @@
},

_generatePayload: async () => {
const { circuitType, passportData, secret, uuid, sharedKey } = get();
const { circuitType, passportData, secret, uuid, sharedKey, env } =

Check warning on line 803 in app/src/utils/proving/provingMachine.ts

View workflow job for this annotation

GitHub Actions / lint

Delete `⏎·······`

Check warning on line 803 in app/src/utils/proving/provingMachine.ts

View workflow job for this annotation

GitHub Actions / lint

Delete `⏎·······`
get();
const document: DocumentCategory = passportData.documentCategory;
const selfApp = useSelfAppStore.getState().selfApp;
// TODO: according to the circuitType we could check that the params are valid.
Expand All @@ -810,13 +811,19 @@
endpoint,
circuitTypeWithDocumentExtension;
const protocolStore = useProtocolStore.getState();

if (!env) {
throw new Error('Environment not set');
}

switch (circuitType) {
case 'register':
({ inputs, circuitName, endpointType, endpoint } =
generateTEEInputsRegister(
secret as string,
passportData,
protocolStore[document].dsc_tree,
env,
));
circuitTypeWithDocumentExtension = `${circuitType}${document === 'passport' ? '' : '_id'}`;
break;
Expand All @@ -825,6 +832,7 @@
generateTEEInputsDSC(
passportData,
protocolStore[document].csca_tree as string[][],
env,
));
circuitTypeWithDocumentExtension = `${circuitType}${document === 'passport' ? '' : '_id'}`;
break;
Expand Down
Loading