Skip to content

chore: migrate @sphereon/pex to @animo-id/pex 6.1.1 - #63

Open
jrhender wants to merge 2 commits into
chore/credo-0.7from
chore/pex-6
Open

chore: migrate @sphereon/pex to @animo-id/pex 6.1.1#63
jrhender wants to merge 2 commits into
chore/credo-0.7from
chore/pex-6

Conversation

@jrhender

@jrhender jrhender commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Description

Replaces the unmaintained @sphereon/pex 1.1.3 with @animo-id/pex 6.1.1 — the actively maintained fork that Credo 0.7 already depends on — so the workspace resolves a single copy of @sphereon/ssi-types shared with Credo. Follow-up to the Credo 0.7 migration (part of the #57 modernization series); stacked on chore/credo-0.7.

API adaptations for pex 6

  • pex.presentationFrom now returns a PresentationResult; we pass presentationSubmissionLocation: PRESENTATION and use .presentations[0] so the submission stays embedded in the presentation, exactly as 1.x behaved.
  • validateDefinition is now a static method (PEX.validateDefinition).
  • evaluatePresentation is called with generatePresentationSubmission set when the presentation carries no submission, matching the 1.x tolerance for submission-less presentations.
  • ProofPurpose / IPresentation / IVerifiableCredential / IProof now come from @sphereon/ssi-types. The ProofPurpose OpenAPI enum gains one additive value, verificationMethod (see regenerated docs/openapi.json).
  • @sphereon/pex-models bumped ~2.0.2 → ^2.3.2.

Behavior change: stricter presentation-definition validation

pex 6 validates input-descriptor field filters against the DIF Presentation Exchange filter schema (a keyword whitelist: const, enum, type, pattern, format, contains, tuple items, not, …). pex 1.x accepted free-form JSON Schema keywords such as properties, $ref/definitions, and additionalItems; definitions using those now get a 400 when creating an exchange. The consent e2e fixture used such filters and has been rewritten to express the same checks with JSON paths into the context array and credential subject (spec-conformant and portable across PE implementations).

The e2e suites now also run nock.cleanAll() between tests, so one failed test's unconsumed callback interceptors can no longer absorb later tests' callbacks and cascade into misleading failures.

Side benefit

The ajv "strict mode" warning spam emitted by pex 1.x during presentation-definition evaluation is gone.

Verification

  • CI green: unit 69/69, e2e 12/12, DCO pass.
  • Boot smoke test against the running app: create DID → credentials/issuepresentations/from (returns embedded presentation_submission) → presentations/provepresentations/verify returns verified: true.
  • pex-level checks for the rewritten consent definitions: PEX.validateDefinition passes and evaluatePresentation matches the exact VP shape the tests submit (both the two-group and single-group variants).

🤖 Generated with Claude Code

jrhender added 2 commits July 3, 2026 11:13
Replace the unmaintained @sphereon/pex 1.x with @animo-id/pex 6.1.1,
the fork used by Credo 0.7, so both resolve to a single copy of
@sphereon/ssi-types.

- presentationFrom now returns a PresentationResult; request the
  submission embedded in the presentation
  (presentationSubmissionLocation: PRESENTATION) to keep 1.x behavior
- validateDefinition is now a static method on PEX
- evaluatePresentation is told to generate a submission when the
  presentation does not carry one, matching 1.x tolerance
- ProofPurpose/IPresentation/IVerifiableCredential/IProof now come
  from @sphereon/ssi-types; the ProofPurpose OpenAPI enum gains
  verificationMethod (additive)
- bump @sphereon/pex-models to ^2.3.2; regenerate docs/openapi.json

Signed-off-by: John Henderson <jrhender@users.noreply.github.com>
pex 6 validates field filters against the DIF Presentation Exchange
filter schema, which does not allow free-form json-schema keywords
(properties, $ref, definitions, additionalItems). The consent
credential @context and credentialSubject filters used those keywords
and were rejected, so creating the consent presentation exchange
returned 400 in CI. Express the same checks with json paths into the
context array and subject instead.

Also clean nock interceptors between e2e tests: the 400 aborted one
test and its unused callback interceptor absorbed the next tests\x27
callbacks, cascading into two unrelated-looking scope failures.

Signed-off-by: John Henderson <jrhender@users.noreply.github.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.

1 participant