Skip to content

Commit

Permalink
fix: Provide meaningful error message when signature verification fai…
Browse files Browse the repository at this point in the history
…ls (#197)

<!--
  For Work In Progress Pull Requests, please use the Draft PR feature,
see https://github.blog/2019-02-14-introducing-draft-pull-requests/ for
further details.
  
  For a timely review/response, please avoid force-pushing additional
  commits if your PR already received reviews or comments.
  
Before submitting a Pull Request, please ensure you've done the
following:
- 📖 Read the [Contributing
Guide](https://github.com/uncefact/project-vckit/blob/main/CONTRIBUTING.md).
- 📖 Read the [Code of
Conduct](https://github.com/uncefact/project-vckit/blob/main/CODE_OF_CONDUCT.md).
  - 👷‍♀️ Create small PRs. In most cases, this will be possible.
  - ✅ Provide tests for your changes.
- 📝 Use descriptive commit messages following [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/).
- 📗 Update any related documentation and include any relevant
screenshots.
-->

## What type of PR is this? (check all applicable)

- [ ] 🍕 Feature
- [x] 🐛 Bug Fix
- [ ] 📝 Documentation Update
- [ ] 🎨 Style
- [ ] 🧑‍💻 Code Refactor
- [ ] 🔥 Performance Improvements
- [ ] ✅ Test
- [ ] 🤖 Build
- [ ] 🔁 CI
- [ ] 📦 Chore (Release)
- [ ] ⏩ Revert

## Description
I found something regarding this issue. If you want to know more, please
read the comment in the attached ticket below.<!--
Please do not leave this blank 
This PR [adds/removes/fixes/replaces] the [feature/bug/etc]. 
-->

## Related Tickets & Documents
<!-- 
Please use this format link issue numbers: Fixes #123

https://docs.github.com/en/free-pro-team@latest/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword
-->
gs-gs/fa-ag-trace#476
## Mobile & Desktop Screenshots/Recordings

<!-- Visual changes require screenshots -->
<img width="1440" alt="image"
src="https://github.com/uncefact/project-vckit/assets/59736798/8219d4ff-d902-4119-8c9d-cb43c108a668">

<img width="1440" alt="image"
src="https://github.com/uncefact/project-vckit/assets/59736798/405d4881-9f39-4452-adb1-f92c40c3f3eb">

## Added tests?

- [ ] 👍 yes
- [x] 🙅 no, because they aren't needed
- [ ] 🙋 no, because I need help

## Added to documentation?

- [ ] 📜 README.md
- [ ] 📓 [vc-kit doc site](https://uncefact.github.io/vckit/)
- [ ] 📕 storybook
- [x] 🙅 no documentation needed

## [optional] Are there any post-deployment tasks we need to perform?


<!-- note: PRs with deleted sections will be marked invalid -->
  • Loading branch information
ldhyen99 committed Jun 14, 2024
1 parent d487a36 commit b6b18c6
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/demo-explorer/src/pages/CredentialVerifier.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,16 @@ const CredentialVerifier = () => {
credential: JSON.parse(text),
fetchRemoteContexts: true,
})
setVerificationResult(result)

if (result?.verified) {
setVerificationResult((result) => {
if (!result) return result
return { ...result, verifiableCredential: JSON.parse(text) }
setVerificationResult({
...result,
verifiableCredential: JSON.parse(text),
})
} else {
setVerificationResult({
verified: false,
error: { message: JSON.stringify(result?.error, null, 2) },
})
}
} catch (e: any) {
Expand Down

0 comments on commit b6b18c6

Please sign in to comment.