orangecheck 3.3.0__tar.gz → 3.3.1__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 (75) hide show
  1. {orangecheck-3.3.0 → orangecheck-3.3.1}/CHANGELOG.md +10 -0
  2. {orangecheck-3.3.0 → orangecheck-3.3.1}/PKG-INFO +1 -1
  3. {orangecheck-3.3.0 → orangecheck-3.3.1}/orangecheck/__init__.py +1 -1
  4. {orangecheck-3.3.0 → orangecheck-3.3.1}/orangecheck/integrator.py +13 -6
  5. {orangecheck-3.3.0 → orangecheck-3.3.1}/pyproject.toml +1 -1
  6. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/test_integrator_vectors.py +7 -2
  7. {orangecheck-3.3.0 → orangecheck-3.3.1}/.gitignore +0 -0
  8. {orangecheck-3.3.0 → orangecheck-3.3.1}/README.md +0 -0
  9. {orangecheck-3.3.0 → orangecheck-3.3.1}/orangecheck/__main__.py +0 -0
  10. {orangecheck-3.3.0 → orangecheck-3.3.1}/orangecheck/address.py +0 -0
  11. {orangecheck-3.3.0 → orangecheck-3.3.1}/orangecheck/bond.py +0 -0
  12. {orangecheck-3.3.0 → orangecheck-3.3.1}/orangecheck/canonical.py +0 -0
  13. {orangecheck-3.3.0 → orangecheck-3.3.1}/orangecheck/client.py +0 -0
  14. {orangecheck-3.3.0 → orangecheck-3.3.1}/orangecheck/connect.py +0 -0
  15. {orangecheck-3.3.0 → orangecheck-3.3.1}/orangecheck/errors.py +0 -0
  16. {orangecheck-3.3.0 → orangecheck-3.3.1}/orangecheck/pledge/__init__.py +0 -0
  17. {orangecheck-3.3.0 → orangecheck-3.3.1}/orangecheck/pledge/bond.py +0 -0
  18. {orangecheck-3.3.0 → orangecheck-3.3.1}/orangecheck/pledge/canonical.py +0 -0
  19. {orangecheck-3.3.0 → orangecheck-3.3.1}/orangecheck/pledge/delegation.py +0 -0
  20. {orangecheck-3.3.0 → orangecheck-3.3.1}/orangecheck/pledge/envelopes.py +0 -0
  21. {orangecheck-3.3.0 → orangecheck-3.3.1}/orangecheck/pledge/resolution.py +0 -0
  22. {orangecheck-3.3.0 → orangecheck-3.3.1}/orangecheck/pledge/state.py +0 -0
  23. {orangecheck-3.3.0 → orangecheck-3.3.1}/orangecheck/py.typed +0 -0
  24. {orangecheck-3.3.0 → orangecheck-3.3.1}/orangecheck/tokens.py +0 -0
  25. {orangecheck-3.3.0 → orangecheck-3.3.1}/orangecheck/top_level.py +0 -0
  26. {orangecheck-3.3.0 → orangecheck-3.3.1}/orangecheck/types.py +0 -0
  27. {orangecheck-3.3.0 → orangecheck-3.3.1}/orangecheck/verify_sig.py +0 -0
  28. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/fixtures/bip137-parity.json +0 -0
  29. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/fixtures/bip322-js-6.1.8.json +0 -0
  30. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/fixtures/bip322-official-basic.json +0 -0
  31. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/fixtures/bip322-official-generated.json +0 -0
  32. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/pledge/__init__.py +0 -0
  33. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/pledge/test_authority.py +0 -0
  34. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/pledge/test_create_signers.py +0 -0
  35. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/pledge/test_delegation.py +0 -0
  36. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/pledge/test_vectors.py +0 -0
  37. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/pledge/test_wrap.py +0 -0
  38. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/test_address.py +0 -0
  39. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/test_bip322_official.py +0 -0
  40. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/test_client.py +0 -0
  41. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/test_client_failure_modes.py +0 -0
  42. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/test_conformance.py +0 -0
  43. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/test_connect.py +0 -0
  44. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/test_ripemd160.py +0 -0
  45. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/test_server_helpers.py +0 -0
  46. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/test_signature_parity.py +0 -0
  47. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/vectors/index.json +0 -0
  48. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/vectors/tv01.json +0 -0
  49. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/vectors/tv02.json +0 -0
  50. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/vectors/tv03.json +0 -0
  51. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/vectors/tv04.json +0 -0
  52. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/vectors/tv05.json +0 -0
  53. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/vectors/tv06.json +0 -0
  54. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/vectors/tv07.json +0 -0
  55. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/vectors/tv08.json +0 -0
  56. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/vectors/tv09.json +0 -0
  57. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/vectors/tv10.json +0 -0
  58. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/vectors/tv11.json +0 -0
  59. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/vectors/tv12.json +0 -0
  60. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/vectors/tv13.json +0 -0
  61. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/vectors/tv14.json +0 -0
  62. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/vectors/tv15.json +0 -0
  63. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/vectors/tv16.json +0 -0
  64. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/vectors/tv17.json +0 -0
  65. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/vectors/tv18.json +0 -0
  66. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/vectors/tv19.json +0 -0
  67. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/vectors/tv20.json +0 -0
  68. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/vectors/tv21.json +0 -0
  69. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/vectors/tv22.json +0 -0
  70. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/vectors/tv23.json +0 -0
  71. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/vectors/tv24.json +0 -0
  72. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/vectors/tv25.json +0 -0
  73. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/vectors/tv26.json +0 -0
  74. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/vectors/tv27.json +0 -0
  75. {orangecheck-3.3.0 → orangecheck-3.3.1}/tests/vectors/tv28.json +0 -0
@@ -4,6 +4,16 @@ 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
+ ## [3.3.1] — 2026-10-24
8
+
9
+ ### Changed
10
+
11
+ - `RevocationList` reads the `tokens` of its audience's list and answers
12
+ `"revoked"` for a token whose own `jti` is there, as
13
+ `@orangecheck/auth-core`'s `integratorRevocationCheck` does, so a token ended
14
+ with `revoke_token` stops passing once me.ochk.io lists it. `status()` and
15
+ `status_for()` take the jti (shared vectors "a token ended on its own").
16
+
7
17
  ## [3.3.0] — 2026-10-24
8
18
 
9
19
  ### Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: orangecheck
3
- Version: 3.3.0
3
+ Version: 3.3.1
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
@@ -207,7 +207,7 @@ __all__ = [
207
207
  "VerificationError",
208
208
  ]
209
209
 
210
- __version__ = "3.3.0"
210
+ __version__ = "3.3.1"
211
211
 
212
212
  # OC Pledge submodule — sibling primitive for forward-looking commitments
213
213
  # bound to a Bitcoin address. Imported here so consumers can write:
@@ -371,6 +371,7 @@ class _AudienceList:
371
371
  + quote(aud, safe="-_.!~*'()")
372
372
  )
373
373
  self._handles: dict[str, float] = {}
374
+ self._tokens: frozenset[str] = frozenset()
374
375
  self._at: Optional[float] = None
375
376
  # How old the list already was when fetched, by the wall clock.
376
377
  self._age_at_fetch = float("inf")
@@ -408,6 +409,7 @@ class _AudienceList:
408
409
  raw = doc.get("handles")
409
410
  handles: dict[str, Any] = raw if isinstance(raw, dict) else {}
410
411
  self._handles = {k: float(v) for k, v in handles.items() if _finite(v)}
412
+ self._tokens = frozenset(t for t in doc["tokens"] if isinstance(t, str))
411
413
  at: Any = doc.get("at")
412
414
  self._at = float(at) if _finite(at) else None
413
415
  self._age_at_fetch = float("inf") if self._at is None else time.time() - self._at
@@ -449,11 +451,14 @@ class _AudienceList:
449
451
  return WarmPart("failed", problem)
450
452
  return _FETCHED if self._fetched_at != before else _KEPT
451
453
 
452
- def status(self, rh: str, iat: Optional[float]) -> str:
454
+ def status(self, rh: str, iat: Optional[float], jti: Optional[str] = None) -> str:
453
455
  with self._lock:
454
456
  self._refresh()
455
457
  if self._fetched_at is None:
456
458
  return "unverified"
459
+ # A token known to be ended stays ended, however old the copy.
460
+ if isinstance(jti, str) and revocation_key("jti", jti) in self._tokens:
461
+ return "revoked"
457
462
  cutoff = self._handles.get(rh)
458
463
  if cutoff is not None and not (iat is not None and iat >= cutoff):
459
464
  return "revoked"
@@ -507,10 +512,12 @@ class RevocationList:
507
512
  lst = self._lists[aud] = _AudienceList(self, aud)
508
513
  return lst
509
514
 
510
- def status(self, rh: Optional[str], aud: Optional[str], iat: Optional[float]) -> str:
515
+ def status(
516
+ self, rh: Optional[str], aud: Optional[str], iat: Optional[float], jti: Optional[str] = None
517
+ ) -> str:
511
518
  if rh is None:
512
519
  return "live"
513
- return self._status(rh, aud, iat)
520
+ return self._status(rh, aud, iat, jti)
514
521
 
515
522
  def status_for(self, claims: Mapping[str, Any]) -> str:
516
523
  """
@@ -520,12 +527,12 @@ class RevocationList:
520
527
  """
521
528
  if "rh" not in claims:
522
529
  return "live"
523
- return self._status(claims["rh"], claims.get("aud"), claims.get("iat"))
530
+ return self._status(claims["rh"], claims.get("aud"), claims.get("iat"), claims.get("jti"))
524
531
 
525
- def _status(self, rh: Any, aud: Any, iat: Optional[float]) -> str:
532
+ def _status(self, rh: Any, aud: Any, iat: Optional[float], jti: Any = None) -> str:
526
533
  if not isinstance(rh, str) or not rh or not isinstance(aud, str) or not aud:
527
534
  return "revoked"
528
- return self._list(aud).status(rh, iat)
535
+ return self._list(aud).status(rh, iat, jti)
529
536
 
530
537
 
531
538
  # ─── who may sign in (coin backing) ──────────────────────────────────────
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "orangecheck"
7
- version = "3.3.0"
7
+ version = "3.3.1"
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" }
@@ -258,15 +258,20 @@ def test_revocation_key_matches_the_node_sdk(v: dict[str, Any]) -> None:
258
258
  assert revocation_key("sub", v["sub"]) == v["key"]
259
259
 
260
260
 
261
+ @pytest.mark.parametrize("v", R["token_keys"], ids=lambda v: v["jti"])
262
+ def test_token_key_matches_the_node_sdk(v: dict[str, Any]) -> None:
263
+ assert revocation_key("jti", v["jti"]) == v["key"]
264
+
265
+
261
266
  @respx.mock
262
267
  @pytest.mark.parametrize("v", R["sessions"], ids=lambda v: v["name"])
263
268
  def test_revocations_decide_as_the_node_sdk_does(v: dict[str, Any]) -> None:
264
269
  _serve_lists()
265
270
  # A key absent from the vector is absent from the claims; null stays null.
266
- claims = {k: v[k] for k in ("rh", "aud", "iat") if k in v}
271
+ claims = {k: v[k] for k in ("rh", "aud", "iat", "jti") if k in v}
267
272
  assert _revocations().status_for(claims) == v["status"]
268
273
  if "rh" not in v or v["rh"] is not None:
269
- assert _revocations().status(v.get("rh"), v["aud"], v["iat"]) == v["status"]
274
+ assert _revocations().status(v.get("rh"), v["aud"], v["iat"], v.get("jti")) == v["status"]
270
275
 
271
276
 
272
277
  @respx.mock
File without changes
File without changes