sm-revocation 0.1.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 (62) hide show
  1. sm_revocation-0.1.1/.github/CODEOWNERS +1 -0
  2. sm_revocation-0.1.1/.github/workflows/ci.yml +25 -0
  3. sm_revocation-0.1.1/.github/workflows/release.yml +162 -0
  4. sm_revocation-0.1.1/.gitignore +16 -0
  5. sm_revocation-0.1.1/CHANGELOG.md +46 -0
  6. sm_revocation-0.1.1/GOVERNANCE.md +38 -0
  7. sm_revocation-0.1.1/LICENSE +21 -0
  8. sm_revocation-0.1.1/PKG-INFO +189 -0
  9. sm_revocation-0.1.1/PUBLISHING.md +46 -0
  10. sm_revocation-0.1.1/README.md +164 -0
  11. sm_revocation-0.1.1/SPEC.md +676 -0
  12. sm_revocation-0.1.1/THREATMODEL.md +202 -0
  13. sm_revocation-0.1.1/WHITEPAPER.md +136 -0
  14. sm_revocation-0.1.1/conformance/_vector_gen.py +1032 -0
  15. sm_revocation-0.1.1/conformance/vectors/.gitkeep +0 -0
  16. sm_revocation-0.1.1/conformance/vectors/01-answers-revoked-and-not-revoked.json +112 -0
  17. sm_revocation-0.1.1/conformance/vectors/02-answers-heartbeat-advances-as-of.json +115 -0
  18. sm_revocation-0.1.1/conformance/vectors/03-answers-stale-without-a-head.json +92 -0
  19. sm_revocation-0.1.1/conformance/vectors/04-answers-not-covered.json +115 -0
  20. sm_revocation-0.1.1/conformance/vectors/05-answers-behind.json +123 -0
  21. sm_revocation-0.1.1/conformance/vectors/06-objects-rejected-never-raise.json +522 -0
  22. sm_revocation-0.1.1/conformance/vectors/07-chain-genesis-not-policy.json +81 -0
  23. sm_revocation-0.1.1/conformance/vectors/08-chain-policy-changes-subject-kinds.json +84 -0
  24. sm_revocation-0.1.1/conformance/vectors/09-chain-uncovered-kind.json +98 -0
  25. sm_revocation-0.1.1/conformance/vectors/10-carriage-out-of-order-one-at-a-time.json +173 -0
  26. sm_revocation-0.1.1/conformance/vectors/11-carriage-missing-middle-entry.json +173 -0
  27. sm_revocation-0.1.1/conformance/vectors/12-carriage-corrupt-entry-in-page.json +133 -0
  28. sm_revocation-0.1.1/conformance/vectors/13-carriage-old-page-and-head-replayed.json +188 -0
  29. sm_revocation-0.1.1/conformance/vectors/14-carriage-flooded-single-revoke.json +122 -0
  30. sm_revocation-0.1.1/conformance/vectors/15-merging-rules-and-order-independence.json +304 -0
  31. sm_revocation-0.1.1/conformance/vectors/16-merging-backdated-revocation.json +120 -0
  32. sm_revocation-0.1.1/conformance/vectors/17-evidence-fork-head-head-and-head-entry.json +228 -0
  33. sm_revocation-0.1.1/conformance/vectors/18-evidence-fork-entry-entry-through-prev-hash.json +137 -0
  34. sm_revocation-0.1.1/conformance/vectors/19-evidence-order-conflict-exposes-a-freeze.json +532 -0
  35. sm_revocation-0.1.1/conformance/vectors/20-evidence-order-conflict-between-two-heads.json +136 -0
  36. sm_revocation-0.1.1/conformance/vectors/21-evidence-proofs-tampered-and-equivocation.json +208 -0
  37. sm_revocation-0.1.1/conformance/vectors/22-compaction-late-joiner.json +377 -0
  38. sm_revocation-0.1.1/conformance/vectors/23-compaction-adoption-keeps-revocations.json +227 -0
  39. sm_revocation-0.1.1/conformance/vectors/24-compaction-recursive-active-list.json +206 -0
  40. sm_revocation-0.1.1/conformance/vectors/25-compaction-false-digest-on-the-chain.json +114 -0
  41. sm_revocation-0.1.1/conformance/vectors/26-compaction-fork-against-the-anchor.json +79 -0
  42. sm_revocation-0.1.1/conformance/vectors/27-adapter-revoked-set.json +210 -0
  43. sm_revocation-0.1.1/conformance/vectors/28-adapter-dat-checker.json +280 -0
  44. sm_revocation-0.1.1/examples/quick_start.py +76 -0
  45. sm_revocation-0.1.1/pyproject.toml +65 -0
  46. sm_revocation-0.1.1/sm_revocation/__init__.py +79 -0
  47. sm_revocation-0.1.1/sm_revocation/_wire.py +109 -0
  48. sm_revocation-0.1.1/sm_revocation/adapters.py +95 -0
  49. sm_revocation-0.1.1/sm_revocation/conflicts.py +118 -0
  50. sm_revocation-0.1.1/sm_revocation/issuer.py +154 -0
  51. sm_revocation-0.1.1/sm_revocation/objects.py +146 -0
  52. sm_revocation-0.1.1/sm_revocation/payloads.py +242 -0
  53. sm_revocation-0.1.1/sm_revocation/py.typed +0 -0
  54. sm_revocation-0.1.1/sm_revocation/status.py +110 -0
  55. sm_revocation-0.1.1/sm_revocation/view.py +399 -0
  56. sm_revocation-0.1.1/tests/test_conformance_vectors.py +89 -0
  57. sm_revocation-0.1.1/tests/test_docs_run.py +33 -0
  58. sm_revocation-0.1.1/tests/test_edges.py +257 -0
  59. sm_revocation-0.1.1/tests/test_issuer_and_adapters.py +211 -0
  60. sm_revocation-0.1.1/tests/test_merge_and_wire.py +107 -0
  61. sm_revocation-0.1.1/tests/test_never_raises.py +194 -0
  62. sm_revocation-0.1.1/tests/test_packaging.py +14 -0
@@ -0,0 +1 @@
1
+ * @Sharathvc23
@@ -0,0 +1,25 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ python-version: ["3.11", "3.12", "3.13"]
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: actions/setup-python@v5
17
+ with:
18
+ python-version: ${{ matrix.python-version }}
19
+ - run: pip install -e ".[dev]"
20
+ - run: ruff check .
21
+ - run: ruff format --check .
22
+ - run: mypy sm_revocation conformance examples tests
23
+ - run: coverage run -m pytest && coverage report
24
+ - run: python conformance/_vector_gen.py && git diff --exit-code conformance/vectors
25
+ - run: python examples/quick_start.py
@@ -0,0 +1,162 @@
1
+ # Publish sm-revocation to PyPI via PyPI Trusted Publishing (OIDC), and tag the release.
2
+ #
3
+ # No API token anywhere: PyPI is told (once, in its web UI) to trust THIS repo +
4
+ # THIS workflow file, and the `id-token: write` permission below lets the job
5
+ # mint a short-lived OIDC token PyPI accepts. See PUBLISHING.md for the one-time
6
+ # setup and the exact values to type into PyPI's "Add a publisher" form.
7
+ #
8
+ # Two ways in, same job:
9
+ # - a push to `main` whose pyproject `version` is not yet on PyPI → publish it,
10
+ # then create and push the `vX.Y.Z` tag and a GitHub release. The version
11
+ # bump in pyproject.toml IS the release decision; nobody pushes tags by hand.
12
+ # - a pushed `vX.Y.Z` tag (the old path) → publish if not already on PyPI.
13
+ # Either way a version already on PyPI is a no-op, never a red run.
14
+ name: release
15
+
16
+ on:
17
+ push:
18
+ branches: [main, master]
19
+ tags:
20
+ - "v*"
21
+ workflow_dispatch:
22
+
23
+ permissions:
24
+ contents: read
25
+
26
+ concurrency:
27
+ group: release
28
+ cancel-in-progress: false
29
+
30
+ jobs:
31
+ publish:
32
+ name: Build + publish to PyPI + tag
33
+ runs-on: ubuntu-latest
34
+ permissions:
35
+ # A job-level permissions block REPLACES the workflow-level one (it does not
36
+ # merge), so contents must be restated here. `write` is needed to push the
37
+ # tag and create the GitHub release.
38
+ contents: write
39
+ id-token: write # REQUIRED for Trusted Publishing — this is what replaces the token.
40
+ steps:
41
+ - uses: actions/checkout@v4
42
+ with:
43
+ fetch-depth: 0
44
+
45
+ - uses: actions/setup-python@v5
46
+ with:
47
+ python-version: "3.12"
48
+
49
+ - name: Read version and decide
50
+ id: decide
51
+ run: |
52
+ set -euo pipefail
53
+ VERSION=$(python - <<'EOF'
54
+ import tomllib; print(tomllib.load(open("pyproject.toml","rb"))["project"]["version"])
55
+ EOF
56
+ )
57
+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
58
+ if python - "$VERSION" <<'EOF'
59
+ import json, sys, urllib.request
60
+ v = sys.argv[1]
61
+ try:
62
+ with urllib.request.urlopen("https://pypi.org/pypi/sm-revocation/json", timeout=30) as r:
63
+ on_pypi = v in json.load(r)["releases"]
64
+ except Exception as e: # first release, or PyPI hiccup: try to publish
65
+ print("pypi lookup failed:", e); on_pypi = False
66
+ sys.exit(0 if on_pypi else 1)
67
+ EOF
68
+ then
69
+ echo "sm-revocation $VERSION is already on PyPI; nothing to publish."
70
+ echo "publish=false" >> "$GITHUB_OUTPUT"
71
+ else
72
+ echo "sm-revocation $VERSION is not on PyPI; publishing."
73
+ echo "publish=true" >> "$GITHUB_OUTPUT"
74
+ fi
75
+
76
+ - name: Build sdist + wheel
77
+ if: steps.decide.outputs.publish == 'true'
78
+ run: |
79
+ python -m pip install --upgrade build
80
+ python -m build
81
+
82
+ - name: Check the built distributions
83
+ if: steps.decide.outputs.publish == 'true'
84
+ run: |
85
+ python -m pip install --upgrade twine
86
+ python -m twine check dist/*
87
+
88
+ - name: Publish to PyPI
89
+ id: pypi
90
+ if: steps.decide.outputs.publish == 'true'
91
+ # No `with: password:` — the action uses the OIDC token automatically.
92
+ # continue-on-error: until the pending publisher is registered on PyPI
93
+ # (PUBLISHING.md, one-time), this step fails with "invalid-publisher".
94
+ # The tag and GitHub release below still happen, the run stays green
95
+ # with a warning, and the next push to main retries the upload because
96
+ # the version is still missing from PyPI. Nothing to redo by hand.
97
+ uses: pypa/gh-action-pypi-publish@release/v1
98
+ continue-on-error: true
99
+ with:
100
+ skip-existing: true
101
+
102
+ - name: Report PyPI outcome
103
+ if: steps.decide.outputs.publish == 'true'
104
+ run: |
105
+ if [ "${{ steps.pypi.outcome }}" = "success" ]; then
106
+ echo "::notice::sm-revocation ${{ steps.decide.outputs.version }} published to PyPI."
107
+ else
108
+ echo "::warning::PyPI upload failed — most likely the Trusted Publisher is not registered yet. Follow PUBLISHING.md once; the next push to main will publish automatically."
109
+ fi
110
+
111
+ - name: Tag and release on GitHub
112
+ # Tags created here use GITHUB_TOKEN, which by design does not re-trigger
113
+ # workflows, so this cannot loop. Idempotent: an existing tag is left alone.
114
+ env:
115
+ GH_TOKEN: ${{ github.token }}
116
+ VERSION: ${{ steps.decide.outputs.version }}
117
+ run: |
118
+ set -euo pipefail
119
+ TAG="v$VERSION"
120
+ if git ls-remote --exit-code --tags origin "refs/tags/$TAG" >/dev/null 2>&1; then
121
+ echo "$TAG already exists."
122
+ else
123
+ git config user.name "github-actions[bot]"
124
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
125
+ git tag -a "$TAG" -m "sm-revocation $VERSION"
126
+ git push origin "$TAG"
127
+ echo "pushed $TAG"
128
+ fi
129
+ if ! gh release view "$TAG" >/dev/null 2>&1; then
130
+ gh release create "$TAG" --title "sm-revocation $VERSION" --notes "See CHANGELOG.md for $VERSION." ${{ steps.decide.outputs.publish == 'true' && 'dist/*' || '' }}
131
+ fi
132
+ if [ "${{ steps.decide.outputs.publish }}" = "true" ] && [ "${{ steps.pypi.outcome }}" != "success" ]; then
133
+ echo "PyPI upload pending Trusted Publisher setup (see PUBLISHING.md)." >> "$GITHUB_STEP_SUMMARY"
134
+ true
135
+ fi
136
+
137
+ - name: Create any tags listed in .release-tags
138
+ # One `name commit message...` per line; `HEAD` means the commit being
139
+ # built. A tag that already exists is left alone. Used for draft-NN
140
+ # markers that pair a draft revision with the code that implements it.
141
+ # Note: GITHUB_TOKEN may not push a ref whose target changes workflow
142
+ # files relative to the branch, so tag HEAD (or a commit with identical
143
+ # .github/workflows) rather than an arbitrary older commit.
144
+ env:
145
+ GH_TOKEN: ${{ github.token }}
146
+ VERSION: ${{ steps.decide.outputs.version }}
147
+ run: |
148
+ set -euo pipefail
149
+ [ -f .release-tags ] || exit 0
150
+ git config user.name "github-actions[bot]"
151
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
152
+ grep -vE '^[[:space:]]*(#|$)' .release-tags > /tmp/release-tags || true
153
+ while read -r NAME COMMIT MSG; do
154
+ if git ls-remote --exit-code --tags origin "refs/tags/$NAME" >/dev/null 2>&1 </dev/null; then
155
+ echo "$NAME exists"; continue
156
+ fi
157
+ [ "$COMMIT" = "HEAD" ] && COMMIT="$GITHUB_SHA"
158
+ git cat-file -e "$COMMIT^{commit}" </dev/null
159
+ git tag -a "$NAME" "$COMMIT" -m "${MSG:-$NAME}" </dev/null
160
+ git push origin "refs/tags/$NAME" </dev/null
161
+ echo "pushed $NAME -> $COMMIT"
162
+ done < /tmp/release-tags
@@ -0,0 +1,16 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ build/
6
+ dist/
7
+ .venv/
8
+ venv/
9
+
10
+ # Tooling caches
11
+ .pytest_cache/
12
+ .mypy_cache/
13
+ .ruff_cache/
14
+ .coverage
15
+ htmlcov/
16
+ coverage/
@@ -0,0 +1,46 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/) and this project adheres to
5
+ [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.1.1] — 2026-11-28
10
+
11
+ The first release on PyPI. `0.1.0` was tagged in the repository but never
12
+ published; this release carries the fixes below on top of it. Wire strings are
13
+ unchanged (`revocation/0.1`).
14
+
15
+ ### Fixed (independent review)
16
+ - A refused `set_heartbeat` (a malformed time) changed the issuer's policy
17
+ without appending it, so the next checkpoint's digest was wrong and every
18
+ walking view accused an honest issuer. State now changes only after the
19
+ entry is signed.
20
+ - `status`, `revoked_set` and `dat_checker` raised `OverflowError` for a
21
+ staleness bound near `2^53 − 1` or a head dated near year 9999. The
22
+ freshness comparison is now exact integer arithmetic on the elapsed time.
23
+ - The view keeps the earliest- as well as the latest-dated head per position,
24
+ so an order conflict with an entry that arrives later is still found.
25
+
26
+ ## [0.1.0] — 2026-11-28
27
+
28
+ The reference implementation of the `revocation/0.1` working draft. Tagged, not
29
+ published to PyPI.
30
+
31
+ ### Added
32
+ - `RevocationIssuer`: a revocation feed on `sm-feed` that appends the genesis
33
+ policy, validates every payload before signing it, clamps signed times so they
34
+ never decrease (SPEC §5.3), and computes checkpoint digests and snapshots.
35
+ - `FeedView`: ingests entries, heads, pages, proofs and snapshots from any carrier
36
+ in any order, and answers `REVOKED`, `NOT_REVOKED(as_of)` or `UNKNOWN(reason)`
37
+ (SPEC §6). Its cursor, frontier, revocations and evidence only grow.
38
+ - `revocation-conflict/0.1`: fork and signed-time-order conflicts, built,
39
+ verified and gossiped (SPEC §7); `sm-feed`'s `feed-equivocation/0.1` accepted.
40
+ - `revocation-snapshot/0.1` for late joiners, with the recursive state digest
41
+ every walking view recomputes (SPEC §8).
42
+ - `revoked_set` for `sm-renewal` and `dat_checker` for `sm-dat` (SPEC §9).
43
+ - 28 deterministic conformance vectors, regenerated byte for byte, each
44
+ expectation written from the SPEC and checked against the implementation;
45
+ a hostile-path suite substituting hostile values into every field of every
46
+ object; an honest-issuer property test (no evidence under any delivery order).
@@ -0,0 +1,38 @@
1
+ # Governance
2
+
3
+ ## Scope
4
+
5
+ | In scope | Out of scope |
6
+ | --- | --- |
7
+ | The `revocation/0.1` payload profile on `sm-feed`: policy and revoke payloads, the record merge | The feed, head, page and checkpoint formats (`sm-feed`) |
8
+ | The issuer's obligations: genesis policy, heartbeat, signed-time order, checkpoint digests | Transport, gossip, scheduling and priority of revocation traffic |
9
+ | The view: ingest from any carrier, status, conflict evidence, snapshots | The decision to revoke, and what a caller does with `UNKNOWN` |
10
+ | `revocation-conflict/0.1` and `revocation-snapshot/0.1` | Witness co-signing; peer-initiated suspension |
11
+ | The `sm-renewal` and `sm-dat` adapters | Key custody and rotation for the feed key |
12
+
13
+ The primitive owns one thing. Anything outside the table belongs to a companion
14
+ package or the consumer's stack.
15
+
16
+ ## Versioning
17
+
18
+ Semantic Versioning 2.0.0. The protocol surface (wire shape / algorithm) is
19
+ frozen within a major. A change to it requires an RFC-style PR to `SPEC.md`
20
+ before code.
21
+
22
+ ## Conformance
23
+
24
+ The test suite under `tests/` (and any vectors it loads) is the authoritative
25
+ behavioural specification. A change in behaviour without a corresponding test
26
+ change is a bug.
27
+
28
+ ## Contributions
29
+
30
+ - PRs must include tests and pass `ruff` + `mypy --strict` + `pytest`.
31
+ - No expansion of the protocol surface without an accepted RFC.
32
+ - No domain-specific or deployment-specific content — this is a generic
33
+ primitive (see the neutrality checklist in the extraction playbook).
34
+ - Sign off with the Developer Certificate of Origin (DCO), not a CLA.
35
+
36
+ ## Attribution
37
+
38
+ *Personal research contributions aligned with [Project NANDA](https://projectnanda.org) standards. [Stellarminds.ai](https://stellarminds.ai)*
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 stellarminds.ai
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,189 @@
1
+ Metadata-Version: 2.5
2
+ Name: sm-revocation
3
+ Version: 0.1.1
4
+ Summary: Freshness-bounded revocation feeds for agent meshes on intermittent links: REVOKED, NOT_REVOKED(as_of) or UNKNOWN, from signed feeds any carrier can forward.
5
+ Project-URL: Homepage, https://agentclock.ai
6
+ Project-URL: Documentation, https://pypi.org/project/sm-revocation/#files
7
+ Author-email: StellarMinds <hello@stellarminds.ai>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Keywords: ai-agents,delay-tolerant,did,nanda,partition,revocation,verifiable
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Typing :: Typed
15
+ Requires-Python: >=3.11
16
+ Requires-Dist: jcs>=0.2.1
17
+ Requires-Dist: sm-arp>=0.3.0
18
+ Requires-Dist: sm-feed>=0.2.1
19
+ Provides-Extra: dev
20
+ Requires-Dist: coverage>=7.0; extra == 'dev'
21
+ Requires-Dist: mypy>=1.0; extra == 'dev'
22
+ Requires-Dist: pytest>=7.0; extra == 'dev'
23
+ Requires-Dist: ruff==0.15.13; extra == 'dev'
24
+ Description-Content-Type: text/markdown
25
+
26
+ # sm-revocation
27
+
28
+ **Freshness-bounded revocation feeds for agent meshes on intermittent links**
29
+
30
+ Revocation assumes a reachable issuer. A CRL or an OCSP responder tells a relying
31
+ party that a credential is revoked only if the relying party can reach it, and a
32
+ mesh cut off from its issuer either keeps acting on old information without
33
+ knowing how old it is, or stops. `sm-revocation` is the third option: the issuer
34
+ publishes revocations on a signed, hash-chained [`sm-feed`](https://pypi.org/project/sm-feed/)
35
+ feed and re-signs the feed's head on a declared cadence; anyone who met the issuer
36
+ — a member, a relay, a vehicle, a store-and-forward bundle — can carry entries,
37
+ heads and pages onward; and a holder's view answers one of three things about a
38
+ subject at a time:
39
+
40
+ - **`REVOKED(effective_at, reason)`** — an issuer-signed revocation it holds;
41
+ - **`NOT_REVOKED(as_of)`** — it holds every revocation the issuer had signed up to a
42
+ head the issuer itself dated `as_of`, and none names the subject;
43
+ - **`UNKNOWN(reason)`** — `behind`, `stale`, `not_covered`, `before_anchor` or
44
+ `feed_misbehaved`, each a statement of what the view cannot rule out.
45
+
46
+ The caller bounds how old `as_of` may be. Past the bound the answer is `UNKNOWN`,
47
+ so a partitioned mesh knows how old its revocation information is and refuses past
48
+ the bound, instead of acting on it blind. This package owns the revocation payload
49
+ profile on `sm-feed`, the issuer's time obligations, the view, its conflict
50
+ evidence, and the adapters for [`sm-renewal`](https://pypi.org/project/sm-renewal/)
51
+ and [`sm-dat`](https://pypi.org/project/sm-dat/).
52
+
53
+ ## What it does (0.1)
54
+
55
+ - **A revocation counts as soon as it is seen.** A single signed revoke entry,
56
+ flooded through any carrier on its own, makes every holder that receives it
57
+ answer `REVOKED`, without the rest of the chain (SPEC §6.3).
58
+ - **`NOT_REVOKED` only from a complete chain and a matching head.** Entries extend
59
+ the view's chain one at a time, in any order and from any carrier; a missing,
60
+ reordered or corrupt entry stops the chain at the gap and the view answers
61
+ `UNKNOWN(behind)`, never `NOT_REVOKED` (§6.4).
62
+ - **Monotone state.** Nothing a carrier sends, in any order, moves the view's
63
+ cursor, frontier, revocations or evidence backwards. A replayed old page or head
64
+ changes nothing; there is no un-revoke (§4.5, §6.1).
65
+ - **Freshness from the issuer's own signatures.** `as_of` is the `generated_at` of
66
+ the newest head the chain is complete to. The view reads no clock, so equal
67
+ inputs give equal answers anywhere (§6.7).
68
+ - **Issuer misbehaviour becomes transferable evidence.** The issuer's signed times
69
+ must never decrease (§5.3). Two signed objects that bind one position to two
70
+ hashes (a fork), or whose times run backwards along the feed (an order
71
+ conflict), form a `revocation-conflict/0.1` proof anyone can re-check. An order
72
+ conflict is what exposes an issuer that keeps heartbeating a holder while hiding
73
+ a later entry from it, as soon as the hidden entry and a heartbeat meet at any
74
+ holder (§7).
75
+ - **Late joiners.** A `revocation-snapshot/0.1` lets a view start from a signed
76
+ checkpoint, whose state digest every view walking through it recomputes (§8).
77
+ - **Adversarially tested.** 28 deterministic conformance vectors and a hostile-path
78
+ suite: forged, tampered, mistyped and non-canonical objects, profile violations,
79
+ chain-rule breaks, out-of-order and partial carriage, replays, forks of every
80
+ kind, order conflicts at either holder, tampered proofs, snapshot refusals and
81
+ false checkpoint digests. Hostile values are substituted into every field of
82
+ every object; the view names the failing stage and never raises.
83
+
84
+ ## What it does not do
85
+
86
+ - **Deliver a revocation to a node nothing can reach.** A mesh with no path to the
87
+ issuer, direct or carried, learns nothing new. Its answers go `stale` on
88
+ schedule. That is the inherited revocation residual, made visible, not removed.
89
+ - **Catch a freeze at a holder that meets no one.** A holder that hears only from
90
+ the issuer cannot tell "nothing was revoked" from "nothing is being shown to me".
91
+ Freeze detection needs contact between holders; witness co-signing is not in
92
+ `0.1`.
93
+ - **Check the issuer's word.** `effective_at`, `reason`, `prune_after` and every
94
+ signed time are the issuer's statements. A caller that wants to cap future-dated
95
+ heads does so against its own clock, outside the view.
96
+ - **Transport, scheduling or the decision to revoke.** Those are the consumer's.
97
+
98
+ `THREATMODEL.md` states every boundary.
99
+
100
+ ## Installation
101
+
102
+ ```bash
103
+ pip install sm-revocation
104
+ ```
105
+
106
+ Requires Python 3.11+ and `sm-feed` 0.2.1 or later.
107
+
108
+ ## Quick start
109
+
110
+ ```python
111
+ from sm_arp import Identity
112
+ from sm_revocation import RENEWAL_KINDS, FeedView, RevocationIssuer, revoked_set
113
+
114
+ issuer = RevocationIssuer(
115
+ Identity.generate(),
116
+ heartbeat_seconds=60,
117
+ subject_kinds=["credential_hash", "manifest_hash"],
118
+ issued_at="2026-11-01T09:00:00Z",
119
+ )
120
+ issuer.revoke(
121
+ subject_kind="credential_hash",
122
+ subject="sha256:" + "a1" * 32,
123
+ effective_at="2026-11-01T09:02:00Z",
124
+ issued_at="2026-11-01T09:02:00Z",
125
+ reason="key_compromise",
126
+ )
127
+
128
+ # Any carrier forwards the page; the holder verifies everything itself.
129
+ view = FeedView(issuer.feed_id)
130
+ view.ingest_page(issuer.page(None, generated_at="2026-11-01T09:05:00Z"))
131
+
132
+ view.status("credential_hash", "sha256:" + "a1" * 32, "2026-11-01T09:06:00Z", 300)
133
+ # Status(outcome='REVOKED', effective_at='2026-11-01T09:02:00Z', reason='key_compromise', ...)
134
+
135
+ # For sm-renewal: the set to pass as revoked_credential_hashes, or None.
136
+ revoked = revoked_set(view, RENEWAL_KINDS, "2026-11-01T09:06:00Z", 300)
137
+ if revoked is None:
138
+ ... # decline to attest. Never substitute an empty set.
139
+ ```
140
+
141
+ A `Status` deliberately has no truth value: test `.revoked`, `.not_revoked` or
142
+ `.unknown`. `examples/quick_start.py` runs a fuller version, including a freeze
143
+ being caught.
144
+
145
+ ## Using it with sm-renewal and sm-dat
146
+
147
+ - **`revoked_set(view, kinds, at, max_staleness_seconds)`** returns the
148
+ `frozenset` `sm-renewal` takes as `revoked_credential_hashes`, or `None` when the
149
+ view cannot vouch for completeness and freshness. An attester that gets `None`
150
+ declines; a relying party fails its revocation step. **Never pass an empty set in
151
+ place of `None`**: `sm-renewal` reads an empty set as "complete, fresh, and
152
+ nothing revoked" (SPEC §9.1).
153
+ - **`dat_checker(resolve)`** returns the `revocation_checker` `sm-dat` takes.
154
+ `sm-dat` calls one checker for every grant in a chain, ancestors included, so
155
+ `resolve(grant_id)` returns that grant's own feed views and its
156
+ `max_revocation_age_seconds`. `REVOKED` → `True`, `NOT_REVOKED` → `False`,
157
+ anything else → `None` (SPEC §9.2).
158
+
159
+ ## Reference fixtures
160
+
161
+ `conformance/vectors/*.json` — 28 deterministic scenarios from fixed, non-secret
162
+ seeds, each a script of ingests and queries with the answer the SPEC requires at
163
+ every step. `conformance/_vector_gen.py` regenerates them byte for byte, and checks
164
+ each hand-written expectation against the implementation while it writes.
165
+
166
+ ## Specification
167
+
168
+ - [`SPEC.md`](./SPEC.md) — normative wire format and behaviour, working draft.
169
+ - [`WHITEPAPER.md`](./WHITEPAPER.md) — design rationale.
170
+ - [`THREATMODEL.md`](./THREATMODEL.md) — what it defends, and what it does not.
171
+
172
+ ## Related packages
173
+
174
+ | Package | Role |
175
+ | --- | --- |
176
+ | [`sm-feed`](https://pypi.org/project/sm-feed/) | The substrate: signed, hash-chained, cursor-based feed |
177
+ | [`sm-renewal`](https://pypi.org/project/sm-renewal/) | Partition-tolerant renewal; consumes `revoked_set` |
178
+ | [`sm-dat`](https://pypi.org/project/sm-dat/) | Delegated authority tokens; consumes `dat_checker` |
179
+ | [`sm-arp`](https://pypi.org/project/sm-arp/) | Ed25519, JCS and `did:key`, shared across the family |
180
+
181
+ ## License
182
+
183
+ [MIT](./LICENSE)
184
+
185
+ ---
186
+
187
+ *First published: 2026-11-28 | Last modified: 2026-11-28*
188
+
189
+ *Personal research contributions aligned with [Project NANDA](https://projectnanda.org) standards. [Stellarminds.ai](https://stellarminds.ai)*
@@ -0,0 +1,46 @@
1
+ # Publishing sm-revocation to PyPI
2
+
3
+ `sm-revocation` publishes via **PyPI Trusted Publishing** — no API tokens. You tell
4
+ PyPI once that this repo's `release.yml` workflow may publish; after that, every
5
+ version bump on `main` builds, uploads, tags and releases automatically.
6
+
7
+ ## One-time setup (≈5 minutes — this is the part only you can do)
8
+
9
+ 1. Sign in to PyPI (the same account that publishes the rest of the `sm-*` family).
10
+ 2. Go to **https://pypi.org/manage/account/publishing/** → "Add a pending
11
+ publisher" (use *pending*, because the `sm-revocation` project doesn't exist on
12
+ PyPI yet — the first publish creates it).
13
+ 3. Fill the form with **exactly** these values:
14
+
15
+ | Field | Value |
16
+ |-------|-------|
17
+ | PyPI Project Name | `sm-revocation` |
18
+ | Owner | `Sharathvc23` |
19
+ | Repository name | `sm-revocation` |
20
+ | **Workflow name** | `release.yml` ← just the filename |
21
+ | Environment name | *(leave blank)* |
22
+
23
+ That's it. No secret is created or stored anywhere.
24
+
25
+ ## Releasing (every time, after setup)
26
+
27
+ 1. Bump `version` in `pyproject.toml` and add the `CHANGELOG.md` entry.
28
+ 2. Commit and push to `main`.
29
+
30
+ That is the whole release. The `release` workflow sees a version that is not on
31
+ PyPI, builds the sdist + wheel, runs `twine check`, uploads over OIDC, then
32
+ creates the `vX.Y.Z` tag and a GitHub release with the distributions attached.
33
+ A version already on PyPI is a no-op, never a red run. Nobody pushes tags by
34
+ hand; `GITHUB_TOKEN`-created tags do not re-trigger workflows, so it cannot loop.
35
+
36
+ Until the one-time setup above is done, the upload step fails with a warning
37
+ but the tag and GitHub release are still created and the run stays green; the
38
+ next push to `main` retries the upload. `0.1.0` is the first release through
39
+ this path.
40
+
41
+ ## Notes
42
+
43
+ - The tag is derived from `version` in `pyproject.toml`; they cannot disagree.
44
+ - Dry run anytime, no upload: `python -m build && python -m twine check dist/*`.
45
+ - Pushing a `vX.Y.Z` tag by hand still works (old path) and publishes if the
46
+ version is missing from PyPI.