Sphereon-Opensource / OID4VC-demo

Demo for OID4VC, containing a configurable agent, OID4VCI Issuer and demopage as well as SIOPv2 and OID4VP RPs with demo page
Apache License 2.0
17 stars 8 forks source link

Problem with local dev config for demo issuer front-end #10

Open nedgar opened 1 year ago

nedgar commented 1 year ago

I'm trying to run the issuer front-end locally on my dev machine, either against the local agent (via ngrok) or the one at https://ssi.sphereon.com.

In .env.local, copied from .env per the instructions, should it have: REACT_APP_OID4VP_PRESENTATION_DEF_ID=sphereon (like in the .env file) or REACT_APP_OID4VP_PRESENTATION_DEF_ID=sphereon2023 (like in the README)

Example packages/oid4vci-demo-frontend/.env.local:

REACT_APP_OID4VP_AGENT_BASE_URL=https://ssi.sphereon.com/agent
REACT_APP_OID4VP_PRESENTATION_DEF_ID=sphereon
REACT_APP_OID4VCI_AGENT_BASE_URL=https://ssi.sphereon.com/issuer/sphereon2023
REACT_APP_ENVIRONMENT=sphereon
PORT=5001

With REACT_APP_OID4VP_PRESENTATION_DEF_ID as sphereon, trying to log in with the Sphereon ID wallet app (latest iOS version) fails with:

Unable to retrieve information. Error: undefined is not an object (evaluating 'e.claims.vp_token')

The payload of the auth request JWT doesn't contain any claims, and the app isn't resilient to that, surfacing the low level error.

74C1FBE5-D845-408C-B9E5-D49058BF99A6_1_105_c

If I change it to sphereon2023, it gets further, but the wallet prompts for the guest credential, not the primary wallet ID credential. In the expected demo flow, this is only issued later, after authenticating.

If instead I enter the auth info manually, it goes through OK to issuing the guest credential

@nklomp I see there have been recent changes here. Could you please clarify?

nedgar commented 1 year ago

I notice the docker .env file has sphereon2023: https://github.com/Sphereon-Opensource/OID4VC-demo/blob/develop/docker/.env.oid4vci-demo-frontend#L2

nedgar commented 1 year ago

To use ngrok to tunnel to my locally running agent, I also had to change the credential_issuer and credential_endpoint in packages/agent/conf/dev/oid4vci_metadata/sphereon.json: https://github.com/Sphereon-Opensource/OID4VC-demo/blob/771b94f90d7319975d63df9d63972bbbe9f81412/packages/agent/conf/dev/oid4vci_metadata/sphereon.json#L2-L6

It would be nice if the agent endpoint could be configured purely through env vars.

Does the correlationId need to be a URL or can it be a URI that's not tied to the actual deployment address?

nedgar commented 1 year ago

Through experimentation with the public demo issuer at https://ssi.sphereon.com/demo/issuer/#/credentials/verify/request, I see it uses the sphereonWallet definition ID (not sphereon or sphereon2023). Running the demo issuer locally, if I change packages/oid4vci-demo-frontend/.env.local to have:

REACT_APP_OID4VP_AGENT_BASE_URL=https://ssi.sphereon.com/agent
REACT_APP_OID4VP_PRESENTATION_DEF_ID=sphereonWallet
REACT_APP_OID4VCI_AGENT_BASE_URL=https://ssi.sphereon.com/sphereon2023
REACT_APP_ENVIRONMENT=sphereon
PORT=5001

then the fetched auth request includes the correct claims > vp_token > presentation_definition for the identity challenge:

...
  "claims": {
    "vp_token": {
      "presentation_definition": {
        "id": "sphereonWallet",
        "purpose": "You need to prove your Wallet Identity data",
        "submission_requirements": [
          {
            "name": "Sphereon Wallet Identity",
            "rule": "pick",
            "min": 0,
            "max": 1,
            "from": "A"
          }
        ],
        "input_descriptors": [
          {
            "id": "SphereonWalletId",
            "purpose": "Checking your Sphereon Wallet information",
            "name": "Wallet Identity",
            "group": [
              "A"
            ],
            "schema": [
              {
                "uri": "https://sphereon-opensource.github.io/ssi-mobile-wallet/context/sphereon-wallet-identity-v1.jsonld"
              }
            ]
          }
        ]
      }
    }
  },
...

However, the Sphereon Wallet App now hangs and times out with a 504 gateway error when trying to fetch this. Fetching it at the same URL from my laptop works OK. Strange. Does the wallet use a proxy?

nedgar commented 1 year ago

The demo agent doesn't have any definition with ID sphereonWallet though. Is that definition missing from the open source?