nostr-web

Crates.ionostr-web
lib.rsnostr-web
version0.1.0
sourcesrc
created_at2023-10-30 00:47:07.932619
updated_at2023-10-30 00:47:07.932619
descriptionutilities for building web servers for nostr
homepagehttps://github.com/w3irdrobot/nostr-web
repositoryhttps://github.com/w3irdrobot/nostr-web
max_upload_size
id1017895
size19,990
(w3irdrobot)

documentation

README

nostr-web

Utilities for building web servers for nostr

Available utils

NIP-98 - HTTP Auth

There are extractors for actix and axum to provide a handler with the XOnlyPublicKey of the event in the auth header. If the event doesn't pass the checks defined in NIP-98, then a 401 will be returned as a response instead. An example handler for axum might look like this:

use nostr_web::nip98::Nip98PubKey;

async fn handler(Nip98PubKey(pubkey): Nip98PubKey) -> impl IntoResponse {
    StatusCode::OK
}

Installation

cargo add nostr-web

By default this will enable the parts of the code specific for axum. However, if you'd like to use actix-web instead, use the actix feature instead.

cargo add nostr-web --no-default-features
Commit count: 3

cargo fmt