indy-sdk-react-native icon indicating copy to clipboard operation
indy-sdk-react-native copied to clipboard

Request presentation message is failing in Android release build

Open marcinkiewiczblazej opened this issue 3 years ago • 5 comments
trafficstars

When handling request presentation message I'm getting an error:

ERROR: Error handling message with type https://didcomm.org/present-proof/1.0/request-presentation

Unfortunately the message is quite long and gets truncated. I've been digging deeper and it seems that the provided message is failing on validation. Example error (I've added few more logs to catch that):

12-08 15:41:04.377 31694 31724 E ReactNativeJS: ERROR: Error handling message property 'requestedPredicates' constraints: {
12-08 15:41:04.377 31694 31724 E ReactNativeJS:   "isMap": "requestedPredicates must be a Map"
12-08 15:41:04.377 31694 31724 E ReactNativeJS: }

In the message that arrived requestedPredicates was empty map:

"requested_predicates": {},

The very same message is correctly processed by debug Android build. There's also no problem with iOS version, both release and debug.

I've tested versions 1.14 and 1.15. Result is the same. The only setup difference is that Android version is using Hermes. Without it, it was failing on zmq.

marcinkiewiczblazej avatar Dec 08 '21 15:12 marcinkiewiczblazej

Thanks for opening this issue @marcinkiewiczblazej. It seems like this is a problem with Aries Framework JavaScript, but it is weird this is only happening in the release build.

Do you have a copy of the proof request you're sending on the verifier side? And maybe also the complete message that is received on the holder side?

TimoGlastra avatar Dec 08 '21 16:12 TimoGlastra

@JamesKEbert is this the issue you were running into with maps?

TimoGlastra avatar Dec 08 '21 16:12 TimoGlastra

Here's the message sent from verifier (it's sent using aca-py admin endpoint /present-proof/send-request):

{
    "proof_request": {
        "name": "Proof of ID Credentials",
        "version": "1.0",
        "requested_attributes": {
            "0_first_name_uuid": {
                "name": "first_name",
                "restrictions": [
                    {
                        "schema_name": "id credentials",
                        "schema_id": "5pnRkcshgidE6AoRaLdXce:2:id credentials:75.52.44",
                        "cred_def_id": "5pnRkcshgidE6AoRaLdXce:3:CL:42075:SSI_DESK.id_credentials"
                    }
                ]
            },
            "0_last_name_uuid": {
                "name": "last_name",
                "restrictions": [
                    {
                        "schema_name": "id credentials",
                        "schema_id": "5pnRkcshgidE6AoRaLdXce:2:id credentials:75.52.44",
                        "cred_def_id": "5pnRkcshgidE6AoRaLdXce:3:CL:42075:SSI_DESK.id_credentials"
                    }
                ]
            },
            "0_picture_uuid": {
                "name": "picture",
                "restrictions": [
                    {
                        "schema_name": "id credentials",
                        "schema_id": "5pnRkcshgidE6AoRaLdXce:2:id credentials:75.52.44",
                        "cred_def_id": "5pnRkcshgidE6AoRaLdXce:3:CL:42075:SSI_DESK.id_credentials"
                    }
                ]
            },
            "0_gender_uuid": {
                "name": "gender",
                "restrictions": [
                    {
                        "schema_name": "id credentials",
                        "schema_id": "5pnRkcshgidE6AoRaLdXce:2:id credentials:75.52.44",
                        "cred_def_id": "5pnRkcshgidE6AoRaLdXce:3:CL:42075:SSI_DESK.id_credentials"
                    }
                ]
            },
            "0_birth_date_uuid": {
                "name": "birth_date",
                "restrictions": [
                    {
                        "schema_name": "id credentials",
                        "schema_id": "5pnRkcshgidE6AoRaLdXce:2:id credentials:75.52.44",
                        "cred_def_id": "5pnRkcshgidE6AoRaLdXce:3:CL:42075:SSI_DESK.id_credentials"
                    }
                ]
            }
        },
        "requested_predicates": {}
    },
    "trace": false,
    "connection_id": "74854c4f-42bc-4ab0-b0d0-07ef837c3e62"
}

Here's the request that arrives on the holder side:

12-09 16:33:47.026 20969 21000 E ReactNativeJS:      { name: 'Proof of ID Credentials',
12-09 16:33:47.026 20969 21000 E ReactNativeJS:        version: '1.0',
12-09 16:33:47.026 20969 21000 E ReactNativeJS:        requestedAttributes: 
12-09 16:33:47.026 20969 21000 E ReactNativeJS:         { '0_first_name_uuid': 
12-09 16:33:47.026 20969 21000 E ReactNativeJS:            { name: 'first_name',
12-09 16:33:47.026 20969 21000 E ReactNativeJS:              restrictions: 
12-09 16:33:47.026 20969 21000 E ReactNativeJS:               [ { schema_name: 'id credentials',
12-09 16:33:47.026 20969 21000 E ReactNativeJS:                   schema_id: '5pnRkcshgidE6AoRaLdXce:2:id credentials:75.52.44',
12-09 16:33:47.026 20969 21000 E ReactNativeJS:                   cred_def_id: '5pnRkcshgidE6AoRaLdXce:3:CL:42075:SSI_DESK.id_credentials' } ] },
12-09 16:33:47.026 20969 21000 E ReactNativeJS:           '0_last_name_uuid': 
12-09 16:33:47.026 20969 21000 E ReactNativeJS:            { name: 'last_name',
12-09 16:33:47.026 20969 21000 E ReactNativeJS:              restrictions: 
12-09 16:33:47.026 20969 21000 E ReactNativeJS:               [ { schema_name: 'id credentials',
12-09 16:33:47.026 20969 21000 E ReactNativeJS:                   schema_id: '5pnRkcshgidE6AoRaLdXce:2:id credentials:75.52.44',
12-09 16:33:47.026 20969 21000 E ReactNativeJS:                   cred_def_id: '5pnRkcshgidE6AoRaLdXce:3:CL:42075:SSI_DESK.id_credentials' } ] },
12-09 16:33:47.026 20969 21000 E ReactNativeJS:           '0_picture_uuid': 
12-09 16:33:47.026 20969 21000 E ReactNativeJS:            { name: 'picture',
12-09 16:33:47.026 20969 21000 E ReactNativeJS:              restrictions: 
12-09 16:33:47.026 20969 21000 E ReactNativeJS:               [ { schema_name: 'id credentials',
12-09 16:33:47.026 20969 21000 E ReactNativeJS:                   schema_id: '5pnRkcshgidE6AoRaLdXce:2:id credentials:75.52.44',
12-09 16:33:47.026 20969 21000 E ReactNativeJS:                   cred_def_id: '5pnRkcshgidE6AoRaLdXce:3:CL:42075:SSI_DESK.id_credentials' } ] },
12-09 16:33:47.026 20969 21000 E ReactNativeJS:           '0_gender_uuid': 
12-09 16:33:47.026 20969 21000 E ReactNativeJS:            { name: 'gender',
12-09 16:33:47.026 20969 21000 E ReactNativeJS:              restrictions: 
12-09 16:33:47.026 20969 21000 E ReactNativeJS:               [ { schema_name: 'id credentials',
12-09 16:33:47.026 20969 21000 E ReactNativeJS:                   schema_id: '5pnRkcshgidE6AoRaLdXce:2:id credentials:75.52.44',
12-09 16:33:47.026 20969 21000 E ReactNativeJS:                   cred_def_id: '5pnRkcshgidE6AoRaLdXce:3:CL:42075:SSI_DESK.id_credentials' } ] },
12-09 16:33:47.026 20969 21000 E ReactNativeJS:           '0_birth_date_uuid': 
12-09 16:33:47.026 20969 21000 E ReactNativeJS:            { name: 'birth_date',
12-09 16:33:47.026 20969 21000 E ReactNativeJS:              restrictions: 
12-09 16:33:47.026 20969 21000 E ReactNativeJS:               [ { schema_name: 'id credentials',
12-09 16:33:47.026 20969 21000 E ReactNativeJS:                   schema_id: '5pnRkcshgidE6AoRaLdXce:2:id credentials:75.52.44',
12-09 16:33:47.026 20969 21000 E ReactNativeJS:                   cred_def_id: '5pnRkcshgidE6AoRaLdXce:3:CL:42075:SSI_DESK.id_credentials' } ] },
12-09 16:33:47.026 20969 21000 E ReactNativeJS:           nonRevoked: undefined },
12-09 16:33:47.026 20969 21000 E ReactNativeJS:        requestedPredicates: 
12-09 16:33:47.026 20969 21000 E ReactNativeJS:         { predicateType: undefined,
12-09 16:33:47.026 20969 21000 E ReactNativeJS:           predicateValue: undefined,
12-09 16:33:47.026 20969 21000 E ReactNativeJS:           nonRevoked: undefined },
12-09 16:33:47.026 20969 21000 E ReactNativeJS:        nonce: '732767484921536234178379',
12-09 16:33:47.026 20969 21000 E ReactNativeJS:        nonRevoked: undefined }

marcinkiewiczblazej avatar Dec 09 '21 16:12 marcinkiewiczblazej

There were also errors about strings, arrays, eg:

12-08 15:32:20.911 29269 29298 E ReactNativeJS: ERROR: Child {
12-08 15:32:20.911 29269 29298 E ReactNativeJS:   "isString": "name must be a string"
12-08 15:32:20.911 29269 29298 E ReactNativeJS: }

marcinkiewiczblazej avatar Dec 09 '21 16:12 marcinkiewiczblazej

@TimoGlastra we've found the issue. For Android we've had to enable Hermes, without it we couldn't make agent work properly. It turns out that in release build Hermes is messing up with the validation library used in AFJ, but only in the request-presentation message. Issuing credential flow works fine. If we enable Hermes for iOS application in release build we have the very same problem.

marcinkiewiczblazej avatar Feb 09 '22 14:02 marcinkiewiczblazej