tro-utils 0.4.4__tar.gz → 0.4.6__tar.gz

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.
Files changed (84) hide show
  1. {tro_utils-0.4.4 → tro_utils-0.4.6}/PKG-INFO +1 -1
  2. {tro_utils-0.4.4 → tro_utils-0.4.6}/README.md +8 -3
  3. {tro_utils-0.4.4 → tro_utils-0.4.6}/docs/installation.md +4 -1
  4. {tro_utils-0.4.4 → tro_utils-0.4.6}/docs/usage.md +7 -4
  5. tro_utils-0.4.6/tests/helpers.py +20 -0
  6. {tro_utils-0.4.4 → tro_utils-0.4.6}/tests/test_cli.py +4 -4
  7. {tro_utils-0.4.4 → tro_utils-0.4.6}/tests/test_extra_context.py +28 -28
  8. {tro_utils-0.4.4 → tro_utils-0.4.6}/tests/test_tro_creation.py +4 -1
  9. tro_utils-0.4.6/tests/test_tro_signing.py +149 -0
  10. {tro_utils-0.4.4 → tro_utils-0.4.6}/tests/test_tro_timestamping.py +63 -0
  11. {tro_utils-0.4.4 → tro_utils-0.4.6}/tro_utils/_version.py +3 -3
  12. {tro_utils-0.4.4 → tro_utils-0.4.6}/tro_utils/cli.py +3 -3
  13. {tro_utils-0.4.4 → tro_utils-0.4.6}/tro_utils/models/tro.py +19 -12
  14. {tro_utils-0.4.4 → tro_utils-0.4.6}/tro_utils/tro_utils.py +59 -9
  15. {tro_utils-0.4.4 → tro_utils-0.4.6}/tro_utils.egg-info/PKG-INFO +1 -1
  16. {tro_utils-0.4.4 → tro_utils-0.4.6}/tro_utils.egg-info/SOURCES.txt +2 -0
  17. tro_utils-0.4.6/tro_utils.egg-info/scm_file_list.json +76 -0
  18. tro_utils-0.4.6/tro_utils.egg-info/scm_version.json +8 -0
  19. tro_utils-0.4.4/tests/helpers.py +0 -29
  20. tro_utils-0.4.4/tests/test_tro_signing.py +0 -59
  21. {tro_utils-0.4.4 → tro_utils-0.4.6}/.coveragerc +0 -0
  22. {tro_utils-0.4.4 → tro_utils-0.4.6}/.editorconfig +0 -0
  23. {tro_utils-0.4.4 → tro_utils-0.4.6}/.github/ISSUE_TEMPLATE.md +0 -0
  24. {tro_utils-0.4.4 → tro_utils-0.4.6}/.github/workflows/release.yml +0 -0
  25. {tro_utils-0.4.4 → tro_utils-0.4.6}/.github/workflows/test.yml +0 -0
  26. {tro_utils-0.4.4 → tro_utils-0.4.6}/.gitignore +0 -0
  27. {tro_utils-0.4.4 → tro_utils-0.4.6}/.readthedocs.yaml +0 -0
  28. {tro_utils-0.4.4 → tro_utils-0.4.6}/.travis.yml +0 -0
  29. {tro_utils-0.4.4 → tro_utils-0.4.6}/LICENSE +0 -0
  30. {tro_utils-0.4.4 → tro_utils-0.4.6}/MANIFEST.in +0 -0
  31. {tro_utils-0.4.4 → tro_utils-0.4.6}/Makefile +0 -0
  32. {tro_utils-0.4.4 → tro_utils-0.4.6}/docs/Makefile +0 -0
  33. {tro_utils-0.4.4 → tro_utils-0.4.6}/docs/authors.md +0 -0
  34. {tro_utils-0.4.4 → tro_utils-0.4.6}/docs/conf.py +0 -0
  35. {tro_utils-0.4.4 → tro_utils-0.4.6}/docs/contributing.md +0 -0
  36. {tro_utils-0.4.4 → tro_utils-0.4.6}/docs/history.md +0 -0
  37. {tro_utils-0.4.4 → tro_utils-0.4.6}/docs/index.md +0 -0
  38. {tro_utils-0.4.4 → tro_utils-0.4.6}/docs/make.bat +0 -0
  39. {tro_utils-0.4.4 → tro_utils-0.4.6}/docs/readme.md +0 -0
  40. {tro_utils-0.4.4 → tro_utils-0.4.6}/docs/requirements.txt +0 -0
  41. {tro_utils-0.4.4 → tro_utils-0.4.6}/pyproject.toml +0 -0
  42. {tro_utils-0.4.4 → tro_utils-0.4.6}/pytest.ini +0 -0
  43. {tro_utils-0.4.4 → tro_utils-0.4.6}/requirements_dev.txt +0 -0
  44. {tro_utils-0.4.4 → tro_utils-0.4.6}/setup.cfg +0 -0
  45. {tro_utils-0.4.4 → tro_utils-0.4.6}/tests/__init__.py +0 -0
  46. {tro_utils-0.4.4 → tro_utils-0.4.6}/tests/conftest.py +0 -0
  47. {tro_utils-0.4.4 → tro_utils-0.4.6}/tests/test_models_artifact_arrangement.py +0 -0
  48. {tro_utils-0.4.4 → tro_utils-0.4.6}/tests/test_models_artifact_composition.py +0 -0
  49. {tro_utils-0.4.4 → tro_utils-0.4.6}/tests/test_models_artifact_location.py +0 -0
  50. {tro_utils-0.4.4 → tro_utils-0.4.6}/tests/test_models_composition_fingerprint.py +0 -0
  51. {tro_utils-0.4.4 → tro_utils-0.4.6}/tests/test_models_hash_value.py +0 -0
  52. {tro_utils-0.4.4 → tro_utils-0.4.6}/tests/test_models_performance.py +0 -0
  53. {tro_utils-0.4.4 → tro_utils-0.4.6}/tests/test_models_research_artifact.py +0 -0
  54. {tro_utils-0.4.4 → tro_utils-0.4.6}/tests/test_models_transparent_research_object.py +0 -0
  55. {tro_utils-0.4.4 → tro_utils-0.4.6}/tests/test_models_trs.py +0 -0
  56. {tro_utils-0.4.4 → tro_utils-0.4.6}/tests/test_models_tsa.py +0 -0
  57. {tro_utils-0.4.4 → tro_utils-0.4.6}/tests/test_replication_package_model.py +0 -0
  58. {tro_utils-0.4.4 → tro_utils-0.4.6}/tests/test_replication_package_verification.py +0 -0
  59. {tro_utils-0.4.4 → tro_utils-0.4.6}/tests/test_tro_arrangements.py +0 -0
  60. {tro_utils-0.4.4 → tro_utils-0.4.6}/tests/test_tro_hashing.py +0 -0
  61. {tro_utils-0.4.4 → tro_utils-0.4.6}/tests/test_tro_performances.py +0 -0
  62. {tro_utils-0.4.4 → tro_utils-0.4.6}/tests/test_tro_reporting.py +0 -0
  63. {tro_utils-0.4.4 → tro_utils-0.4.6}/tests/test_tro_save_load.py +0 -0
  64. {tro_utils-0.4.4 → tro_utils-0.4.6}/tests/test_tro_utility_methods.py +0 -0
  65. {tro_utils-0.4.4 → tro_utils-0.4.6}/tests/test_tro_workflow.py +0 -0
  66. {tro_utils-0.4.4 → tro_utils-0.4.6}/tests/test_version.py +0 -0
  67. {tro_utils-0.4.4 → tro_utils-0.4.6}/tox.ini +0 -0
  68. {tro_utils-0.4.4 → tro_utils-0.4.6}/tro_utils/__init__.py +0 -0
  69. {tro_utils-0.4.4 → tro_utils-0.4.6}/tro_utils/default.jinja2 +0 -0
  70. {tro_utils-0.4.4 → tro_utils-0.4.6}/tro_utils/models/__init__.py +0 -0
  71. {tro_utils-0.4.4 → tro_utils-0.4.6}/tro_utils/models/_base.py +0 -0
  72. {tro_utils-0.4.4 → tro_utils-0.4.6}/tro_utils/models/arrangement.py +0 -0
  73. {tro_utils-0.4.4 → tro_utils-0.4.6}/tro_utils/models/artifact.py +0 -0
  74. {tro_utils-0.4.4 → tro_utils-0.4.6}/tro_utils/models/attribute.py +0 -0
  75. {tro_utils-0.4.4 → tro_utils-0.4.6}/tro_utils/models/composition.py +0 -0
  76. {tro_utils-0.4.4 → tro_utils-0.4.6}/tro_utils/models/hash_value.py +0 -0
  77. {tro_utils-0.4.4 → tro_utils-0.4.6}/tro_utils/models/performance.py +0 -0
  78. {tro_utils-0.4.4 → tro_utils-0.4.6}/tro_utils/models/trs.py +0 -0
  79. {tro_utils-0.4.4 → tro_utils-0.4.6}/tro_utils/models/tsa.py +0 -0
  80. {tro_utils-0.4.4 → tro_utils-0.4.6}/tro_utils/replication_package.py +0 -0
  81. {tro_utils-0.4.4 → tro_utils-0.4.6}/tro_utils.egg-info/dependency_links.txt +0 -0
  82. {tro_utils-0.4.4 → tro_utils-0.4.6}/tro_utils.egg-info/entry_points.txt +0 -0
  83. {tro_utils-0.4.4 → tro_utils-0.4.6}/tro_utils.egg-info/requires.txt +0 -0
  84. {tro_utils-0.4.4 → tro_utils-0.4.6}/tro_utils.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tro-utils
3
- Version: 0.4.4
3
+ Version: 0.4.6
4
4
  Summary: Utilities for creating, editing and interacting with TROs
5
5
  Author-email: Kacper Kowalik <xarthisius.kk@gmail.com>, Craig Willis <willis8@illinois.edu>
6
6
  Maintainer-email: Kacper Kowalik <xarthisius.kk@gmail.com>
@@ -24,18 +24,20 @@ It uses the `Click` library to define commands and options. Here's a summary of
24
24
 
25
25
  - `performance`: Manages performances in the TRO. It has a subcommand `add` that adds a performance to the TRO.
26
26
 
27
- - `sign`: Signs the TRO.
27
+ - `sign`: Signs the TRO. This records the public half of the signing key as `trov:publicKey` in the declaration, saves the declaration, and then produces the signature and the RFC 3161 timestamp over it.
28
28
 
29
29
  - `report`: Generates a report of the TRO.
30
30
 
31
31
  3. **TRO Interaction**: The script interacts with the TRO using the `TRO` class from the `tro_utils` module. It uses this class to create a new TRO, add arrangements and performances to the TRO, verify the TRO, and generate a report of the TRO.
32
32
 
33
+ 4. **GPG is only used for signing**: `--gpg-fingerprint` and `--gpg-passphrase` are recorded but never resolved against a keyring until `sign` runs. Building, inspecting, reporting on and verifying a TRO therefore need no GPG key — and no `gpg` binary at all. As a consequence, `trov:publicKey` appears in the declaration only from `sign` onwards, and is by construction the public half of the key that produced the signature (a value supplied by a TRS profile acts as a default until then).
34
+
33
35
  ## Installation
34
36
 
35
37
  ### Pre-requisites
36
38
  Before you begin, you need to have the following installed on your system:
37
39
 
38
- - GPG
40
+ - GPG (only needed to `sign` a TRO)
39
41
  - OpenSSL
40
42
  - Python 3.8+
41
43
 
@@ -46,12 +48,15 @@ $ sudo apt-get install gnupg openssl python3 python3-pip # on Debian/Ubuntu
46
48
  $ brew install gnupg openssl python3 # on macOS with Homebrew
47
49
  ```
48
50
 
51
+ If you only consume TROs — building, inspecting, reporting or `verify-timestamp` —
52
+ GPG is not required; OpenSSL still is.
53
+
49
54
  ## Example Usage
50
55
 
51
56
  Assumes that:
52
57
 
53
58
  * this package is installed
54
- * your GPG key is present
59
+ * your GPG key is present (needed for the `sign` step only)
55
60
  * `trs.jsonld` is available and defines TRS capabilities (see below for an example)
56
61
 
57
62
  Example workflow:
@@ -3,7 +3,7 @@
3
3
  ## Pre-requisites
4
4
  Before you begin, you need to have the following installed on your system:
5
5
 
6
- - GPG
6
+ - GPG (only needed to `sign` a TRO)
7
7
  - OpenSSL
8
8
  - Python 3.8+
9
9
 
@@ -14,6 +14,9 @@ $ sudo apt-get install gnupg openssl python3 python3-pip # on Debian/Ubuntu
14
14
  $ brew install gnupg openssl python3 # on macOS with Homebrew
15
15
  ```
16
16
 
17
+ If you only consume TROs — building, inspecting, reporting or `verify-timestamp` —
18
+ GPG is not required; OpenSSL still is.
19
+
17
20
  ## Stable release
18
21
 
19
22
  To install Transparent Research Object utils, run this command in your terminal:
@@ -60,7 +60,9 @@ tro-utils --declaration my.jsonld performance add \
60
60
  ```
61
61
  tro-utils sign
62
62
  ```
63
- GPG-signs the TRO declaration, writing a `.sig` file.
63
+ Records the signing key's public half as `trov:publicKey` in the declaration, saves the
64
+ declaration, GPG-signs it into a `.sig` file, and timestamps both into a `.tsr` file.
65
+ This is the only command that needs a GPG key.
64
66
 
65
67
  ```
66
68
  tro-utils report -t TEMPLATE -o OUTPUT
@@ -247,11 +249,12 @@ tro.add_performance(
247
249
  modified_arrangement="arrangement/1", # str | (id, path) tuple | list | None
248
250
  )
249
251
 
250
- # Save, sign, and timestamp
252
+ # Save, sign, and timestamp. request_timestamp() attaches trov:publicKey and
253
+ # re-saves the declaration before signing, so the .sig and .tsr always cover the
254
+ # declaration as it exists on disk.
251
255
  tro.save()
252
- tro.trs_signature()
253
256
  tro.request_timestamp()
254
- tro.verify_timestamp()
257
+ tro.verify_timestamp() # needs neither a key nor the gpg binary
255
258
 
256
259
  # Verify a replication package
257
260
  result = tro.verify_replication_package(
@@ -0,0 +1,20 @@
1
+ """Shared helper functions for tro_utils tests."""
2
+
3
+ import os
4
+
5
+ from tro_utils import tro_utils
6
+ from tro_utils.tro_utils import TRO
7
+
8
+
9
+ def create_tro_with_gpg(filepath, gpg_setup, **kwargs):
10
+ """Create a TRO pointed at the test GPG keyring.
11
+
12
+ ``tro_utils.tro_utils.GPG_HOME`` is read at import time, so it is redirected
13
+ here to the keyring created by the ``gpg_setup`` fixture. GPG itself is only
14
+ contacted when a key is needed, so a TRO created without a fingerprint never
15
+ touches it.
16
+ """
17
+ os.environ["GPG_HOME"] = gpg_setup["gpg_home"]
18
+ tro_utils.GPG_HOME = gpg_setup["gpg_home"]
19
+
20
+ return TRO(filepath=filepath, **kwargs)
@@ -690,7 +690,7 @@ class TestExtraContextCLI:
690
690
  assert result.exit_code == 0, result.output
691
691
  with open(tro_file) as f:
692
692
  data = json.load(f)
693
- assert {"ex": "http://example.org/"} in data["@context"]
693
+ assert data["@context"]["ex"] == "http://example.org/"
694
694
 
695
695
  def test_extra_context_multiple(
696
696
  self, runner, tmp_path, temp_workspace, trs_profile
@@ -716,8 +716,8 @@ class TestExtraContextCLI:
716
716
  assert result.exit_code == 0, result.output
717
717
  with open(tro_file) as f:
718
718
  data = json.load(f)
719
- assert {"ex": "http://example.org/"} in data["@context"]
720
- assert {"foaf": "http://xmlns.com/foaf/0.1/"} in data["@context"]
719
+ assert data["@context"]["ex"] == "http://example.org/"
720
+ assert data["@context"]["foaf"] == "http://xmlns.com/foaf/0.1/"
721
721
 
722
722
  def test_extra_context_invalid_format(
723
723
  self, runner, tmp_path, temp_workspace, trs_profile
@@ -761,7 +761,7 @@ class TestExtraContextCLI:
761
761
  )
762
762
  with open(tro_file) as f:
763
763
  data = json.load(f)
764
- base = data["@context"][0]
764
+ base = data["@context"]
765
765
  assert "trov" in base
766
766
 
767
767
  def test_cli_help_shows_extra_context(self, runner):
@@ -12,82 +12,82 @@ class TestExtraContext:
12
12
  """Tests for extra vocabulary support in @context."""
13
13
 
14
14
  def test_extra_context_default_empty(self):
15
- """TransparentResearchObject.extra_context defaults to an empty list."""
15
+ """TransparentResearchObject.extra_context defaults to an empty dict."""
16
16
  tro = TransparentResearchObject()
17
- assert tro.extra_context == []
17
+ assert tro.extra_context == {}
18
18
 
19
19
  def test_extra_context_dict_in_jsonld(self):
20
20
  """A dict extra_context entry appears in the serialised @context."""
21
21
  tro = TransparentResearchObject()
22
- tro.extra_context = [{"ex": "http://example.org/"}]
22
+ tro.extra_context = {"ex": "http://example.org/"}
23
23
  data = tro.to_jsonld()
24
- assert {"ex": "http://example.org/"} in data["@context"]
24
+ assert data["@context"]["ex"] == "http://example.org/"
25
25
 
26
26
  def test_extra_context_multiple_entries(self):
27
- """Multiple extra_context dict entries all appear in @context."""
27
+ """Multiple extra_context entries all appear in @context."""
28
28
  tro = TransparentResearchObject()
29
- tro.extra_context = [
30
- {"ex": "http://example.org/"},
31
- {"foaf": "http://xmlns.com/foaf/0.1/"},
32
- ]
29
+ tro.extra_context = {
30
+ "ex": "http://example.org/",
31
+ "foaf": "http://xmlns.com/foaf/0.1/",
32
+ }
33
33
  data = tro.to_jsonld()
34
- assert {"ex": "http://example.org/"} in data["@context"]
35
- assert {"foaf": "http://xmlns.com/foaf/0.1/"} in data["@context"]
34
+ assert data["@context"]["ex"] == "http://example.org/"
35
+ assert data["@context"]["foaf"] == "http://xmlns.com/foaf/0.1/"
36
36
 
37
37
  def test_extra_context_base_context_still_present(self):
38
- """The standard base context is always the first entry in @context."""
38
+ """The standard base context keys are always present in @context."""
39
39
  tro = TransparentResearchObject()
40
- tro.extra_context = [{"ex": "http://example.org/"}]
40
+ tro.extra_context = {"ex": "http://example.org/"}
41
41
  data = tro.to_jsonld()
42
- base = data["@context"][0]
42
+ base = data["@context"]
43
43
  assert "trov" in base
44
44
  assert "rdf" in base
45
45
 
46
46
  def test_extra_context_roundtrip(self, tmp_path):
47
- """Extra context dict entries survive a save/load roundtrip."""
47
+ """Extra context entries survive a save/load roundtrip."""
48
48
  tro = TransparentResearchObject()
49
- tro.extra_context = [
50
- {"ex": "http://example.org/"},
51
- {"foaf": "http://xmlns.com/foaf/0.1/"},
52
- ]
49
+ tro.extra_context = {
50
+ "ex": "http://example.org/",
51
+ "foaf": "http://xmlns.com/foaf/0.1/",
52
+ }
53
53
  filepath = tmp_path / "tro_with_extra_ctx.jsonld"
54
54
  tro.save(str(filepath))
55
55
 
56
56
  loaded = TransparentResearchObject.load(str(filepath))
57
- assert {"ex": "http://example.org/"} in loaded.extra_context
58
- assert {"foaf": "http://xmlns.com/foaf/0.1/"} in loaded.extra_context
57
+ assert loaded.extra_context["ex"] == "http://example.org/"
58
+ assert loaded.extra_context["foaf"] == "http://xmlns.com/foaf/0.1/"
59
59
 
60
60
  def test_extra_context_via_tro_facade(self, tmp_path):
61
61
  """TRO facade propagates extra_context to the underlying model."""
62
62
  tro_file = tmp_path / "tro.jsonld"
63
63
  tro = TRO(
64
64
  filepath=str(tro_file),
65
- extra_context=[{"ex": "http://example.org/"}],
65
+ extra_context={"ex": "http://example.org/"},
66
66
  )
67
67
  tro.save()
68
68
 
69
69
  with open(tro_file) as f:
70
70
  data = json.load(f)
71
- assert {"ex": "http://example.org/"} in data["@context"]
71
+ assert data["@context"]["ex"] == "http://example.org/"
72
72
 
73
73
  def test_extra_context_via_tro_facade_extends_existing(self, tmp_path):
74
- """TRO facade appends extra_context to any context already in the file."""
74
+ """TRO facade merges extra_context into any context already in the file."""
75
75
  tro_file = tmp_path / "tro.jsonld"
76
76
  # First save with one extra context entry
77
77
  tro = TRO(
78
78
  filepath=str(tro_file),
79
- extra_context=[{"ex": "http://example.org/"}],
79
+ extra_context={"ex": "http://example.org/"},
80
80
  )
81
81
  tro.save()
82
82
 
83
83
  # Re-open and add a second entry
84
84
  tro2 = TRO(
85
85
  filepath=str(tro_file),
86
- extra_context=[{"foaf": "http://xmlns.com/foaf/0.1/"}],
86
+ extra_context={"foaf": "http://xmlns.com/foaf/0.1/"},
87
87
  )
88
88
  tro2.save()
89
89
 
90
90
  with open(tro_file) as f:
91
91
  data = json.load(f)
92
- assert {"ex": "http://example.org/"} in data["@context"]
93
- assert {"foaf": "http://xmlns.com/foaf/0.1/"} in data["@context"]
92
+ assert data["@context"]["ex"] == "http://example.org/"
93
+ assert data["@context"]["foaf"] == "http://xmlns.com/foaf/0.1/"
@@ -46,7 +46,10 @@ class TestTROCreation:
46
46
  )
47
47
 
48
48
  assert tro.basename == "new_tro"
49
- assert tro.gpg_key_id == gpg_setup["keyid"]
49
+ # The fingerprint is recorded but not resolved against the keyring yet
50
+ assert tro.gpg_fingerprint == gpg_setup["fingerprint"]
51
+ assert tro.gpg_key_id is None
52
+ assert "trov:publicKey" not in tro.data["@graph"][0]["trov:wasAssembledBy"]
50
53
  assert "TransparentResearchObject" in str(tro.data)
51
54
  assert tro.data["@graph"][0]["schema:creator"] == "Test Creator"
52
55
  assert tro.data["@graph"][0]["schema:name"] == "Test TRO"
@@ -0,0 +1,149 @@
1
+ """Tests for TRO signing and verification."""
2
+
3
+ import json
4
+ import os
5
+ from unittest.mock import patch
6
+
7
+ import pytest
8
+
9
+ from tro_utils.tro_utils import TRO
10
+
11
+ from tests.helpers import create_tro_with_gpg
12
+
13
+ PUBLIC_KEY_ARMOR = "-----BEGIN PGP PUBLIC KEY BLOCK-----"
14
+
15
+
16
+ def _trs(declaration):
17
+ """Return the ``trov:wasAssembledBy`` block of a saved declaration."""
18
+ with open(declaration) as fp:
19
+ return json.load(fp)["@graph"][0]["trov:wasAssembledBy"]
20
+
21
+
22
+ class TestTROSigning:
23
+ """Test TRO signing and verification."""
24
+
25
+ def test_sign_tro(self, temp_workspace, tmp_path, gpg_setup, trs_profile):
26
+ """Test signing a TRO with GPG."""
27
+ tro = create_tro_with_gpg(
28
+ filepath=str(tmp_path / "test_tro.jsonld"),
29
+ gpg_setup=gpg_setup,
30
+ profile=trs_profile,
31
+ gpg_fingerprint=gpg_setup["fingerprint"],
32
+ gpg_passphrase=gpg_setup["passphrase"],
33
+ )
34
+
35
+ # Add some content
36
+ tro.add_arrangement(str(temp_workspace), comment="Test")
37
+ tro.save()
38
+
39
+ # Sign the TRO
40
+ signature = tro.trs_signature()
41
+
42
+ assert signature is not None
43
+ assert len(str(signature)) > 0
44
+
45
+ # Verify signature file was created
46
+ assert os.path.exists(tro.sig_filename)
47
+
48
+ # Verify signature content
49
+ with open(tro.sig_filename, "r") as f:
50
+ sig_content = f.read()
51
+ assert "BEGIN PGP SIGNATURE" in sig_content
52
+
53
+ def test_sign_without_gpg_key(self, tmp_path):
54
+ """Test that signing without GPG key raises error."""
55
+ tro = TRO(filepath=str(tmp_path / "test_tro.jsonld"))
56
+
57
+ with pytest.raises(RuntimeError, match="GPG fingerprint was not provided"):
58
+ tro.trs_signature()
59
+
60
+ def test_sign_without_passphrase(self, tmp_path, gpg_setup):
61
+ """Test that signing without passphrase raises error."""
62
+ tro = create_tro_with_gpg(
63
+ filepath=str(tmp_path / "test_tro.jsonld"),
64
+ gpg_setup=gpg_setup,
65
+ gpg_fingerprint=gpg_setup["fingerprint"],
66
+ )
67
+
68
+ with pytest.raises(RuntimeError, match="GPG passphrase was not provided"):
69
+ tro.trs_signature()
70
+
71
+
72
+ class TestPublicKeyAttachment:
73
+ """Test that trov:publicKey is only injected at signing time."""
74
+
75
+ def test_public_key_absent_until_attached(
76
+ self, temp_workspace, tmp_path, gpg_setup, trs_profile
77
+ ):
78
+ """Saving before signing must not record a public key."""
79
+ declaration = str(tmp_path / "test_tro.jsonld")
80
+ tro = create_tro_with_gpg(
81
+ filepath=declaration,
82
+ gpg_setup=gpg_setup,
83
+ profile=trs_profile,
84
+ gpg_fingerprint=gpg_setup["fingerprint"],
85
+ gpg_passphrase=gpg_setup["passphrase"],
86
+ )
87
+ tro.add_arrangement(str(temp_workspace), comment="Test")
88
+ tro.save()
89
+
90
+ assert "trov:publicKey" not in _trs(declaration)
91
+
92
+ tro.attach_public_key()
93
+ tro.save()
94
+
95
+ public_key = _trs(declaration)["trov:publicKey"]
96
+ assert public_key.startswith(PUBLIC_KEY_ARMOR)
97
+ assert public_key == gpg_setup["gpg"].export_keys(gpg_setup["keyid"])
98
+ assert tro.gpg_key_id == gpg_setup["keyid"]
99
+
100
+ def test_attach_public_key_without_fingerprint(self, tmp_path):
101
+ """Attaching a key without a configured fingerprint raises."""
102
+ tro = TRO(filepath=str(tmp_path / "test_tro.jsonld"))
103
+
104
+ with pytest.raises(RuntimeError, match="GPG fingerprint was not provided"):
105
+ tro.attach_public_key()
106
+
107
+ def test_attach_public_key_without_keyring(self, tmp_path, monkeypatch):
108
+ """A fingerprint missing from the keyring is reported as such."""
109
+ gpg_home = tmp_path / "empty_keyring"
110
+ gpg_home.mkdir(mode=0o700)
111
+ monkeypatch.setattr("tro_utils.tro_utils.GPG_HOME", str(gpg_home))
112
+
113
+ tro = TRO(
114
+ filepath=str(tmp_path / "test_tro.jsonld"),
115
+ gpg_fingerprint="0" * 40,
116
+ )
117
+
118
+ with pytest.raises(RuntimeError, match="was not found in the keyring"):
119
+ tro.attach_public_key()
120
+
121
+ def test_save_with_fingerprint_but_no_keyring(
122
+ self, temp_workspace, tmp_path, monkeypatch
123
+ ):
124
+ """Building and saving a TRO must not require the configured key."""
125
+ gpg_home = tmp_path / "empty_keyring"
126
+ gpg_home.mkdir(mode=0o700)
127
+ monkeypatch.setattr("tro_utils.tro_utils.GPG_HOME", str(gpg_home))
128
+ declaration = str(tmp_path / "test_tro.jsonld")
129
+
130
+ tro = TRO(filepath=declaration, gpg_fingerprint="0" * 40)
131
+ tro.add_arrangement(str(temp_workspace), comment="Test")
132
+ tro.save()
133
+
134
+ assert "trov:publicKey" not in _trs(declaration)
135
+
136
+ def test_read_write_never_touches_gpg(self, temp_workspace, tmp_path):
137
+ """No GPG binary is needed to create, mutate, save or reload a TRO."""
138
+ declaration = str(tmp_path / "test_tro.jsonld")
139
+
140
+ def no_gpg(*args, **kwargs):
141
+ raise AssertionError("GPG must not be used outside of signing")
142
+
143
+ with patch.object(TRO, "_gpg", no_gpg):
144
+ tro = TRO(filepath=declaration, gpg_fingerprint="0" * 40)
145
+ tro.add_arrangement(str(temp_workspace), comment="Test")
146
+ tro.save()
147
+ reloaded = TRO(filepath=declaration, gpg_fingerprint="0" * 40)
148
+
149
+ assert reloaded.list_arrangements()
@@ -1,8 +1,11 @@
1
1
  """Tests for TRO timestamping operations."""
2
2
 
3
+ import json
3
4
  import os
4
5
  from unittest.mock import MagicMock, patch
5
6
 
7
+ from tro_utils.tro_utils import TRO
8
+
6
9
  from tests.helpers import create_tro_with_gpg
7
10
 
8
11
 
@@ -102,3 +105,63 @@ class TestTROTimestamping:
102
105
  assert call_args[0] == "openssl"
103
106
  assert call_args[1] == "ts"
104
107
  assert call_args[2] == "-verify"
108
+
109
+ @patch("subprocess.check_call")
110
+ @patch("requests.get")
111
+ @patch("tro_utils.tro_utils.encoder.encode")
112
+ @patch("tro_utils.tro_utils.rfc3161ng.RemoteTimestamper")
113
+ def test_timestamped_payload_matches_saved_declaration(
114
+ self,
115
+ mock_timestamper,
116
+ mock_encode,
117
+ mock_get,
118
+ mock_check_call,
119
+ temp_workspace,
120
+ tmp_path,
121
+ gpg_setup,
122
+ trs_profile,
123
+ ):
124
+ """The timestamped payload must match what a verifier recomputes.
125
+
126
+ Regression test for the ordering of ``attach_public_key()``: the public
127
+ key has to land in the declaration before it is hashed *and* be written
128
+ to disk, otherwise a signed TRO fails its own ``verify_timestamp()``.
129
+ """
130
+ mock_encode.return_value = b"encoded_tsr_data"
131
+ mock_tsr = MagicMock()
132
+ mock_ts_instance = MagicMock(return_value=mock_tsr)
133
+ mock_timestamper.return_value = mock_ts_instance
134
+ mock_get.return_value = MagicMock(content=b"fake cert content")
135
+
136
+ declaration = str(tmp_path / "test_tro.jsonld")
137
+ tro = create_tro_with_gpg(
138
+ filepath=declaration,
139
+ gpg_setup=gpg_setup,
140
+ profile=trs_profile,
141
+ gpg_fingerprint=gpg_setup["fingerprint"],
142
+ gpg_passphrase=gpg_setup["passphrase"],
143
+ )
144
+ tro.add_arrangement(str(temp_workspace), comment="Test")
145
+ tro.save()
146
+
147
+ tro.request_timestamp()
148
+ signed_payload = mock_ts_instance.call_args.kwargs["data"]
149
+
150
+ # Signing must persist the declaration it attested to
151
+ with open(declaration) as fp:
152
+ saved = json.load(fp)
153
+ public_key = saved["@graph"][0]["trov:wasAssembledBy"]["trov:publicKey"]
154
+ assert public_key.startswith("-----BEGIN PGP PUBLIC KEY BLOCK-----")
155
+
156
+ # A third party verifies from the files alone: no fingerprint, no
157
+ # passphrase, no keyring.
158
+ verified_payload = {}
159
+
160
+ def capture_payload(args):
161
+ with open(args[args.index("-data") + 1], "rb") as fp:
162
+ verified_payload["data"] = fp.read()
163
+
164
+ mock_check_call.side_effect = capture_payload
165
+ TRO(filepath=declaration).verify_timestamp()
166
+
167
+ assert verified_payload["data"] == signed_payload
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '0.4.4'
22
- __version_tuple__ = version_tuple = (0, 4, 4)
21
+ __version__ = version = '0.4.6'
22
+ __version_tuple__ = version_tuple = (0, 4, 6)
23
23
 
24
- __commit_id__ = commit_id = 'g49075ca80'
24
+ __commit_id__ = commit_id = 'gc26932ea1'
@@ -22,11 +22,11 @@ def _parse_arrangement_ref(value: str) -> tuple[str, str | None]:
22
22
 
23
23
 
24
24
  def _parse_extra_context_value(ctx, param, value):
25
- """Parse ``--extra-context`` values into JSON-LD context dicts.
25
+ """Parse ``--extra-context`` values into a JSON-LD context dict.
26
26
 
27
27
  Each value must be in ``PREFIX=URI`` form (e.g. ``ex=http://example.org/``).
28
28
  """
29
- result = []
29
+ result = {}
30
30
  for v in value:
31
31
  if "=" not in v:
32
32
  raise click.BadParameter(
@@ -35,7 +35,7 @@ def _parse_extra_context_value(ctx, param, value):
35
35
  ctx=ctx,
36
36
  )
37
37
  prefix, _, uri = v.partition("=")
38
- result.append({prefix: uri})
38
+ result[prefix] = uri
39
39
  return result
40
40
 
41
41
 
@@ -28,14 +28,12 @@ from .tsa import TimeStampingAuthority
28
28
 
29
29
  TROV_VOCABULARY_VERSION = Version("0.1")
30
30
 
31
- _JSONLD_CONTEXT = [
32
- {
33
- "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
34
- "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
35
- "trov": f"https://w3id.org/trace/trov/{TROV_VOCABULARY_VERSION}#",
36
- "schema": "https://schema.org",
37
- }
38
- ]
31
+ _JSONLD_CONTEXT = {
32
+ "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
33
+ "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
34
+ "trov": f"https://w3id.org/trace/trov/{TROV_VOCABULARY_VERSION}#",
35
+ "schema": "https://schema.org/",
36
+ }
39
37
 
40
38
 
41
39
  @dataclass
@@ -56,7 +54,7 @@ class TransparentResearchObject(TROVModel):
56
54
  arrangements: list[ArtifactArrangement] = field(default_factory=list)
57
55
  performances: list[TrustedResearchPerformance] = field(default_factory=list)
58
56
  attributes: list[TROAttribute] = field(default_factory=list)
59
- extra_context: list[dict] = field(default_factory=list)
57
+ extra_context: dict = field(default_factory=dict)
60
58
 
61
59
  # ------------------------------------------------------------------
62
60
  # File I/O
@@ -327,7 +325,7 @@ class TransparentResearchObject(TROVModel):
327
325
  graph_node["trov:hasPerformance"][i].update(extra)
328
326
 
329
327
  return {
330
- "@context": _JSONLD_CONTEXT + self.extra_context,
328
+ "@context": {**_JSONLD_CONTEXT, **self.extra_context},
331
329
  "@graph": [graph_node],
332
330
  }
333
331
 
@@ -346,8 +344,17 @@ class TransparentResearchObject(TROVModel):
346
344
  """
347
345
  graph = data["@graph"][0]
348
346
 
349
- raw_context = data.get("@context", [])
350
- extra_context = list(raw_context[1:]) if isinstance(raw_context, list) else []
347
+ raw_context = data.get("@context", {})
348
+ if isinstance(raw_context, list):
349
+ # backward compat: merge list of dicts into a single dict
350
+ merged: dict = {}
351
+ for item in raw_context:
352
+ if isinstance(item, dict):
353
+ merged.update(item)
354
+ raw_context = merged
355
+ extra_context = {
356
+ k: v for k, v in raw_context.items() if k not in _JSONLD_CONTEXT
357
+ }
351
358
 
352
359
  vocab_version = Version(graph.get("trov:vocabularyVersion", "0.0.1"))
353
360
  if vocab_version < TROV_VOCABULARY_VERSION:
@@ -15,7 +15,6 @@ import pathlib
15
15
  import subprocess
16
16
  import tempfile
17
17
 
18
- import gnupg
19
18
  from jinja2 import Template
20
19
  import requests
21
20
  import rfc3161ng
@@ -30,10 +29,12 @@ GPG_HOME = os.environ.get("GPG_HOME")
30
29
 
31
30
 
32
31
  class TRO:
32
+ gpg_fingerprint = None
33
33
  gpg_key_id = None
34
34
  gpg_passphrase = None
35
35
  basename = None
36
36
  profile = None
37
+ _gpg_obj = None
37
38
 
38
39
  def __init__(
39
40
  self,
@@ -82,12 +83,13 @@ class TRO:
82
83
  self._model = TransparentResearchObject.load(self.tro_filename)
83
84
 
84
85
  if extra_context:
85
- self._model.extra_context.extend(extra_context)
86
+ self._model.extra_context.update(extra_context)
86
87
 
87
- self.gpg = gnupg.GPG(gnupghome=GPG_HOME, verbose=False)
88
+ # GPG configuration is only recorded here; nothing touches the keyring
89
+ # until a signature is actually produced. See _gpg() and
90
+ # attach_public_key().
88
91
  if gpg_fingerprint:
89
- self.gpg_key_id = self.gpg.list_keys().key_map[gpg_fingerprint]["keyid"]
90
- self._model.trs.public_key = self.gpg.export_keys(self.gpg_key_id)
92
+ self.gpg_fingerprint = gpg_fingerprint
91
93
  if gpg_passphrase:
92
94
  self.gpg_passphrase = gpg_passphrase
93
95
 
@@ -182,14 +184,53 @@ class TRO:
182
184
  # Signing and timestamping
183
185
  # ------------------------------------------------------------------
184
186
 
185
- def trs_signature(self):
187
+ def _gpg(self):
188
+ """Return the GPG interface, constructing it on first use.
189
+
190
+ Instantiating :class:`gnupg.GPG` spawns the ``gpg`` binary, so it is
191
+ deferred until a key is actually needed. Creating, mutating, saving,
192
+ reporting on and verifying a TRO therefore require neither the binary
193
+ nor a keyring.
194
+ """
195
+ if self._gpg_obj is None:
196
+ import gnupg
197
+
198
+ self._gpg_obj = gnupg.GPG(gnupghome=GPG_HOME, verbose=False)
199
+ return self._gpg_obj
200
+
201
+ def _resolve_key_id(self):
202
+ """Resolve the configured fingerprint against the local keyring."""
203
+ if self.gpg_fingerprint is None:
204
+ raise RuntimeError("GPG fingerprint was not provided")
186
205
  if self.gpg_key_id is None:
206
+ try:
207
+ self.gpg_key_id = (
208
+ self._gpg().list_keys().key_map[self.gpg_fingerprint]["keyid"]
209
+ )
210
+ except KeyError:
211
+ raise RuntimeError(
212
+ f"GPG key {self.gpg_fingerprint} was not found in the keyring"
213
+ ) from None
214
+ return self.gpg_key_id
215
+
216
+ def attach_public_key(self):
217
+ """Record the public half of the signing key in the declaration.
218
+
219
+ Called by :meth:`request_timestamp` before the declaration is hashed or
220
+ signed, so that ``trov:publicKey`` is by construction the public half of
221
+ the key that produced the signature. A value supplied by a TRS profile
222
+ acts as a default until it is replaced here.
223
+ """
224
+ self._model.trs.public_key = self._gpg().export_keys(self._resolve_key_id())
225
+
226
+ def trs_signature(self):
227
+ if self.gpg_fingerprint is None:
187
228
  raise RuntimeError("GPG fingerprint was not provided")
188
229
  if self.gpg_passphrase is None:
189
230
  raise RuntimeError("GPG passphrase was not provided")
190
- signature = self.gpg.sign(
231
+ signature = self._gpg().sign(
191
232
  json.dumps(self.data, indent=2, sort_keys=True),
192
- keyid=self.gpg_key_id,
233
+ keyid=self._resolve_key_id(),
193
234
  passphrase=self.gpg_passphrase,
194
235
  detach=True,
195
236
  )
@@ -198,7 +239,16 @@ class TRO:
198
239
  return signature
199
240
 
200
241
  def request_timestamp(self):
201
- """Request a timestamp from a remote TSA and store the result in a file."""
242
+ """Request a timestamp from a remote TSA and store the result in a file.
243
+
244
+ The public key is attached and the declaration written out *before*
245
+ anything is hashed, so that the signature and the timestamp both cover
246
+ the declaration exactly as it ends up on disk. Injecting the key any
247
+ later — inside :meth:`trs_signature`, say — would make every TRO fail
248
+ its own :meth:`verify_timestamp`.
249
+ """
250
+ self.attach_public_key()
251
+ self.save()
202
252
  rt = rfc3161ng.RemoteTimestamper("https://freetsa.org/tsr", hashname="sha512")
203
253
  ts_data = {
204
254
  "tro_declaration": hashlib.sha512(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tro-utils
3
- Version: 0.4.4
3
+ Version: 0.4.6
4
4
  Summary: Utilities for creating, editing and interacting with TROs
5
5
  Author-email: Kacper Kowalik <xarthisius.kk@gmail.com>, Craig Willis <willis8@illinois.edu>
6
6
  Maintainer-email: Kacper Kowalik <xarthisius.kk@gmail.com>
@@ -65,6 +65,8 @@ tro_utils.egg-info/SOURCES.txt
65
65
  tro_utils.egg-info/dependency_links.txt
66
66
  tro_utils.egg-info/entry_points.txt
67
67
  tro_utils.egg-info/requires.txt
68
+ tro_utils.egg-info/scm_file_list.json
69
+ tro_utils.egg-info/scm_version.json
68
70
  tro_utils.egg-info/top_level.txt
69
71
  tro_utils/models/__init__.py
70
72
  tro_utils/models/_base.py
@@ -0,0 +1,76 @@
1
+ {
2
+ "files": [
3
+ "tox.ini",
4
+ ".travis.yml",
5
+ "MANIFEST.in",
6
+ "requirements_dev.txt",
7
+ "Makefile",
8
+ ".editorconfig",
9
+ "pyproject.toml",
10
+ ".readthedocs.yaml",
11
+ "setup.cfg",
12
+ "LICENSE",
13
+ "README.md",
14
+ "pytest.ini",
15
+ ".gitignore",
16
+ ".coveragerc",
17
+ ".github/ISSUE_TEMPLATE.md",
18
+ ".github/workflows/release.yml",
19
+ ".github/workflows/test.yml",
20
+ "tests/test_replication_package_verification.py",
21
+ "tests/test_models_hash_value.py",
22
+ "tests/test_tro_hashing.py",
23
+ "tests/helpers.py",
24
+ "tests/test_models_transparent_research_object.py",
25
+ "tests/test_models_composition_fingerprint.py",
26
+ "tests/test_tro_performances.py",
27
+ "tests/test_replication_package_model.py",
28
+ "tests/test_tro_save_load.py",
29
+ "tests/__init__.py",
30
+ "tests/test_models_tsa.py",
31
+ "tests/test_version.py",
32
+ "tests/test_tro_timestamping.py",
33
+ "tests/test_models_artifact_location.py",
34
+ "tests/test_tro_arrangements.py",
35
+ "tests/test_models_artifact_arrangement.py",
36
+ "tests/test_tro_creation.py",
37
+ "tests/test_models_artifact_composition.py",
38
+ "tests/test_models_research_artifact.py",
39
+ "tests/test_tro_workflow.py",
40
+ "tests/test_models_trs.py",
41
+ "tests/test_tro_reporting.py",
42
+ "tests/test_cli.py",
43
+ "tests/test_tro_utility_methods.py",
44
+ "tests/conftest.py",
45
+ "tests/test_tro_signing.py",
46
+ "tests/test_extra_context.py",
47
+ "tests/test_models_performance.py",
48
+ "docs/requirements.txt",
49
+ "docs/contributing.md",
50
+ "docs/conf.py",
51
+ "docs/usage.md",
52
+ "docs/readme.md",
53
+ "docs/authors.md",
54
+ "docs/Makefile",
55
+ "docs/history.md",
56
+ "docs/make.bat",
57
+ "docs/installation.md",
58
+ "docs/index.md",
59
+ "tro_utils/tro_utils.py",
60
+ "tro_utils/default.jinja2",
61
+ "tro_utils/__init__.py",
62
+ "tro_utils/cli.py",
63
+ "tro_utils/replication_package.py",
64
+ "tro_utils/models/arrangement.py",
65
+ "tro_utils/models/_base.py",
66
+ "tro_utils/models/trs.py",
67
+ "tro_utils/models/tro.py",
68
+ "tro_utils/models/__init__.py",
69
+ "tro_utils/models/artifact.py",
70
+ "tro_utils/models/tsa.py",
71
+ "tro_utils/models/performance.py",
72
+ "tro_utils/models/hash_value.py",
73
+ "tro_utils/models/composition.py",
74
+ "tro_utils/models/attribute.py"
75
+ ]
76
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "0.4.6",
3
+ "distance": 0,
4
+ "node": "gc26932ea17bd09b8fbfdc64659dfe5540679a963",
5
+ "dirty": false,
6
+ "branch": "HEAD",
7
+ "node_date": "2026-07-31"
8
+ }
@@ -1,29 +0,0 @@
1
- """Shared helper functions for tro_utils tests."""
2
-
3
- import os
4
-
5
- from tro_utils.tro_utils import TRO
6
-
7
-
8
- def create_tro_with_gpg(filepath, gpg_setup, **kwargs):
9
- """Helper to create TRO with proper GPG configuration."""
10
- # Set GPG_HOME environment variable
11
- os.environ["GPG_HOME"] = gpg_setup["gpg_home"]
12
-
13
- # Temporarily remove gpg_fingerprint from kwargs to avoid key_map lookup error
14
- gpg_fingerprint = kwargs.pop("gpg_fingerprint", None)
15
-
16
- # Create TRO instance without fingerprint first
17
- tro = TRO(filepath=filepath, **kwargs)
18
-
19
- # Now manually set up the GPG key if fingerprint was provided
20
- # This works around the key_map issue in the gnupg library
21
- if gpg_fingerprint:
22
- tro.gpg = gpg_setup["gpg"]
23
- tro.gpg_key_id = gpg_setup["keyid"]
24
- tro.data["@graph"][0]["trov:wasAssembledBy"]["trov:publicKey"] = (
25
- tro.gpg.export_keys(tro.gpg_key_id)
26
- )
27
- tro.gpg_passphrase = kwargs.get("gpg_passphrase")
28
-
29
- return tro
@@ -1,59 +0,0 @@
1
- """Tests for TRO signing and verification."""
2
-
3
- import os
4
-
5
- import pytest
6
-
7
- from tro_utils.tro_utils import TRO
8
-
9
- from tests.helpers import create_tro_with_gpg
10
-
11
-
12
- class TestTROSigning:
13
- """Test TRO signing and verification."""
14
-
15
- def test_sign_tro(self, temp_workspace, tmp_path, gpg_setup, trs_profile):
16
- """Test signing a TRO with GPG."""
17
- tro = create_tro_with_gpg(
18
- filepath=str(tmp_path / "test_tro.jsonld"),
19
- gpg_setup=gpg_setup,
20
- profile=trs_profile,
21
- gpg_fingerprint=gpg_setup["fingerprint"],
22
- gpg_passphrase=gpg_setup["passphrase"],
23
- )
24
-
25
- # Add some content
26
- tro.add_arrangement(str(temp_workspace), comment="Test")
27
- tro.save()
28
-
29
- # Sign the TRO
30
- signature = tro.trs_signature()
31
-
32
- assert signature is not None
33
- assert len(str(signature)) > 0
34
-
35
- # Verify signature file was created
36
- assert os.path.exists(tro.sig_filename)
37
-
38
- # Verify signature content
39
- with open(tro.sig_filename, "r") as f:
40
- sig_content = f.read()
41
- assert "BEGIN PGP SIGNATURE" in sig_content
42
-
43
- def test_sign_without_gpg_key(self, tmp_path):
44
- """Test that signing without GPG key raises error."""
45
- tro = TRO(filepath=str(tmp_path / "test_tro.jsonld"))
46
-
47
- with pytest.raises(RuntimeError, match="GPG fingerprint was not provided"):
48
- tro.trs_signature()
49
-
50
- def test_sign_without_passphrase(self, tmp_path, gpg_setup):
51
- """Test that signing without passphrase raises error."""
52
- tro = create_tro_with_gpg(
53
- filepath=str(tmp_path / "test_tro.jsonld"),
54
- gpg_setup=gpg_setup,
55
- gpg_fingerprint=gpg_setup["fingerprint"],
56
- )
57
-
58
- with pytest.raises(RuntimeError, match="GPG passphrase was not provided"):
59
- tro.trs_signature()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes