clipshare-cli
v1.0.4
Published
CLI tool for secure secret sharing with WebSockets
Downloads
299
Maintainers
Readme
ClipShare CLI
ClipShare CLI is a command-line utility for developers to securely share sensitive information, such as environment variables, directly in their terminals. It uses WebSockets for real-time communication and AES-GCM encryption to ensure the secure transmission of secrets.
Features
End-to-End Encryption: Share secrets securely using AES-GCM encryption.
WebSocket Communication: Real-time exchange of secrets.
Key Management: Generate, encrypt, and decrypt secrets with pre-shared keys.
Simple and Intuitive Commands: Easy-to-use commands for common tasks.
Installation
You can install ClipShare CLI via npm:
npm install -g clipshare
Getting Started
Ensure you have a WebSocket server running before using the CLI. You can start the included server with:
node server.ts
This will start a WebSocket server at ws://localhost:8080
.
Basic Workflow
Generate or set a pre-shared encryption key.
Encrypt the secret you want to share.
Send the encrypted secret to the recipient.
The recipient receives and decrypts the secret.
Usage
Commands
Here are the commands supported by ClipShare CLI
:
1. Generate a New Encryption Key
Generate a secure encryption key for sharing secrets.
clipshare generate-key
Output:
Generated key: <your-key>
2. Set a Pre-Shared Key
Store a pre-shared key for encrypting and decrypting secrets.
clipshare set-key <key>
Example:
clipshare set-key mySuperSecretKey
Output:
Pre-shared key set: mySuperSecretKey
3. Encrypt a Secret
Encrypt a secret using a key.
clipshare encrypt <secret>
Example:
clipshare encrypt "myPassword123"
Output:
Encrypted data: <encrypted-secret>
IV: <initialization-vector>
Key: <key>
4. Decrypt a Secret
Decrypt a previously encrypted secret.
clipshare decrypt <encryptedData> <iv> <key>
Example:
clipshare decrypt <encrypted-data> <iv> <key>
Output:
Decrypted secret: myPassword123
5. Send a Secret
Encrypt and send a secret to a recipient via WebSocket.
clipshare send <recipient> <secret> <key>
Example:
clipshare send user123 "mySecret123" myEncryptionKey
Output:
Message sent.
6. Receive a Secret
Listen for and decrypt incoming secrets.
clipshare receive <key>
Example:
clipshare receive myEncryptionKey
Output:
Received secret: mySecret123
WebSocket Server
The WebSocket server handles client communication. It assigns temporary IDs to clients and facilitates message routing.
Starting the Server
node server.ts
Output:
WebSocket server started on ws://localhost:8080
Logs
Client connection:
Client connected with ID: <client-id>
Message received:
received: <message>
Client disconnection:
Client disconnected with ID: <client-id>
Security Notes
- Use strong, randomly generated keys.
- Avoid sharing keys through insecure channels.
- Run the WebSocket server in a secure environment.
Development
Run Locally
Clone the repository:
git clone https://github.com/jcopperman/clipshare-cli.git
cd clipshare-cli
Install dependencies:
npm install
Run the CLI tool:
node cli.ts
Start the WebSocket server:
node server.ts
License
This project is licensed under the MIT License. See the LICENSE file for details.
Support My Work
If you find this tool helpful, please consider supporting me on GitHub Sponsors. Your support helps keep this project alive and maintained!