Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

book: rework sections #637

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bindings/nostr-sdk-ffi/python/examples/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async def main():
.set_picture("https://example.com/avatar.png") \
.set_banner("https://example.com/banner.png") \
.set_nip05("[email protected]") \
.set_lud16("yuki@getalby.com")
.set_lud16("pay@yukikishimoto.com")

print(f"Setting profile metadata for {keys.public_key().to_bech32()}...")
print(metadata.as_json())
Expand Down
2 changes: 1 addition & 1 deletion bindings/nostr-sdk-js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ async function main() {
.picture("https://example.com/avatar.png")
.banner("https://example.com/banner.png")
.nip05("[email protected]")
.lud16("yuki@getalby.com");
.lud16("pay@yukikishimoto.com");

await client.setMetadata(metadata);

Expand Down
4 changes: 2 additions & 2 deletions bindings/nostr-sdk-js/examples/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async function main() {
.picture("https://example.com/avatar.png")
.banner("https://example.com/banner.png")
.nip05("[email protected]")
.lud16("yuki@getalby.com");
.lud16("pay@yukikishimoto.com");

await client.setMetadata(metadata);

Expand All @@ -57,4 +57,4 @@ async function main() {
await client.sendEventBuilder(builder);
}

main();
main();
4 changes: 2 additions & 2 deletions bindings/nostr-sdk-js/examples/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ const { Metadata, loadWasmSync } = require("../");
function main() {
loadWasmSync();

let metadata = new Metadata().name("test").displayName("Testing Rust Nostr").lud16("yuki@getalby.com");
let metadata = new Metadata().name("test").displayName("Testing Rust Nostr").lud16("pay@yukikishimoto.com");

console.log("JSON:", metadata.asJson());
console.log("Display name:", metadata.getDisplayName());
}

main();
main();
4 changes: 2 additions & 2 deletions bindings/nostr-sdk-js/examples/nip05.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ async function main() {
await loadWasmAsync();

let public_key = PublicKey.fromBech32("npub1drvpzev3syqt0kjrls50050uzf25gehpz9vgdw08hvex7e0vgfeq0eseet");
if (await verifyNip05(public_key, "yuki@getalby.com")) {
if (await verifyNip05(public_key, "pay@yukikishimoto.com")) {
console.log("Valid NIP05")
} else {
console.log("Invalid NIP05: " + error)
}
}

main();
main();
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 15 additions & 3 deletions book/snippets/justfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
test:
cd nostr && just test
cd nostr-sdk && just test
test: rust python js kotlin

rust:
cd rust && cargo build

python:
cd python && just test

js:
cd js && npm i
node js/index.js

kotlin:
cd kotlin && just test

File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 0 additions & 17 deletions book/snippets/nostr-sdk/justfile

This file was deleted.

8 changes: 0 additions & 8 deletions book/snippets/nostr-sdk/rust/src/main.rs

This file was deleted.

52 changes: 0 additions & 52 deletions book/snippets/nostr-sdk/rust/src/quickstart.rs

This file was deleted.

15 changes: 0 additions & 15 deletions book/snippets/nostr/justfile

This file was deleted.

2 changes: 0 additions & 2 deletions book/snippets/nostr/rust/.gitignore

This file was deleted.

11 changes: 0 additions & 11 deletions book/snippets/nostr/rust/Cargo.toml

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ requirements: venv
. ENV/bin/activate && pip install -r requirements.txt

test: requirements
. ENV/bin/activate && python main.py
. ENV/bin/activate && python main.py
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "snippets-nostr-sdk-rust"
name = "snippets-rust"
version = "0.1.0"
edition = "2021"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use nostr::prelude::*;
use nostr_sdk::prelude::*;

pub fn event() -> Result<()> {
let keys = Keys::generate();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use nostr::prelude::*;
use nostr_sdk::prelude::*;

pub fn event() -> Result<()> {
// Deserialize from json
Expand Down
28 changes: 28 additions & 0 deletions book/snippets/rust/src/hello.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// ANCHOR: all
use nostr_sdk::prelude::*;

pub async fn hello() -> Result<()> {
// ANCHOR: keys
let keys: Keys = Keys::generate();
// ANCHOR_END: keys

// ANCHOR: client
let client = Client::new(keys);
// ANCHOR_END: client

// ANCHOR: connect
client.add_relay("wss://relay.damus.io").await?;
client.add_read_relay("wss://relay.nostr.info").await?;

client.connect().await;
// ANCHOR_END: connect

// ANCHOR: publish
let builder = EventBuilder::text_note("Hello, rust-nostr!", []);
client.send_event_builder(builder).await?;
// ANCHOR_END: publish

Ok(())
}

// ANCHOR_END: all
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use nostr::prelude::*;
use nostr_sdk::prelude::*;

// ANCHOR: generate
pub fn generate() -> Result<()> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@ mod messages;
mod nip01;
mod nip44;
mod nip59;
mod hello;
mod nip17;

fn main() {}
#[tokio::main]
async fn main() {}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use nostr::prelude::*;
use nostr_sdk::prelude::*;

pub fn relay_message() -> Result<()> {
// Deserialize from json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use nostr::prelude::*;
use nostr_sdk::prelude::*;

pub fn nip01() -> Result<()> {
let keys = Keys::generate();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use nostr::prelude::*;
use nostr_sdk::prelude::*;

pub fn run() -> Result<()> {
let keys = Keys::generate();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use nostr::prelude::*;
use nostr_sdk::prelude::*;

pub async fn run() -> Result<()> {
// Sender keys
Expand Down
6 changes: 0 additions & 6 deletions book/src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@

* **Customizable**: The libraries are built in modular way, allowing to build customized nostr apps.

## Libraries

* [Nostr](./nostr/index.md): Implementation of the `nostr` protocol
* [Nostr Database](): Databases abstraction, indexes and in-memory database implementation
* [Nostr SDK](./nostr-sdk/index.md): High level nostr client library

## Communication

* Nostr community: <nostr:naddr1qvzqqqyx7cpzq6xcz9jerqgqkldy8lpg7lglcyj4g3nwzy2cs6u70wejdaj7csnjqyg8wumn8ghj7mn0wd68ytnddakj7qgawaehxw309ahx7um5wghx6at5d9h8jampd3kx2apwvdhk6tcqpfe82um594hx7um5wguyvg2q>
Expand Down
84 changes: 52 additions & 32 deletions book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,58 @@

[Introduction](README.md)

# Libraries

* [Nostr](nostr/index.md)
* [Installation](nostr/installation.md)
* [Signers](nostr/signers/index.md)
* [Keys](nostr/signers/keys.md)
* [Event](nostr/event/index.md)
* [Event ID](nostr/event/id.md)
* [Kind](nostr/event/kind.md)
* [Timestamp](nostr/event/timestamp.md)
* [Tag](nostr/event/tag.md)
* [Messages](nostr/messages/index.md)
* [Client Message](nostr/messages/client.md)
* [Filters](nostr/messages/filters.md)
* [Relay Message](nostr/messages/relay.md)
* [NIPs](nostr/nips/index.md)
* [NIP-01](nostr/nips/01.md)
* [NIP-05](nostr/nips/05.md)
* [NIP-06](nostr/nips/06.md)
* [NIP-07](nostr/nips/07.md)
* [NIP-19](nostr/nips/19.md)
* [NIP-21](nostr/nips/21.md)
* [NIP-44](nostr/nips/44.md)
* [NIP-59](nostr/nips/59.md)
* [NIP-65](nostr/nips/65.md)

* [Nostr SDK](nostr-sdk/index.md)
* [Installation](nostr-sdk/installation.md)
* [Quickstart](nostr-sdk/quickstart.md)
* [Private Messages (NIP-17)](nostr-sdk/nip17.md)
* [Options](nostr-sdk/options/index.md)
* [Proxy](nostr-sdk/options/proxy.md)
# SDK

* [Getting Started](sdk/getting-started.md)
* [Installation](sdk/install.md)
* [Enabling logging](sdk/logging.md)
* [Hello, rust-nostr!](sdk/hello.md)

* [Signers](sdk/signers/index.md)
* [Keys](sdk/signers/keys.md)
* [Browser Extension (NIP07)](sdk/nips/07.md)
* [Nostr Connect (NIP46)](sdk/signers/nostr-connect.md)

* [Event](sdk/event/index.md)
* [ID](sdk/event/id.md)
* [Kind](sdk/event/kind.md)
* [Tag](sdk/event/tag.md)
* [Builder](sdk/event/builder.md)

* [Filters](sdk/messages/filters.md)

* [Client](sdk/client/index.md)
* [Options](sdk/client/options/index.md)
* [Proxy](sdk/client/options/proxy.md)
* [Embedded Tor](sdk/client/options/tor.md)

* [NIPs](sdk/nips/index.md)
* [NIP-01: Basic protocol flow description](sdk/nips/01.md)
* [NIP-05: Mapping nostr keys to DNS-based internet identifiers](sdk/nips/05.md)
* [NIP-06: Key derivation from seed phrase](sdk/nips/06.md)
* [NIP-07: Browser Extension Signer](sdk/nips/07.md)
* [NIP-17: Private Direct Messages](sdk/nips/17.md)
* [NIP-19: bech32-encoded entities](sdk/nips/19.md)
* [NIP-21: nostr URI scheme](sdk/nips/21.md)
* [NIP-44: Encrypted Payloads](sdk/nips/44.md)
* [NIP-59: Gift Wrap](sdk/nips/59.md)
* [NIP-65: Relay List Metadata](sdk/nips/65.md)

# Advanced

* [Messages](sdk/messages/index.md)
* [Client Message](sdk/messages/client.md)
* [Relay Message](sdk/messages/relay.md)

---

# CLI

* [Getting Started]()
* [Installation]()

* [Shell]()
---

[Changelog](changelog.md)
[Donate](donate.md)
Loading
Loading