Repository navigation
feat: encrypt provider credentials, payout idempotency, webhook verification, multi-currency balances (#1005 #1006 #1009 #1010) - #1302
Merged
github-actions[bot] merged 1 commit intoOct 18, 2026
Conversation
…ication, multi-currency balances (Smartdevs17#1005 Smartdevs17#1006 Smartdevs17#1009 Smartdevs17#1010) - Smartdevs17#1010: add an encrypted-at-rest provider credential vault (services/provider-credentials.ts + /api/v1/provider-credentials routes) on top of the shared AES-256-GCM column encryptor, with audited reveal and key rotation; register Webhook.secret and PushSubscription.auth in the Prisma PII field registry. - Smartdevs17#1005: add a TTL-bounded service-level payout idempotency store and wire the Idempotency-Key header through POST /api/v1/payouts/scheduled, replaying the original payout and rejecting key reuse with a different body (409). - Smartdevs17#1006: verify bank-partner payout webhooks with HMAC-SHA256 by extracting createWebhookVerifier and mounting raw-body capture before the JSON parser. - Smartdevs17#1009: aggregate wallet balances per currency (byCurrency), add GET /api/v1/wallet/balances, and render a Balances by Currency table in the UI. Adds unit tests, provider webhook fixtures, and docs.
|
@therealjhay is attempting to deploy a commit to the smartdevs17's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@therealjhay 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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves four issues across credential storage, payout creation, inbound webhooks, and wallet balances.
Closes #1005 Closes #1006, Closes #1009 Closes #1010
#1010 — Encrypt provider credentials at rest
backend/src/services/provider-credentials.ts, built on the shared AES-256-GCM column encryptor (backend/src/encryption/column-encryptor.ts). Values are sealed before they are retained; only$enc1$…ciphertext is kept, with HKDF-derived per-tenant DEKs and master-key rotation (rotateMasterKey)./api/v1/provider-credentials(list / put / get / reveal / delete / rotate-key), with every create, update, reveal, rotate and delete written to the audit trail (never the plaintext or ciphertext).Webhook.secretandPushSubscription.authin the Prisma column-encryptionPII_FIELDSregistry so those persisted secrets are encrypted transparently.#1005 — Idempotency keys on payout creation
backend/src/services/payouts/payout-idempotency.ts(default 24h) that fingerprints the request body.POST /api/v1/payouts/schedulednow passes theIdempotency-Key(orX-Idempotency-Key) header intoPayoutBatcher.schedule(), which replays the original payout for a duplicate key and throwsIDEMPOTENCY_KEY_REUSE_MISMATCH(mapped to409) when a key is reused with a different body.PayoutBatcher.purgeExpiredIdempotencyKeys()for scheduled cleanup.#1006 — Webhook signature verification
verifyBankPartnerWebhook(backend/src/services/webhooks/providers.ts), verifyingX-Bank-Signature/X-Bank-Timestampwith the same HMAC-SHA256, tolerance-window and constant-time comparison as other providers.createWebhookVerifierand exportedbankPartnerWebhookVerifier; mounted raw-body capture for/api/v1/fiat-payments/webhooksbefore the global JSON parser and applied the verifier to the bank-partner payout webhook.#1009 — Multi-currency wallet balances
WalletAggregationServicenow returns abyCurrencybreakdown (CurrencyBalance) alongside the USD total; addedgetBalancesByCurrencyandgetCurrencyBalance(returnsundefined, never a coerced0, when a currency is absent).GET /api/v1/wallet/balances(optionally?currency=), and a Balances by Currency table infrontend/components/wallet/WalletManager.tsx; the previously-missing wallet slice was added tofrontend/store/web3Store.ts.Tests & docs
provider-credentials.test.ts,payout-idempotency.test.ts,wallet-multi-currency.test.ts,bank-partner-verification.test.ts, plus signed fixtures inbackend/src/tests/fixtures/webhooks.ts.docs/security/provider-credentials-encryption.md,docs/PAYOUT_IDEMPOTENCY.md,docs/MULTI_CURRENCY_BALANCES.md, an "Inbound provider webhooks" section indocs/security/webhook-signatures.md, and updateddocs/README.mdindex.