orangecheck 2.5.1__tar.gz → 2.5.2__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 (70) hide show
  1. {orangecheck-2.5.1 → orangecheck-2.5.2}/CHANGELOG.md +8 -0
  2. {orangecheck-2.5.1 → orangecheck-2.5.2}/PKG-INFO +1 -1
  3. {orangecheck-2.5.1 → orangecheck-2.5.2}/orangecheck/__init__.py +1 -1
  4. {orangecheck-2.5.1 → orangecheck-2.5.2}/orangecheck/pledge/envelopes.py +6 -0
  5. {orangecheck-2.5.1 → orangecheck-2.5.2}/pyproject.toml +1 -1
  6. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/pledge/test_delegation.py +24 -0
  7. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/pledge/test_vectors.py +12 -1
  8. {orangecheck-2.5.1 → orangecheck-2.5.2}/.gitignore +0 -0
  9. {orangecheck-2.5.1 → orangecheck-2.5.2}/README.md +0 -0
  10. {orangecheck-2.5.1 → orangecheck-2.5.2}/orangecheck/__main__.py +0 -0
  11. {orangecheck-2.5.1 → orangecheck-2.5.2}/orangecheck/address.py +0 -0
  12. {orangecheck-2.5.1 → orangecheck-2.5.2}/orangecheck/bond.py +0 -0
  13. {orangecheck-2.5.1 → orangecheck-2.5.2}/orangecheck/canonical.py +0 -0
  14. {orangecheck-2.5.1 → orangecheck-2.5.2}/orangecheck/client.py +0 -0
  15. {orangecheck-2.5.1 → orangecheck-2.5.2}/orangecheck/errors.py +0 -0
  16. {orangecheck-2.5.1 → orangecheck-2.5.2}/orangecheck/integrator.py +0 -0
  17. {orangecheck-2.5.1 → orangecheck-2.5.2}/orangecheck/pledge/__init__.py +0 -0
  18. {orangecheck-2.5.1 → orangecheck-2.5.2}/orangecheck/pledge/bond.py +0 -0
  19. {orangecheck-2.5.1 → orangecheck-2.5.2}/orangecheck/pledge/canonical.py +0 -0
  20. {orangecheck-2.5.1 → orangecheck-2.5.2}/orangecheck/pledge/delegation.py +0 -0
  21. {orangecheck-2.5.1 → orangecheck-2.5.2}/orangecheck/pledge/resolution.py +0 -0
  22. {orangecheck-2.5.1 → orangecheck-2.5.2}/orangecheck/pledge/state.py +0 -0
  23. {orangecheck-2.5.1 → orangecheck-2.5.2}/orangecheck/py.typed +0 -0
  24. {orangecheck-2.5.1 → orangecheck-2.5.2}/orangecheck/top_level.py +0 -0
  25. {orangecheck-2.5.1 → orangecheck-2.5.2}/orangecheck/types.py +0 -0
  26. {orangecheck-2.5.1 → orangecheck-2.5.2}/orangecheck/verify_sig.py +0 -0
  27. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/fixtures/bip137-parity.json +0 -0
  28. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/fixtures/bip322-js-6.1.8.json +0 -0
  29. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/fixtures/bip322-official-basic.json +0 -0
  30. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/fixtures/bip322-official-generated.json +0 -0
  31. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/pledge/__init__.py +0 -0
  32. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/pledge/test_authority.py +0 -0
  33. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/pledge/test_wrap.py +0 -0
  34. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/test_address.py +0 -0
  35. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/test_bip322_official.py +0 -0
  36. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/test_client.py +0 -0
  37. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/test_client_failure_modes.py +0 -0
  38. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/test_conformance.py +0 -0
  39. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/test_integrator_vectors.py +0 -0
  40. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/test_ripemd160.py +0 -0
  41. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/test_signature_parity.py +0 -0
  42. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/vectors/index.json +0 -0
  43. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/vectors/tv01.json +0 -0
  44. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/vectors/tv02.json +0 -0
  45. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/vectors/tv03.json +0 -0
  46. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/vectors/tv04.json +0 -0
  47. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/vectors/tv05.json +0 -0
  48. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/vectors/tv06.json +0 -0
  49. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/vectors/tv07.json +0 -0
  50. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/vectors/tv08.json +0 -0
  51. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/vectors/tv09.json +0 -0
  52. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/vectors/tv10.json +0 -0
  53. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/vectors/tv11.json +0 -0
  54. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/vectors/tv12.json +0 -0
  55. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/vectors/tv13.json +0 -0
  56. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/vectors/tv14.json +0 -0
  57. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/vectors/tv15.json +0 -0
  58. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/vectors/tv16.json +0 -0
  59. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/vectors/tv17.json +0 -0
  60. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/vectors/tv18.json +0 -0
  61. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/vectors/tv19.json +0 -0
  62. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/vectors/tv20.json +0 -0
  63. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/vectors/tv21.json +0 -0
  64. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/vectors/tv22.json +0 -0
  65. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/vectors/tv23.json +0 -0
  66. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/vectors/tv24.json +0 -0
  67. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/vectors/tv25.json +0 -0
  68. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/vectors/tv26.json +0 -0
  69. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/vectors/tv27.json +0 -0
  70. {orangecheck-2.5.1 → orangecheck-2.5.2}/tests/vectors/tv28.json +0 -0
@@ -4,6 +4,14 @@ All notable changes to the **`orangecheck`** Python package. Follows
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
5
5
  [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [2.5.2] — 2026-10-22
8
+
9
+ ### Fixed — an agent pledge's agent is never its swearer
10
+
11
+ As `@orangecheck/pledge-core` 3.2.2 (SPEC §7.3). `verify_pledge` refuses an
12
+ envelope whose `agent_address` equals `swearer.address` (`E_PLEDGE_MALFORMED`).
13
+ Vector `v33`.
14
+
7
15
  ## [2.5.1] — 2026-10-22
8
16
 
9
17
  ### Fixed — a signed outcome dated after expires_at comes too late
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: orangecheck
3
- Version: 2.5.1
3
+ Version: 2.5.2
4
4
  Summary: Python SDK for OrangeCheck — proof of Bitcoin stake, the OC Pledge primitive, and ochk.app sign-in for your backend.
5
5
  Project-URL: Homepage, https://ochk.io
6
6
  Project-URL: Documentation, https://ochk.io/docs
@@ -139,7 +139,7 @@ __all__ = [
139
139
  "VerificationError",
140
140
  ]
141
141
 
142
- __version__ = "2.5.1"
142
+ __version__ = "2.5.2"
143
143
 
144
144
  # OC Pledge submodule — sibling primitive for forward-looking commitments
145
145
  # bound to a Bitcoin address. Imported here so consumers can write:
@@ -511,6 +511,12 @@ def _check_pledge_shape(env: dict[str, Any]) -> Optional[VerifyErr]:
511
511
  "E_PLEDGE_MALFORMED",
512
512
  "envelope.agent_address required when via_delegation present",
513
513
  )
514
+ # SPEC §7.3: the agent is never the swearer. Neither field is in the id.
515
+ if env.get("agent_address") == swearer.get("address"):
516
+ return _err(
517
+ "E_PLEDGE_MALFORMED",
518
+ "envelope.agent_address must differ from swearer.address (§7.3)",
519
+ )
514
520
  # SPEC §3.6 vs §7.3 contradiction documented in pledge-core: under
515
521
  # §7.3 the sig.pubkey is informational; the verifier uses
516
522
  # agent_address as the BIP-322 key. We accept either reading.
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "orangecheck"
7
- version = "2.5.1"
7
+ version = "2.5.2"
8
8
  description = "Python SDK for OrangeCheck — proof of Bitcoin stake, the OC Pledge primitive, and ochk.app sign-in for your backend."
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -183,6 +183,30 @@ def test_verify_passes_with_delegation():
183
183
  assert r.ok
184
184
 
185
185
 
186
+ def test_verify_refuses_agent_address_equal_to_swearer():
187
+ # via_delegation and agent_address are outside the id, so anyone can add
188
+ # them to a copy of a pledge the swearer signed directly (SPEC §7.3).
189
+ copy = dict(_pledge(), agent_address="bc1qprincipal")
190
+ copy["sig"] = dict(copy["sig"], pubkey="bc1qprincipal")
191
+ self_delegation = _delegation({"agent": "bc1qprincipal"})
192
+ for kwargs in (
193
+ {"skip_delegation_verification": True},
194
+ {"delegation_lookup": lambda _id, _now: self_delegation},
195
+ ):
196
+ r = verify_pledge(copy, skip_signature_verification=True, **kwargs)
197
+ assert not r.ok
198
+ assert (r.code, r.message) == (
199
+ "E_PLEDGE_MALFORMED",
200
+ "envelope.agent_address must differ from swearer.address (§7.3)",
201
+ )
202
+ audit = verify_pledge_as_of_sworn_at(
203
+ copy,
204
+ skip_signature_verification=True,
205
+ delegation_lookup=lambda _id, _now: self_delegation,
206
+ )
207
+ assert not audit.ok
208
+
209
+
186
210
  def test_verify_e_delegation_not_found_when_lookup_returns_none():
187
211
  r = verify_pledge(
188
212
  _pledge(),
@@ -356,13 +356,24 @@ def _outcome_stub(pledge_id: str, outcome: str, resolved_at: str) -> dict[str, A
356
356
  }
357
357
 
358
358
 
359
- # ─── Shape C — malformed-input (v28) ──────────────────────────────────────
359
+ # ─── Shape C — malformed-input (v28, v33) ──────────────────────────────────
360
360
 
361
361
 
362
362
  def _run_malformed(vec: dict[str, Any]) -> None:
363
363
  inputs = vec["inputs"]
364
364
  expected_error = vec["expected"]["error"]
365
365
 
366
+ # v33: a whole envelope that verification MUST refuse.
367
+ if "envelope" in inputs:
368
+ r = verify_pledge(
369
+ inputs["envelope"],
370
+ skip_signature_verification=True,
371
+ skip_delegation_verification=True,
372
+ )
373
+ assert not r.ok
374
+ assert r.code == expected_error
375
+ return
376
+
366
377
  class _NoopSigner:
367
378
  def __init__(self, address: str) -> None:
368
379
  self.address = address
File without changes
File without changes