orangecheck 3.2.0__tar.gz → 3.2.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.
- {orangecheck-3.2.0 → orangecheck-3.2.1}/CHANGELOG.md +10 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/PKG-INFO +1 -1
- {orangecheck-3.2.0 → orangecheck-3.2.1}/orangecheck/__init__.py +1 -1
- {orangecheck-3.2.0 → orangecheck-3.2.1}/orangecheck/integrator.py +5 -1
- {orangecheck-3.2.0 → orangecheck-3.2.1}/pyproject.toml +1 -1
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/test_integrator_vectors.py +23 -3
- {orangecheck-3.2.0 → orangecheck-3.2.1}/.gitignore +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/README.md +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/orangecheck/__main__.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/orangecheck/address.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/orangecheck/bond.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/orangecheck/canonical.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/orangecheck/client.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/orangecheck/connect.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/orangecheck/errors.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/orangecheck/pledge/__init__.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/orangecheck/pledge/bond.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/orangecheck/pledge/canonical.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/orangecheck/pledge/delegation.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/orangecheck/pledge/envelopes.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/orangecheck/pledge/resolution.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/orangecheck/pledge/state.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/orangecheck/py.typed +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/orangecheck/tokens.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/orangecheck/top_level.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/orangecheck/types.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/orangecheck/verify_sig.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/fixtures/bip137-parity.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/fixtures/bip322-js-6.1.8.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/fixtures/bip322-official-basic.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/fixtures/bip322-official-generated.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/pledge/__init__.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/pledge/test_authority.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/pledge/test_create_signers.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/pledge/test_delegation.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/pledge/test_vectors.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/pledge/test_wrap.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/test_address.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/test_bip322_official.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/test_client.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/test_client_failure_modes.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/test_conformance.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/test_connect.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/test_ripemd160.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/test_server_helpers.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/test_signature_parity.py +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/vectors/index.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/vectors/tv01.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/vectors/tv02.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/vectors/tv03.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/vectors/tv04.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/vectors/tv05.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/vectors/tv06.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/vectors/tv07.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/vectors/tv08.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/vectors/tv09.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/vectors/tv10.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/vectors/tv11.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/vectors/tv12.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/vectors/tv13.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/vectors/tv14.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/vectors/tv15.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/vectors/tv16.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/vectors/tv17.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/vectors/tv18.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/vectors/tv19.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/vectors/tv20.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/vectors/tv21.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/vectors/tv22.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/vectors/tv23.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/vectors/tv24.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/vectors/tv25.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/vectors/tv26.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.1}/tests/vectors/tv27.json +0 -0
- {orangecheck-3.2.0 → orangecheck-3.2.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.2.1] — 2026-10-24
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- A key set that answers with no Ed25519 key counts as a failed fetch, as in
|
|
12
|
+
`@orangecheck/auth-core` 2.17.0: the copy held stands in, and with none held
|
|
13
|
+
`check_oc_session` answers 503 `key_set_unavailable` (shared vector "a key set
|
|
14
|
+
with no key the verifier can use"). It answered 401, signing out everyone. To
|
|
15
|
+
withdraw a key, the host publishes the set without it.
|
|
16
|
+
|
|
7
17
|
## [3.2.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.2.
|
|
3
|
+
Version: 3.2.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
|
|
@@ -205,7 +205,7 @@ __all__ = [
|
|
|
205
205
|
"VerificationError",
|
|
206
206
|
]
|
|
207
207
|
|
|
208
|
-
__version__ = "3.2.
|
|
208
|
+
__version__ = "3.2.1"
|
|
209
209
|
|
|
210
210
|
# OC Pledge submodule — sibling primitive for forward-looking commitments
|
|
211
211
|
# bound to a Bitcoin address. Imported here so consumers can write:
|
|
@@ -209,7 +209,11 @@ class _KeySet:
|
|
|
209
209
|
r = httpx.get(self.url, headers={"Accept": "application/json"}, timeout=10.0)
|
|
210
210
|
r.raise_for_status()
|
|
211
211
|
doc = r.json()
|
|
212
|
-
|
|
212
|
+
keys = _import_jwks(doc)
|
|
213
|
+
# No key this verifier can use is a misdeploy at the host, not a reason to refuse every token.
|
|
214
|
+
if not keys:
|
|
215
|
+
raise ValueError("JWKS has no Ed25519 key")
|
|
216
|
+
self._keys = keys
|
|
213
217
|
self._retired = _retired_at(doc)
|
|
214
218
|
self._fetched_at, self._fetched_wall = _clock(), time.time()
|
|
215
219
|
self._error = None
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "orangecheck"
|
|
7
|
-
version = "3.2.
|
|
7
|
+
version = "3.2.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" }
|
|
@@ -10,6 +10,7 @@ backend can't drift apart. Regenerate with
|
|
|
10
10
|
|
|
11
11
|
from __future__ import annotations
|
|
12
12
|
|
|
13
|
+
import base64
|
|
13
14
|
import json
|
|
14
15
|
import os
|
|
15
16
|
import threading
|
|
@@ -21,6 +22,8 @@ import httpx
|
|
|
21
22
|
from urllib.parse import quote
|
|
22
23
|
import pytest
|
|
23
24
|
import respx
|
|
25
|
+
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
|
|
26
|
+
from cryptography.hazmat.primitives.serialization import Encoding, PublicFormat
|
|
24
27
|
|
|
25
28
|
import orangecheck.integrator as integrator
|
|
26
29
|
from orangecheck import (
|
|
@@ -149,6 +152,18 @@ def test_webhook_stops_leaning_on_a_key_set_six_hours_old(fresh_key_sets: None)
|
|
|
149
152
|
assert err.value.reason == "key_set_unavailable"
|
|
150
153
|
|
|
151
154
|
|
|
155
|
+
@respx.mock
|
|
156
|
+
def test_session_keeps_a_key_set_when_the_set_comes_back_with_no_usable_key(fresh_key_sets: None) -> None:
|
|
157
|
+
# An empty or unusable set is a misdeploy at the host: the copy held stands in, as for an outage.
|
|
158
|
+
respx.get("https://ochk.io/.well-known/jwks.json").mock(
|
|
159
|
+
side_effect=[httpx.Response(200, json=V["session"]["jwks"]), httpx.Response(200, json={"keys": [{"kty": "EC", "kid": "x"}]})]
|
|
160
|
+
)
|
|
161
|
+
v = V["session"]["valid"][0]
|
|
162
|
+
verify_session(v["token"], v["audience"])
|
|
163
|
+
integrator._session_keys._fetched_at = V["now"] - 3600
|
|
164
|
+
assert verify_session(v["token"], v["audience"]).did_oc == v["claims"]["did_oc"]
|
|
165
|
+
|
|
166
|
+
|
|
152
167
|
@respx.mock
|
|
153
168
|
def test_session_without_any_key_set_is_refused(fresh_key_sets: None) -> None:
|
|
154
169
|
respx.get("https://ochk.io/.well-known/jwks.json").mock(return_value=httpx.Response(503))
|
|
@@ -609,10 +624,12 @@ def test_bond_age_is_counted_as_node_counts_it() -> None:
|
|
|
609
624
|
|
|
610
625
|
@respx.mock
|
|
611
626
|
def test_an_empty_key_set_is_not_fetched_again_on_every_call(fresh_key_sets: None) -> None:
|
|
627
|
+
# An empty set is an outage at the host, retried at most every ten seconds, never a refetch per token.
|
|
612
628
|
route = respx.get("https://ochk.io/.well-known/jwks.json").mock(return_value=httpx.Response(200, json={"keys": []}))
|
|
613
629
|
for _ in range(5):
|
|
614
|
-
|
|
615
|
-
|
|
630
|
+
with pytest.raises(ValueError, match="key set unavailable|no Ed25519 key"):
|
|
631
|
+
integrator._session_keys.get("k1")
|
|
632
|
+
assert route.call_count == 1
|
|
616
633
|
|
|
617
634
|
|
|
618
635
|
@pytest.mark.skipif(not hasattr(os, "fork"), reason="needs fork")
|
|
@@ -886,8 +903,11 @@ def test_after_a_pause_the_key_set_is_fetched_again_and_a_dropped_key_is_gone(
|
|
|
886
903
|
fresh_key_sets: None, monkeypatch: pytest.MonkeyPatch
|
|
887
904
|
) -> None:
|
|
888
905
|
clocks = _Clocks(monkeypatch)
|
|
906
|
+
# The host withdraws a key by publishing the set without it (an empty set reads as an outage).
|
|
907
|
+
other = Ed25519PrivateKey.generate().public_key().public_bytes(Encoding.Raw, PublicFormat.Raw)
|
|
908
|
+
replaced = {"keys": [{"kty": "OKP", "crv": "Ed25519", "kid": "replacement", "x": base64.urlsafe_b64encode(other).rstrip(b"=").decode()}]}
|
|
889
909
|
route = respx.get("https://ochk.io/.well-known/jwks.json").mock(
|
|
890
|
-
side_effect=[httpx.Response(200, json=V["session"]["jwks"])] + [httpx.Response(200, json=
|
|
910
|
+
side_effect=[httpx.Response(200, json=V["session"]["jwks"])] + [httpx.Response(200, json=replaced)] * 2
|
|
891
911
|
)
|
|
892
912
|
kid = V["session"]["jwks"]["keys"][0]["kid"]
|
|
893
913
|
assert integrator._session_keys.get(kid) is not None
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|