git-timestamps/check-attestation.sh

20 lines
511 B
Bash
Executable file

#!/bin/bash
# check-attestation.sh - Check if an OpenTimestamp proof is fully attested
# Usage: check-attestation.sh <proof-file>
# Returns: 0 if fully attested, 1 if pending
PROOF_FILE="${1:-}"
if [ -z "$PROOF_FILE" ] || [ ! -f "$PROOF_FILE" ]; then
echo "Error: proof file not found: $PROOF_FILE" >&2
exit 2
fi
# Check for PendingAttestation in ots info output
if ots info "$PROOF_FILE" 2>&1 | grep -q "PendingAttestation"; then
echo "pending"
exit 1
else
echo "attested"
exit 0
fi