opentimestamps 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b838c1eea0b1a967eca1038728e5aaa07aea6fc10ea932258543cda2d31c91a
4
- data.tar.gz: '009ed17044167540849e8b07dde1f218a5bd4bd2e55dbf593ecfe07126fe1a54'
3
+ metadata.gz: 5dcaeacc2884c216e8e1a018d76368e38c5856fd4b5156401b5af1b9b388ab78
4
+ data.tar.gz: 44286ff948c4f54355ef9738557725eb7998e047e009b91658607d0ac50395a7
5
5
  SHA512:
6
- metadata.gz: 91e9a62492b192bc54dcdc71c63d69c6964921f6a3003e9b5055b83444f60ef537bed2fac99100061e25800706c39fcae1e9cb337e72a39ae3337126e7e02bb3
7
- data.tar.gz: 592987fab8b0eb07e7dd9165d2441df8352abb210170d0f19572a303fbc6686169208f8161114c663570f5c3694441982e5aef3e6774a201a1501f6eeb1d54f0
6
+ metadata.gz: 3acf13d2640d2b1b72cebaadb649db0fe75a2f752a59b7b0305faa536f0c4eee30eb325a9f4022b4c50bc8e3b5984ff02451a3d956c285a8158b5aa62c60cb4f
7
+ data.tar.gz: 4727d466c3dff7e26285a4a6801c8008099b652a5a18468e1e142beddedb7b34aea1bcb8f00a0739255a27f28a6dfd2e8cc55427e2804c0ae4bbf390c9848a31
data/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ project uses [Semantic Versioning](https://semver.org/).
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.4.0]
9
+
10
+ ### Added
11
+
12
+ - `ots verify` accepts the proof path, like the reference Python client:
13
+ `ots verify report.pdf.ots` binds the proof to `report.pdf` (announced on
14
+ stderr). `--file PATH` names a different target document. Passing the document
15
+ (`ots verify report.pdf`) works as before, including for a document whose own
16
+ name ends in `.ots` when its `<file>.ots` proof exists.
17
+
8
18
  ## [0.3.0]
9
19
 
10
20
  ### Added
@@ -103,7 +113,8 @@ caps; only `DeserializationError` on malformed bytes). Tested with byte-exact
103
113
  round-trips of twelve reference vectors, an offline check against Bitcoin block
104
114
  358391, and Keccak-256 known-answer vectors.
105
115
 
106
- [Unreleased]: https://github.com/sirruf/opentimestamps/compare/v0.3.0...HEAD
116
+ [Unreleased]: https://github.com/sirruf/opentimestamps/compare/v0.4.0...HEAD
117
+ [0.4.0]: https://github.com/sirruf/opentimestamps/compare/v0.3.0...v0.4.0
107
118
  [0.3.0]: https://github.com/sirruf/opentimestamps/compare/v0.2.0...v0.3.0
108
119
  [0.2.0]: https://github.com/sirruf/opentimestamps/compare/v0.1.0...v0.2.0
109
120
  [0.1.0]: https://github.com/sirruf/opentimestamps/releases/tag/v0.1.0
data/README.md CHANGED
@@ -83,6 +83,7 @@ The gem installs an `ots` executable, a thin wrapper over the library:
83
83
  $ ots stamp report.pdf # writes report.pdf.ots (pending)
84
84
  $ ots upgrade report.pdf.ots # an hour later: fold in the Bitcoin path
85
85
  $ ots verify report.pdf # checks report.pdf.ots and binds it to the file
86
+ $ ots verify report.pdf.ots # same, reference-client style (proof path)
86
87
  $ ots info report.pdf.ots # dump the proof's structure
87
88
  ```
88
89
 
data/exe/ots CHANGED
@@ -38,7 +38,7 @@ module OTSCLI
38
38
  Commands:
39
39
  stamp <file> Create <file>.ots (submits the file hash to calendars)
40
40
  upgrade <file.ots> Fold in the Bitcoin path once a calendar has anchored it
41
- verify <file> Check <file>.ots against the chain and bind it to <file>
41
+ verify <file | file.ots> Check the proof against the chain and bind it to the file
42
42
  info <file.ots> Print the structure of a proof
43
43
  version Print the library version
44
44
 
@@ -90,8 +90,9 @@ module OTSCLI
90
90
  def verify(argv)
91
91
  opts = { quorum: 1 }
92
92
  OptionParser.new do |p|
93
- p.banner = "Usage: ots verify <file> [options]"
93
+ p.banner = "Usage: ots verify <file | file.ots> [options]"
94
94
  p.on("-o", "--ots PATH", "Proof path (default: <file>.ots)") { |o| opts[:ots] = o }
95
+ p.on("-f", "--file PATH", "Document to bind the proof to (when passing a .ots)") { |f| opts[:file] = f }
95
96
  p.on("--quorum N", Integer, "Require N independent Bitcoin anchors (default: 1)") { |n| opts[:quorum] = n }
96
97
  p.on("--node URL", "Verify against your Bitcoin Core node instead of a public explorer") { |u| opts[:node] = u }
97
98
  p.on("--rpcuser USER", "Bitcoin Core RPC user") { |u| opts[:user] = u }
@@ -99,9 +100,8 @@ module OTSCLI
99
100
  p.on("--cookie PATH", "Bitcoin Core .cookie file for RPC auth") { |c| opts[:cookie] = c }
100
101
  end.parse!(argv)
101
102
 
102
- file = require_arg(argv, "verify <file>")
103
+ file, ots_path = verify_paths(require_arg(argv, "verify <file | file.ots>"), opts)
103
104
  no_extra(argv)
104
- ots_path = opts[:ots] || "#{file}.ots"
105
105
  detached = OpenTimestamps::DetachedTimestampFile.deserialize(File.binread(ots_path))
106
106
 
107
107
  # Bind the proof to the document first: it is cheap and needs no network, so a
@@ -136,6 +136,20 @@ module OTSCLI
136
136
  end
137
137
  end
138
138
 
139
+ # Resolve (document, proof) from the positional argument. Like the reference
140
+ # client, a path ending in .ots names the proof and the document is the same
141
+ # path without the suffix (or --file). Anything else names the document, whose
142
+ # proof is <file>.ots (or --ots). A document that itself ends in .ots is still
143
+ # handled as a document when its own <file>.ots proof exists.
144
+ def verify_paths(arg, opts)
145
+ proof_given = arg.end_with?(".ots") && !opts[:ots] && !File.exist?("#{arg}.ots")
146
+ return [arg, opts[:ots] || "#{arg}.ots"] unless proof_given
147
+
148
+ file = opts[:file] || arg.delete_suffix(".ots")
149
+ warn "ots: assuming target file is #{file}" unless opts[:file]
150
+ [file, arg]
151
+ end
152
+
139
153
  # Recompute the file's hash with the proof's file-hash op and compare it to the
140
154
  # digest the proof commits to; this is what binds a proof to a document.
141
155
  def bound_to_file?(detached, file)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenTimestamps
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentimestamps
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artem Kolesnikov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-09-03 00:00:00.000000000 Z
11
+ date: 2026-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest