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
15 changes: 9 additions & 6 deletions app/src/utils/proving/provingMachine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ const _generateCircuitInputs = async (
const docStore =
doc === 'passport'
? protocolStore.passport
: protocolStore.id_card;
: doc === 'aadhaar'
? protocolStore.aadhaar
: protocolStore.id_card;
switch (tree) {
case 'ofac':
return docStore.ofac_trees;
Expand All @@ -167,10 +169,7 @@ const _generateCircuitInputs = async (
}
},
));
circuitTypeWithDocumentExtension = getCircuitTypeWithDocumentExtension(
circuitType,
document,
);
circuitTypeWithDocumentExtension = `disclose`;
break;
default:
throw new Error('Invalid circuit type:' + circuitType);
Expand Down Expand Up @@ -1218,7 +1217,10 @@ export const useProvingStore = create<ProvingState>((set, get) => {

let circuitName;
if (circuitType === 'disclose') {
circuitName = 'disclose';
circuitName =
passportData.documentCategory === 'aadhaar'
? 'disclose_aadhaar'
: 'disclose';
} else {
circuitName = getCircuitNameFromPassportData(
passportData,
Expand All @@ -1231,6 +1233,7 @@ export const useProvingStore = create<ProvingState>((set, get) => {
passportData as PassportData,
circuitName,
);

logProofEvent('info', 'Circuit resolution', baseContext, {
circuit_name: circuitName,
ws_url: wsRpcUrl,
Expand Down
8 changes: 5 additions & 3 deletions common/src/utils/aadhaar/mockData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,10 @@ export function prepareAadhaarDiscloseData(
const inputs = {
attestation_id: '3',
secret,
qrDataHash: BigInt(sharedData.qrHash).toString(),
gender: genderAscii.toString(),
qrDataHash: formatInput(BigInt(sharedData.qrHash)),
gender: formatInput(genderAscii),
// qrDataHash: BigInt(sharedData.qrHash).toString(),
// gender: genderAscii.toString(),
yob: stringToAsciiArray(sharedData.extractedFields.yob),
mob: stringToAsciiArray(sharedData.extractedFields.mob),
dob: stringToAsciiArray(sharedData.extractedFields.dob),
Expand All @@ -263,7 +265,7 @@ export function prepareAadhaarDiscloseData(
ofac_name_yob_smt_leaf_key: formatInput(BigInt(ofac_name_yob_smt_leaf_key)),
ofac_name_yob_smt_root: formatInput(BigInt(ofac_name_yob_smt_root)),
ofac_name_yob_smt_siblings: formatInput(ofac_name_yob_smt_siblings),
selector,
selector: formatInput(selector),
minimumAge: formatInput(discloseAttributes.minimumAge ?? 0),
currentYear: formatInput(currentYear),
currentMonth: formatInput(currentMonth),
Expand Down
6 changes: 5 additions & 1 deletion common/src/utils/circuits/registerInputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,17 @@ function getSelectorDg1IdCard(disclosures: SelfAppDisclosureConfig) {

export function generateTEEInputsDiscloseStateless(
secret: string,
passportData: PassportData,
passportData: IDDocument,
selfApp: SelfApp,
getTree: <T extends 'ofac' | 'commitment'>(
doc: DocumentCategory,
tree: T
) => T extends 'ofac' ? OfacTree : any
) {
if (passportData.documentCategory === 'aadhaar') {
const { inputs, circuitName, endpointType, endpoint } = generateTEEInputsAadhaarDisclose(secret, passportData, selfApp, getTree);
return { inputs, circuitName, endpointType, endpoint };
}
const { scope, disclosures, endpoint, userId, userDefinedData, chainID } = selfApp;
const userIdentifierHash = calculateUserIdentifierHash(chainID, userId, userDefinedData);
const scope_hash = hashEndpointWithScope(endpoint, scope);
Expand Down
2 changes: 1 addition & 1 deletion common/src/utils/proving.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export function getPayload(
) {
if (circuitType === 'disclose') {
const type = circuitName === 'vc_and_disclose' ? 'disclose' :
circuitName === 'disclose_aadhaar' ? 'disclose_aadhaar' :
circuitName === 'vc_and_disclose_aadhaar' ? 'disclose_aadhaar' :
'disclose_id';
const payload: TEEPayloadDisclose = {
type,
Expand Down
Loading