Crates.io | nostr-web |
lib.rs | nostr-web |
version | 0.1.0 |
source | src |
created_at | 2023-10-30 00:47:07.932619 |
updated_at | 2023-10-30 00:47:07.932619 |
description | utilities for building web servers for nostr |
homepage | https://github.com/w3irdrobot/nostr-web |
repository | https://github.com/w3irdrobot/nostr-web |
max_upload_size | |
id | 1017895 |
size | 19,990 |
Utilities for building web servers for nostr
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
}
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