Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement L402 functionality as HTTP middleware #10

Open
SamuelAl opened this issue Mar 20, 2024 · 0 comments
Open

Implement L402 functionality as HTTP middleware #10

SamuelAl opened this issue Mar 20, 2024 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@SamuelAl
Copy link
Contributor

SamuelAl commented Mar 20, 2024

Reserved for job candidates

Objective

We're looking to enhance our Golang L402 client's capabilities by introducing a middleware component that intercepts HTTP requests to handle L402 payment challenges. This task involves designing and implementing a middleware function that integrates with the existing L402 client logic and the standard http.Handler interface in Go.

The task is to create a middleware function that works seamlessly with an HTTP server in Go. This middleware should utilize our L402 client to manage payment challenges encountered during HTTP requests. The implementation should be modular, testable, and maintainable, aligning with best practices in Go middleware design.

Guidelines and Considerations

  • Integration with http.Handler: Your middleware should take an http.Handler as input and return another http.Handler, following the common pattern in Go middleware.
  • L402 Payment Challenge Handling: The core functionality should involve intercepting HTTP requests, using the L402 client to handle any payment challenges (e.g., 402 Payment Required responses), and then proceeding with the request if the challenge is resolved.
  • Modularity: Design your solution in a way that keeps the middleware logic distinct from the L402 client's internal workings. This separation of concerns will enhance modularity and code reusability.
  • Error Handling: Implement robust error handling within the middleware to manage scenarios where payment challenges cannot be resolved, or other issues arise during request processing.
  • Testing: At least include unit-testing

Getting Started

The existing Client and Wallet interface definitions provided in our repository should be useful as a starting point.

Bounty

Upon successful review and closing of this issue, a bounty of 44,000 sats (approx. 25 EUR) will be rewarded via lightning to the PR contributor.

@SamuelAl SamuelAl added enhancement New feature or request help wanted Extra attention is needed labels Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant