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: idkit state and error handling improvements #194

Merged
merged 6 commits into from
Dec 6, 2023
Merged

Conversation

0xPenryn
Copy link
Collaborator

@0xPenryn 0xPenryn commented Dec 5, 2023

Resolves an issue I demo'd to @m1guelpf where IDKit would resubmit a proof to callback functions when it was reopened. The bridge store in idkit-core wasn't clearing the result and errorCode on reset, so these values were getting picked up again when entering WorldIDState.

Also adds proper error when a proof request times out (such as when a user never scans the QR code or never clicks "Verify with World ID" in the app). This is a distinct error from a user rejecting a proof request.

Also fixes an issue where if an error was thrown synchronously in handleVerify, the error would not be properly displayed by IDKit. Resolved by always calling handleVerify callbacks as async so the thrown error is handled as promise rejection.

Also ensures that the credential_type returned in the proof matches the configured accepted credential_types. This should only happen when manually selecting the wrong credential in the Simulator (as World App should prevent the proof from being generated at all if the requested credential is not available), but it's a good check to have.

solves an issue where reopening the IDKit widget would resubmit the same proof to the callback functions
throws connection_failed error if pollForUpdates gets a 404 from bridge (meaning request has expired)
ensures that handleVerify callbacks are processed async so the promise can reject on thrown errors and display them nicely in IDKit
checks to ensure the credential_type in the proof returned from the bridge is one of the configured credential_types, and displays the relevant error if not

this should only happen when manually selecting the wrong credential in the simulator, but good to have anyway
@0xPenryn 0xPenryn requested review from m1guelpf and pdtfh December 5, 2023 21:24
Copy link

vercel bot commented Dec 5, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
idkit-js-example ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 6, 2023 6:11pm

This was referenced Jul 10, 2024
@github-actions github-actions bot mentioned this pull request Jul 19, 2024
@github-actions github-actions bot mentioned this pull request Aug 9, 2024
@github-actions github-actions bot mentioned this pull request Aug 22, 2024
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.

2 participants