Remove Node.js hooks, require ots CLI only
- Delete hooks/post-commit-node (local proofs only, no attestation) - Delete hooks/pre-commit-node (no upgrade support) - Update hooks/install.sh to require ots CLI (no fallback) - Update documentation with clear ots CLI requirement - Add prominent warnings about Node.js limitations Rationale: The @opentimestamps/ots Node.js package only creates local proofs without calendar submission or Bitcoin attestation. For tamper-evident timestamps, ots CLI is the only complete implementation. No partial/fallback implementations.
This commit is contained in:
parent
b1e305d831
commit
b4e2eb3c12
6 changed files with 203 additions and 357 deletions
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
# Git OpenTimestamp Hooks Installer
|
||||
# Detects available tools and installs matching hooks
|
||||
# Requires: opentimestamps-client (ots CLI)
|
||||
|
||||
set -e
|
||||
|
||||
|
|
@ -14,44 +14,35 @@ if ! git rev-parse --git-dir > /dev/null 2>&1; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
HOOKS_DIR="$(git rev-parse --git-dir)/hooks"
|
||||
MODE=""
|
||||
|
||||
# Detect available tools
|
||||
if command -v ots &> /dev/null; then
|
||||
MODE="ots"
|
||||
echo "Detected: ots CLI"
|
||||
elif command -v node &> /dev/null && node -e "require('@opentimestamps/ots')" &> /dev/null 2>&1; then
|
||||
MODE="node"
|
||||
echo "Detected: @opentimestamps/ots (Node.js)"
|
||||
echo "Note: Node version creates local proofs only (no calendar submission)"
|
||||
echo ""
|
||||
|
||||
# Install node package locally if not already present
|
||||
if [ ! -d "node_modules/@opentimestamps" ]; then
|
||||
echo "Installing @opentimestamps/ots locally..."
|
||||
npm install @opentimestamps/ots
|
||||
echo "✓ Package installed"
|
||||
fi
|
||||
else
|
||||
echo "Error: Neither ots CLI nor @opentimestamps/ots found" >&2
|
||||
echo "Install one of:" >&2
|
||||
echo " pipx install opentimestamps-client (recommended)" >&2
|
||||
echo " npm install @opentimestamps/ots (local proofs only)" >&2
|
||||
# Check for ots CLI (required)
|
||||
if ! command -v ots &> /dev/null; then
|
||||
echo "Error: ots CLI not found" >&2
|
||||
echo "" >&2
|
||||
echo "OpenTimestamp client is required for full Bitcoin attestation." >&2
|
||||
echo "Install with one of:" >&2
|
||||
echo "" >&2
|
||||
echo " # Recommended (isolated install)" >&2
|
||||
echo " pipx install opentimestamps-client" >&2
|
||||
echo "" >&2
|
||||
echo " # Or with pip" >&2
|
||||
echo " pip install opentimestamps-client" >&2
|
||||
echo "" >&2
|
||||
echo " # Or from source" >&2
|
||||
echo " git clone https://github.com/opentimestamps/opentimestamps-client" >&2
|
||||
echo " cd opentimestamps-client && pip install ." >&2
|
||||
echo "" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Installing $MODE hooks to: $HOOKS_DIR"
|
||||
echo "✓ Detected: ots CLI ($(ots --version))"
|
||||
|
||||
# Copy appropriate hooks
|
||||
if [ "$MODE" = "ots" ]; then
|
||||
cp "$SCRIPT_DIR/post-commit-ots" "$HOOKS_DIR/post-commit"
|
||||
cp "$SCRIPT_DIR/pre-commit-ots" "$HOOKS_DIR/pre-commit"
|
||||
else
|
||||
cp "$SCRIPT_DIR/post-commit-node" "$HOOKS_DIR/post-commit"
|
||||
cp "$SCRIPT_DIR/pre-commit-node" "$HOOKS_DIR/pre-commit"
|
||||
fi
|
||||
HOOKS_DIR="$(git rev-parse --git-dir)/hooks"
|
||||
|
||||
echo "Installing hooks to: $HOOKS_DIR"
|
||||
|
||||
# Copy ots hooks
|
||||
cp "$SCRIPT_DIR/post-commit-ots" "$HOOKS_DIR/post-commit"
|
||||
cp "$SCRIPT_DIR/pre-commit-ots" "$HOOKS_DIR/pre-commit"
|
||||
|
||||
chmod +x "$HOOKS_DIR/post-commit" "$HOOKS_DIR/pre-commit"
|
||||
|
||||
|
|
@ -61,29 +52,18 @@ echo "✓ Pre-commit backfill hook installed"
|
|||
# Setup .gitignore
|
||||
GITIGNORE=".gitignore"
|
||||
if [ ! -f "$GITIGNORE" ]; then
|
||||
cat > "$GITIGNORE" << 'EOF'
|
||||
.ots/.attestation-cache
|
||||
node_modules/
|
||||
EOF
|
||||
echo ".ots/.attestation-cache" > "$GITIGNORE"
|
||||
echo "✓ Created .gitignore"
|
||||
elif ! grep -q ".ots/.attestation-cache" "$GITIGNORE"; then
|
||||
echo ".ots/.attestation-cache" >> "$GITIGNORE"
|
||||
if [ "$MODE" = "node" ] && ! grep -q "node_modules/" "$GITIGNORE"; then
|
||||
echo "node_modules/" >> "$GITIGNORE"
|
||||
fi
|
||||
echo "✓ Updated .gitignore"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Mode: $MODE"
|
||||
if [ "$MODE" = "ots" ]; then
|
||||
echo " - Full Bitcoin attestation via calendars"
|
||||
echo " - Proofs submitted to remote calendars"
|
||||
else
|
||||
echo " - Local proofs only (no calendar submission)"
|
||||
echo " - For full attestation, use: pipx install opentimestamps-client"
|
||||
fi
|
||||
|
||||
echo "Configuration:"
|
||||
echo " - Full Bitcoin attestation via remote calendars"
|
||||
echo " - Proofs submitted to 4+ calendar servers"
|
||||
echo " - Attestation available after ~10 min (Bitcoin confirmation)"
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo "1. Make a test commit"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue