Blake's avatar
Blake
_@wako.ws
npub1ktw5...mrvj
#Bitcoin #Nostr #Freedom wss://relay.nostrgraph.net
Blake's avatar
wakoinc 2 years ago
I’ve updated my rust Lightning webhook library example code for both BTCPay and LNbits - you literally can set some ENV vars, uncomment some code, and set your desired SQL payment code. Then you just create your invoices with metadata like a pubkey, enable web hooks, and you’re 😎.
Blake's avatar
wakoinc 2 years ago
I’ve written a proof of concept Nostr Event Parser in typescript that ideally can be used universally by others to parse event content into html, or just extract metadata that can be used to render html however you like. If anyone’s keen to use this, let me know. I think having a general purpose Nostr event parsing library is valuable. I’m not entirely sure how best to handle some of the performance critical parts, however I’m sure we can find a way. ## Features * Extract hashtags (and convert to html a tags) * Extract mentions (and convert to html a tags) * Extract urls (fetch content-type, preview metadata, and convert to html a tags) * Custom URL handlers ## Future * Refactor into a library * Query relays for mention pubkey kind0 metadata (possible caching) * Root event and reply event lookup (with optional pubkey lookup) * Handle different event kinds * Support for NIP-27 - Text Note References * Ideally more information on image urls like dimentions
Blake's avatar
wakoinc 2 years ago
So I’ve made a fair bit of progress with a white label Nostr CDN (use your own domain) that accepts Lightning payments and checks access either via a cookie session or Nostr HTTP AUTH spec. For paid images you don’t have access to, it shows a blurhash or thumbnail preview (but with a 402 response status), then you can hover and click to buy via lightning (money goes to seller directly, with a provider service fee added using a wrapped invoice). You can pay with Ably. And then if you refresh the image, and send either the session cookie or Nostr HTTP AUTH header, it will show the unmasked content. The best part is this actually seems to work fairly well in web browsers. Nostr apps would just need to detect a 402 image response, and either try auth or offer to pay the invoice. Early days, however it’s possible to use Alby as a Nostr auth extension and invoice payment method. And a simple JS library for loading 402 style images that leverages it could be pretty cool. PS. If this post kills @fiatjaf with boredom, forgive me.
Blake's avatar
wakoinc 2 years ago
Thinking out loud how we can easily support Nostr 402 (payment required) and 401 (unauthorised). Good news — I think we can just use a WWW-Authenticate header to indicate supported auth methods - which can double as a way to prove payment. Basically, for 402 Payment Required, we can return a mime/type suitable response. For an image we can return a blurred/masked image and maybe some kind of indicator it’s paywalled with two HTTP headers. An invoice header to optionally pay and a WWW-Authenticate with something like Nostr-NIP-98. Doesn’t solve the issue of knowing if you’ve already paid. If you get 402, do you automatically try auth to see? Privacy issues exist. Do you try auth once before invoice payment as a sense check? Also doesn’t solve normal web browser inter-op. Maybe closer to an approach.. but lots to solve still. One possible approach is to whitelist domains you are happy sending HTTP AUTH events for accessing the content - paid or private.