Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

decrypt payload for authenticated data #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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