Skip to content

feat: implement webhook notifications for certificate lifecycle events (#353)#440

Merged
AnnabelJoe merged 2 commits into
AnnabelJoe:mainfrom
Sammy-Samy:feat/issue-353-webhook-notifications
Jun 3, 2026
Merged

feat: implement webhook notifications for certificate lifecycle events (#353)#440
AnnabelJoe merged 2 commits into
AnnabelJoe:mainfrom
Sammy-Samy:feat/issue-353-webhook-notifications

Conversation

@Sammy-Samy
Copy link
Copy Markdown
Contributor

Summary

Implements full webhook notification support for certificate lifecycle events, including registration API, HMAC-SHA256 signing, exponential backoff retry, and a delivery log endpoint.

Changes

  • apps/web/src/app/api/webhooks/route.tsPOST registers webhooks with new events; GET lists endpoints for a cooperative
  • apps/web/src/app/api/webhooks/logs/route.tsGET /api/webhooks/logs?endpoint_id= returns delivery log
  • apps/web/src/app/api/v1/webhooks/route.ts — v1 re-export
  • apps/web/src/app/api/v1/webhooks/logs/route.ts — v1 re-export
  • apps/web/src/lib/webhooks.ts — adds certificate.minted, certificate.transferred, certificate.retired events; exponential backoff (1s→2s→4s→8s→16s, 5 max attempts)
  • apps/web/src/lib/queue.ts — fires certificate.minted after successful mint
  • apps/web/src/app/api/certificates/[id]/retire/route.ts — fires certificate.retired alongside legacy retire event

Acceptance Criteria

  • Webhook registration API (POST /api/webhooks)
  • Events: certificate.minted, certificate.transferred, certificate.retired
  • HMAC-SHA256 signature on webhook payload (X-SolarProof-Signature header)
  • Retry with exponential backoff on delivery failure (up to 5 attempts)
  • Webhook delivery log accessible to users (GET /api/webhooks/logs)

Type of change

  • New feature

Related issue

Closes #353

Checklist

  • Tests pass
  • No new lint warnings
  • PR targets develop

AnnabelJoe#353)

- POST /api/webhooks: supports certificate.minted, certificate.transferred,
  certificate.retired events (plus legacy anchor/mint/retire)
- GET /api/webhooks: list registered endpoints for a cooperative
- GET /api/webhooks/logs: delivery log accessible to users
- lib/webhooks.ts: exponential backoff (1s/2s/4s/8s/16s) up to 5 attempts,
  HMAC-SHA256 signature on X-SolarProof-Signature header
- queue.ts: fires certificate.minted webhook after successful mint
- retire route: fires certificate.retired webhook alongside legacy retire event
- v1 re-exports for all new routes

Closes AnnabelJoe#353
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@Sammy-Samy 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

@AnnabelJoe AnnabelJoe merged commit ceabb58 into AnnabelJoe:main Jun 3, 2026
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.

Implement webhook notifications for certificate lifecycle events

2 participants