bcgov / bc-wallet-mobile

BC Wallet to hold Verifiable Credentials
Apache License 2.0
60 stars 49 forks source link

Display an error if a proof request hits a validation error #2164

Open loneil opened 2 weeks ago

loneil commented 2 weeks ago

Not sure if bug or nice-to-have feature request (probably the latter)

Description of feature / user story

If a connectionless (not sure what happens if using a real connection) proof request scanned fails with a validation error, would be nice I think to have feedback to the user that it fails.

Currently a validation error from Credo about the proof being malformed will just sit on the making connection spinner.

Acceptance Criteria

A (friendly? or developer-y?) error message to the user that this proof will not work rather than possibly confusing "waiting for connection" spinning.

Wireframes or relevant image assets / links

I make a mistake in my proof like below, using a string when a Int is needed or something in p_value

{
  "name": "CSB Transcriber",
  "version": "0.0.1",
  "requested_attributes": {
  blah blah blah
 }
  },
  "requested_predicates": {
    "req_pred_0": {
      "name": "contract_start_dateint",
      "restrictions": [{ "schema_name": "contractor-credential" }],
      "p_value": "20240913",
      "p_type": "<=",
      "non_revoked": { "from": 1726269311, "to": 1726269311 }
    }
  },
  "nonce": "989457181219949169483799"
}

If I use that proof in VCAuthN either in a connectionless invitation, or an Out-Of-Band, then what I see in the BC Wallet when I scan the QR code is:

image

And that just keeps going.

Using remote debugging I can see these validationErrors errors throw from the BC Wallet.

{"message":"Error handling message with type https://didcomm.org/present-proof/2.0/request-presentation","data":{"message":{"@type":"https://didcomm.org/present-proof/2.0/request-presentation","will_confirm":true,"present_multiple":false,"@id":"530f138c-0f02-464b-82a4-0509fee26433","~thread":{"pthid":"e2b9ea5b-5d05-4658-a777-8b561973a950"},"formats":[{"attach_id":"indy","format":"hlindy/proof-req@v2.0"}],"request_presentations~attach":[{"@id":"indy","mime-type":"application/json","data":{"base64":"eyJuYW1lIjogIkNTQiBUcmFuc2NyaWJlciIsICJ2ZXJzaW9uIjogIjAuMC4xIiwgInJlcXVlc3RlZF9hdHRyaWJ1dGVzIjogeyJyZXFfYXR0cl8wIjogeyJuYW1lcyI6IFsidXNlcl9pZCIsICJjb21wYW55X25hbWUiXSwgInJlc3RyaWN0aW9ucyI6IFt7InNjaGVtYV9uYW1lIjogImNvbnRyYWN0b3ItY3JlZGVudGlhbCIsICJpc3N1ZXJfZGlkIjogIlJTREFWeWFpVWpGUENqMjQ1UG9ZM1AifV0sICJub25fcmV2b2tlZCI6IHsiZnJvbSI6IDE3MjYyMDAwMTMsICJ0byI6IDE3MjYyMDAwMTN9fX0sICJyZXF1ZXN0ZWRfcHJlZGljYXRlcyI6IHsicmVxX3ByZWRfMCI6IHsibmFtZSI6ICJjb250cmFjdF9zdGFydF9kYXRlaW50IiwgInJlc3RyaWN0aW9ucyI6IFt7InNjaGVtYV9uYW1lIjogImNvbnRyYWN0b3ItY3JlZGVudGlhbCJ9XSwgInBfdmFsdWUiOiAiMjAyNDA5MTMiLCAicF90eXBlIjogIjw9IiwgIm5vbl9yZXZva2VkIjogeyJmcm9tIjogMTcyNjIwMDAxMywgInRvIjogMTcyNjIwMDAxM319fSwgIm5vbmNlIjogIjExOTAxNzI2MTgyMTg0MDkzMzk4NTM4NjMifQ=="}}]},"error":{"validationErrors":[{"target":{"name":"CSB Transcriber","version":"0.0.1","requestedAttributes":{},"requestedPredicates":{},"nonce":"1190172618218409339853863"},"value":{},"property":"requestedPredicates","children":[{"target":{},"value":{"name":"contract_start_dateint","restrictions":[{"attributeMarkers":{},"attributeValues":{},"schemaName":"contractor-credential"}],"predicateValue":"20240913","predicateType":"<=","nonRevoked":{"from":1726200013,"to":1726200013}},"property":"req_pred_0","children":[{"target":{"name":"contract_start_dateint","restrictions":[{"attributeMarkers":{},"attributeValues":{},"schemaName":"contractor-credential"}],"predicateValue":"20240913","predicateType":"<=","nonRevoked":{"from":1726200013,"to":1726200013}},"value":"20240913","property":"predicateValue","children":[],"constraints":{"isInt":"predicateValue must be an integer number"}}]}]}]}}}
{"message":"Failed to process message","data":{"error":{"validationErrors":[{"target":{"name":"CSB Transcriber","version":"0.0.1","requestedAttributes":{},"requestedPredicates":{},"nonce":"1190172618218409339853863"},"value":{},"property":"requestedPredicates","children":[{"target":{},"value":{"name":"contract_start_dateint","restrictions":[{"attributeMarkers":{},"attributeValues":{},"schemaName":"contractor-credential"}],"predicateValue":"20240913","predicateType":"<=","nonRevoked":{"from":1726200013,"to":1726200013}},"property":"req_pred_0","children":[{"target":{"name":"contract_start_dateint","restrictions":[{"attributeMarkers":{},"attributeValues":{},"schemaName":"contractor-credential"}],"predicateValue":"20240913","predicateType":"<=","nonRevoked":{"from":1726200013,"to":1726200013}},"value":"20240913","property":"predicateValue","children":[],"constraints":{"isInt":"predicateValue must be an integer number"}}]}]}]}}}
loneil commented 1 week ago

@krobinsonca this is the one I referenced earlier today when I put the wrong data type in a proof restriction field, if a proof request has a specific problem with it (a validation error) then the wallet can just spin without an error display.