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. --- internal/nostr/example_test.go | 85 ------------------------------------------ 1 file changed, 85 deletions(-) delete mode 100644 internal/nostr/example_test.go (limited to 'internal/nostr/example_test.go') diff --git a/internal/nostr/example_test.go b/internal/nostr/example_test.go deleted file mode 100644 index 7031c65..0000000 --- a/internal/nostr/example_test.go +++ /dev/null @@ -1,85 +0,0 @@ -package nostr_test - -import ( - "context" - "fmt" - "time" - - "northwest.io/muxstr/internal/nostr" -) - -// Example_basic demonstrates basic usage of the nostr library. -func Example_basic() { - // Generate a new key pair - key, err := nostr.GenerateKey() - if err != nil { - fmt.Printf("Failed to generate key: %v\n", err) - return - } - - 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{ - CreatedAt: time.Now().Unix(), - 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) - return - } - - // 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!") - } -} - -// ExampleRelay demonstrates connecting to a relay (requires network). -// This is a documentation example - run with: go test -v -run 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, 10*time.Second) - defer cancel() - - // Fetch recent text notes (closes on EOSE) - since := time.Now().Add(-1 * time.Hour).Unix() - sub := relay.Fetch(ctx, nostr.Filter{ - Kinds: []int{nostr.KindTextNote}, - Since: &since, - Limit: 5, - }) - - eventCount := 0 - for event := range sub.Events { - eventCount++ - fmt.Printf("Received event from %s...\n", event.PubKey[:8]) - } - fmt.Printf("Received %d events\n", eventCount) -} -- cgit v1.2.3