{"id":17966098,"url":"https://github.com/chebizarro/nostrsignermodule","last_synced_at":"2026-02-17T14:34:36.168Z","repository":{"id":259619564,"uuid":"878758503","full_name":"chebizarro/NostrSignerModule","owner":"chebizarro","description":"A React Native Nostr Signer Module for Android","archived":false,"fork":false,"pushed_at":"2025-01-18T21:22:42.000Z","size":262,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-09T08:42:15.507Z","etag":null,"topics":["android","nostr","react-native"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/chebizarro.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":"2024-10-26T03:20:35.000Z","updated_at":"2025-01-18T21:22:44.000Z","dependencies_parsed_at":"2024-11-20T03:28:30.034Z","dependency_job_id":null,"html_url":"https://github.com/chebizarro/NostrSignerModule","commit_stats":{"total_commits":6,"total_committers":1,"mean_commits":6.0,"dds":0.0,"last_synced_commit":"d6417028e7698601f9dda537b3c799a490d0b7ef"},"previous_names":["chebizarro/nostrsignermodule"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chebizarro%2FNostrSignerModule","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chebizarro%2FNostrSignerModule/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chebizarro%2FNostrSignerModule/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chebizarro%2FNostrSignerModule/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chebizarro","download_url":"https://codeload.github.com/chebizarro/NostrSignerModule/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247073132,"owners_count":20879005,"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":["android","nostr","react-native"],"created_at":"2024-10-29T13:07:37.684Z","updated_at":"2026-02-17T14:34:36.119Z","avatar_url":"https://github.com/chebizarro.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Native Nostr Signer Module\n\nA React Native module that provides signing capabilities for Nostr applications, implementing [NIP-55](https://github.com/nostr-protocol/nips/blob/master/55.md). This module allows developers to securely and efficiently sign Nostr events and perform encryption/decryption operations via Android Signer apps.\n\n## Table of Contents\n\n- [Introduction](#introduction)\n- [Features](#features)\n- [Installation](#installation)\n- [Setup](#setup)\n- [Usage](#usage)\n- [API Reference](#api-reference)\n- [Example](#example)\n- [NIP-55 Compliance](#nip-55-compliance)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Introduction\n\nThe React Native Nostr Signer Module enables React Native applications to interact with [Nostr](https://nostr.com/) Signer apps using Android Intents and Content Providers. By adhering to [NIP-55](https://github.com/nostr-protocol/nips/blob/master/55.md), this module ensures secure and standardized signing of Nostr events and related operations, facilitating seamless integration with the Nostr network.\n\n## Features\n\n- **Sign Nostr Events**: Securely sign events to interact with the Nostr protocol.\n- **Retrieve Public Keys**: Access the user's public key for identity verification.\n- **Encryption \u0026 Decryption**: Perform NIP-04 and NIP-44 encryption and decryption operations.\n- **Handle Zap Events**: Decrypt Zap events.\n- **Retrieve Relay Information**: Get information about relays from the Signer app.\n- **Retrieve Installed Signer Apps**: Get a list of installed signer applications with details.\n- **Set Package Name**: Configure the default signer app package name for subsequent operations.\n- **Check Signer Installation**: Verify if a specific external signer app is installed.\n- **NIP-55 Compliance**: Fully implements the NIP-55 specification for application-level signing.\n\n## Installation\n\nUsing npm:\n\n```bash\nnpm install react-native-nostr-signer-module\n```\n\nOr using Yarn:\n\n```bash\nyarn add react-native-nostr-signer-module\n```\n\n## Setup\n\n### Android\n\n1. **Auto-linking (React Native 0.60+):**  \n   The module should be linked automatically for React Native 0.60 or higher. If not, follow manual linking instructions for older versions.\n\n2. **Update `MainApplication.java`:**  \n   Ensure that the package is added to your React Native app. If auto-linking doesn't work, manually add the module package to your list of packages:\n\n   ```java\n   import biz.nostr.signer_module.NostrSignerModulePackage; \n\n   @Override\n   protected List\u003cReactPackage\u003e getPackages() {\n       @SuppressWarnings(\"UnnecessaryLocalVariable\")\n       List\u003cReactPackage\u003e packages = new PackageList(this).getPackages();\n       packages.add(new NostrSignerModulePackage()); // Add the signer module package\n       return packages;\n   }\n   ```\n\n3. **AndroidManifest.xml:**  \n   Ensure that any necessary permissions or intent filters required by the module are declared in your `AndroidManifest.xml`.\n\n### iOS\n\nNIP-55 is not currently supported on iOS.\n\n## Usage\n\nImport the module in your JavaScript/TypeScript code:\n\n```typescript\nimport NostrSignerModule from 'react-native-nostr-signer-module';\n```\n\n### Setting Up the Signer\n\n**Set the Default Package Name:**\n\n```typescript\nawait NostrSignerModule.setPackageName('com.example.signerapp');\n```\n\n**Check if Signer is Installed:**\n\n```typescript\nconst isInstalled = await NostrSignerModule.isExternalSignerInstalled('com.example.signerapp');\nconsole.log('Signer Installed:', isInstalled.installed);\n```\n\n**Get Public Key:**\n\n```typescript\ntry {\n  const result = await NostrSignerModule.getPublicKey('com.example.signerapp');\n  console.log('Public Key:', result.npub);\n} catch (error) {\n  console.error('Failed to get public key:', error);\n}\n```\n\n**Sign Event:**\n\n```typescript\ntry {\n  const eventJson = '{\"content\": \"Hello, Nostr!\"}';\n  const eventId = 'event123';\n  const npub = 'npub1example...';\n\n  const result = await NostrSignerModule.signEvent('com.example.signerapp', eventJson, eventId, npub);\n  console.log('Signature:', result.signature);\n} catch (error) {\n  console.error('Failed to sign event:', error);\n}\n```\n\n**Encryption \u0026 Decryption:**\n\n```typescript\ntry {\n  const plainText = \"Hello, World!\";\n  const id = \"unique_id\";\n  const pubKey = \"recipientPublicKey\";\n\n  // NIP-04 Encrypt\n  const encryptResult = await NostrSignerModule.nip04Encrypt('com.example.signerapp', plainText, id, pubKey, npub);\n  console.log('Encrypted:', encryptResult.result);\n\n  // NIP-04 Decrypt\n  const decryptResult = await NostrSignerModule.nip04Decrypt('com.example.signerapp', encryptResult.result, id, pubKey, npub);\n  console.log('Decrypted:', decryptResult.result);\n} catch (error) {\n  console.error('Encryption/Decryption failed:', error);\n}\n```\n\n**Retrieve Installed Signer Apps:**\n\n```typescript\ntry {\n  const apps = await NostrSignerModule.getInstalledSignerApps();\n  apps.forEach(app =\u003e {\n    console.log(`Name: ${app.name}, Package: ${app.packageName}`);\n  });\n} catch (error) {\n  console.error('Error fetching signer apps:', error);\n}\n```\n\n**Decrypt Zap Event:**\n\n```typescript\ntry {\n  const eventJson = '{\"content\": \"Zap event\"}';\n  const id = \"zap123\";\n  const result = await NostrSignerModule.decryptZapEvent('com.example.signerapp', eventJson, id, npub);\n  console.log('Decrypted Zap Event:', result.result);\n} catch (error) {\n  console.error('Failed to decrypt Zap event:', error);\n}\n```\n\n**Get Relays:**\n\n```typescript\ntry {\n  const id = \"relayRequest123\";\n  const result = await NostrSignerModule.getRelays('com.example.signerapp', id, npub);\n  console.log('Relays:', result.result);\n} catch (error) {\n  console.error('Failed to get relays:', error);\n}\n```\n\n## API Reference\n\n### Methods\n\n#### `setPackageName(packageName: string): Promise\u003cvoid\u003e`\n\nSets the package name of the external signer app.\n\n#### `isExternalSignerInstalled(packageName: string): Promise\u003c{ installed: boolean }\u003e`\n\nChecks if an external signer app is installed.\n\n#### `getInstalledSignerApps(): Promise\u003cSignerAppInfo[]\u003e`\n\nRetrieves a list of installed signer apps.\n\n#### `getPublicKey(packageName: string): Promise\u003c{ npub: string; package: string }\u003e`\n\nRetrieves the user's public key from the specified signer app.\n\n#### `signEvent(packageName: string, eventJson: string, eventId: string, npub: string): Promise\u003c{ signature: string; id: string; event: string }\u003e`\n\nSigns a Nostr event.\n\n#### `nip04Encrypt(packageName: string, plainText: string, id: string, pubkey: string, npub: string): Promise\u003c{ result: string }\u003e`\n\nEncrypts a message using NIP-04.\n\n#### `nip04Decrypt(packageName: string, encryptedText: string, id: string, pubkey: string, npub: string): Promise\u003c{ result: string }\u003e`\n\nDecrypts a message using NIP-04.\n\n#### `nip44Encrypt(packageName: string, plainText: string, id: string, pubkey: string, npub: string): Promise\u003c{ result: string }\u003e`\n\nEncrypts a message using NIP-44.\n\n#### `nip44Decrypt(packageName: string, encryptedText: string, id: string, pubkey: string, npub: string): Promise\u003c{ result: string }\u003e`\n\nDecrypts a message using NIP-44.\n\n#### `decryptZapEvent(packageName: string, eventJson: string, id: string, npub: string): Promise\u003c{ result: string }\u003e`\n\nDecrypts a Zap event.\n\n#### `getRelays(packageName: string, id: string, npub: string): Promise\u003c{ result: string }\u003e`\n\nRetrieves relay information.\n\n### Types\n\n#### `SignerAppInfo`\n\nRepresents information about an installed signer app.\n\n```typescript\ninterface SignerAppInfo {\n  name: string;\n  packageName: string;\n  iconData: string;\n  iconUrl: string;\n}\n```\n\n## NIP-55 Compliance\n\nThis module fully implements key aspects of the [NIP-55](https://github.com/nostr-protocol/nips/blob/master/55.md) specification, enabling secure and standardized signing of Nostr events via external signer apps.\n\n## Contributing\n\nContributions are welcome! Please follow the standard [contributing guidelines](CONTRIBUTING.md) for this project.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n---\n\n**Note**: For any issues or questions, please open an issue on the [GitHub repository](https://github.com/chebizarro/NostrSignerModule/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchebizarro%2Fnostrsignermodule","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchebizarro%2Fnostrsignermodule","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchebizarro%2Fnostrsignermodule/lists"}