Skip to content

decrypt payload for authenticated data#18

Open
caseThree wants to merge 1 commit intotruecaller:masterfrom
caseThree:payload_data
Open

decrypt payload for authenticated data#18
caseThree wants to merge 1 commit intotruecaller:masterfrom
caseThree:payload_data

Conversation

@caseThree
Copy link

The truecaller profile received at the backend is of this format:

{
"avatarUrl":null,
"city":null,
"companyName":null,
"countryCode":"IN",
"email":null,
"facebookId":null,
"firstName":"Shobhit",
"gender":"M",
"isAmbassador":false,
"isBusiness":false,
"isVerified":false,
"jobTitle":null,
"lastName":"Tewari",
"payload":null,
"phoneNumber": null,
"requestNonce": null,
"signature": null,
"street":null,
"successful":true,
"twitterId":null,
"url":null,
"zipcode":null
}

Here null is the placeholdere for specific fields.

In this format of data, we verify the signature but there is a possibility that the developer may take data from the raw object mentioned above. After validation, the data must be taken from the payload and not the raw object received at the backend as shown above. This is also mentioned in the docs.

I created a function that will return the details in the payload which is the verified data in the format:

{
requestNonce: null,
requestTime: null,
phoneNumber: null,
firstName: 'Shobhit',
lastName: 'Tewari',
gender: 'M',
countryCode: 'IN',
trueName: true,
ambassador: false,
isBusiness: false,
verifier: null
}

This is the data which is received after decoding the payload which is verified after verifying the signature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant