{"id":31689470,"url":"https://github.com/anasfik/nostr_relay_management","last_synced_at":"2026-05-18T19:03:43.976Z","repository":{"id":318363513,"uuid":"1066700004","full_name":"anasfik/nostr_relay_management","owner":"anasfik","description":"Dart/Flutter support for NIP-86 (Relay Management API) with better developer experience.","archived":false,"fork":false,"pushed_at":"2025-10-06T18:33:03.000Z","size":25,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-06T19:38:23.826Z","etag":null,"topics":["86","auth","client","dart","flutter","nip","nostr"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/nostr_relay_management_api","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anasfik.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-29T21:01:32.000Z","updated_at":"2025-10-06T19:18:59.000Z","dependencies_parsed_at":"2025-10-06T19:38:39.769Z","dependency_job_id":null,"html_url":"https://github.com/anasfik/nostr_relay_management","commit_stats":null,"previous_names":["anasfik/nostr_relay_management"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/anasfik/nostr_relay_management","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anasfik%2Fnostr_relay_management","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anasfik%2Fnostr_relay_management/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anasfik%2Fnostr_relay_management/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anasfik%2Fnostr_relay_management/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anasfik","download_url":"https://codeload.github.com/anasfik/nostr_relay_management/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anasfik%2Fnostr_relay_management/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278931701,"owners_count":26070800,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["86","auth","client","dart","flutter","nip","nostr"],"created_at":"2025-10-08T11:16:03.125Z","updated_at":"2026-05-18T19:03:43.961Z","avatar_url":"https://github.com/anasfik.png","language":"Dart","funding_links":[],"categories":["Libraries"],"sub_categories":["Client reviews and/or comparisons"],"readme":"# 🚀 Nostr Relay Management API for Dart/Flutter\n\n[![pub package](https://img.shields.io/pub/v/nostr_relay_management_api.svg)](https://pub.dev/packages/nostr_relay_management_api)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nA comprehensive Dart/Flutter package that makes **NIP-86 Relay Management** simple and easy! This package abstracts away the complexity of [NIP-98 HTTP Authentication](https://github.com/nostr-protocol/nips/blob/master/98.md) and provides a clean, type-safe API for managing Nostr relays.\n\n## ✨ What is NIP-86?\n\n[NIP-86](https://github.com/nostr-protocol/nips/blob/master/86.md) defines a standardized API for managing Nostr relays. It allows you to:\n\n- 🚫 **Ban/Allow** users and events\n- 📊 **Monitor** relay statistics and moderation queues\n- ⚙️ **Configure** relay settings (name, description, icon)\n- 🔒 **Manage** admin permissions\n- 🌐 **Block/Unblock** IP addresses\n- 📝 **Control** event kinds (allow/disallow specific types)\n\n## 🎯 Why Use This Package?\n\n- ✅ **Complete NIP-86 Coverage** - All 23+ management methods supported\n- 🔐 **Secure Authentication** - Handles NIP-98 auth automatically\n- 🎨 **Type-Safe** - Full Dart type safety with proper models\n- 🚀 **Easy to Use** - Simple, intuitive API design\n- 🧪 **Well Tested** - Comprehensive example with real relay testing\n- 📱 **Flutter Ready** - Works seamlessly in Flutter apps\n\n## 📦 Installation\n\nAdd this to your `pubspec.yaml`:\n\n```yaml\ndependencies:\n  nostr_relay_management_api: ^latest_version\n```\n\nThen run:\n\n```bash\nflutter pub get\n# or\ndart pub get\n```\n\n## 🚀 Quick Start\n\n```dart\nimport 'package:nostr_relay_management_api/nostr_relay_management_api.dart';\n\nvoid main() async {\n  // Initialize the relay management service\n  final relay = NostrRelayManagement(\n    hexPrivateKey: \"your_private_key_here\", // Your Nostr private key\n    url: \"https://your-relay.com\",          // Relay URL that supports NIP-86\n  );\n\n  // Get supported methods\n  final methods = await relay.methods.supportedmethods();\n  print('Available methods: $methods');\n\n  // List banned users\n  final bannedUsers = await relay.methods.listbannedpubkeys();\n  print('Banned users: $bannedUsers');\n}\n```\n\n## 📚 Complete API Reference\n\n### 🔍 **Discovery \u0026 Information**\n\n#### Get Supported Methods\n\n```dart\nfinal methods = await relay.methods.supportedmethods();\n// Returns: List of all available management methods\n```\n\n#### Get Relay Statistics\n\n```dart\nfinal stats = await relay.methods.stats();\n// Returns: Map with relay statistics and metrics\n```\n\n### 👥 **User Management**\n\n#### Ban a User\n\n```dart\nfinal success = await relay.methods.banpubkey(\n  pubkey: \"npub1...\",\n  reason: \"Spam behavior\"\n);\n```\n\n#### Allow a User\n\n```dart\nfinal success = await relay.methods.allowpubkey(\n  pubkey: \"npub1...\",\n  reason: \"Appealed successfully\"\n);\n```\n\n#### List Banned Users\n\n```dart\nfinal bannedUsers = await relay.methods.listbannedpubkeys();\nbannedUsers?.forEach((user) {\n  print('Banned: ${user.pubkey} - ${user.reason}');\n});\n```\n\n#### List Allowed Users\n\n```dart\nfinal allowedUsers = await relay.methods.listallowedpubkeys();\nallowedUsers?.forEach((user) {\n  print('Whitelisted: ${user.pubkey} - ${user.reason}');\n});\n```\n\n### 📝 **Event Management**\n\n#### Ban an Event\n\n```dart\nfinal success = await relay.methods.banevent(\n  eventId: \"event_id_here\",\n  reason: \"Inappropriate content\"\n);\n```\n\n#### Allow an Event\n\n```dart\nfinal success = await relay.methods.allowevent(\n  eventId: \"event_id_here\",\n  reason: \"Content reviewed and approved\"\n);\n```\n\n#### List Banned Events\n\n```dart\nfinal bannedEvents = await relay.methods.listbannedevents();\nbannedEvents?.forEach((event) {\n  print('Banned Event: ${event.id} - ${event.reason}');\n});\n```\n\n#### List Allowed Events\n\n```dart\nfinal allowedEvents = await relay.methods.listallowedevents();\nallowedEvents?.forEach((event) {\n  print('Whitelisted Event: ${event.id} - ${event.reason}');\n});\n```\n\n#### Events Needing Moderation\n\n```dart\nfinal pendingEvents = await relay.methods.listeventsneedingmoderation();\npendingEvents?.forEach((event) {\n  print('Needs Review: ${event.id} - ${event.reason}');\n});\n```\n\n### 🎛️ **Kind Management**\n\n#### Allow Event Kind\n\n```dart\nfinal success = await relay.methods.allowkind(kind: 1); // Text notes\n```\n\n#### Disallow Event Kind\n\n```dart\nfinal success = await relay.methods.disallowkind(kind: 4); // Encrypted DMs\n```\n\n#### List Allowed Kinds\n\n```dart\nfinal allowedKinds = await relay.methods.listallowedkinds();\nprint('Allowed kinds: $allowedKinds'); // [0, 1, 3, ...]\n```\n\n#### List Disallowed Kinds\n\n```dart\nfinal disallowedKinds = await relay.methods.listdisallowedkinds();\nprint('Disallowed kinds: $disallowedKinds'); // [4, 5, 6, ...]\n```\n\n### 🌐 **IP Management**\n\n#### Block IP Address\n\n```dart\nfinal success = await relay.methods.blockip(\n  ip: \"192.168.1.100\",\n  reason: \"DoS attack detected\"\n);\n```\n\n#### Unblock IP Address\n\n```dart\nfinal success = await relay.methods.unblockip(ip: \"192.168.1.100\");\n```\n\n#### List Blocked IPs\n\n```dart\nfinal blockedIPs = await relay.methods.listblockedips();\nblockedIPs?.forEach((ip) {\n  print('Blocked IP: ${ip.ip} - ${ip.reason}');\n});\n```\n\n### ⚙️ **Relay Configuration**\n\n#### Change Relay Name\n\n```dart\nfinal success = await relay.methods.changerelayname(\n  newName: \"My Awesome Relay\"\n);\n```\n\n#### Change Relay Description\n\n```dart\nfinal success = await relay.methods.changerelaydescription(\n  newDescription: \"A fast and reliable Nostr relay\"\n);\n```\n\n#### Change Relay Icon\n\n```dart\nfinal success = await relay.methods.changerelayicon(\n  newIconUrl: \"https://example.com/relay-icon.png\"\n);\n```\n\n### 👑 **Admin Management**\n\n#### Grant Admin Permissions\n\n```dart\nfinal success = await relay.methods.grantadmin(\n  pubkey: \"npub1...\",\n  methods: [\"banpubkey\", \"allowpubkey\", \"banevent\"]\n);\n```\n\n#### Revoke Admin Permissions\n\n```dart\nfinal success = await relay.methods.revokeadmin(\n  pubkey: \"npub1...\",\n  methods: [\"banpubkey\", \"allowpubkey\"]\n);\n```\n\n### 🔧 **Custom Methods**\n\nFor relays with custom methods not covered by NIP-86:\n\n```dart\n// Example: Custom backup method\nfinal backupResult = await relay.methods.customMethod\u003cBackupInfo\u003e(\n  methodName: \"backupdatabaseInternally\",\n  params: [\"full\", \"compress\"],\n  adapter: (result) {\n    final data = result as Map\u003cString, dynamic\u003e;\n    return BackupInfo(\n      backedUpEvents: data['events'] as int,\n      backupLocation: data['location'] as String,\n    );\n  },\n);\n```\n\n## 🧪 Testing \u0026 Examples\n\nCheck out the comprehensive example in `example/nostr_relay_management_api_example.dart` that demonstrates all 17 categories of NIP-86 functionality:\n\n```bash\n# Run the example (make sure you have a NIP-86 compatible relay running)\ncd example\ndart run nostr_relay_management_api_example.dart\n```\n\n## 🔐 Authentication\n\nThis package uses **NIP-98 HTTP Authentication** automatically. You just need to provide your Nostr private key, and the package handles:\n\n- ✅ Creating proper authentication headers\n- ✅ Signing requests with your private key\n- ✅ Managing authentication tokens\n- ✅ Error handling for auth failures\n\n## 🛠️ Error Handling\n\nAll methods return nullable types and handle errors gracefully:\n\n```dart\nfinal result = await relay.methods.banpubkey(\n  pubkey: \"invalid_pubkey\",\n  reason: \"test\"\n);\n\nif (result == null) {\n  print('Operation failed - check logs for details');\n} else {\n  print('Success: $result');\n}\n```\n\n## 🤝 Contributing\n\nWe welcome contributions! Here's how you can help:\n\n- 🐛 **Report bugs** - Open an issue with details\n- 💡 **Suggest features** - Propose new functionality\n- 🔧 **Add methods** - Implement new NIP-86 methods as they're added\n- 📖 **Improve docs** - Help make the documentation better\n- 🧪 **Add tests** - Increase test coverage\n\n## 📄 License\n\nThis project is licensed under the **MIT License** - see the [LICENSE](LICENSE) file for details.\n\n## 🔗 Links\n\n- 📖 [NIP-86 Specification](https://github.com/nostr-protocol/nips/blob/master/86.md)\n- 🔐 [NIP-98 HTTP Auth](https://github.com/nostr-protocol/nips/blob/master/98.md)\n- 📦 [Pub.dev Package](https://pub.dev/packages/nostr_relay_management_api)\n- 🐙 [GitHub Repository](https://github.com/anasfik/nostr_relay_management)\n\n---\n\n**Made with ❤️ for the Nostr community**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanasfik%2Fnostr_relay_management","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanasfik%2Fnostr_relay_management","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanasfik%2Fnostr_relay_management/lists"}