A secure implementation of Shamir's Secret Sharing scheme for splitting and managing private keys. This system allows splitting a private key into multiple shares, where a subset of shares is required to reconstruct the original key.
- Split private keys into multiple shares (3 shares by default)
- Reconstruct private keys using a threshold of shares (2 shares minimum)
- Generate new compatible shares from existing ones
- Cryptographic integrity protection for shares
- Version control for share compatibility
- Share types: Device, Server, and Recovery shares
- Secure random number generation
- Galois Field (GF256) arithmetic for mathematical operations
Clone the repository
git clone https://github.com/yourusername/private-key-split.git
cd private-key-split
npm install
PRIVATE_KEY=your_solana_private_key_here
Splits a private key into multiple shares.
privateKey
: String - The private key to splittotalShares
: Number - Total number of shares to createthreshold
: Number - Minimum shares needed to reconstruct- Returns: Array of share objects
Reconstructs the private key from shares.
shares
: Array - Array of share objects- Returns: String - The reconstructed private key
Generates a new compatible share from two existing shares.
share1
: Object - First shareshare2
: Object - Second share- Returns: Object - A new compatible share