interledger / rafiki

An open-source, comprehensive Interledger service for wallet providers, enabling them to provide Interledger functionality to their users.
https://rafiki.dev/
Apache License 2.0
234 stars 83 forks source link

chore(backend): update wallet address middleware & error handling #2722

Closed mkurapov closed 4 months ago

mkurapov commented 4 months ago

Changes proposed in this pull request

To finalize the standardization of Open Payments route errors in backend, this PR splits up walletAddressMiddleware into several separate middlewares. One group of them deals with adding the walletAddressUrl onto the ctx (from several resources), while getWalletAddressForSubresource simply polls for the active wallet address by using the ctx.walletAddressUrl itself. Each of the middlewares is then added explicity to the route.

The benefits:

Other changes:

Context

Fixes #1905 for backend

Checklist

netlify[bot] commented 4 months ago

Deploy Preview for brilliant-pasca-3e80ec ready!

Name Link
Latest commit bffcaa5e6d723a2327f007a1125c821f4bc06958
Latest deploy log https://app.netlify.com/sites/brilliant-pasca-3e80ec/deploys/664c9ffc9d1af20008f24f03
Deploy Preview https://deploy-preview-2722--brilliant-pasca-3e80ec.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

BlairCurrey commented 4 months ago
  • walletAddressUrl is added to the ctx as a middleware specific to the route route, meaning we can remove all-encompassing logic in walletAddressMiddleware. Likewise, we don't need to actually fetch the wallet address before doing token introspection and http sig verification

This is much better. Low coupling/high cohesion. 👍

mkurapov commented 4 months ago

Going to close and re-open to see if I can get past the stuck actions (I think affected by their degradation here)