Third commit with corrected ots invocation
This commit is contained in:
parent
db6f29e01a
commit
4a6f5ed0c1
2 changed files with 15 additions and 4 deletions
|
|
@ -23,17 +23,27 @@ generate_with_ots_cli() {
|
||||||
|
|
||||||
# Create a temporary file with the hash (convert hex to binary)
|
# Create a temporary file with the hash (convert hex to binary)
|
||||||
local temp_file=$(mktemp)
|
local temp_file=$(mktemp)
|
||||||
|
local temp_ots="${temp_file}.ots"
|
||||||
|
|
||||||
# Use python3 for hex to binary conversion (more portable than xxd)
|
# Use python3 for hex to binary conversion (more portable than xxd)
|
||||||
python3 -c "import sys; sys.stdout.buffer.write(bytes.fromhex('$hash'))" > "$temp_file"
|
python3 -c "import sys; sys.stdout.buffer.write(bytes.fromhex('$hash'))" > "$temp_file"
|
||||||
|
|
||||||
# Generate timestamp
|
# Generate timestamp - ots creates .ots file alongside the original
|
||||||
ots stamp "$temp_file" -o "$output"
|
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
|
# Cleanup
|
||||||
rm -f "$temp_file"
|
rm -f "$temp_file"
|
||||||
|
|
||||||
echo "Generated proof with ots CLI: $output"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to generate proof using opentimestamps-nodejs
|
# Function to generate proof using opentimestamps-nodejs
|
||||||
|
|
|
||||||
1
test2.txt
Normal file
1
test2.txt
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
# Another test
|
||||||
Loading…
Add table
Add a link
Reference in a new issue