From b3ed6fee35aba21fe282a691850f428277e1f8b7 Mon Sep 17 00:00:00 2001 From: Gustavo <11652547+gofeuer@users.noreply.github.com> Date: Thu, 8 Aug 2024 01:50:48 -0300 Subject: [PATCH] Tabs --- README.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3a975f8..4d96ac0 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ func (m YourMacaroonMinter) MintWithChallenge(r *http.Request) (string, l402.Cha macaroonsBase64, _ := l402.MarshalMacaroons(mac) // Accepts multiple macaroons - // Provide an invoice from your lighting node that reveals the secret matching paymentHash + // Provide an invoice from your lighting node that reveals the secret matching paymentHash challenge := l402.Invoice("lnbc20m1pvjluezpp5q...") return macaroonsBase64, challenge, nil @@ -62,7 +62,6 @@ type YourAccessAuthority struct { } func (m YourAccessAuthority) ApproveAccess(r *http.Request, macaroons map[l402.Identifier]*macaroon.Macaroon) l402.Rejection { - for identifier, macaroon := range macaroons { // Verify if macaroon is singed by the correct rootKey } @@ -80,13 +79,13 @@ func (m YourAccessAuthority) ApproveAccess(r *http.Request, macaroons map[l402.I import "github.com/gofeuer/l402" func main() { - minter := YourMacaroonMinter{} // Your l402.MacaroonMinter implementation + minter := YourMacaroonMinter{} // Your l402.MacaroonMinter implementation authorizer := YourAccessAuthority{} // Your l402.AccessAuthority implementation - // Create a L402 proxy by passing a l402.MacaroonMinter and a l402.AccessAuthority + // Create a L402 proxy by passing a l402.MacaroonMinter and a l402.AccessAuthority proxy := l402.Proxy(minter, authorizer) - // Use `proxy` as a middleware to endpoints that require payment + // Use `proxy` as a middleware to endpoints that require payment http.Handle("GET /", proxy(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { fmt.Fprintln(w, "premium content") }))) @@ -99,4 +98,4 @@ func main() { Pull requests are welcome! If you have ideas for enhancing L402 Core, feel free to fork the repo and submit your changes. -**L402:** Because paying for content should be as smooth as a Lightning bolt. ⚡️🌐 +**L402** | Because paying for content should be as smooth as a Lightning bolt. ⚡️🌐