diff --git a/generate-proof.sh b/generate-proof.sh index e97cfbb..a8c4d87 100755 --- a/generate-proof.sh +++ b/generate-proof.sh @@ -23,17 +23,27 @@ generate_with_ots_cli() { # Create a temporary file with the hash (convert hex to binary) local temp_file=$(mktemp) + local temp_ots="${temp_file}.ots" # Use python3 for hex to binary conversion (more portable than xxd) python3 -c "import sys; sys.stdout.buffer.write(bytes.fromhex('$hash'))" > "$temp_file" - # Generate timestamp - ots stamp "$temp_file" -o "$output" + # Generate timestamp - ots creates .ots file alongside the original + ots stamp "$temp_file" + + # Move the generated .ots file to the desired location + if [ -f "$temp_ots" ]; then + mkdir -p "$(dirname "$output")" + mv "$temp_ots" "$output" + echo "Generated proof with ots CLI: $output" + else + echo "Error: ots did not generate proof file" >&2 + rm -f "$temp_file" + exit 1 + fi # Cleanup rm -f "$temp_file" - - echo "Generated proof with ots CLI: $output" } # Function to generate proof using opentimestamps-nodejs diff --git a/test2.txt b/test2.txt new file mode 100644 index 0000000..e53c627 --- /dev/null +++ b/test2.txt @@ -0,0 +1 @@ +# Another test