Skip to content

Implement credential issuance REST API with W3C VC compliance#16

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/implement-credential-issuance-logic
Draft

Implement credential issuance REST API with W3C VC compliance#16
Copilot wants to merge 5 commits intomainfrom
copilot/implement-credential-issuance-logic

Conversation

Copy link
Contributor

Copilot AI commented Feb 11, 2026

Implements minimal backend for issuing and storing W3C Verifiable Credentials by extending the existing backend scaffold from PR #15. Mock signing and in-memory storage provide foundation for production-ready cryptographic operations and PostgreSQL migration.

API Endpoints

POST /api/v1/credentials - Issue credential

{
  "issuer": "did:example:org",
  "credentialSubject": { "id": "did:example:holder", "name": "Alice" },
  "type": ["VerifiableCredential", "CustomType"],
  "expirationDate": "2025-12-31T23:59:59Z"
}

GET /api/v1/credentials/:id - Retrieve by ID

GET /api/v1/credentials?holderId=X - Query by holder

Implementation

  • Built on PR Create REST API backend scaffold with /health endpoint #15: Extends existing backend scaffold with CommonJS configuration
  • Backend structure: Modular monolith with separated API/domain/infrastructure layers
  • Credential format: W3C VC Data Model 2.0 compliant with Data Integrity Proof
  • Signing: Mocked base64 proof (placeholder for Credo framework integration)
  • Storage: In-memory Map (designed for PostgreSQL migration with row-level security)
  • Type safety: TypeScript strict mode, explicit types throughout
  • Testing: 12 comprehensive tests covering credential issuance and retrieval

Example Response

{
  "@context": ["https://www.w3.org/2018/credentials/v1"],
  "id": "urn:uuid:...",
  "type": ["VerifiableCredential"],
  "issuer": "did:example:org",
  "issuanceDate": "2026-02-11T15:20:00.000Z",
  "credentialSubject": { "id": "did:example:holder", "name": "Alice" },
  "proof": {
    "type": "DataIntegrityProof",
    "created": "2026-02-11T15:20:00.000Z",
    "proofPurpose": "assertionMethod",
    "verificationMethod": "did:example:org#key-1",
    "proofValue": "..."
  }
}

Next Steps

Migration paths documented in backend/README.md:

  • Real cryptographic signing via Credo
  • PostgreSQL with multi-tenant isolation
  • OAuth2/OIDC authentication
  • OpenAPI specification
Original prompt

This section details on the original issue you should resolve

<issue_title>[FR-0006] Implement core credential issuance logic</issue_title>
<issue_description>Implement the minimal logic required for issuing digital credentials to subjects (users, organizations). Create backend handlers supporting creation, signing, and secure storage of a simple credential type, with stubs or mocks for cryptographic operations if full implementation is not ready.

Definition of Ready:

  • This issue is labeled with FR-0006 and 'status:Backlog'.
  • At least one basic credential schema specified (or stub).
  • Task is sized for a single backend developer.

Definition of Done:

  • Endpoint or function accepts credential data, signs (or mocks signing) and stores it securely.
  • Code supports retrieval for the 'holder' later.
  • Handler is covered by at least one test.
  • Readme updated with usage or test instructions.
  • Product Owner review/accepts behavior.
    </issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 11, 2026 15:22
- Create backend directory with Node.js/Express/TypeScript setup
- Implement CredentialService with mocked cryptographic signing
- Implement CredentialRepository with in-memory storage
- Add REST API endpoints for credential issuance and retrieval
- Add comprehensive test suite (12 tests passing)
- Add backend README with usage instructions and API documentation
- Update main README with backend setup instructions
- Add example script demonstrating API usage

Co-authored-by: samuelmr <2461240+samuelmr@users.noreply.github.com>
- Fix type handling for req.params.id
- Use underscore prefix for unused request parameters
- All tests still passing

Co-authored-by: samuelmr <2461240+samuelmr@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement core credential issuance logic for minimal functionality Implement credential issuance REST API with W3C VC compliance Feb 11, 2026
Copilot AI requested a review from samuelmr February 11, 2026 15:27
Copy link
Contributor

@samuelmr samuelmr left a comment

Choose a reason for hiding this comment

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

There are conflicts. Perhaps #15 wasn't merged when you started working.

In this PR, you used "type": "commonjs" in the package.json, whereas #15 created a backend using "type": "module".

Please reimplement the credential issuance REST API by appending to the code created in #15.

Copilot AI and others added 2 commits February 11, 2026 20:41
Co-authored-by: samuelmr <2461240+samuelmr@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 11, 2026

There are conflicts. Perhaps #15 wasn't merged when you started working.

In this PR, you used "type": "commonjs" in the package.json, whereas #15 created a backend using "type": "module"....

Reimplemented the credential issuance API by building on top of PR #15's backend scaffold. The new implementation extends the existing CommonJS setup with modular credential issuance logic. All functionality from the original implementation is preserved with 12 passing tests. (commit 268b1d3)

@samuelmr
Copy link
Contributor

Try to resolve the merge conflicts.

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.

[FR-0006] Implement core credential issuance logic

2 participants