From 4fc493e6d8cc20137f920f8647e39fc5051bb245 Mon Sep 17 00:00:00 2001 From: bndw Date: Sat, 14 Feb 2026 12:03:21 -0800 Subject: refactor: remove frivolous comments from auth validation/credentials Also removed internal/nostr package - now using northwest.io/nostr library. --- examples/basic/basic | Bin 8724655 -> 0 bytes examples/basic/main.go | 78 ------------------------------------------------- 2 files changed, 78 deletions(-) delete mode 100755 examples/basic/basic delete mode 100644 examples/basic/main.go (limited to 'examples/basic') diff --git a/examples/basic/basic b/examples/basic/basic deleted file mode 100755 index 4b25081..0000000 Binary files a/examples/basic/basic and /dev/null differ diff --git a/examples/basic/main.go b/examples/basic/main.go deleted file mode 100644 index 29d58a6..0000000 --- a/examples/basic/main.go +++ /dev/null @@ -1,78 +0,0 @@ -package main - -import ( - "context" - "fmt" - "os" - "time" - - "northwest.io/muxstr/internal/nostr" -) - -// Example_basic demonstrates basic usage of the nostr library. -func main() { - // Generate a new key pair - key, err := nostr.GenerateKey() - if err != nil { - fmt.Printf("Failed to generate key: %v\n", err) - os.Exit(1) - } - - fmt.Printf("Public key (hex): %s...\n", key.Public()[:16]) - fmt.Printf("Public key (npub): %s...\n", key.Npub()[:20]) - - // Create an event - event := &nostr.Event{ - Kind: nostr.KindTextNote, - Tags: nostr.Tags{{"t", "test"}}, - Content: "Hello from nostr-go!", - } - - // Sign the event - if err := key.Sign(event); err != nil { - fmt.Printf("Failed to sign event: %v\n", err) - os.Exit(1) - } - - // Verify the signature - if event.Verify() { - fmt.Println("Event signature verified!") - } - - // Create a filter to match our event - filter := nostr.Filter{ - Kinds: []int{nostr.KindTextNote}, - Authors: []string{key.Public()[:8]}, // Prefix matching - } - - if filter.Matches(event) { - fmt.Println("Filter matches the event!") - } - - fmt.Println("connecting to relay...") - ExampleRelay() -} - -func ExampleRelay() { - ctx := context.Background() - - // Connect to a public relay - relay, err := nostr.Connect(ctx, "wss://relay.damus.io") - if err != nil { - fmt.Printf("Failed to connect: %v\n", err) - return - } - defer relay.Close() - fmt.Println("Connected to relay!") - - ctx, cancel := context.WithTimeout(ctx, 25*time.Second) - defer cancel() - - filter := nostr.Filter{ - Kinds: []int{nostr.KindTextNote}, - Limit: 5, - } - for event := range relay.Fetch(ctx, filter).Events { - fmt.Printf("Received event from %s...\n", event) - } -} -- cgit v1.2.3