Skip to content

feat(api): add batch issuance API endpoint with partial-failure semantics (#389) - #447

Open
bamiebot-maker wants to merge 1 commit into
ToluLabs:mainfrom
bamiebot-maker:feat/389-batch-issuance-api
Open

feat(api): add batch issuance API endpoint with partial-failure semantics (#389)#447
bamiebot-maker wants to merge 1 commit into
ToluLabs:mainfrom
bamiebot-maker:feat/389-batch-issuance-api

Conversation

@bamiebot-maker

Copy link
Copy Markdown
Contributor

Closes #389

Summary of Changes

  • Batch Issuance Route (\POST /api/issue/batch):

    • Accepts multiple issuance requests in one call (supporting both { items: [...] }\ with top-level defaults and raw array payloads).
    • Enforces a maximum batch size limit (\MAX_BATCH_SIZE = 50) and rejects empty batches with 400.
    • Implements partial-failure semantics: each item is validated and signed independently, returning { total, successful, failed, results: [{ index, success, credentials?, error? }] }.
    • Maintains strict security model per item: \prehash: false\ secp256k1 signing directly over the Poseidon2 commitment, server-side private keys only, and zero identity PII stored/logged.
    • Enforces rate limiting per IP and per unique wallet in the batch.
    • Supports \Idempotency-Key\ header with in-memory caching and in-flight de-duplication.
  • Issuer Package Update (@stellarcred/issuer):

    • Added \issueBatch(items: IssueParams[]): Promise\ to \IssuerClient.
    • Added TypeScript interfaces \BatchIssueItemResult\ and \BatchIssueResult.
    • Documented \issueBatch()\ in \packages/issuer/README.md.
  • Documentation & Security:

    • Updated \README.md, \docs/ARCHITECTURE.md, and \SECURITY.md\ documenting batch issuance capabilities and security model.
  • Test Coverage:

    • Added unit test suite in \packages/issuer/src/index.test.ts\ for \issueBatch.
    • Added API route test suite in \ rontend/app/api/issue/batch/tests/route.test.ts\ (empty/oversized batches, partial failure, array payloads, idempotency replay, signature verification).
    • All test suites passing (19 test files / 269 tests).

@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@bamiebot-maker Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Psalmuel01

Copy link
Copy Markdown
Collaborator

Batch issuance with partial-failure semantics (#389) is the right shape. Two checks are failing: Frontend typecheck and build, and Accessibility (axe-core). Please get both green. On the endpoint, confirm each item keeps the full per-item security model (prehash:false signing, no identity fields stored, issuer key server-side only), respects the per-item rate limit and body-size cap, and returns per-item success/error rather than all-or-nothing.

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.

Feature: batch issuance API for issuers (issue many credentials in one request)

2 participants