credential-handler / credential-handler-polyfill

Credential Handler API polyfill
https://chapi.io
BSD 3-Clause "New" or "Revised" License
36 stars 13 forks source link

Remove TODO: Update to something more useful from readme #27

Closed OR13 closed 2 years ago

OR13 commented 2 years ago
    const credentialQuery = { web: {} }; // TODO: Update to something more useful

Provide at least a simple example

OR13 commented 2 years ago

Use:

 const credentialQuery =   {
        "web": {
          "VerifiablePresentation": {
            "query": [{
              "type": "QueryByExample",
              "credentialQuery": {
                "reason": "Please present a UniversityDegreeCredential for JaneDoe.",
                "example": {
                  "@context": [
                    "https://w3id.org/credentials/v1",
                    "https://www.w3.org/2018/credentials/examples/v1"
                  ],
                  "type": ["UniversityDegreeCredential"],
                  "credentialSubject": {
                    "id": "did:example:ebfeb1f712ebc6f1c276e12ec21"
                  }
                }
              }
            }]
          },
          "recommendedHandlerOrigins": [
            "https://chapi-demo-wallet.digitalbazaar.com"
          ]
        }
      }
dlongley commented 2 years ago

@tolson4 -- can you provide a really simple example, something that matches from chapi.io?

dlongley commented 2 years ago

I'll tweak the above example and add it real quick. @tolson4, this is another area we'll want to make sure we're aligning / using chapi.io as best as possible here to avoid duplicate maintenance.

OR13 commented 2 years ago

Why would anyone ever use:

recommendedHandlerOrigins

AFAIK, its undocumented here: https://w3c-ccg.github.io/vp-request-spec/

dmitrizagidulin commented 2 years ago

@OR13 so, recommendedHandlerOrigins is super useful -- it supports the very common usecase of people /not/ having any wallets installed. So the Origins array provides some suggestions of - hey, if you don't have a wallet, here are some you might want to try.

(And yeah, it should be added to the VPR spec)

dlongley commented 2 years ago

This has been updated: https://github.com/credential-handler/credential-handler-polyfill/blob/main/README.md#get

dlongley commented 2 years ago

@OR13, @dmitrizagidulin,

"recommendedHandlerOrigins" is not part of VPR, it is part of a WebCredential request (so part of the Credential Handler API / CHAPI instead).

OR13 commented 2 years ago

I am removing it (recommendedHandlerOrigins) in my demo, I don't see any documentation or reason to support it

OR13 commented 2 years ago

imo it should be in the VPR spec... if its in a query... which it is.

Even its its semantics are defined in another spec.

dlongley commented 2 years ago

@OR13,

imo it should be in the VPR spec... if its in a query... which it is.

Even its its semantics are defined in another spec.

It is not in a VPR query. Your example's indentation was wrong. It's properly fixed in the README.

EDIT: No, your example is right, you just may have been misreading it if you thought it was in the VPR query -- it's not.

dlongley commented 2 years ago

@OR13,

The recommendedHandlerOrigins CHAPI feature and rationale are now mentioned in the VPR spec here:

https://w3c-ccg.github.io/vp-request-spec/#requesting-and-storing-credentials

dlongley commented 2 years ago

Closing as the README has a better example now and it also links to chapi.io with more information, demos, examples, playground, etc.