Skip to content

Commit 35c9b74

Browse files
committed
Refactor KYC image upload response structure in kyc.service.js
- Updated uploadKycImage function to return a structured response object. - Introduced an identity object to encapsulate user information. - Cleaned up response handling by ensuring quote and identity are included in the final response. - Improved logging for better traceability during KYC processing.
1 parent 6644a57 commit 35c9b74

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

Execution_Service/src/kyc.service.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ async function uploadKycImage(fileBuffer = null) {
179179
console.log("No quote file found or error reading quote:", error.message);
180180
}
181181

182-
response.quote = quote;
182+
183183

184184
const testPrivateKeyPath = path.resolve(__dirname, "../data/private_key.pem");
185185
const prodPrivateKeyPath = path.resolve("./crypto/docker_private_key_ed25519.pem");
@@ -196,17 +196,21 @@ async function uploadKycImage(fileBuffer = null) {
196196
privateKeyPath = testPrivateKeyPath;
197197
}
198198

199-
200-
const signature = signJsonResponse({
199+
const identity = {
201200
id_number: response.id_number,
202201
over_18: response.over_18,
203202
over_21: response.over_21
204-
}, privateKeyPath);
203+
};
204+
205+
const signature = signJsonResponse(identity, privateKeyPath);
206+
207+
response.identity = identity;
208+
response.quote = quote;
205209
response.signature = signature;
206210

207211
console.log("✅ KYC Processing Result:");
208212
console.log(response);
209-
return response;
213+
return {response: response};
210214

211215
} catch (error) {
212216
console.error("❌ KYC processing failed:");

Validation_Service/src/verify.service.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ async function verify(proofOfTask) {
1111

1212
try {
1313
const inputJson = await dalService.getIPfsTask(proofOfTask);
14-
console.log("in the verifificatin", inputJson);
14+
console.log("in the verifification", inputJson);
1515
// Step 1: Extract fields
1616
const response = inputJson.response;
1717
const quote = response.quote;
@@ -22,12 +22,16 @@ async function verify(proofOfTask) {
2222
throw new Error("Missing required field in input JSON");
2323
}
2424

25+
console.log("parse quote", quote);
26+
2527
// Step 2: Send quote to PCCS API
2628
const apiResp = await axios.post(
2729
"https://pccs.scrtlabs.com/dcap-tools/quote-parse",
2830
new URLSearchParams({ quote }),
2931
{ headers: { "Content-Type": "application/x-www-form-urlencoded" } }
3032
);
33+
34+
console.log("apiResp", apiResp);
3135

3236
const reportDataHex = apiResp.data?.quote?.report_data;
3337
console.log("reportDataHex", reportDataHex);

0 commit comments

Comments
 (0)