A web application for creating and managing co-signed contracts using the Nostr protocol.
Cosigner is a prototype implementation of a co-signed contracts system built on Nostr, specifically using kind: 30023 events. It allows users to:
- Upload markdown documents as contracts
- Specify required signatories using Nostr public keys
- Sign contracts using their Nostr keys
- Track the status of contracts
- Resolve signature conflicts
- Authentication: Sign in with NIP-07 browser extensions or directly with nsec keys
- Contract Management: Upload, view, and sign contracts
- Markdown Support: Contracts are written in markdown format
- Signature Verification: Cryptographic verification of signatures
- Conflict Resolution: Handling of signature conflicts due to Nostr's immutable nature
- Built with React and TypeScript
- Uses
nostr-toolsfor Nostr protocol integration - Implements the sequential signing approach (1a) as described in the specification
- Connects to relay.primal.net for Nostr event publishing and subscription
- Node.js (v16 or later)
- npm or yarn
-
Clone the repository:
git clone https://github.com/djinoz/cosigner.git cd cosigner -
Install dependencies:
npm install -
Start the development server:
npm run dev -
Open your browser and navigate to
http://localhost:5173
- Use a NIP-07 compatible browser extension (like Alby or nos2x)
- Or sign in with your nsec key (not recommended for production use)
- For testing, you can generate a new key pair
- Click "Upload Contract" in the navigation bar
- Upload a markdown file or paste markdown content
- Enter a title for the contract
- Add the Nostr public keys (npub) of all required signatories
- Specify the minimum number of signatures required
- Click "Publish Contract"
- Navigate to the Contracts list
- Find a contract that needs your signature
- Click "View" to see the contract details
- Review the contract content
- Click "Sign Contract" to add your signature
If multiple signatories sign simultaneously, conflicts may occur. In this case:
- The contract will show a warning about multiple versions
- Click "Resolve Conflicts" to merge the signatures
- Once resolved, the contract can be signed by remaining signatories
- This is a prototype implementation and not intended for production use
- All cryptographic operations are performed client-side
- Private keys (nsec) are never stored or transmitted, only kept in memory during the session
- The application includes a simulation mode that allows it to function without requiring an actual Nostr relay connection
- For real-world usage, the application would connect to a Nostr relay (configured to use relay.primal.net)
~~ - Simulation Mode: The application can operate in a simulation mode where it generates sample contracts and simulates signing operations, allowing you to test the full workflow without a real Nostr relay ~~ ~~ - Fallback Mechanisms: If a contract is not found in the relay, the application will generate a simulated contract for demonstration purposes~~
- Authentication Flexibility: Supports both NIP-07 browser extensions and direct nsec key input, with fallback mechanisms to ensure signing always works
- Error Handling: Comprehensive error handling throughout the application to provide a smooth user experience
MIT