feat: migrate refimpls from draft-00 to draft-01 claim names
- Rename `par` to `pred` (predecessor) in types, serialization, tests - Remove `pol`, `pol_decision` from core payload; move to `ect_ext` - Remove `sub` from payload (not part of ECT spec) - Update `typ` from `wimse-exec+jwt` to `exec+jwt` (accept both) - Rename MaxParLength to MaxPredLength everywhere - Update testdata, demos, READMEs with migration table - All Go tests pass, all 56 Python tests pass (90% coverage)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# WIMSE ECT — Python Reference Implementation
|
||||
|
||||
Python reference implementation of [Execution Context Tokens (ECTs)](../../draft-nennemann-wimse-execution-context-00.txt) for WIMSE. Implements ECT creation (ES256), verification (Section 7), DAG validation (Section 6), and an in-memory audit ledger (Section 9).
|
||||
Python reference implementation of [Execution Context Tokens (ECTs)](../../draft-nennemann-wimse-execution-context-01.txt) for WIMSE. Implements ECT creation (ES256), verification (Section 7), DAG validation (Section 6), and an in-memory audit ledger (Section 9).
|
||||
|
||||
## Layout
|
||||
|
||||
@@ -42,7 +42,6 @@ from ect import (
|
||||
verify,
|
||||
VerifyOptions,
|
||||
MemoryLedger,
|
||||
POL_DECISION_APPROVED,
|
||||
)
|
||||
|
||||
cfg = load_config_from_env()
|
||||
@@ -54,9 +53,11 @@ payload = Payload(
|
||||
exp=int(time.time()) + 600,
|
||||
jti="550e8400-e29b-41d4-a716-446655440000",
|
||||
exec_act="review_spec",
|
||||
par=[],
|
||||
pol="policy_v1",
|
||||
pol_decision=POL_DECISION_APPROVED,
|
||||
pred=[],
|
||||
ext={
|
||||
"pol": "policy_v1",
|
||||
"pol_decision": "approved",
|
||||
},
|
||||
)
|
||||
compact = create(payload, key, cfg.create_options("agent-a-key"))
|
||||
|
||||
@@ -83,6 +84,16 @@ cd refimpl/python && python3 -m pytest tests/ -v
|
||||
|
||||
Unit tests require **90% coverage** minimum (`pytest` is configured with `--cov-fail-under=90` in `pyproject.toml`). Install dev deps: `pip install -e ".[dev]"`. Uncovered lines are mainly abstract base methods and a few verify branches that need manually built tokens.
|
||||
|
||||
## draft-01 claim changes
|
||||
|
||||
| -00 (previous) | -01 (current) | Notes |
|
||||
|----------------|---------------|-------|
|
||||
| `par` | `pred` | Predecessor task IDs |
|
||||
| `pol`, `pol_decision` | removed (use `ect_ext`) | Policy claims moved to extension object |
|
||||
| `sub` | not defined | Standard JWT claim, not part of ECT spec |
|
||||
| `typ: wimse-exec+jwt` | `typ: exec+jwt` (preferred) | Both accepted for backward compat |
|
||||
| `max_par_length` | `max_pred_length` | Renamed to match `pred` claim |
|
||||
|
||||
## Production configuration (environment)
|
||||
|
||||
Same env vars as the Go refimpl: `ECT_IAT_MAX_AGE_MINUTES`, `ECT_IAT_MAX_FUTURE_SEC`, `ECT_DEFAULT_EXPIRY_MIN`, `ECT_JTI_REPLAY_CACHE_SIZE`, `ECT_JTI_REPLAY_TTL_MIN`.
|
||||
|
||||
Reference in New Issue
Block a user