Skip to content

Commit 3815d85

Browse files
committed
nostr: add NIP98 example
Signed-off-by: Yuki Kishimoto <[email protected]>
1 parent 4431e84 commit 3815d85

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

crates/nostr/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@ required-features = ["std"]
134134
name = "nip96"
135135
required-features = ["std", "nip96"]
136136

137+
[[example]]
138+
name = "nip98"
139+
required-features = ["std", "nip98"]
140+
137141
[[example]]
138142
name = "parser"
139143
required-features = ["std", "parser"]

crates/nostr/examples/nip98.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright (c) 2022-2023 Yuki Kishimoto
2+
// Copyright (c) 2023-2025 Rust Nostr Developers
3+
// Distributed under the MIT software license
4+
5+
use nostr::prelude::*;
6+
7+
#[tokio::main]
8+
async fn main() -> Result<()> {
9+
let keys = Keys::parse("nsec1j4c6269y9w0q2er2xjw8sv2ehyrtfxq3jwgdlxj6qfn8z4gjsq5qfvfk99")?;
10+
11+
let server_url: Url = Url::parse("https://example.com")?;
12+
let method = HttpMethod::GET;
13+
14+
let auth = HttpData::new(server_url, method)
15+
.to_authorization(&keys)
16+
.await?;
17+
18+
println!("{auth}");
19+
20+
Ok(())
21+
}

0 commit comments

Comments
 (0)