Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Implement base work to enable wallet to receive OpenID4VCI #1214

Conversation

MosCD3
Copy link
Contributor

@MosCD3 MosCD3 commented Jul 28, 2024

Summary of Changes

  • Add OpenID4VCI credo packages
  • Add resolver module for OIDC
  • Add parser utility to distinguish didcimm invitation from open-id
  • Refactor scan QR code flow to re-route to OIDC flow when detecting such invitation

TODO: Implement UI and Navigation

Pull Request Checklist

Tick all boxes below to demonstrate that you have completed the respective task. If the item does not apply to your this PR check it anyway to make it apparent that there's nothing to do.

  • All commits contain a DCO Signed-off-by line (we use the DCO GitHub app to enforce this);
  • Updated LICENSE-3RD-PARTY.md for any added dependencies or vendored components;
  • Updated documentation as needed for changed code and new or modified features;
  • Added sufficient tests so that overall code coverage is not reduced.

If you have any questions to any of the points above, just submit and ask! This checklist is here to help you, not to deter you from contributing!

Pro Tip 🤓

  • Read our contribution guide at least once; it will save you a few review cycles!
  • Your PR will likely not be reviewed until all the above boxes are checked and all automated tests have passed.

PR template adapted from the Python attrs project.

Signed-off-by: Mostafa Gamal <moscd3@gmail.com>
Signed-off-by: Mostafa Gamal <moscd3@gmail.com>
Signed-off-by: Mostafa Gamal <moscd3@gmail.com>
Signed-off-by: Mostafa Gamal <moscd3@gmail.com>
Signed-off-by: Mostafa Gamal <moscd3@gmail.com>
@cvarjao cvarjao changed the title chore: Implement base work to enable wallet to recieve OIDC feat: Implement base work to enable wallet to receive OpenID4VCI Jul 29, 2024
Signed-off-by: Mostafa Gamal <moscd3@gmail.com>
Signed-off-by: Mostafa Gamal <moscd3@gmail.com>
Signed-off-by: Mostafa Gamal <moscd3@gmail.com>
Copy link
Contributor

@bryce-mcmath bryce-mcmath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple things

}
}

const openId4VcCredentialMetadataKey = '_paradym/openId4VcCredentialMetadata'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this introduce a dependency on Paradym?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, but you are right, I should introduce a different key

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

return true
}

if (url.includes('c_i=') || url.includes('oob=') || url.includes('oobUrl=') || url.includes('d_m=')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this not account for c_i, d_m, oob, _oob, and _url? As it currently checks for those during scan handling

Copy link
Contributor Author

@MosCD3 MosCD3 Aug 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I will take a closer look

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MosCD3 , there was some work done to normalize and remove duplication on how URLs/Payloads are being parsed. We had some duplication and inconsistency between scanning QR Code vs open with deep link.
This is the main entry point:

export const connectFromScanOrDeepLink = async (

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to clarify, yes this is the entry point and I need a way to differ open-id invitation from that of did-comm
And the way I did it is through the entry point you mentioned @cvarjao to minimize code impact. I added a parser and the way the parser works is scanning the invitation URL for known did-comm tags in line 66, so the answer @bryce-mcmath is yes we need this to return the type of invitation so that we route the invitation to the correct flow. If you have any other better and more clean flow to have the same result, please suggest it here and I will refactor

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should just worry about "isOpenIdPresentationRequest()" and then add the logic to handle that, and fallback to what we already have, I would hope that in the future Credo can actually parse the invitation payload and make that decision.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a nice plan

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

Signed-off-by: Mostafa Gamal <moscd3@gmail.com>
}
} else if (invitationData.type === 'openid-credential-offer') {
//TODO: Impliment Navigation to display credential
// const record = await receiveCredentialFromOpenId4VciOffer({ agent: agent, uri: uri })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should avoid silent errors/dead-end, if it is not supported/implemented yet, it should throw an error.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will throw an error. This should be the next PR after implementing the base work

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

Copy link

sonarcloud bot commented Aug 12, 2024

@MosCD3 MosCD3 merged commit cca599f into openwallet-foundation:main Aug 12, 2024
6 checks passed
ramyzhang pushed a commit to DTCoE-CGI/aries-mobile-agent-react-native that referenced this pull request Sep 4, 2024
…nwallet-foundation#1214)

Signed-off-by: Mostafa Gamal <moscd3@gmail.com>
Signed-off-by: Ramy Zhang <ramyjzh@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants