I’ve got a hackish Damus POC for Nostr HTTP Auth using NIP98. Basically for 401 Unauthorised and 402 Payment Required image requests with a WWW-Authenticate: NOSTR-NIP-98 header, we can optionally retry with a signed event base64 encoded in the Authorisation header.

This is exciting because we get to use the 401 header, have a nice way to retry requests with Nostr auth, and can optionally accept payment or perhaps offer a subscription to gain access.

For the UX, I’d like to have a UI to add a domain to a trusted Nostr HTTP Auth List, which allows ask, or always send auth (for domain).

If you’d like to help progress the swift code for Damus, let me know. I’d appreciate the help.. as it’s a little complex managing cache and retries using kingfisher with custom requests.

#[2]​ is this something you’re open to accepting into Damus? It should only matter for content that returns 401/2 and has the Nostr auth headers - otherwise it shouldn’t do anything. So it’s an extension in capability.

Reply to this note

Please Login to reply.

Discussion

Interesting. The code up somewhere?

Hopefully this week. My first approach was a bit destructive, haha. I’m refactoring it now.

Works for event view and overlay. Not for DMs as yet. Needs edge case handling improvements.

This code works as an example 402 payment required server. I’ve refactored it a lot locally too - but should work fine.

https://github.com/blakejakopovic/nostr_paywall_example

👀

Sent you a DM!

I have something early you can look at. Lots of todos, a small bugs/issues.

https://github.com/blakejakopovic/damus/commit/e27162b00fb10dcf2f02cc2fe533e1a09cb168aa

Basic testing endpoint (doesn't validate actual BLA content, just that something exists)

curl -I -H "Authorization: Nostr BLA"

Endpoint code: https://gist.github.com/blakejakopovic/2e8fa806e1b85c17411b66b55f3df4e8

nostr:note172de9jv7nthqj06eznqke0u7v3zngluz9j06rskrauf5kry4428s8d7haw