Addresses array cannot contain corresponding entries in verified addresses array.
mayurbhandary opened this issue · 0 comments
Expected Behavior
The CLI tool outputs this after signing with an identity key:
{
"payId": "test$payid.mayurbhandary.com",
"addresses": [
{
"paymentNetwork": "XRPL",
"environment": "TESTNET",
"addressDetailsType": "CryptoAddressDetails",
"addressDetails": {
"address": "rU3mTFnefto99VcEECBAbQseRMEKTCLGxr"
}
}
],
"verifiedAddresses": [
{
"payload": "{\"payId\":\"test$payid.mayurbhandary.com\",\"payIdAddress\":{\"paymentNetwork\":\"XRPL\",\"environment\":\"TESTNET\",\"addressDetailsType\":\"CryptoAddressDetails\",\"addressDetails\":{\"address\":\"rU3mTFnefto99VcEECBAbQseRMEKTCLGxr\"}}}",
"signatures": [
{
"protected": "eyJuYW1lIjoiaWRlbnRpdHlLZXkiLCJhbGciOiJFUzI1NiIsInR5cCI6IkpPU0UrSlNPTiIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0IiwibmFtZSJdLCJqd2siOnsiY3J2IjoiUC0yNTYiLCJ4IjoiSzhNeFFRdTdrdjc4RWUxcHBOMllabWUzVkhFTnR1c2oyako4a0huclBpUSIsInkiOiJXWDMwZkJGTGhPSXJOaV9tQXhLeXlDd2EteWtYRVVtWUluSjN3SGw5ZUZnIiwia3R5IjoiRUMiLCJraWQiOiJFNVd3TWdPTlBvdXYtZWRkbFhlVUp1dmVkR0l1TFpjZV9oOEs4RVhieVY4In19",
"signature": "lGajpmG4_JNA4XDsVVEFMHyB6ay1hw6ovr27-GVNuPmgB_9GkKZEn3uGLOEyTqyrkTQq3OXMA118rs2Hd-FLdQ"
}
]
}
]
}
So the corresponding Admin API request to create the PayID should be:
curl --location --request POST 'http://127.0.0.1:8081/users' \
--header 'PayID-API-Version: 2020-09-01' \
--header 'Content-Type: application/json' \
--data-raw '{
"payId": "test$payid.mayurbhandary.com",
"addresses": [
{
"paymentNetwork": "XRPL",
"environment": "TESTNET",
"addressDetailsType": "CryptoAddressDetails",
"addressDetails": {
"address": "rU3mTFnefto99VcEECBAbQseRMEKTCLGxr"
}
}
],
"verifiedAddresses": [
{
"payload": "{\"payId\":\"test$payid.mayurbhandary.com\",\"payIdAddress\":{\"paymentNetwork\":\"XRPL\",\"environment\":\"TESTNET\",\"addressDetailsType\":\"CryptoAddressDetails\",\"addressDetails\":{\"address\":\"rU3mTFnefto99VcEECBAbQseRMEKTCLGxr\"}}}",
"signatures": [
{
"protected": "eyJuYW1lIjoiaWRlbnRpdHlLZXkiLCJhbGciOiJFUzI1NiIsInR5cCI6IkpPU0UrSlNPTiIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0IiwibmFtZSJdLCJqd2siOnsiY3J2IjoiUC0yNTYiLCJ4IjoiSzhNeFFRdTdrdjc4RWUxcHBOMllabWUzVkhFTnR1c2oyako4a0huclBpUSIsInkiOiJXWDMwZkJGTGhPSXJOaV9tQXhLeXlDd2EteWtYRVVtWUluSjN3SGw5ZUZnIiwia3R5IjoiRUMiLCJraWQiOiJFNVd3TWdPTlBvdXYtZWRkbFhlVUp1dmVkR0l1TFpjZV9oOEs4RVhieVY4In19",
"signature": "lGajpmG4_JNA4XDsVVEFMHyB6ay1hw6ovr27-GVNuPmgB_9GkKZEn3uGLOEyTqyrkTQq3OXMA118rs2Hd-FLdQ"
}
]
}
]
}'
Actual Behavior
The above curl command gives this error:
{"statusCode":409,"error":"Conflict","message":"More than one address for the same (payment_network, environment) tuple was provided"}
In order to create the verified PayID, the PaymentInformation must be removed from the addresses array.
Context
This might not be an issue if the intended behavior is to make sure a verified address isn't also in addresses
, but there should be consistency between the CLI tool and the reference implementation.
Potential Solution
We should have a discussion about whether this behavior is intended and whether the CLI tool or the reference implementation needs to be changed so that they match.
Steps to Reproduce
See above
Environment
- Node version:
- NPM version:
- Operating System and version:
- PayID server version:
- PayID Version header (if applicable):
Screenshots
If applicable, add screenshots to help explain your problem.
Bonus
Are you willing to submit a pull request to fix this bug?
Yes