https://github.com/starc007/private-key-split
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.
https://github.com/starc007/private-key-split
Last synced: 8 months ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/starc007/private-key-split
- Owner: starc007
- Created: 2025-01-29T10:59:36.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-01-29T11:03:14.000Z (8 months ago)
- Last Synced: 2025-01-29T12:19:50.235Z (8 months ago)
- Language: JavaScript
- Size: 31.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Private Key Sharing System
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.
## Features
- 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## Installation
```bash
Clone the repository
git clone https://github.com/yourusername/private-key-split.git
cd private-key-split
```## Install dependencies
```bash
npm install
```## Environment Variables
```bash
PRIVATE_KEY=your_solana_private_key_here
```## API Reference
### KeyManager
#### `splitKey(privateKey, totalShares, threshold)`
Splits a private key into multiple shares.
- `privateKey`: String - The private key to split
- `totalShares`: Number - Total number of shares to create
- `threshold`: Number - Minimum shares needed to reconstruct
- Returns: Array of share objects#### `combineShares(shares)`
Reconstructs the private key from shares.
- `shares`: Array - Array of share objects
- Returns: String - The reconstructed private key#### `generateNewShareFromTwo(share1, share2)`
Generates a new compatible share from two existing shares.
- `share1`: Object - First share
- `share2`: Object - Second share
- Returns: Object - A new compatible share