{"id":13832733,"url":"https://github.com/cnixbtc/NostrKit","last_synced_at":"2025-07-09T19:31:14.330Z","repository":{"id":172843309,"uuid":"528878244","full_name":"cnixbtc/NostrKit","owner":"cnixbtc","description":"A simple Swift library providing data types for interacting with Nostr relays.","archived":false,"fork":false,"pushed_at":"2024-01-25T13:49:45.000Z","size":25,"stargazers_count":17,"open_issues_count":2,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-02-17T05:33:30.849Z","etag":null,"topics":["ios","macos","nostr","swift"],"latest_commit_sha":null,"homepage":"https://github.com/cnixbtc/NostrKit","language":"Swift","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/cnixbtc.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2022-08-25T14:05:40.000Z","updated_at":"2024-05-29T23:55:26.137Z","dependencies_parsed_at":"2024-05-29T23:55:24.760Z","dependency_job_id":"57d1f911-02ee-4970-be0b-75b36b69bf0b","html_url":"https://github.com/cnixbtc/NostrKit","commit_stats":null,"previous_names":["cnixbtc/nostrkit"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnixbtc%2FNostrKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnixbtc%2FNostrKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnixbtc%2FNostrKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnixbtc%2FNostrKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cnixbtc","download_url":"https://codeload.github.com/cnixbtc/NostrKit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225581826,"owners_count":17491794,"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":["ios","macos","nostr","swift"],"created_at":"2024-08-04T11:00:29.059Z","updated_at":"2024-11-20T15:31:03.586Z","avatar_url":"https://github.com/cnixbtc.png","language":"Swift","funding_links":[],"categories":["Install from Source","Libraries"],"sub_categories":["Nostr","Client reviews and/or comparisons"],"readme":"# 🗒 NostrKit \n\nA Swift library providing data types for interacting with a [Nostr](https://github.com/nostr-protocol/nostr) relay.\n\n## Installation\n\nNostrKit is available as a [Swift Package Manager](https://swift.org/package-manager/) package.\nTo use it, add the following dependency to your `Package.swift` file:\n\n``` swift\n.package(url: \"https://github.com/cnixbtc/NostrKit.git\", from: \"1.0.0\"),\n```\n\n## Functionality\n\nNostrKit provides the necessary data types for interacting with a Nostr relay to create events and manage subscriptions.\n\n### Subscribing to Events\n\n``` swift\nlet keyPair = try KeyPair(privateKey: \"\u003chex\u003e\")\n\nlet subscription = Subscription(filters: [\n    .init(authors: [keyPair.publicKey])\n])\n\nlet subscribeMessage = try ClientMessage\n    .subscribe(subscription)\n    .string()\n\n// Subscribe to events created by this key pair by sending `subscribeMessage` \n// to a relay using a web socket connection of your choice. \n// Later on, create a message to unsubscribe like so:\n\nlet unsubscribeMessage = try ClientMessage\n    .unsubscribe(subscription.id)\n    .string()\n```\n\n### Publishing Events\n\n``` swift\nlet keyPair = try KeyPair(privateKey: \"\u003chex\u003e\")\n\nlet event = try Event(keyPair: keyPair, content: \"Hello NostrKit.\")\n\nlet message = ClientMessage\n    .event(event)\n    .string()\n\n// Publish the event by sending `subscribeMessage` \n// to a relay using a web socket connection of your choice. \n```\n\nFully functional code examples can be found in `Sources/ExampleReader` as well as `Sources/ExampleWriter`.\nRun `swift run example-reader` and `swift run example-writer` to see them in action.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcnixbtc%2FNostrKit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcnixbtc%2FNostrKit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcnixbtc%2FNostrKit/lists"}