{"id":13832732,"url":"https://github.com/wilsonsilva/nostr","last_synced_at":"2025-04-09T16:19:23.019Z","repository":{"id":65178264,"uuid":"585788424","full_name":"wilsonsilva/nostr","owner":"wilsonsilva","description":"Asynchronous Nostr client in Ruby","archived":false,"fork":false,"pushed_at":"2025-02-27T07:55:28.000Z","size":333,"stargazers_count":27,"open_issues_count":5,"forks_count":5,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-09T16:19:16.017Z","etag":null,"topics":["async","gem","nostr","nostr-client","nostr-protocol","nostr-ruby","nostr-sdk","ruby","rubygem"],"latest_commit_sha":null,"homepage":"https://nostr-ruby.com","language":"Ruby","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/wilsonsilva.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","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}},"created_at":"2023-01-06T04:26:48.000Z","updated_at":"2025-02-28T23:52:28.000Z","dependencies_parsed_at":"2023-12-22T12:53:14.038Z","dependency_job_id":"6ffc3d83-9c1f-4e4d-a911-1b7da981e1d6","html_url":"https://github.com/wilsonsilva/nostr","commit_stats":{"total_commits":56,"total_committers":2,"mean_commits":28.0,"dds":"0.017857142857142905","last_synced_commit":"e2b650fb849f1f55c672b939fc7b4bb01d642738"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonsilva%2Fnostr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonsilva%2Fnostr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonsilva%2Fnostr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonsilva%2Fnostr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wilsonsilva","download_url":"https://codeload.github.com/wilsonsilva/nostr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248065281,"owners_count":21041872,"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","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":["async","gem","nostr","nostr-client","nostr-protocol","nostr-ruby","nostr-sdk","ruby","rubygem"],"created_at":"2024-08-04T11:00:29.039Z","updated_at":"2025-04-09T16:19:23.002Z","avatar_url":"https://github.com/wilsonsilva.png","language":"Ruby","funding_links":[],"categories":["Install from Source","Libraries"],"sub_categories":["Nostr","Client reviews and/or comparisons"],"readme":"# Nostr\n\n[![Gem Version](https://badge.fury.io/rb/nostr.svg)](https://badge.fury.io/rb/nostr)\n![Build](https://github.com/wilsonsilva/nostr/actions/workflows/main.yml/badge.svg)\n[![Maintainability](https://api.codeclimate.com/v1/badges/c7633eb2c89eb95ee7f2/maintainability)](https://codeclimate.com/github/wilsonsilva/nostr/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/c7633eb2c89eb95ee7f2/test_coverage)](https://codeclimate.com/github/wilsonsilva/nostr/test_coverage)\n\nAsynchronous Nostr client for Rubyists.\n\n## Table of contents\n\n- [Key features](#-key-features)\n- [Installation](#-installation)\n- [Quickstart](#-quickstart)\n- [Documentation](#-documentation)\n- [Implemented NIPs](#-implemented-nips)\n- [Development](#-development)\n  * [Type checking](#type-checking)\n- [Contributing](#-contributing)\n- [License](#-license)\n- [Code of Conduct](#-code-of-conduct)\n\n## 🔑 Key features\n\n- Asynchronous\n- Easy to use\n- Fully documented\n- Fully tested\n- Fully typed\n\n## 📦 Installation\n\nInstall the gem and add to the application's Gemfile by executing:\n\n    $ bundle add nostr\n\nIf bundler is not being used to manage dependencies, install the gem by executing:\n\n    $ gem install nostr\n\n## ⚡️ Quickstart\n\nHere is a quick example of how to use the gem. For more detailed documentation, please check the\n[documentation website](https://nostr-ruby.com).\n\n```ruby\n# Require the gem\nrequire 'nostr'\n\n# Instantiate a client\nclient = Nostr::Client.new\n\n# a) Use an existing keypair\nkeypair = Nostr::KeyPair.new(\n  private_key: Nostr::PrivateKey.new('add-your-hex-private-key-here'),\n  public_key: Nostr::PublicKey.new('add-your-hex-public-key-here'),\n)\n\n# b) Or build a keypair from a private key\nkeygen = Nostr::Keygen.new\nkeypair = keygen.get_key_pair_from_private_key(\n  Nostr::PrivateKey.new('add-your-hex-private-key-here')\n)\n\n# c) Or create a new keypair\nkeygen = Nostr::Keygen.new\nkeypair = keygen.generate_key_pair\n\n# Create a user with the keypair\nuser = Nostr::User.new(keypair: keypair)\n\n# Create a signed event\ntext_note_event = user.create_event(\n  kind: Nostr::EventKind::TEXT_NOTE,\n  content: 'Your feedback is appreciated, now pay $8'\n)\n\n# Connect asynchronously to a relay\nrelay = Nostr::Relay.new(url: 'wss://nostr.wine', name: 'Wine')\nclient.connect(relay)\n\n# Listen asynchronously for the connect event\nclient.on :connect do |relay|\n  # Send the event to the Relay\n  client.publish(text_note_event)\n\n  # Create a filter to receive the first 20 text notes\n  # and encrypted direct messages from the relay that\n  # were created in the previous hour\n  filter = Nostr::Filter.new(\n    kinds: [\n      Nostr::EventKind::TEXT_NOTE,\n      Nostr::EventKind::ENCRYPTED_DIRECT_MESSAGE\n    ],\n    since: Time.now.to_i - 3600, # 1 hour ago\n    until: Time.now.to_i,\n    limit: 20,\n  )\n\n  # Subscribe to events matching conditions of a filter\n  subscription = client.subscribe(filter: filter)\n\n  # Unsubscribe from events matching the filter above\n  client.unsubscribe(subscription.id)\nend\n\n# Listen for incoming messages and print them\nclient.on :message do |message|\n  puts message\nend\n\n# Listen for error messages\nclient.on :error do |error_message|\n  # Handle the error\nend\n\n# Listen for the close event\nclient.on :close do |code, reason|\n  # You may attempt to reconnect to the relay here\nend\n\n# This line keeps the background client from exiting immediately.\ngets\n```\n\n## 📚 Documentation\n\nI made a detailed documentation for this gem and it's usage. The code is also fully documented using YARD.\n\n- [Guide documentation](https://nostr-ruby.com)\n- [YARD documentation](https://rubydoc.info/gems/nostr)\n\n## ✅ Implemented NIPs\n\n- [x] [NIP-01 - Basic protocol flow description](https://github.com/nostr-protocol/nips/blob/master/01.md)\n- [x] [NIP-02 - Contact List and Petnames](https://github.com/nostr-protocol/nips/blob/master/02.md)\n- [x] [NIP-04 - Encrypted Direct Message](https://github.com/nostr-protocol/nips/blob/master/04.md)\n- [x] [NIP-19 - Bech32-encoded entities](https://github.com/nostr-protocol/nips/blob/master/19.md)\n\n## 🔨 Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies.\n\nTo install this gem onto your local machine, run `bundle exec rake install`.\n\nYou can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`,\nwhich will create a git tag for the version, push git commits and the created tag, and push the `.gem` file\nto [rubygems.org](https://rubygems.org).\n\nThe health and maintainability of the codebase is ensured through a set of\nRake tasks to test, lint and audit the gem for security vulnerabilities and documentation:\n\n```\nrake build                    # Build nostr.gem into the pkg directory\nrake build:checksum           # Generate SHA512 checksum if nostr.gem into the checksums directory\nrake bundle:audit:check       # Checks the Gemfile.lock for insecure dependencies\nrake bundle:audit:update      # Updates the bundler-audit vulnerability database\nrake clean                    # Remove any temporary products\nrake clobber                  # Remove any generated files\nrake coverage                 # Run spec with coverage\nrake install                  # Build and install nostr.gem into system gems\nrake install:local            # Build and install nostr.gem into system gems without network access\nrake qa                       # Test, lint and perform security and documentation audits\nrake release[remote]          # Create a tag, build and push nostr.gem to rubygems.org\nrake rubocop                  # Run RuboCop\nrake rubocop:autocorrect      # Autocorrect RuboCop offenses (only when it's safe)\nrake rubocop:autocorrect_all  # Autocorrect RuboCop offenses (safe and unsafe)\nrake spec                     # Run RSpec code examples\nrake verify_measurements      # Verify that yardstick coverage is at least 100%\nrake yard                     # Generate YARD Documentation\nrake yard:junk                # Check the junk in your YARD Documentation\nrake yardstick_measure        # Measure docs in lib/**/*.rb with yardstick\n```\n\n### Type checking\n\nThis gem leverages [RBS](https://github.com/ruby/rbs), a language to describe the structure of Ruby programs. It is\nused to provide type checking and autocompletion in your editor. Run `bundle exec typeprof FILENAME` to generate\nan RBS definition for the given Ruby file. And validate all definitions using [Steep](https://github.com/soutaro/steep)\nwith the command `bundle exec steep check`.\n\n## 🐞 Issues \u0026 Bugs\n\nIf you find any issues or bugs, please report them [here](https://github.com/wilsonsilva/nostr/issues), I will be happy\nto have a look at them and fix them as soon as possible.\n\n## 🤝 Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/wilsonsilva/nostr.\nThis project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere\nto the [code of conduct](https://github.com/wilsonsilva/nostr/blob/main/CODE_OF_CONDUCT.md).\n\n## 📜 License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## 👔 Code of Conduct\n\nEveryone interacting in the Nostr project's codebases, issue trackers, chat rooms and mailing lists is expected\nto follow the [code of conduct](https://github.com/wilsonsilva/nostr/blob/main/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilsonsilva%2Fnostr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwilsonsilva%2Fnostr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilsonsilva%2Fnostr/lists"}