Skip to content

Conversation

@rmlearney-digicatapult
Copy link
Contributor

@rmlearney-digicatapult rmlearney-digicatapult commented Dec 11, 2025

Pull Request

Checklist

  • Have you read Digital Catapult's Code of Conduct?
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.

PR Type

Please delete options that are irrelevant.

  • Feature
  • Documentation Update

Linked tickets

High level description

Updated ProofController to accept credential selection when presenting a proof rather than trusting the agent to pick the one from the top of the list

Updated the ProofController with an endpoint to retrieve the proof content

Detailed description

AI-assisted PR.

New API Capability: The POST /proofs/{proofRecordId}/accept-request endpoint now accepts a simplified proofFormats object in the body. This allows callers to specify exactly which credentialId should satisfy each attribute or predicate in a proof request

New proposalMessage endpoint: added GET /proofs/:proofRecordId/content to retrieve the formatted proof content for a specific proofRecord

Hydration Logic: Implemented logic in the ProofController to "hydrate" these simplified selection requests into the complex protocol-specific formats required by Credo-TS (e.g. anoncreds proof structures)

Validation: Added strict validation to ensure requested credentials exist and match the proof requirements, returning 400 Bad Request for malformed requests and 404 Not Found for missing credentials

Type Safety: Refactored the ProofController and associated tests to remove any casts, significantly improving type safety and maintainability

Tests: Unit test coverage for all new functionality

Documentation:
Added comprehensive documentation in explicit-credential-selection.md detailing the new workflow and payload structures

Describe alternatives you've considered

No changes, allowing the agent to just automatically choose which credentials to use for proofs from the 'top of the pile'

Operational impacte

Allowing the verifying agent to select which fields they want to be proven

Allowing the proving agent to select which credentials to use for proof, selecting from multiple credentials and composing multiple credentials to generate proofs

Additional context

- Refactor ProofController.acceptRequest to support simplified proof formats
- Add hydration logic to convert simplified formats to full Credo-TS formats
- Add validation for simplified formats (400 Bad Request)
- Add error handling for missing credentials (404 Not Found)
- Export ProofFormats type in types.ts
- Update unit tests to verify new logic and remove any casts
- Add documentation for explicit credential selection
- Update README with link to new docs
- Update maker script to support credential selection
Copilot AI review requested due to automatic review settings December 11, 2025 14:16
@rmlearney-digicatapult rmlearney-digicatapult requested a review from a team as a code owner December 11, 2025 14:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces explicit credential selection for proof requests, allowing API clients to specify which credentials should be used when responding to proof requests rather than relying on automatic selection. The implementation adds a simplified API format that gets hydrated into the complex Credo TS proof format, reducing client-side complexity.

Key Changes

  • New API capability: POST /v1/proofs/{proofRecordId}/accept-request now accepts optional simplified proofFormats with just credentialId and revealed fields
  • Hydration logic: Controller automatically enriches simplified format with full credential metadata from Credo TS wallet
  • Script enhancement: maker-accept-proof-from-oem.ts updated to support credential selection via CLI argument

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/controllers/v1/proofs/ProofController.ts Implements three-path logic (auto-select/hydrate/pass-through) with hydration loops for attributes and predicates, plus type guard for format detection
src/controllers/types.ts Adds SimpleProofFormats interface and exports ProofFormats type, extends AcceptProofRequestOptions with new proofFormats field
tests/unit/proof.test.ts Adds single happy-path test for simplified credential selection, validates hydration output structure
scripts/maker-accept-proof-from-oem.ts Adds --credential-id CLI parameter, constructs simplified proofFormats from proof request message
docs/explicit-credential-selection.md Comprehensive new documentation explaining the feature, API usage, three-path logic, and example scenario
README.md Minor formatting fixes (code blocks, links), adds reference to new documentation, fixes typo
docker-compose-integration-tests.yml Updates comments with NODE_EXTRA_CA_CERTS setup instructions, adds environment variable to test service
package.json, package-lock.json Version bump from 0.16.13 to 0.16.14

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link

Copilot AI commented Dec 11, 2025

@rmlearney-digicatapult I've opened a new pull request, #424, to work on those changes. Once the pull request is ready, I'll request review from you.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Fix TypeScript errors in ProofController hydration logic
- Downgrade sensitive credential logging to debug level
- Add extensive unit tests for ProofController edge cases and security checks
- Redact sensitive credential data from ProofController logs
- Remove temporary /credentials endpoint
- Improve type safety in redaction logic (remove any)
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 9 comments.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: David Blane <32327139+dblane-digicatapult@users.noreply.github.com>
@rmlearney-digicatapult
Copy link
Contributor Author

@copilot re-review. ignore maker-accept-proof-from-oem.ts and redactProofFormats method redacts credentialInfo and value fields for logging, but the credentialId itself is not redacted

Copy link

Copilot AI commented Dec 12, 2025

@rmlearney-digicatapult I've opened a new pull request, #428, to work on those changes. Once the pull request is ready, I'll request review from you.

- Add GET /:proofRecordId/content to return proof format data
- Remove legacy getProposalMessage endpoint
- Update unit tests
- Refactor ProofController to use strict types and helper methods
- Update ProofController tests to cover new logic and remove 'any' types
- Add tests for proof content simplification and includeContent
- Filter out redundant proof state change events in ProofEvents
- Add tests for webhook noise reduction
- Fix 500 error in ProofController by adding null check for availableAnonCreds
- Update e2e test to filter credentials by connectionId to avoid stale data
- Update e2e test to use correct credentialRecordId from nested structure
- Configure Bob agent to never auto-accept credentials to enable manual acceptance testing
…automation

- Update `register-schema.ts` to default to `makeAuthorisation.json`.
- Update `issue-credential.ts` to auto-lookup the latest credential definition.
- Update `maker-connect-to-oem.ts` to auto-lookup the latest holder credential.
- Update `oem-accept-connection.ts` to auto-accept pending connections.
- Update `maker-propose-proof-to-oem.ts` to disable auto-accept proof, enabling manual response flow.
- Add `maker-accept-credential.ts` for credential acceptance.
- Replace `maker-accept-proof-from-oem.ts` with `maker-respond-proof-request.ts` for robust proof handling.
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