Skip to content

DCQL: keep the verifier's error in the failure message - #42

Draft
scott410md wants to merge 1 commit into
mainfrom
feat/presentation-error-detail
Draft

scott410md wants to merge 1 commit into
mainfrom
feat/presentation-error-detail

Conversation

@scott410md

Copy link
Copy Markdown
Collaborator

What it does

When a presentation or a credential fails verification during DCQL evaluation, the record's errors get a failure line such as:

Presentation for <credential id> failed verification

If the verifier's result payload carries an "error" text (for example a status list result), that line now ends with ": <error>":

Presentation for <credential id> failed verification: Credential is revoked or suspended (status_list idx=1, status=1)

The same applies to the Credential for <credential id> failed verification line.

The line is unchanged when there is no error text: no "error" key, an empty or non-string value, or a payload that is not a dict.

Why

A failed presentation record says why it failed. Callers that show a reason to a user, for example a verifier dashboard, can show the verifier's own text instead of a generic failure.

Scope

  • oid4vc/oid4vc/dcql.py only. A small helper, _with_verifier_error, is used for the presentation and credential failure lines.
  • No API change, no record schema change and no dependency change.
  • Successful verification is unchanged.

Tests

There are six new cases in oid4vc/oid4vc/tests/test_dcql.py. They use mocked verifiers and check the failure line for:

  • a presentation failure with an error text (the line ends with ": <error>");
  • a presentation failure without one (the line is unchanged);
  • a presentation failure whose payload is not a dict (the line is unchanged);
  • the same three cases for a credential failure.

Results on this branch:

  • pytest oid4vc/tests/test_dcql.py: 9 passed (3 existing, 6 new).
  • pytest jwt_vc_json mso_mdoc oid4vc sd_jwt_vc: 313 passed (307 on the base commit, plus the 6 new cases), 0 failed.
  • ruff check and ruff format --check (ruff 0.15.7, repository configuration) on both files: clean.

Companion change in proven-core (stores these errors with the presentation) will follow as a separate draft PR on main-2.0.

When a presentation or credential fails verification and the verifier
returns an error text in its result payload (for example a status list
result), the failure line now ends with ": <error>", so a failed
presentation record says why. Without an error text the line is unchanged.

Signed-off-by: Scott Harris <82886769+scott410md@users.noreply.github.com>
@scott410md

Copy link
Copy Markdown
Collaborator Author

Companion proven-core PR (stores these errors with the presentation): https://github.com/Indicio-tech/proven-core/pull/528

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.

1 participant