Install
openclaw skills install magic-wormholeSecure secret sharing for OpenClaw using magic-wormhole protocol
openclaw skills install magic-wormholeThis skill enables OpenClaw agents to securely share secrets (SSH keys, API tokens, passwords, certificates, and other sensitive data) with humans without exposing them in chat history or logs.
Uses magic-wormhole, a secure file and text transfer tool that employs the PAKE (Password-Authenticated Key Exchange) protocol. Secrets are transferred using human-readable codes (e.g., 7-blue-rabbit) that enable end-to-end encrypted communication without pre-shared keys or certificates.
✅ Use magic-wormhole when:
❌ Don't use for:
exec tool)| Platform | Installation Method | Tested |
|---|---|---|
| Linux (Debian/Ubuntu) | apt, snap, pip | ✅ |
| Linux (Fedora) | dnf, pip | ✅ |
| Linux (openSUSE) | zypper, pip | ✅ |
| macOS | Homebrew, pip | ✅ |
| Windows | pip | ⚠️ Limited |
relay.magic-wormhole.io)Run the installation script included with this skill:
cd /data/.openclaw/workspace/skills/magic-wormhole
./install.sh
The script will:
magic-wormhole if not presentsudo apt update
sudo apt install magic-wormhole
sudo dnf install magic-wormhole
pip install --user magic-wormhole
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
brew install magic-wormhole
Check that installation succeeded:
wormhole --version
# Should output: magic-wormhole X.X.X
For production security, host your own relay servers:
pip install magic-wormhole-server
wormhole-server start --rendezvous-relay=ws://0.0.0.0:4000/v1 \
--transit-relay=tcp:0.0.0.0:4001
Then use with --server flag:
wormhole send --server=ws://your-server:4000/v1 filename
Workflow:
wormhole send --text "$SECRET"wormhole receive and enters codeExample Script:
#!/bin/bash
# Generate SSH key and send securely
# 1. Generate key
ssh-keygen -t ed25519 -f /tmp/key -N ""
# 2. Send via wormhole
CODE=$(wormhole send --text "$(cat /tmp/key)" 2>&1 | grep "Wormhole code is:" | cut -d' ' -f4)
# 3. Return only the code (NOT the secret!)
echo "I've generated a new SSH key. Receive it with: wormhole receive"
echo "Code: $CODE"
# 4. Cleanup
rm -f /tmp/key /tmp/key.pub
Human receives:
wormhole receive
# Enter: 7-blue-rabbit
# Save the key
Workflow:
wormhole send --text "my-secret"wormhole receive <<< "$CODE"Example Script:
#!/bin/bash
# Receive secret from human and store
# 1. Receive secret
wormhole receive <<< "$CODE" > /tmp/secret
# 2. Store securely (example: password manager)
pass insert -m api/production-key < /tmp/secret
# 3. Cleanup
rm -f /tmp/secret
echo "Secret stored securely."
# Send text/secret
wormhole send --text "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5..."
# Send file
wormhole send ~/.ssh/id_rsa
# Send directory
wormhole send ~/.ssh/
# Send from clipboard (Linux)
xclip -o | wormhole send --text "$(cat)"
# Send from clipboard (macOS)
pbpaste | wormhole send --text "$(cat)"
# Interactive
wormhole receive
# Enter code when prompted
# Non-interactive
echo "7-blue-rabbit" | wormhole receive
# From argument
wormhole receive 7-blue-rabbit > output.txt
# Extract code from output
CODE=$(wormhole send --text "$SECRET" 2>&1 | grep "Wormhole code is:" | cut -d' ' -f4)
# Verify extraction
if [ -z "$CODE" ]; then
echo "ERROR: Failed to extract code"
exit 1
fi
echo "Code: $CODE"
#!/bin/bash
# Send multiple secrets to team
# Send username
USER_CODE=$(wormhole send --text "$DB_USER" 2>&1 | grep "Wormhole code is:" | cut -d' ' -f4)
# Send password
PASS_CODE=$(wormhole send --text "$DB_PASS" 2>&1 | grep "Wormhole code is:" | cut -d' ' -f4)
# Report codes
echo "Database credentials ready:"
echo "Username: wormhole receive → Code: $USER_CODE"
echo "Password: wormhole receive → Code: $PASS_CODE"
This skill integrates seamlessly with OpenClaw's agent capabilities:
Agent executes shell commands directly:
# Agent command
ssh-keygen -t ed25519 -f /tmp/key -N ""
wormhole send --text "$(cat /tmp/key)"
Agent generates and executes scripts on-the-fly:
# Create temporary script
cat > /tmp/send-key.sh << 'EOF'
#!/bin/bash
SECRET="$1"
CODE=$(wormhole send --text "$SECRET" 2>&1 | grep "Wormhole code is:" | cut -d' ' -f4)
echo "Code: $CODE"
EOF
chmod +x /tmp/send-key.sh
/tmp/send-key.sh "$MY_SECRET"
Use as part of larger automated workflows:
#!/bin/bash
# Deployment workflow with secure credential distribution
# 1. Generate deployment credentials
USER="deploy-$(date +%s)"
PASS=$(openssl rand -base64 24)
# 2. Configure server
ssh root@server "useradd $USER && echo '$PASS' | passwd $USER --stdin"
# 3. Send credentials to team via wormhole
USER_CODE=$(wormhole send --text "$USER" 2>&1 | grep "Wormhole code is:" | cut -d' ' -f4)
PASS_CODE=$(wormhole send --text "$PASS" 2>&1 | grep "Wormhole code is:" | cut -d' ' -f4)
# 4. Notify team (via message tool or other channel)
echo "Deployment credentials ready:"
echo "User: $USER_CODE"
echo "Pass: $PASS_CODE"
✅ Return only codes: Never return secrets in agent responses
✅ Use temporary files: Write secrets to /tmp/ with cleanup on exit
✅ Set proper permissions: chmod 600 for sensitive files
✅ Validate codes: Check that code extraction succeeded before proceeding
✅ Use secure storage: Store received secrets in password managers or keyrings
✅ Self-host for production: Use your own relay servers for sensitive operations
✅ Share codes separately: Use phone, video chat, or secure messaging for codes
❌ Log secrets: Avoid logging secret values in debug output
❌ Reuse codes: Codes are single-use; generate new ones for each transfer
❌ Share codes in same channel: Don't send codes and discuss secrets in same chat
❌ Ignore errors: "Crowded"/"scary" errors indicate potential attacks
❌ Leave temporary files: Clean up /tmp/ after transfers
❌ Use short codes: Use --code-length 3 for sensitive secrets
# Pseudocode: Send secure notification with code
import subprocess
def send_secret_notification(secret, channel):
# 1. Send secret via wormhole
result = subprocess.run(
["wormhole", "send", "--text", secret],
capture_output=True,
text=True
)
# 2. Extract code
if "Wormhole code is:" in result.stderr:
code = result.stderr.split("Wormhole code is:")[1].strip().split()[0]
else:
return {"error": "Failed to send secret"}
# 3. Send notification via message tool
message.send(
action="send",
channel=channel,
message=f"I'm sending a secure secret. Receive with: wormhole receive\nCode: {code}"
)
return {"success": True, "code": code}
Cause: Firewall or NAT blocking connection
Solutions:
# Check firewall
sudo ufw allow 4000:4001/tcp
# Use custom transit relay
wormhole send --transit-relay=tcp://public-relay.magic-wormhole.io:4001 filename
# Test connectivity
ping -c 3 relay.magic-wormhole.io
nc -zv transit.magic-wormhole.io 4001
Cause: Wrong code or active MITM attack
Solution:
# Verify code with recipient
# Re-send with new code
wormhole send --text "$SECRET"
Cause: Code expired (single-use) or wrong server
Solutions:
# Generate new code
wormhole send --text "$SECRET"
# Check server
wormhole send --server=ws://relay.magic-wormhole.io:4000/v1 filename
Cause: No write permission in current directory
Solution:
cd ~/Downloads
wormhole receive
Cause: Relay congestion or slow internet
Solutions:
# Use compression
wormhole send --zstd large-file.tar
# Use custom transit relay
wormhole send --transit-relay=tcp://fast-relay.example.com:4001 filename
Enable verbose output:
# Full debug logs
wormhole send --debug filename
# Save logs to file
wormhole send --debug filename 2>&1 | tee wormhole-debug.log
Check version:
wormhole --version
Update:
pip install --upgrade magic-wormhole
# or
sudo apt update && sudo apt upgrade magic-wormhole
# Install missing dependencies
pip install --upgrade attrs automat spake2 twisted
# Check Python version (requires 3.10+)
python3 --version
# Test with dummy secret
echo "test" | wormhole send --text "$(cat)"
# Should output: "Wormhole code is: X-word-word"
| Threat | Protection |
|---|---|
| Man-in-the-Middle | PAKE prevents impersonation without the code |
| Server Compromise | Servers only see encrypted data or metadata |
| Brute Force | Single-use codes + 256-bit derived key |
| Traffic Analysis | All data encrypted end-to-end |
| Replay Attacks | Codes are single-use, expire after transfer |
--code-length 3 for highly sensitive secrets (~4M combinations)wormhole send --tor filenameSee the examples/ directory for detailed usage examples:
relay.magic-wormhole.io:4000transit.magic-wormhole.io:4001#magic-wormhole on Libera.chatThis skill documentation is provided for use with OpenClaw deployments.
Magic Wormhole itself is licensed under the MIT License: https://github.com/magic-wormhole/magic-wormhole/blob/main/LICENSE