MGit is a specialized Git implementation designed for secure, self-custodial medical data management using Nostr public keys for authentication. Built initially as a Go wrapper around git operations, it provides enhanced functionality for managing medical records in a distributed, self-sovereign manner.
MGit extends Git with the following key features:
- Nostr public key integration for commit attribution
- Enhanced authentication for medical record repositories
- Custom hash generation that incorporates Nostr public keys
- Server-side components for secure repository hosting
- Client tools for repository management
MGit supports these operations:
mgit init
- Initialize a new repositorymgit clone <url> [path]
- Clone a repository with Nostr authenticationmgit add <files...>
- Add files to stagingmgit commit -m <message>
- Commit staged changes with Nostr public key attributionmgit push
- Push commits to remotemgit pull
- Pull changes from remotemgit status
- Show repository statusmgit show [commit]
- Show commit details and changesmgit config
- Get and set configuration values
MGit uses a challenge-response authentication system based on Nostr keys:
- The client requests a challenge from the server
- The challenge is signed using the user's Nostr private key
- The server verifies the signature and issues a JWT token
- The token is used for subsequent repository operations
- Go-based implementation using go-git
- Server components using Node.js
- Nostr authentication integration
- Basic repository operations
- In-browser implementation using isomorphic-git
- Browser storage for repository data
- React-based UI for medical record management
- Native module approach using libgit2
- Custom C library (libmgit2) implementing MGit functionality
- React Native integration for iOS and Android
- Full offline support for medical record access
$ mgit config --global user.name "Your Name"
$ mgit config --global user.email "your.email@example.com"
$ mgit config --global user.pubkey "npub..."
# Authenticate with the MGit server
# (Currently implemented through the web interface)
# This generates a JWT token stored in ~/.mgitconfig/tokens.json
# Clone a repository
$ mgit clone http://mgit-server.com/repo-name
# Add and commit changes
$ mgit add medical-record.json
$ mgit commit -m "Update medical record with new lab results"
# View repository information
$ mgit show
The primary goal of MGit is to enable patients to maintain self-custody of their medical records. By using Git's robust version control features combined with Nostr's cryptographic identity system, MGit provides:
- Verifiable authorship of medical record changes
- Complete history of medical record updates
- Secure, distributed storage
- Patient-controlled access to medical information
MIT